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
|
@@ -20,4 +20,61 @@ tags:
|
|
| 20 |
- RAG
|
| 21 |
license: apache-2.0
|
| 22 |
library_name: sentence-transformers
|
| 23 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
- RAG
|
| 21 |
license: apache-2.0
|
| 22 |
library_name: sentence-transformers
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
<h1 align="center">KaLM-Reranker-V1: Fast but Not Late Interaction for Compressed Document Reranking</h1>
|
| 27 |
+
|
| 28 |
+
<p align="center">
|
| 29 |
+
<a href="https://huggingface.co/collections/KaLM-Embedding/lychee-kalm-reranker">
|
| 30 |
+
<img src="https://img.shields.io/badge/%F0%9F%A4%97_Collection-KaLM--Reranker-ffbd45.svg" alt="Hugging Face Collection">
|
| 31 |
+
</a>
|
| 32 |
+
<a href="https://arxiv.org/abs/2606.22807">
|
| 33 |
+
<img src="https://img.shields.io/badge/arXiv-2606.22807-b31b1b.svg" alt="Paper">
|
| 34 |
+
</a>
|
| 35 |
+
<a href="https://github.com/KaLM-Embedding">
|
| 36 |
+
<img src="https://img.shields.io/badge/GitHub-KaLM--Embedding-blue.svg?logo=github" alt="GitHub">
|
| 37 |
+
</a>
|
| 38 |
+
<a href="https://www.apache.org/licenses/LICENSE-2.0">
|
| 39 |
+
<img src="https://img.shields.io/badge/License-Apache--2.0-green.svg" alt="License">
|
| 40 |
+
</a>
|
| 41 |
+
</p>
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
## What is R2?
|
| 45 |
+
|
| 46 |
+
**KaLM-Reranker-V1-R2 is a substantially improved checkpoint release of KaLM-Reranker-V1.** It keeps the same fast-but-not-late-interaction (FBNL) architecture and inference interface as the original release, while introducing a stronger multi-stage training recipe for three practical goals:
|
| 47 |
+
|
| 48 |
+
1. **Stronger compression robustness.** R2 supports Matryoshka embedding pooling (MEP) from **1x to 128x**, extending the maximum validated compression ratio from 32x to 128x. Even at 128x compression, all three model sizes retain at least 92% of their average nDCG@10 at 2x compression on both BEIR and MIRACL.
|
| 49 |
+
2. **Adjustable test-time compute.** A single R2 checkpoint can trade compute for quality by changing the compression ratio. It can also use a coarse-to-fine cascade: cheaply screen all candidates with heavily compressed document representations, then spend more compute only on the most promising candidates.
|
| 50 |
+
3. **Better multi-domain and multilingual ranking.** At the default 4x compression ratio, every R2 model improves on BEIR, while MIRACL average nDCG@10 increases by **+9.03**, **+7.17**, and **+4.85** points for Nano, Small, and Large, respectively.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
### R2 vs. the original release
|
| 55 |
+
|
| 56 |
+
All results below use the same default compression ratio, `r=4`. Original-release results are taken from the previous model cards; R2 results are from the updated paper.
|
| 57 |
+
|
| 58 |
+
| Model | BEIR original | BEIR R2 | Delta | MIRACL original | MIRACL R2 | Delta |
|
| 59 |
+
|:--|--:|--:|--:|--:|--:|--:|
|
| 60 |
+
| Nano | 57.41 | **58.54** | **+1.13** | 62.08 | **71.11** | **+9.03** |
|
| 61 |
+
| Small | 60.01 | **61.07** | **+1.06** | 66.89 | **74.06** | **+7.17** |
|
| 62 |
+
| Large | 62.87 | **63.53** | **+0.66** | 70.07 | **74.92** | **+4.85** |
|
| 63 |
+
|
| 64 |
+
| Capability | Original release | R2 |
|
| 65 |
+
|:--|:--|:--|
|
| 66 |
+
| Validated MEP range | 1x-32x | **1x-128x** |
|
| 67 |
+
| Test-time compute | Flexible MEP, not explicitly evaluated as a compute-scaling strategy | **Adjustable compression and evaluated coarse-to-fine cascading** |
|
| 68 |
+
| Training | Original supervised checkpoints | **High-quality SFT -> soft-label distillation -> model soup** |
|
| 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 |
|
| 77 |
+
| [KaLM-Reranker-V1-Small-R2](https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Small-R2) | 1B | 26 + 26 | 128K | 1152 | 1x-128x | Yes |
|
| 78 |
+
| [KaLM-Reranker-V1-Large-R2](https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Large-R2) | 4B | 34 + 34 | 128K | 2560 | 1x-128x | Yes |
|
| 79 |
+
|
| 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.
|