Text Ranking
sentence-transformers
ONNX
Safetensors
Transformers.js
modernbert
text-classification
reranker
cross-encoder
rerank
rag
retrieval
chinese
japanese
korean
langchain
llamaindex
haystack
text-embeddings-inference
Instructions to use CheezOne/reranker-cjk-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use CheezOne/reranker-cjk-small with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("CheezOne/reranker-cjk-small") 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.js
How to use CheezOne/reranker-cjk-small with Transformers.js:
// npm i @huggingface/transformers import { AutoTokenizer, AutoModelForSequenceClassification } from '@huggingface/transformers'; const tokenizer = await AutoTokenizer.from_pretrained('CheezOne/reranker-cjk-small'); const model = await AutoModelForSequenceClassification.from_pretrained('CheezOne/reranker-cjk-small'); const query = 'Which planet is known as the Red Planet?'; const documents = [ 'Mars, known for its reddish appearance, is often referred to as the Red Planet.', 'Venus is often called the twin of Earth because of its similar size and proximity.', ]; const inputs = tokenizer(new Array(documents.length).fill(query), { text_pair: documents, padding: true, truncation: true }); const { logits } = await model(inputs); console.log(logits.sigmoid().tolist()); // one relevance score per document - Notebooks
- Google Colab
- Kaggle
|
Download README.md from CheezOne/reranker-cjk-small: direct link, hf CLI and curl.
- Browser
- Download file 5.6 kB
-
https://huggingface.co/CheezOne/reranker-cjk-small/resolve/main/README.md
- Command line
-
hf download hf://CheezOne/reranker-cjk-small/README.md
-
curl -L -o README.md https://huggingface.co/CheezOne/reranker-cjk-small/resolve/main/README.md
5.6 kB
| 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) | |