English | 日本語
A Japanese SPLADE (Learned Sparse Retrieval) model built on ModernBERT-Ja-310M.
It converts input text into a sparse vector over the vocabulary dimensions (102,400 dimensions), enabling fast retrieval via inverted indexes or sparse matrix operations while providing natural expansion to related terms. It incorporates a mechanism to suppress noise tokens such as punctuation, symbols, subword fragments, and decorative placeholders during training, so trust_remote_code and additional modules are not required during inference. It can be loaded directly with plain SparseEncoder.from_pretrained().
| Property | Value |
|---|---|
| Base model | sbintuitions/modernbert-ja-310m |
| Architecture | Transformer (fill-mask) + SpladePooling (max) |
| Parameters | About 315M |
| Maximum input length | 8,192 tokens (trained with 512 tokens) |
| Vocabulary size (= output dimensions) | 102,400 |
| Tokenizer | SentencePiece (uses the ModernBERT-Ja vocabulary as-is) |
| Main framework | sentence-transformers >= 5.4 (SparseEncoder) |
| Loss function | CachedSpladeLoss(SparseMultipleNegativesRankingLoss) |
| Mixed precision | bf16 |
SPLADE v2 produces sparse embeddings obtained by max pooling the logits of the MLM head across each vocabulary dimension, with only tens to hundreds of non-zero dimensions per sentence. At retrieval time, scoring can be performed by dot product, which provides high compatibility with inverted indexes (Elasticsearch, OpenSearch, Vespa, Qdrant, etc.).
from sentence_transformers import SparseEncoder
model = SparseEncoder("mahiyama/splade-ja-310m")
# Queries: "What is the capital of Japan?", "What is machine learning?"
queries = [
"日本の首都はどこですか?",
"機械学習とは何ですか",
]
# Documents: on Tokyo (the capital of Japan), Kyoto (an ancient capital), and machine learning
documents = [
"東京は日本の首都であり、政治・経済の中心地である。",
"京都は古都として知られ、神社仏閣が多くある。",
"機械学習は人工知能の一分野で、データからパターンを学習する手法である。",
]
q_emb = model.encode_query(queries)
d_emb = model.encode_document(documents)
# Compute similarity scores by dot product
scores = model.similarity(q_emb, d_emb)
print(scores)
# Inspect expanded tokens (top_k=15 vocabulary tokens and their weights)
for token, weight in model.decode(q_emb[0], top_k=15):
print(f" {token:>20} {weight:.3f}")
The model is designed to use the same encoder for queries and documents (symmetric rather than asymmetric). Compute scores with the dot product (dot, not cosine).
Here are three examples showing how the trained model expands each query into vocabulary dimensions. The samples are JSON in {token: weight} form, where tokens higher in the list have larger weights, and only the top 10 tokens of each sample are shown.
{
"query": "機械学習",
"active_dims": 307,
"top_tokens": {
"機械学習": 2.828,
"学習": 1.906,
"分類": 1.734,
"人工知能": 1.711,
"機械": 1.672,
"アルゴリズム": 1.578,
"用語": 1.508,
"コンピューター": 1.492,
"サイエンス": 1.461,
"科学": 1.453
}
}
In addition to the query 「機械学習」 itself, it is cleanly expanded to words representing broader concepts and related fields, such as 学習 (learning), 人工知能 (artificial intelligence), アルゴリズム (algorithm), コンピューター (computer), and 科学 (science). This expansion also makes it easier to retrieve documents that surface-level matching such as BM25 cannot find: documents about machine learning that do not contain the term 「機械学習」.
{
"query": "日本の首都はどこですか?",
"active_dims": 11,
"top_tokens": {
"首都": 2.562,
"日本の": 2.156,
"の首都": 1.859,
"日本": 1.273,
"首相": 1.219,
"都": 0.902,
"日本で": 0.801,
"都市": 0.734,
"はどこですか": 0.391,
"日本における": 0.289
}
}
Even in question format, active_dims is extremely sparse at 11, with weights concentrated on 「首都」 (capital), 「日本」 (Japan), and 「都市」 (city), which form the core of the search. Weights are not wasted on question function words like 「は」 (topic marker), 「どこ」 (where), and 「ですか」 (question marker), resulting in a sparse vector with little noise as a search signal.
{
"query": "アップル",
"active_dims": 533,
"top_tokens": {
"アップル": 2.781,
"別名": 2.062,
"リンゴ": 1.992,
"Apple": 1.984,
"apple": 1.922,
"▁Apple": 1.820,
"▁apple": 1.781,
"英語": 1.773,
"りんご": 1.711,
"APPLE": 1.680
}
}
Tokens for both senses, the fruit (リンゴ, りんご) and the company (Apple, apple, APPLE), including English and Japanese spelling variants (▁Apple carries the SentencePiece word-initial marker), are activated with high weights at the same time, showing broad sense coverage for a query without context. Meanwhile, punctuation, symbols, emoji, and special tokens (such as [CLS]) are not included in the top ranks at all.
Starting from the base ModernBERT-Ja-310M, the model was completed through six stages of progressive training. The strategy at each stage was to take the best checkpoint of the previous stage as the starting point, gradually adjusting data size, learning rate, and regularization to achieve step-by-step convergence.
| Stage | Starting model | Training examples | epoch | batch_size | learning_rate | query_reg | document_reg |
|---|---|---|---|---|---|---|---|
| Stage 1 | Base MLM | 200,000 | 1 | 64 | 1.5e-5 | 2e-5 | 1.5e-4 |
| Stage 2 | Stage 1 best | 200,000 | 1 | 64 | 5e-6 | 1.5e-5 | 1e-4 |
| Stage 3 | Stage 2 best | 500,000 | 1 | 64 | 3e-6 | 1.5e-5 | 1e-4 |
| Stage 4 | Stage 3 best | 1,000,000 | 1 | 64 | 2e-6 | 1.5e-5 | 1e-4 |
| Stage 5 | Stage 4 best | 200,000 | 1 | 64 | 1e-6 | 1.5e-5 | 1e-4 |
| Stage 6 (final) | Stage 5 best | 200,000 | 1 | 64 | 5e-7 | 1e-5 | 5e-5 |
Settings shared across all stages:
With each stage, the learning rate was reduced by approximately 1/3 (1.5e-5 → 5e-6 → 3e-6 → 2e-6 → 1e-6 → 5e-7), adjusting the training to incorporate only the objectives of each stage without shifting the converged model excessively.
To achieve natural vocabulary expansion, a mechanism was built in to suppress, during training, tokens that have no value as search signals.
Because SPLADE directly uses the MLM head logits as vocabulary dimensions, tokens that are worthless as search signals tend to slip into the top expansion results if left unchecked. Specifically, these include punctuation and symbols, the standalone SPM word-initial marker ▁, byte fallbacks (<0xHH>), decorative placeholders (○○, ※, ■, →, etc.), special tokens ([CLS], [SEP], [PAD], [MASK]), and meta-tokens originating from the Wikipedia corpus (○○, わからない, 質問, etc.). These become high-frequency dimensions in an inverted index, wasting both memory and computation time.
The suppression targets were automatically determined across the entire vocabulary using the following rules, supplemented with manually added corpus-specific meta-tokens:
SPLADE is designed so that high-frequency, low-contribution dimensions are naturally suppressed by FLOPS regularization incorporated into the loss function. Therefore, punctuation and symbols should theoretically lose weight gradually, but in practice, relying solely on natural decay was judged to be difficult for the following reasons:
Therefore, this model adopts an approach where tokens structurally identifiable as noise are eliminated via hard constraints, allowing FLOPS regularization to focus on its primary role of sparsity control within related-term expansion. This reliably balances retrieval quality with natural vocabulary expansion, while also making active_dims tuning more predictable.
Suppression was made permanent through the following two steps:
From stage 2 onward, an automated feedback loop was run in which vocabulary expansions for sample queries were dumped to JSON at each eval step, extracting noise words that appeared at the top and propagating them to the suppression list for the next stage. This allowed corpus-specific meta-tokens to be progressively eliminated.
This section documents insights regarding SPLADE training gained through the development of this model.
In continued training from an already converged SPLADE model, active_dims tended not to change substantially even when adjusting the regularization weights (query_reg / document_reg). For example, if query_active_dims converged to around 20 in the first stage trained from the base MLM, weakening query_reg to 1/10 in subsequent stages only increased it to around 30. If you want to change the target range significantly, you need to restart from the base MLM.
When training exclusively on Wikipedia-based corpora (auto-wiki-qa), structural words originating from the corpus, such as 「別名」 (alias), 「英語版」 (English edition), 「学名」 (scientific name), 「主な」 (main), and 「タグ」 (tag), frequently appear at the top of expansions. Because FLOPS regularization is a data-agnostic frequency penalty that only suppresses unused high-frequency dimensions, this kind of word that happens to contribute to improving the ground-truth score under the contrastive loss remains unpenalized. The fundamental solution is data mixing (blending corpora from different domains and registers); training on a single corpus alone has its limits.
Automated detection based on Unicode categories (Punctuation, Symbol, Modifier, repetitions, etc.) cleanly captures punctuation, symbols, emoji, SPM markers, and byte tokens, but misses corpus-specific meta-tokens such as 「○○」, 「わからない」, and 「質問」 because they have no structural features. By incorporating a workflow where vocabulary expansion logs from each stage are visually inspected and top-ranking meta-tokens are manually added to the suppression list for the next stage, the contamination rate of punctuation and subword fragments in the top 30 was ultimately kept at 0%.
The small-scale version of the JaCWIR Retrieval benchmark used as the evaluation dataset during training has a relatively small configuration of 1,000 queries and 10,000 corpus documents, offering the advantage of being lightweight enough to evaluate frequently within the training loop. On the other hand, it reached a high level of nDCG@10 ≈ 0.97 starting from stage 1 of this model, with improvements between stages as small as about 0.005, making it difficult to function as an indicator for training decisions on its own. In developing this model, the active_dims profile (fit to the query and corpus target ranges) and the naturalness of vocabulary expansion samples were used in combination as secondary evaluation criteria. For thorough evaluation, it is desirable to combine more challenging benchmarks like MIRACL-ja or JSQuAD.
SparseInformationRetrievalEvaluator in sentence-transformers computes similarity using sparse matrix multiplication on the CPU against the corpus-side sparse vectors. In the early stages of training, active_dims balloons to several thousand dimensions, so even on a scale of queries=1,000 / corpus=10,000, a single evaluation can take over 10 minutes. Implementing capped evaluation around max_active_dims=512 keeps the eval loop within a practical timeframe (1–2 minutes), while running only the final evaluation uncapped to measure raw sparsity has proven to be a stable operating practice.
MIT License
sbintuitions/modernbert-ja-310m