MIREI
Collection
MIREI: What Makes Decoder-Based Sentence Embeddings Strong? Rethinking Encoder and Decoder Architectures for Sentence Embeddings • 70 items • Updated • 1
How to use iamtatsuki05/sarashina2.2-Bi-1b with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("iamtatsuki05/sarashina2.2-Bi-1b", trust_remote_code=True)
model = AutoModel.from_pretrained("iamtatsuki05/sarashina2.2-Bi-1b", trust_remote_code=True, device_map="auto")English / Japanese
sarashina2.2-Bi-1b adapts sbintuitions/sarashina2.2-1b into an LLM2Vec-style bidirectional encoder by replacing causal attention with bidirectional attention. It is the starting point for the Decoder-PT sentence encoders (Sentence-Sarashina-Bi-*).
transformers>=4.51.0
accelerate>=1.6.0
sentencepiece>=0.2.0
flash-attn>=2.7.3
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer
model_name = "iamtatsuki05/sarashina2.2-Bi-1b"
model_kwargs = {
"torch_dtype": torch.bfloat16,
"attn_implementation": "flash_attention_2",
"device_map": "auto",
"trust_remote_code": True,
}
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name, **model_kwargs)
queries = ["ハチワレはどのようなキャラクターですか?"]
docs = [
"ハチワレは、『ちいかわ』に登場する猫風のキャラクターで、明るく社交的、前向きな性格が特徴。ちいかわたちと共に日常を楽しみつつ、討伐などの冒険にも積極的に挑む存在です。",
"うさぎは、天真爛漫でマイペースな性格が特徴のキャラクターで、突飛な行動力と鋭い直感でちいかわたちを引っ張る存在。自由気ままながらも仲間思いな一面を併せ持ちます。",
]
q_emb = model.encode_query(queries, tokenizer)
d_emb = model.encode_document(docs, tokenizer)
scores = F.cosine_similarity(q_emb, d_emb)
print(scores)
Bidirectional conversions of the sarashina2.2 series.
| ID | Architecture | #Param. | #Param. w/o Emb. |
|---|---|---|---|
| iamtatsuki05/sarashina2.2-Bi-0.5b | Llama | 661M | 530M |
| iamtatsuki05/sarashina2.2-Bi-1b (this model) |
Llama | 1224M | 1040M |
| iamtatsuki05/sarashina2.2-Bi-3b | Llama | 3093M | 2831M |
This model is distributed under the MIT License.
@article{MIREI
title={同一条件下における Encoder/Decoder アーキテクチャによる文埋め込みの性能分析},
author={岡田 龍樹 and 杉本 徹},
journal={言語処理学会第 32 回年次大会 (NLP2026)},
year={2026}
}