tiny-rerank-ja-en-30m

A 36.7M-parameter English-Japanese sentence encoder (256-dim) for CPU retrieval. It was distilled from BAAI/bge-m3 into sbintuitions/modernbert-ja-30m and then given a short Matryoshka fine-tune, so the embedding can be truncated to 128 or 64 dimensions. ONNX exports for all three sizes are in this repo. Code and write-up: https://github.com/raihan-js/tiny-bilingual-retriever

Which checkpoint is this? This repo is the Matryoshka fine-tune. At full 256 dimensions it scores EN→JA nDCG@10 0.416 (62% of bge-m3's 0.674) on a synthetic 500-query / 5,000-passage OPUS-100 test; at 128 dims 0.399, at 64 dims 0.361 (87% of its own 256-dim score at a quarter of the index). The plain distilled checkpoint, before the Matryoshka step, scores 0.481 (71% of the teacher) and is the better choice if you only need 256 dimensions: raihan-js/tiny-rerank-ja-en-30m-distilled.

Limits: the public cl-nagoya/ruri-v3-30m (same size) scores higher on both English→Japanese (0.542) and Japanese→Japanese retrieval (0.960 vs this model's 0.155), so this is a measured compression recipe, not a state-of-the-art encoder. Use it for English→Japanese queries only. The evaluation is synthetic and single-run. Per-item results: results/baselines.json.


Auto-generated details

This is a sentence-transformers model finetuned from sbintuitions/modernbert-ja-30m. It maps inputs to a 256-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: sbintuitions/modernbert-ja-30m
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 256 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'ModernBertModel'})
  (1): Pooling({'embedding_dimension': 256, 'pooling_mode': 'mean', 'include_prompt': True})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

pip install -U sentence-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("raihan-js/tiny-rerank-ja-en-30m")
# Run inference
sentences = [
    'The weather is lovely today.',
    "It's so sunny outside!",
    'He drove to the stadium.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 256]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.9411, 0.8413],
#         [0.9411, 1.0000, 0.8631],
#         [0.8413, 0.8631, 1.0000]])

Training Details

Framework Versions

  • Python: 3.12.3
  • Sentence Transformers: 6.1.0
  • Transformers: 5.18.0
  • PyTorch: 2.13.0+cu130
  • Accelerate:
  • Datasets: 5.0.1
  • Tokenizers: 0.23.2

Additional Resources

Citation

BibTeX

Downloads last month
45
Safetensors
Model size
36.7M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for raihan-js/tiny-rerank-ja-en-30m

Finetuned
(9)
this model