SAE training on real encoders¶
Three short runs on an Apple M5 Pro with MPS, to check that the pipeline works with a real model, tokenizer and dataset. It is not a statement about SAE quality: the budget is 0.5% of the recipe's one billion tokens, there is one seed, and no reference value exists to compare with.
| Setting | Value |
|---|---|
| Encoder | cl-nagoya/ruri-v3-30m, last_hidden_state, width 256 |
| Data | subset jsquad of cl-nagoya/ruri-v3-dataset-ft; columns anc with 検索クエリ:, pos and neg with 検索文書: |
| SAE | 8,192 latents, k = 16 |
| Budget | 5 million tokens (610 steps of 8,192), dead after 1 million tokens, 5% of the texts held out |
| Seed | 0, the default at the time |
topk |
saelens topk, zero decoder bias |
saelens topk, median decoder bias |
|
|---|---|---|---|
| FVU on 200,000 held-out tokens | 0.441 | 0.511 | 0.467 |
| Active latents per token | 16 | 16 | 16 |
| Latents that never fired | 0% | 91.5% | 54.1% |
| Latents firing on more than 10% of tokens | 0% | 0.4% | 0% |
| Largest firing share of one latent | 6.3% | 23.7% | 7.4% |
| Wall time, with evaluation | 200 s | 189 s | 193 s |
The first run includes the download of the model and the dataset subset. Evaluated on 200,000 tokens of the jaquad subset, which was not used for training, the topk SAE had an FVU of 0.447, no latent that never fired, and one latent above 10% (10.1%). Each run encoded 31,616 distinct texts, 5.52 million content tokens; the topk run did so at about 42,000 tokens per second including the encoder.
What the runs show beyond "it works":
- The prompt rule does what it should with this tokenizer. It is a fast tokenizer.
検索クエリ:becomes the four tokens検索,クエリ,:and▁; all of them end inside the prompt and are dropped, and every token of the text is kept. This was checked by hand on three texts, with and without a prompt. - These hidden states have a large common component. Over 100,000 activations, the mean activation has a norm of 35.0, as large as the average distance of an activation from it (35.3); it carries half of the squared norm.
- The decoder bias matters for the SAELens backend. Starting it at the geometric median instead of zero lowered the latents that never fired from 91.5% to 54.1% and the FVU from 0.511 to 0.467.
What they do not show:
- The log of the
topkrun shows no dead latent and a zero auxiliary loss at every logged step, so AuxK was not exercised on real activations. - Why half of the SAELens latents still never fired. The short budget is a candidate, as described for the SAELens backend above, but a longer run was not made.
- A like-for-like comparison of the trainers. The columns differ in auxiliary loss, dead-latent bookkeeping, decoder scaling and initialisation.
Training length¶
The same setting on the nine retrieval subsets of the dataset (auto-wiki-qa-nemotron, jaquad, jqara, jsquad, miracl, mkqa, mr-tydi, quiz-no-mori, quiz-works), seed 42, one independent run per length and trainer, evaluated on 200,000 held-out tokens. The SAELens runs start the decoder bias at the geometric median.
| Training tokens | topk FVU |
saelens FVU |
saelens latents that never fired |
Largest firing share, topk / saelens |
|---|---|---|---|---|
| 5 million | 0.444 | 0.474 | 54.1% | 5.3% / 6.4% |
| 10 million | 0.396 | 0.420 | 17.1% | 6.6% / 5.2% |
| 20 million | 0.360 | 0.365 | 0.9% | 6.6% / 13.3% |
| 30 million | 0.341 | 0.342 | 0.8% | 14.2% / 14.1% |
- The unused latents of the SAELens backend were a matter of training length. With enough tokens the two trainers reach the same FVU; in short runs the
topktrainer is ahead, and every one of its latents fired at every length. - FVU was still falling at 30 million tokens, by less each time the length doubled.
- No latent of the
topkruns was ever flagged dead, so AuxK was not exercised at this size (width 256, 8,192 latents). - In the longer runs of both trainers one latent fires on about 14% of the tokens. It is examined below.
- Throughput halved from the fourth run on, from about 43,000 to about 23,000 tokens per second, across separate processes. The cause was not isolated; these runs did not record encoder and SAE time separately.
After pooling¶
The eight SAEs of the previous section, measured per text with eval-sae on one million held-out tokens: 5,472 documents of 181 content tokens on average and 657 queries of 17.
| Training tokens | Trainer | Active latents per document | Active latents per query | Latents active in more than 10% of the documents | FLOPS, query and document |
|---|---|---|---|---|---|
| 5 million | topk |
742 | 146 | 23.7% | 20.1 |
| 5 million | saelens |
309 | 90 | 9.5% | 37.4 |
| 10 million | topk |
682 | 135 | 17.0% | 21.4 |
| 10 million | saelens |
469 | 109 | 16.2% | 30.1 |
| 20 million | topk |
643 | 128 | 17.8% | 21.7 |
| 20 million | saelens |
603 | 123 | 18.0% | 22.2 |
| 30 million | topk |
643 | 126 | 18.9% | 20.2 |
| 30 million | saelens |
631 | 124 | 19.7% | 19.5 |
- A document activates about 640 of the 8,192 latents and a query about 125. A document has 181 tokens with 16 latents each, 2,890 slots in all, so most slots repeat a latent that another token of the same text already uses.
- Nearly a fifth of the dictionary is active in more than one document in ten, and the most widespread latent is active in 99% of the documents.
- The short SAELens runs activate fewer latents per text only because half of their dictionary was unused. Their FLOPS is higher, since the texts crowd onto the latents that are in use.
- This is a small dictionary on a small encoder, before any retrieval training. For scale: the Japanese SPLADE models in this report have 14 to 28 active dimensions per query and 73 to 146 per document after training with a sparsity regulariser.
What the latents respond to¶
inspect-sae on the same texts, for the 30-million-token SAEs.
The most frequent latent carries the common component, not content. In the topk run it fires on 13.7% of the tokens and in 92% of the texts. No token accounts for more than 2.3% of its firings, its firings sit anywhere in a text (mean relative position 0.48), and it fires on 13.8% of the document tokens against 7.4% of the query tokens. Computed from the exported tensors, its decoder direction has a cosine of -0.92 with the decoder bias. That is the largest absolute value among all latents, whose median is 0.10. The latent therefore takes back part of the decoder bias on tokens that carry less of the common component than the bias assumes. The SAELens run learned the same latent (13.7% of the tokens, cosine -0.93). The topk run at 10 million tokens has none: its largest absolute cosine with the decoder bias is 0.59. This is the latent behind the 14% in the table of the previous section.
Few latents are vocabulary entries. In 86 of the 8,192 latents of the topk run, and 293 of the SAELens run, a single token accounts for at least half of the firings. The frequent latents after the first follow punctuation, particles, verb endings, the units of dates and digits, each spread over several tokens.
No latent of the topk run follows the position. None has more than half of its firings on the first or on the last token of a text. The SAELens run has seven that fire mostly on the last token. Fourteen latents of the topk run fire at least five times as often on query tokens as on document tokens; the most frequent of them fires on question marks.
A latent like the first one adds a similar amount to the score of every pair of texts and makes the index longer without telling texts apart. The retrieval head can mask such latents, and the probe reports ranking with and without inverse document frequency weights for the same reason.
Reranking without training¶
probe-sae on three of the SAEs above, with 200 queries of the JQaRA test split, 100 candidate documents each. The documents are the text column alone, without titles, so the figures are not comparable with published JQaRA results. Each nDCG@10 has a standard error near 0.02.
| SAE | Dense, encoder as it is | Dense, reconstruction | Dense, empty code | Recovered | Sparse | Sparse with IDF | Active latents, query / document |
|---|---|---|---|---|---|---|---|
topk, 30 million tokens |
0.505 | 0.425 | 0.314 | 0.58 | 0.473 | 0.488 | 161 / 380 |
saelens, 30 million tokens |
0.505 | 0.420 | 0.309 | 0.57 | 0.475 | 0.491 | 160 / 366 |
topk, 5 million tokens |
0.505 | 0.442 | 0.333 | 0.64 | 0.465 | 0.460 | 189 / 433 |
- The SAE's features rank almost as well as the encoder's embeddings before any retrieval training. The dot product of the pooled features reaches 0.473 against 0.505 for the dense embeddings.
- The reconstruction keeps the embedding close and still loses ranking quality. The mean cosine similarity between a document's original embedding and the one built from reconstructed token states is 0.972, yet only 58% of the gap between the empty code and the untouched encoder is recovered. Cosine similarity and FVU do not show whether the directions that ranking depends on survive.
- A lower FVU did not bring a higher recovery. The 5-million-token SAE has the worse FVU, 0.445 against 0.342, and the higher recovery, 0.64 against 0.58. The difference may be within the error of 200 queries, and no paired error was computed, but it is a reason not to choose an SAE by FVU alone.
- Inverse document frequency weights change little, 0.015 at most. The latents that are active in most documents, the common-component latent among them, cost the ranking less than their document frequency suggests.
The retrieval head was checked on the same encoder with its real tokenizer. On three queries and four documents its vectors equal the probe's exactly. The prompt has four tokens, Sentence Transformers reports a prompt length of five including the leading special token, and the character-based rule of SAE training drops the same positions.
Three 310M encoders¶
The same probe on SAEs with 16,384 latents trained on 10 million tokens of three encoders of about 310M parameters. It ranks the first 100 of the 200 queries above, again without titles, so each nDCG@10 has a standard error near 0.025. The SAEs were trained on the retrieval subsets of cl-nagoya/ruri-v3-dataset-ft including jqara. ruri-v3-310m is trained for retrieval, ruri-v3-pt-310m is its pre-trained starting point, and modernbert-ja-310m is a masked language model whose mean-pooled states were never trained as embeddings.
| Encoder | FVU | Dense, encoder as it is | Recovered | Sparse | Sparse with IDF | Active latents, query / document |
|---|---|---|---|---|---|---|
| ruri-v3-310m | 0.50 | 0.583 | 0.47 | 0.522 | 0.537 | 150 / 406 |
| ruri-v3-pt-310m | 0.49 | 0.444 | 0.58 | 0.480 | 0.489 | 143 / 311 |
| modernbert-ja-310m | 0.33 | 0.211 | 0.60 | 0.388 | 0.410 | 254 / 769 |
- The sparse features of the two encoders that were not trained for retrieval rank better than their own dense embeddings: 0.480 against 0.444 for ruri-v3-pt-310m and 0.388 against 0.211 for modernbert-ja-310m. Pooling the maximum of sparse features suits ranking better than a mean of the states.
- The encoder that reconstructs best ranks worst, here. modernbert-ja-310m has the lowest FVU and the lowest sparse nDCG@10, and it activates the most latents per text. Of its latents, 35 fire on a single token at least 90% of the time, against one or two for the ruri encoders; its states keep more of the token identity, which is easier to reconstruct and less useful to rank without training.
- On modernbert-ja-310m, the masked-language-model loss recovered is 0.858 with 15% of the tokens masked and 0.812 with 30%, on 100 texts. The SAE of the Shizuku card, with 65,536 latents and one billion tokens on the same encoder, reports 0.944 on its own evaluation data, without stating the masking rate.
BM25 over summed activations¶
Latent Terms (Clavié et al., arXiv 2605.29384) ranks with the latents of an SAE and no retrieval training: the activations of a text's tokens are summed, passed through the square root and used as term frequencies in BM25. probe-sae reports that ranking as sparse.bm25 next to the two above. This measurement puts the document's title in front of its text, as JQaRA's own evaluator does, so its figures are not comparable with the two tables above; the queries are the same 200, or the first 100 for the 310M encoders. In brackets: the mean per-query gain over the ranking with IDF and the standard error of that paired difference.
| SAE | Latents active in most documents | Maximum, dot product | Maximum, with IDF | BM25, the paper's IDF | BM25, IDF that is never negative | The same without length normalisation | Dense, encoder as it is |
|---|---|---|---|---|---|---|---|
ruri-v3-30m, topk, 30 million tokens |
25 | 0.513 | 0.529 | 0.571 (+0.042 ± 0.012) | 0.577 (+0.048 ± 0.012) | 0.526 (−0.003 ± 0.007) | 0.584 |
| ruri-v3-310m | 39 | 0.526 | 0.552 | 0.611 (+0.059 ± 0.019) | 0.617 (+0.064 ± 0.018) | 0.546 (−0.006 ± 0.011) | 0.680 |
| ruri-v3-pt-310m | 37 | 0.495 | 0.514 | 0.533 (+0.019 ± 0.019) | 0.558 (+0.044 ± 0.019) | 0.495 (−0.019 ± 0.011) | 0.578 |
| modernbert-ja-310m | 151 | 0.389 | 0.411 | 0.302 (−0.110 ± 0.019) | 0.420 (+0.009 ± 0.020) | 0.395 (−0.016 ± 0.009) | 0.220 |
| modernbert-ja-30m | 113 | 0.376 | 0.407 | 0.425 (+0.019 ± 0.016) | 0.447 (+0.040 ± 0.016) | 0.389 (−0.018 ± 0.007) | 0.164 |
- The paper's IDF can turn against the ranking.
log((N - n + 0.5) / (n + 0.5))is negative for a latent that is active in more than half of the documents. A word rarely is; 151 latents of the SAE on modernbert-ja-310m are, and there BM25 falls 0.110 below the ranking it should improve. Withlog(1 + (N - n + 0.5) / (n + 0.5)), which is never negative, the fall is gone, and on all five SAEs that form is at least as good as the paper's. It is the default ofprobe-saefor that reason;--bm25-idf okapigives the paper's formula. - With that IDF, BM25 ranks better than the maximum with IDF on four of the five SAEs, by 0.040 to 0.064, which is 2.3 to 4.0 standard errors of the paired difference. On modernbert-ja-310m the two are level.
- The gain comes from length normalisation. With
--bm25-b 0it disappears on all five. Summing instead of taking the maximum, the saturation of BM25 and its IDF do not by themselves rank better than the maximum. - The dot product of the summed weights, without BM25, is below the maximum on all five (0.310 to 0.458 against 0.376 to 0.526), which is the direction the paper reports.
- What this does not show: the settings were compared on the test queries themselves, so the best one is a hint about the cause and not a result.
k1andbare the paper's and were not tuned. The paper does not define the length of a document, which here is the sum of its weights. It is reranking of 100 candidates with small SAEs, not retrieval from a collection, and the trained heads below start from the maximum and not from BM25.
CUDA¶
The 5-million-token jsquad run above, repeated on an NVIDIA L4 with seed 0, gave an FVU of 0.4406 in float32 and 0.4405 with bfloat16 autocast for the encoder and the SAE, against 0.441 on MPS. Throughput was about 55,000 and 76,000 tokens per second.
A short run at the full recipe width (cl-nagoya/ruri-v3-310m, 65,536 latents, 3 million tokens, bfloat16) ran at about 15,000 tokens per second on the L4 including the encoder. The SAE updates alone take 133 ms per 8,192 tokens there, about 62,000 tokens per second, so the encoder is the larger part. At that rate one billion tokens would take about 19 hours on an L4. This is an extrapolation from a 3-million-token run, not a measurement.