Downloads · 30 days
0
Chottokun/ruri-v3-reranker-310m-lite
ruri-v3-reranker-310m-lite is a text classification model from Chottokun. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
cl-nagoya/ruri-v3-reranker-310m is an ultra-high-precision Japanese Cross-Encoder reranker based on the ModernBERT-Ja architecture (315M parameters).
Downloads · 30 days
0
Access
Public
Updated Sep 24, 2026
Repo size
4.7 GB
Likes
0
Public
Click a slice to open those files.
.onnx3 GB · 64%
From the Hugging Face model README
cl-nagoya/ruri-v3-reranker-310m is an ultra-high-precision Japanese Cross-Encoder reranker based on the ModernBERT-Ja architecture (315M parameters).
ruri-v3-reranker-310m-lite is an optimized deployment package engineered for Zero-Torch runtime (no PyTorch, no Transformers) and zero C++ compilation (pre-built wheels provided).
torch, torchvision, transformers).sentencepiece_lite, onnxruntime / onnxruntime-gpu, numpy, huggingface_hub.sentencepiece_lite and zero-copy FlatBuffers dictionary (.spm.fb) are bundled.AutoTokenizer.| Precision | Target File | Disk Size | Download (Gzip) | Reduction | CPU Latency (Top-10) | Speedup | Top-1 Match |
|---|---|---|---|---|---|---|---|
fp32 | model.onnx | 1,202.6 MB | - | Baseline | 2,589 ms | 1.00x | ✅ 100% Match (Baseline) |
fp16 | model_fp16.onnx | 601.4 MB | - | -50.0% | (GPU Tensor Core) | - | ✅ 100% Match |
int8 | model_int8.onnx | 526.0 MB | - | -56.3% | 2,072 ms | 1.25x | ✅ 100% Match |
int8_full ⚡ | model_int8_full.onnx | 301.0 MB | 🔥 202.7 MB | -75.0% (Gzip -83.1%) | 2,116 ms | 1.22x | ✅ 100% Match (100% Identical) |
pruned_16l 🚀 | model_pruned_16l_int8.onnx | 220.6 MB | 🔥 178.1 MB | -81.7% (Gzip -85.2%) | 1,382 ms | ⚡ 1.87x | ✅ 100% Match (Top-1 Preserved) |
Transparent on-the-fly streaming Gzip decompression is natively supported in
ruri_v3_reranker_lite.py. By default on CPU,precision="auto"loads the ultra-compactint8_fullmodel via 202 MB streaming download.
Install via pip (or uv pip):
# Install the pre-built SentencePiece Lite wheel and runtime dependencies
pip install https://huggingface.co/Chottokun/ruri-v3-reranker-310m-lite/resolve/main/wheels/sentencepiece_lite-0.1.0-cp311-cp311-linux_x86_64.whl onnxruntime numpy huggingface_hub
For GPU acceleration, replace
onnxruntimewithonnxruntime-gpu.
from ruri_v3_reranker_lite import RuriV3RerankerLite
# Initialize model with your desired precision tier:
# - "int8_full" (Recommended for CPU): 301 MB ultra-compact, 1.33x faster, 100% rank preservation
# - "int8": 526 MB dynamic quantized
# - "fp16": 601 MB for modern GPUs (Turing/Ampere+)
# - "fp32": 1,202 MB standard baseline
reranker = RuriV3RerankerLite(
repo_id="Chottokun/ruri-v3-reranker-310m-lite",
precision="int8_full", # Loads the 301 MB ultra-compact model
device="cpu"
)
query = "日本の首都はどこですか?"
documents = [
"日本の首都は東京都です。政治・経済の中枢が集約されています。",
"東京は日本の政治と文化の中心都市であり、多くの観光客が訪れます。",
"大阪は関西地方の主要都市で、独自の食文化やお笑いで知られています。",
"明日の天気は全国的に晴れのち曇りとなる見込みです。",
"ピタゴラスの定理は直角三角形の斜辺の長さを計算するための幾何学の基本法則です。"
]
# 1. Reranking API: Returns sorted results in descending score order
results = reranker.rerank(query, documents, top_k=3, normalize=True)
for rank, item in enumerate(results, start=1):
print(f"Rank {rank}: Score={item['score']:.4f} (Index {item['index']}) -> {item['document']}")
# Output:
# Rank 1: Score=1.0000 (Index 0) -> 日本の首都は東京都です。政治・経済の中枢が集約されています。
# Rank 2: Score=0.5633 (Index 1) -> 東京は日本の政治と文化の中心都市であり、多くの観光客が訪れます。
# Rank 3: Score=0.0093 (Index 2) -> 大阪は関西地方の主要都市で、独自の食文化やお笑いで知られています。
# 2. Raw Scoring API (Pairs)
pairs = [(query, doc) for doc in documents]
scores = reranker.score(pairs, normalize=True)
print("Relevance Probabilities:", scores)
Tested on Linux x86_64 (CPU, 4 threads, document length ~150 chars):
| Top-N Documents | PyTorch (Transformers) | Zero-Torch Lite | Tokenization Speedup | Lite Throughput |
|---|---|---|---|---|
| Top-5 | 567.3 ms | 540.4 ms | 4.24x | 9.3 docs/s |
| Top-10 | 1,104.7 ms | 1,277.4 ms | 4.51x | 7.8 docs/s |
| Top-20 | 2,343.2 ms | 2,479.5 ms | 4.18x | 8.1 docs/s |
| Top-50 | 5,828.6 ms | 6,215.3 ms | 3.79x | 8.0 docs/s |
| Top-100 | 11,214.4 ms | 12,452.8 ms | 4.55x | 8.0 docs/s |
Two-Stage RAG Architecture Recommendation: Since Cross-Encoder inference runs in $O(N)$ time per query (~1.2s for Top-10 on CPU), we strongly recommend a two-stage hybrid retrieval pipeline:
- Stage 1 (Coarse Candidate Retrieval): Retrieve Top-20~30 candidate documents using a lightweight Bi-Encoder (e.g.,
Chottokun/ruri-v3-30m-lite) in $< 10$ ms.- Stage 2 (Fine-grained Reranking): Rerank the candidate set using
ruri-v3-reranker-310m-liteto extract the most accurate Top-3~5 passages.
This distribution and derived artifacts are licensed under the Apache License 2.0.
cl-nagoya/ruri-v3-reranker-310m.spm.fb).ruri_v3_reranker_lite.py).@misc{Ruri,
title={Ruri: Japanese General Text Embeddings},
author={Hayato Tsukagoshi and Ryohei Sasano},
year={2024},
eprint={2409.07737},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2409.07737},
}