A cap on the share of texts an entry appears in (experimental)¶
The FLOPS regulariser shortens posting lists through a penalty. capacity states the limit instead: an entry of the vocabulary head should appear in at most that share of the texts (muscari.heads.TermCapacity). In training the head keeps a running share of the texts that carry each entry, over the last capacity_window texts it encoded (queries and documents together), and one bias per entry that it subtracts from the entry's scores. The bias of an entry above the cap grows in proportion to the logarithm of its share over the cap, at capacity_rate per window of texts; the bias of any other entry falls back to zero and never below. The biases are saved with the head and used unchanged at inference. The method is this project's own: dual ascent on one inequality per entry, as in constrained optimisation, applied here to a vocabulary head; it has not been compared with DF-FLOPS or other penalties on document frequency.
All runs below use the probability head of the previous section without any sparsity regulariser, on modernbert-ja-30m with the settings given there; the run without a cap is the one of the previous section.
| Cap | nDCG@10, no cap on the vectors | nDCG@10, 64/64 | Non-zero, query / document | FLOPS | Largest share at the end | Entries above the cap |
|---|---|---|---|---|---|---|
| None | 0.543 / 0.547 | 0.525 / 0.531 | 23 / 105, 29 / 98 | 1.29 / 2.01 | ||
| 5% | 0.541 / 0.538 | 0.530 / 0.528 | 28 / 96, 36 / 99 | 0.63 / 0.85 | 0.090 / 0.073 | 155 / 229 |
| 3% (seed 42) | 0.542 | 0.530 | 26 / 119 | 0.51 | 0.068 | 678 |
| 2% (seed 42) | 0.536 | 0.529 | 47 / 134 | 0.85 | 0.046 | 1,772 |
| 1% | 0.514 / 0.512 | 0.495 / 0.506 | 56 / 250, 28 / 95 | 0.68 / 0.22 | 0.025 / 0.023 | 10,523 / 1,883 |
(Seeds 42 and 43 where two values are given. The last two columns are over the texts of training at its end.)
- A cap of 3% or 5% cuts the FLOPS to 40 to 50% and keeps the accuracy. Against the run without a cap and the same seed, the differences are -0.002 (-0.011 to +0.006) and -0.008 (-0.017 to -0.000) at 5%, and -0.001 (-0.010 to +0.008) at 3%. The number of entries per document hardly changes: the cap shortens the posting lists of frequent entries rather than the vectors.
- A cap of 1% costs 0.03. Both seeds fall by 0.029 and 0.034, and with seed 42 the documents grow to 250 entries: the weight taken from frequent entries goes to many rare ones. At 2%, and at 1% with seed 42, the queries also gain entries.
- The cap is not held exactly. At the end of training the most frequent entry was in 1.5 to 2.5 times the share allowed. The runs were made with a version that counted each text twice under GradCache (
--mini-batch-size), which behaves about likecapacity_window=1000now; the current version counts every text once. - On modernbert-ja-310m a cap of 5% (seed 42) lowered the FLOPS from 0.36 to 0.28 and the accuracy by 0.006 (-0.015 to +0.004). It does not close the gap of the probability head to the other heads at that size.
What limits these results: one benchmark, 2,000 steps, two seeds at most, and the share is counted over training texts, not over the documents of an index.