reranker-cjk-small / README.md
CheezOne's picture
Link to renamed PI guard
e8cebfe verified
|
Raw History Blame Contribute Delete
7.84 kB
metadata
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
  - distillation
  - modernbert

Small multilingual reranker for Chinese, Japanese and Korean (and more)

A 140M-parameter cross-encoder reranker distilled from BAAI/bge-reranker-v2-m3 into jhu-clsp/mmBERT-small (ModernBERT). Use it as the second stage of RAG / search: give it a query and candidate passages, it returns relevance scores.

  • 0.666 avg nDCG@10 on MIRACL reranking (zh/ja/ko/th/id/en), vs 0.688 for the 568M teacher: 2.2 points lower, 3.7× faster.
  • Beats every small open reranker we tested on all 6 languages, including Chinese, where small models are weakest.
  • Context up to 8k tokens (ModernBERT), trained at 384 tokens per query+passage.
  • ONNX fp32 + int8 included → runs on CPU and in the browser (transformers.js).

中文简介:一个约 1.4 亿参数的小型重排序(rerank)模型,面向中文、日文、韩文 RAG / 检索。从 bge-reranker-v2-m3 蒸馏而来, MIRACL 上平均只比老师低 2.2 分,速度快 3.7 倍;在 6 种语言上全部超过我们测过的同级别小模型。附 ONNX(可 CPU / 浏览器运行)。

Results: MIRACL reranking, nDCG@10

Candidate lists from mteb/MIRACLReranking (dev). Queries per language: zh 391, ja 797, ko 212, th 200, id 200, en 200 (zh/ja/ko: all queries in our bundled subset; th/id/en: first 200). Same data, same code and same GPU for every model (scripts/rr_gpu.py eval). Bold = best non-teacher model.

model zh ja ko th id en avg pairs/s (L40, bf16)
this model (mmBERT-small, ~140M) 0.525 0.716 0.727 0.788 0.608 0.629 0.666 2776
BAAI/bge-reranker-v2-m3 (568M, teacher) 0.546 0.738 0.722 0.813 0.658 0.649 0.688 758
hotchpotch/japanese-reranker-cross-encoder-small-v1 (118M) 0.510 0.678 0.696 0.785 0.580 0.609 0.643 5430
cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 (118M) 0.498 0.640 0.679 0.768 0.552 0.580 0.620 5314
BAAI/bge-reranker-base (278M) 0.460 0.561 0.586 0.686 0.508 0.552 0.559 2395

Notes, so you can judge the numbers yourself:

  • Indonesian (id) was never in our training data, so that column is zero-shot transfer.
  • MIRACL queries were removed from the training data (see the dataset card), but MIRACL and Mr. TyDi share Wikipedia, so passages can overlap.
  • hotchpotch's model is Japanese-focused, and the teacher is much larger. We include them as reference points, not as straw men.
  • Throughput was measured with batch 128 and max length 512. Expect different numbers on your hardware.

Usage

sentence-transformers

from sentence_transformers import CrossEncoder
model = CrossEncoder("CheezOne/reranker-cjk-small")
query = "如何办理护照?"
passages = ["办理护照需要携带身份证和户口本到出入境管理局申请。", "护照是一种旅行证件。", "今天北京天气晴朗。"]
print(model.rank(query, passages))

transformers

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("CheezOne/reranker-cjk-small")
model = AutoModelForSequenceClassification.from_pretrained("CheezOne/reranker-cjk-small").eval()
pairs = [["東京タワーの高さは?", "東京タワーの高さは333メートルです。"], ["東京タワーの高さは?", "大阪城は豊臣秀吉が築いた城です。"]]
enc = tok(pairs, padding=True, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
    print(model(**enc).logits.view(-1))   # higher = more relevant

Scores are raw logits; apply sigmoid if you want values in 0–1.

transformers.js (browser / Node)

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(["빨간 물약", "빨간 물약"], { text_pair: ["체력을 회복하는 빨간 물약입니다.", "서울은 한국의 수도입니다."], padding: true, truncation: true });
console.log((await model(inputs)).logits.data);

ONNX

runtime size nDCG@10 zh nDCG@10 ja nDCG@10 ko
PyTorch fp32 563 MB (bf16 safetensors: 281 MB) 0.647 0.729 0.721
ONNX fp32 onnx/model.onnx 563 MB 0.647 0.729 0.721
ONNX int8 onnx/model_quantized.onnx 230 MB 0.650 0.729 0.721

(ONNX check on the first 10 MIRACL queries per language, CPU.)

The int8 model quantizes embeddings and attention only. ModernBERT's GeGLU MLP activations have outliers, so the MLPs and head stay fp32.

Training

  • Teacher: BAAI/bge-reranker-v2-m3 scored 551,213 query–passage pairs in 27 minutes on one L40.
  • Data: CheezOne/reranker-train-chinese-japanese-korean, 51,858 query groups.
    • zh: 40k groups from T2Ranking.
    • ja/ko/th/en: from Mr. TyDi.
    • All Apache-2.0.
  • Loss: listwise KL between student and teacher score distributions within each group, plus 0.05 × MSE on raw scores.
  • Hyperparameters: 2 epochs, 16 groups per step, lr 5e-5, max length 384, bf16. 6,484 steps in 55 minutes on one L40.
  • Reproduce: scripts/rr_prep.py → scripts/rr_gpu.py teacher|train|eval → scripts/rr_export_onnx.py.

Limitations

  • Trained mostly on Chinese (77% of groups), so ja/ko/th/en saw only 1.3k–3.7k groups each. Domain-specific text (legal, medical, code) is not evaluated.
  • It is a reranker, not a retriever: use it on top of BM25 or an embedding model.
  • No safety or bias evaluation was done.

Citation / credits

Base model: jhu-clsp/mmBERT-small (MIT). Teacher: BAAI/bge-reranker-v2-m3 (Apache-2.0). Data: T2Ranking, Mr. TyDi; evaluation: MIRACL (via MTEB).

Use it in your project

  • Model id (paste as-is): CheezOne/reranker-cjk-small
  • License: Apache-2.0 (see LICENSE). You may depend on it, redistribute it and fine-tune it, including commercially. Please keep the attribution.
  • If this model helps your project, a mention of the model id in your README lets other people find it.
@misc{cheezone_reranker_chinese_japanese_korean_multili,
  title  = {Small multilingual reranker for Chinese, Japanese and Korean},
  author = {CheezOne},
  year   = {2026},
  howpublished = {\url{https://huggingface.co/CheezOne/reranker-cjk-small}}
}

More from CheezOne

Small open models for Chinese / Japanese / Korean / English apps. All of them run on CPU, and most in the browser.