Readme
KaLM-Reranker-V1-Small-R2
An open-source multilingual document reranker from the KaLM-Embedding Research Team, designed for search and retrieval-augmented generation (RAG).
KaLM uses an encoder–decoder architecture with compressed document representations. This endpoint exposes compression_ratio as a per-request hyperparameter, enabling users to explore test-time compute and ranking-quality trade-offs without retraining.
Adjustable test-time compute
Set compression_ratio when making a prediction:
- 1: No document representation compression.
- 4: Default compression.
- 32, 64, or 128: More aggressive compression.
Higher compression reduces the number of document representations passed to the scoring decoder. You can change the compression ratio between requests while using the same model checkpoint.
Inputs
| Parameter | Description |
|---|---|
query |
Query text. Required. |
documents |
Array of candidate document texts. Required. |
compression_ratio |
Integer from 1 to 128. Default: 4. |
top_n |
Maximum number of results. Omit to return all documents. |
return_documents |
Include document text in the output. Default: false. |
instruction |
Optional task instruction to guide relevance scoring. |
Example
{
"query": "What is the capital of France?",
"documents": [
"Berlin is the capital of Germany.",
"Paris is the capital of France.",
"Rome is the capital of Italy.",
"Madrid is the capital of Spain."
],
"compression_ratio": 4,
"top_n": 4,
"return_documents": true
}
Try the same input with compression_ratio set to 32 to compare configurations.
Output
Results are sorted by descending relevance score. Each result contains:
index: Original document index, starting from 0.relevance_score: Model relevance score.document: Original text, whenreturn_documentsis true.