File size: 5,601 Bytes
e374d55
 
 
 
 
 
 
 
e6c1a15
e374d55
 
e6c1a15
e374d55
e6c1a15
 
e374d55
e6c1a15
e374d55
 
db2e1e0
e6c1a15
e374d55
 
e6c1a15
 
e374d55
e6c1a15
 
 
 
e374d55
e6c1a15
 
 
 
 
 
 
 
 
 
 
 
 
e374d55
 
db2e1e0
 
e6c1a15
 
e374d55
e6c1a15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a226ca
e6c1a15
 
db2e1e0
9a226ca
 
e6c1a15
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
license: apache-2.0
language: [zh, ja, ko, th, id, en, multilingual]
library_name: sentence-transformers
pipeline_tag: text-ranking
base_model: jhu-clsp/mmBERT-small
datasets:
- CheezOne/reranker-train-chinese-japanese-korean
tags: [reranker, cross-encoder, rerank, rag, retrieval, chinese, japanese, korean, multilingual, onnx, transformers.js, langchain, llamaindex, haystack, modernbert]
---

# Reranker (CJK, small)

A 141M-parameter cross-encoder reranker for RAG and search in **Chinese, Japanese, Korean** and other languages. It is Apache-2.0 and runs on CPU.
It is distilled from `BAAI/bge-reranker-v2-m3`: the average score is 2.2 nDCG points lower and it runs **3.7× faster**.

## Quick start
```python
from sentence_transformers import CrossEncoder
model = CrossEncoder("CheezOne/reranker-cjk-small")
model.rank("如何办理护照?", ["办理护照需要携带身份证到出入境管理局申请。", "今天北京天气晴朗。"])
```

## Use in your RAG stack
LangChain (`langchain` 1.x):
```python
from langchain_community.cross_encoders import HuggingFaceCrossEncoder
from langchain_classic.retrievers.document_compressors import CrossEncoderReranker  # langchain<1.0: langchain.retrievers.document_compressors
reranker = CrossEncoderReranker(model=HuggingFaceCrossEncoder(model_name="CheezOne/reranker-cjk-small"), top_n=5)
docs = reranker.compress_documents(docs, query)
```
LlamaIndex:
```python
from llama_index.core.postprocessor import SentenceTransformerRerank
reranker = SentenceTransformerRerank(model="CheezOne/reranker-cjk-small", top_n=5)
nodes = reranker.postprocess_nodes(nodes, query_str=query)
```
Haystack 3 (`pip install sentence-transformers-haystack`):
```python
from haystack_integrations.components.rankers.sentence_transformers import SentenceTransformersSimilarityRanker
ranker = SentenceTransformersSimilarityRanker(model="CheezOne/reranker-cjk-small", top_k=5); ranker.warm_up()
ranker.run(query=query, documents=documents)
```
transformers.js (browser / Node, int8 ONNX):
```js
import { AutoTokenizer, AutoModelForSequenceClassification } from "@huggingface/transformers";
const tok = await AutoTokenizer.from_pretrained("CheezOne/reranker-cjk-small");
const model = await AutoModelForSequenceClassification.from_pretrained("CheezOne/reranker-cjk-small", { dtype: "q8" });
const inputs = tok([query, query], { text_pair: [docA, docB], padding: true, truncation: true });
const scores = (await model(inputs)).logits.data;   // higher = more relevant
```
All snippets above were run against this repo (2026-11-27). The model also loads on transformers 4.x.

## Results (MIRACL reranking, nDCG@10)
| model | zh | ja | ko | th | id | en | avg |
|---|---|---|---|---|---|---|---|
| **this model** (141M) | 0.525 | 0.716 | 0.727 | 0.788 | 0.608 | 0.629 | 0.666 |
| BAAI/bge-reranker-v2-m3 (568M, our teacher) | 0.546 | 0.738 | 0.722 | 0.813 | 0.658 | 0.649 | 0.688 |
| hotchpotch/japanese-reranker-cross-encoder-small-v1 (118M) | 0.510 | 0.678 | 0.696 | 0.785 | 0.580 | 0.609 | 0.643 |
| cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 (118M) | 0.498 | 0.640 | 0.679 | 0.768 | 0.552 | 0.580 | 0.620 |
| BAAI/bge-reranker-base (278M) | 0.460 | 0.561 | 0.586 | 0.686 | 0.508 | 0.552 | 0.559 |

Head-to-head with the other small mmBERT reranker. Same 100 queries per language for both models, run on CPU:
| model | zh | ja | ko | th | id | en | avg |
|---|---|---|---|---|---|---|---|
| **this model** | 0.534 | 0.707 | 0.719 | 0.786 | 0.567 | 0.650 | 0.661 |
| Horizon-Labs/multilingual-reranker-small | 0.527 | 0.701 | 0.693 | 0.779 | 0.567 | 0.649 | 0.653 |

The two models are **on par**. Only the Korean gap is clearly larger than the noise on 100 queries. Horizon-Labs' model was trained on MIRACL's training split; this one was not.

## Good to know
- Scores are raw logits; apply a sigmoid for values in 0–1. Context up to 8k tokens; trained at 384.
- ONNX: `onnx/model.onnx` (fp32) and `onnx/model_quantized.onnx` (int8, 230 MB; nDCG within 0.003 of PyTorch on zh/ja/ko).
- Trained mostly on Chinese (77% of groups). Indonesian was never in the training data, so that column is zero-shot.
- Not evaluated on legal, medical or code domains. It is a reranker, not a retriever: use it on top of BM25 or an embedding model.

## Details
- Teacher scores: `BAAI/bge-reranker-v2-m3` on 551k query–passage pairs.
- Data: [`CheezOne/reranker-train-chinese-japanese-korean`](https://huggingface.co/datasets/CheezOne/reranker-train-chinese-japanese-korean): T2Ranking (zh) and Mr. TyDi (ja/ko/th/en), 51,858 query groups, Apache-2.0.
- Loss: listwise KL to the teacher + 0.05 × MSE. 2 epochs, lr 5e-5, max length 384, one L40 GPU.
- Reproduce: `scripts/rr_prep.py` → `scripts/rr_gpu.py teacher|train|eval` → `scripts/rr_export_onnx.py`.
- MIRACL candidate lists come from `mteb/MIRACLReranking`. MIRACL queries were removed from our training data; passages can overlap with Mr. TyDi, since both come from Wikipedia.

## License and citation
Apache-2.0. Model id: `CheezOne/reranker-cjk-small`.
```bibtex
@misc{cheezone_reranker_cjk_small,
  title = {Reranker (CJK, small)}, author = {CheezOne}, year = {2026},
  howpublished = {\url{https://huggingface.co/CheezOne/reranker-cjk-small}}
}
```
More from CheezOne: [prompt-injection-guard-cjk-small](https://huggingface.co/CheezOne/prompt-injection-guard-cjk-small) ·
[paraphrase-multilingual-MiniLM-L12-v2-zh-ja-ko-en](https://huggingface.co/CheezOne/paraphrase-multilingual-MiniLM-L12-v2-zh-ja-ko-en) ·
[pixel-art-sprite-generator-16x16](https://huggingface.co/CheezOne/pixel-art-sprite-generator-16x16)