HIT-TMG/KaLM-embedding-multilingual-mini-instruct-v1.5

Model

KaLM-Embedding is a series of embedding models adapted from auto-regressive LLMs with superior training data.

66

5 commits

1 linked in READMEs

updated Mar 13, 2025

See the code
endpoints_compatible
feature-extraction
model-index
mteb
qwen2
safetensors
sentence-similarity
sentence-transformers
text-embeddings-inference

README

KaLM-Embedding

KaLM-Embedding is a series of embedding models adapted from auto-regressive LLMs with superior training data.

KaLM-embedding-multilingual-mini is trained from Qwen/Qwen2-0.5B with massive weakly-supervised pre-training and supervised fine-tuning data.

πŸ“‘ Open-source Plan

Evaluation

Model NameModel SizeC-MTEB(35)MTEB(56)avg
multilingual-e5-large560M58.8161.560.16
bge-m3 (dense)560M60.8059.8460.32
gte-multilingual-base (dense)305M62.7261.4062.06
KaLM-embedding-multilingual-mini-v1494M62.3161.8762.09
KaLM-embedding-multilingual-mini-instruct-v1494M63.5764.7464.16
KaLM-embedding-multilingual-mini-instruct-v1.5494M64.1364.9464.53

Requirements

Since we have used the Qwen2 model, we advise you to install transformers>=4.37.0, or you might encounter the following error:

KeyError: 'qwen2'

Usage

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

from sentence_transformers import SentenceTransformer


sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('{MODEL_NAME_OR_PATH}')   # Do NOT set trust_remote_code
model.max_seq_length = 512

embeddings = model.encode(
    sentences, 
    normalize_embeddings=True,
    batch_size=256, 
    show_progress_bar=True
    )
print(embeddings)

We add instruction for asymmetric tasks: retrieval, reranking, classification and clustering.

If you want to add instruction to the query (no instruction for the corpus), you can use the model like this:

from sentence_transformers import SentenceTransformer


sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('{MODEL_NAME_OR_PATH}')   # Do NOT set trust_remote_code
model.max_seq_length = 512

prompt = "Instruct: Classifying the category of french news. \n Query: "
embeddings = model.encode(
    sentences, 
    prompt=prompt,
    normalize_embeddings=True,
    batch_size=256, 
    show_progress_bar=True
    )
print(embeddings)

Citation

Please cite the repo if you use the model or code in this repo.

@article{hu2025kalm,
  title={KaLM-Embedding: Superior Training Data Brings A Stronger Embedding Model},
  author={Hu, Xinshuo and Shan, Zifei and Zhao, Xinping and Sun, Zetian and Liu, Zhenyu and Li, Dongfang and Ye, Shaolin and Wei, Xinyuan and Chen, Qian and Hu, Baotian and others},
  journal={arXiv preprint arXiv:2501.01028},
  year={2025}
}

Contact

If you encounter any issue, feel free to contact us via the email: yanshek.woo@gmail.com

Contributors

YanshekWoo

5 commits

HIT-TMG/KaLM-embedding-multilingual-mini-instruct-v1.5

Model

KaLM-Embedding is a series of embedding models adapted from auto-regressive LLMs with superior training data.

66

5 commits

1 linked in READMEs

updated Mar 13, 2025

See the code
endpoints_compatible
feature-extraction
model-index
mteb
qwen2
safetensors
sentence-similarity
sentence-transformers
text-embeddings-inference

README

KaLM-Embedding

KaLM-Embedding is a series of embedding models adapted from auto-regressive LLMs with superior training data.

KaLM-embedding-multilingual-mini is trained from Qwen/Qwen2-0.5B with massive weakly-supervised pre-training and supervised fine-tuning data.

πŸ“‘ Open-source Plan

Evaluation

Model NameModel SizeC-MTEB(35)MTEB(56)avg
multilingual-e5-large560M58.8161.560.16
bge-m3 (dense)560M60.8059.8460.32
gte-multilingual-base (dense)305M62.7261.4062.06
KaLM-embedding-multilingual-mini-v1494M62.3161.8762.09
KaLM-embedding-multilingual-mini-instruct-v1494M63.5764.7464.16
KaLM-embedding-multilingual-mini-instruct-v1.5494M64.1364.9464.53

Requirements

Since we have used the Qwen2 model, we advise you to install transformers>=4.37.0, or you might encounter the following error:

KeyError: 'qwen2'

Usage

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

from sentence_transformers import SentenceTransformer


sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('{MODEL_NAME_OR_PATH}')   # Do NOT set trust_remote_code
model.max_seq_length = 512

embeddings = model.encode(
    sentences, 
    normalize_embeddings=True,
    batch_size=256, 
    show_progress_bar=True
    )
print(embeddings)

We add instruction for asymmetric tasks: retrieval, reranking, classification and clustering.

If you want to add instruction to the query (no instruction for the corpus), you can use the model like this:

from sentence_transformers import SentenceTransformer


sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('{MODEL_NAME_OR_PATH}')   # Do NOT set trust_remote_code
model.max_seq_length = 512

prompt = "Instruct: Classifying the category of french news. \n Query: "
embeddings = model.encode(
    sentences, 
    prompt=prompt,
    normalize_embeddings=True,
    batch_size=256, 
    show_progress_bar=True
    )
print(embeddings)

Citation

Please cite the repo if you use the model or code in this repo.

@article{hu2025kalm,
  title={KaLM-Embedding: Superior Training Data Brings A Stronger Embedding Model},
  author={Hu, Xinshuo and Shan, Zifei and Zhao, Xinping and Sun, Zetian and Liu, Zhenyu and Li, Dongfang and Ye, Shaolin and Wei, Xinyuan and Chen, Qian and Hu, Baotian and others},
  journal={arXiv preprint arXiv:2501.01028},
  year={2025}
}

Contact

If you encounter any issue, feel free to contact us via the email: yanshek.woo@gmail.com

Contributors

YanshekWoo

5 commits