Text Ranking
sentence-transformers
Safetensors
Transformers
multilingual
t5gemma2
text2text-generation
reranker
encoder-decoder
FBNL
matryoshka
retrieval
RAG
Instructions to use KaLM-Embedding/KaLM-Reranker-V1-Nano-R2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use KaLM-Embedding/KaLM-Reranker-V1-Nano-R2 with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("KaLM-Embedding/KaLM-Reranker-V1-Nano-R2") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use KaLM-Embedding/KaLM-Reranker-V1-Nano-R2 with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("KaLM-Embedding/KaLM-Reranker-V1-Nano-R2") model = AutoModelForMultimodalLM.from_pretrained("KaLM-Embedding/KaLM-Reranker-V1-Nano-R2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -52,25 +52,33 @@ library_name: sentence-transformers
|
|
| 52 |
|
| 53 |
|
| 54 |
### KaLM-Reranker-V1-R2 vs. the original KaLM-Reranker-V1
|
| 55 |
-
|
| 56 |
All results below use the same default compression ratio, `r=4`. KaLM-Reranker-V1 results are taken from the previous model cards; KaLM-Reranker-V1-R2 results are from the updated paper.
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
| 61 |
-
|
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
| Capability | KaLM-Reranker-V1 | KaLM-Reranker-V1-R2 |
|
| 65 |
|:--|:--|:--|
|
| 66 |
| Validated MEP range | 1x-32x | **1x-128x** |
|
| 67 |
| Test-time compute | Flexible compression | **Flexible allocation of inference-time computation** |
|
| 68 |
-
| Training |
|
| 69 |
| Multi-domain ranking | Strong | **Improved on BEIR for all three sizes** |
|
| 70 |
| Multilingual ranking | Limited | **Substantially improved across MIRACL's 18 languages** |
|
| 71 |
|
| 72 |
## Model family
|
| 73 |
-
|
| 74 |
| Model | Activated parameters | Layers (encoder + decoder) | Sequence length | Document token dimension | MEP support | Instruction aware |
|
| 75 |
|:--|--:|--:|--:|--:|:--:|:--:|
|
| 76 |
| [KaLM-Reranker-V1-Nano-R2](https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Nano-R2) | 0.27B | 18 + 18 | 128K | 640 | 1x-128x | Yes |
|
|
@@ -80,6 +88,22 @@ All results below use the same default compression ratio, `r=4`. KaLM-Reranker-V
|
|
| 80 |
The reported sizes are **activated parameters**. Nano, Small, and Large are initialized from the T5Gemma2 270M-270M, 1B-1B, and 4B-4B encoder-decoder families, respectively.
|
| 81 |
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
# Acknowledgements
|
| 85 |
We sincerely thank `jina-reranker-v3` and `Qwen3-Reranker` for their valuable inspiration and contributions to the reranking community, from which we have learned a lot.
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
### KaLM-Reranker-V1-R2 vs. the original KaLM-Reranker-V1
|
|
|
|
| 55 |
All results below use the same default compression ratio, `r=4`. KaLM-Reranker-V1 results are taken from the previous model cards; KaLM-Reranker-V1-R2 results are from the updated paper.
|
| 56 |
|
| 57 |
+
#### BEIR — Multi-domain Reranking
|
| 58 |
+
|
| 59 |
+
| Model | KaLM-Reranker-V1 | KaLM-Reranker-V1-R2 | Δ |
|
| 60 |
+
|:--|--:|--:|--:|
|
| 61 |
+
| Nano | 57.41 | **58.54** | **+1.13** |
|
| 62 |
+
| Small | 60.01 | **61.07** | **+1.06** |
|
| 63 |
+
| Large | 62.87 | **63.53** | **+0.66** |
|
| 64 |
+
|
| 65 |
+
#### MIRACL — Multilingual Reranking
|
| 66 |
+
|
| 67 |
+
| Model | KaLM-Reranker-V1 | KaLM-Reranker-V1-R2 | Δ |
|
| 68 |
+
|:--|--:|--:|--:|
|
| 69 |
+
| Nano | 62.08 | **71.11** | **+9.03** |
|
| 70 |
+
| Small | 66.89 | **74.06** | **+7.17** |
|
| 71 |
+
| Large | 70.07 | **74.92** | **+4.85** |
|
| 72 |
|
| 73 |
| Capability | KaLM-Reranker-V1 | KaLM-Reranker-V1-R2 |
|
| 74 |
|:--|:--|:--|
|
| 75 |
| Validated MEP range | 1x-32x | **1x-128x** |
|
| 76 |
| Test-time compute | Flexible compression | **Flexible allocation of inference-time computation** |
|
| 77 |
+
| Training | Supervised checkpoints | **High-quality SFT -> soft-label distillation -> model soup** |
|
| 78 |
| Multi-domain ranking | Strong | **Improved on BEIR for all three sizes** |
|
| 79 |
| Multilingual ranking | Limited | **Substantially improved across MIRACL's 18 languages** |
|
| 80 |
|
| 81 |
## Model family
|
|
|
|
| 82 |
| Model | Activated parameters | Layers (encoder + decoder) | Sequence length | Document token dimension | MEP support | Instruction aware |
|
| 83 |
|:--|--:|--:|--:|--:|:--:|:--:|
|
| 84 |
| [KaLM-Reranker-V1-Nano-R2](https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Nano-R2) | 0.27B | 18 + 18 | 128K | 640 | 1x-128x | Yes |
|
|
|
|
| 88 |
The reported sizes are **activated parameters**. Nano, Small, and Large are initialized from the T5Gemma2 270M-270M, 1B-1B, and 4B-4B encoder-decoder families, respectively.
|
| 89 |
|
| 90 |
|
| 91 |
+
# Prompt Template
|
| 92 |
+
```python
|
| 93 |
+
f"<Document>: {document}"
|
| 94 |
+
|
| 95 |
+
```
|
| 96 |
+
```python
|
| 97 |
+
(
|
| 98 |
+
f"<bos><start_of_turn>user\n"
|
| 99 |
+
f"Judge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be \"yes\" or \"no\".\n\n"
|
| 100 |
+
f"<Instruct>: {task_instruction}\n"
|
| 101 |
+
f"<Query>: {query}<end_of_turn>\n"
|
| 102 |
+
f"<start_of_turn>model\n\n\n\n"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
|
| 108 |
# Acknowledgements
|
| 109 |
We sincerely thank `jina-reranker-v3` and `Qwen3-Reranker` for their valuable inspiration and contributions to the reranking community, from which we have learned a lot.
|