KaLM-Embedding-V2.5
SOTA Multilingual Embedding Model from KaLM-Embedding
KaLM-Embedding-V2.5 is a lightweight multilingual embedding model with 0.5B parameters, achieving state-of-the-art performance among models of comparable size. It supports semantic search, retrieval-augmented generation, text similarity, clustering, and classification.
Key Features
- Lightweight: A compact 0.5B-parameter model.
- Multilingual: Multilingual text embeddings with strong English and Chinese performance.
- Adjustable dimensions: Choose 896, 512, 256, 128, or 64 dimensions through Matryoshka representation learning.
- Instruction-aware: Customize query embeddings for different retrieval tasks.
- Long inputs: Supports up to 32,768 tokens per formatted text. This API defaults to 512 tokens.
- Open source: Released under the Apache 2.0 license.
Usage
Provide an array of strings through texts. The API returns one embedding per text, preserving the input order.
For retrieval:
- Encode queries with a task instruction.
- Encode documents with an empty instruction.
- Compare query and document embeddings using cosine similarity.
Use the same embedding dimension when encoding queries and documents.
Encode a Query
{
"texts": [
"What is the capital of France?"
],
"instruction": "Given a question, retrieve passages that answer the question.",
"embedding_dim": 896,
"batch_size": 32,
"max_length": 512,
"normalize": true
}
Enter only the task description in instruction. The API automatically applies the instruction template.
Encode Documents
{
"texts": [
"Berlin is the capital of Germany.",
"Paris is the capital of France.",
"Rome is the capital of Italy.",
"Madrid is the capital of Spain."
],
"instruction": "",
"embedding_dim": 896,
"batch_size": 32,
"max_length": 512,
"normalize": true
}
Output
Each result contains:
index: The zero-based position of the text in the input array.embedding: The embedding vector for that text.
With embedding_dim set to 896, each vector contains 896 values. With normalization enabled, dot products between query and document embeddings give cosine similarity scores.
Parameters
| Parameter | Description | Default |
|---|---|---|
texts |
Array of texts to embed | Required |
instruction |
Optional task description; omit template labels | "" |
embedding_dim |
Output dimension: 896, 512, 256, 128, or 64 | 896 |
batch_size |
Number of texts processed per batch | 32 |
max_length |
Token limit per formatted text, including the instruction; accepts 1–32,768 | 512 |
normalize |
L2-normalize output embeddings | true |
Smaller embedding dimensions reduce vector storage and similarity computation costs. Evaluate the quality trade-off on your own data.
Inputs exceeding max_length are truncated. Longer inputs and larger batches require more memory.
Model Details
| Property | Value |
|---|---|
| Model | KaLM-Embedding-V2.5 |
| Team | KaLM-Embedding |
| Parameters | 0.5B |
| Attention | Bidirectional |
| Pooling | Mean pooling |
| Default embedding dimension | 896 |
| Supported embedding dimensions | 896, 512, 256, 128, 64 |
| Maximum input length | 32,768 tokens |
| License | Apache 2.0 |