Larger Tokenizers Suffer More Multi-Epoch Regret分词器越大,multi-epoch regret 越高
On a fixed amount of text trained for 8 epochs, larger tokenizers suffer more multi-epoch regret.
同样多的文本训 8 个 epoch,分词器越大,multi-epoch regret 越高。
How Vocabulary Size Shapes Overfitting
The full record of this study: code, training curves, and every question we tested, both finished and still running.这项研究的完整记录:代码、运行的训练曲线,还有我们测过的每一个问题(包括已有结论的和还在跑的)。
Byte-level BPE builds a vocabulary by merging frequent pairs字节级 BPE 靠合并高频对建出词表
A tokenizer turns text into token ids from a fixed vocabulary. Each token gets an input embedding row (an input vector) and an output softmax row (weights to predict the next token). Byte-level BPE1 starts from the 256 single bytes. First, a pre-tokenizer splits text into words, numbers, and spaces. Then BPE repeatedly merges the most common adjacent pair until the vocabulary is full. To encode new text, it applies these merges in the same order. The diagram below shows this for the Marin tokenizer (Llama 3's BPE, with 128,000 ordinary tokens ranked by merge order).
分词器把文本转成固定词表里的 token 编号。每个 token 在输入端有一行 embedding(输入行),在输出端有一行预测下一个 token 的 softmax 权重(输出行)。字节级 BPE1 从 256 个单字节起步:预分词器先把文本切成词、数字和空格,BPE 再反复合并出现最多的相邻对,直到填满词表。编码新文本时,就按训练时的顺序依次做这些合并。下面的示意图用 Marin 分词器演示了这个过程(即 Llama 3 的 BPE,有 128,000 个按合并顺序编号的普通 token)。
Keeping only the K lowest-ranked tokens of the 128K vocabulary (for K from 1K to 64K) is the same as stopping BPE at K tokens. We call any token outside the first 8K a rare token. Take " memor" (#16,420) as our running example. The 128K vocabulary gives it its own input and output rows. The 8K vocabulary splits it into " mem" and "or", and the byte vocabulary reads six bytes. Next, we measure what those dedicated rows do across multiple epochs.
只留 128K 词表里编号最小的 K 个 token(K 从 1K 到 64K),就等于让 BPE 在合出 K 个 token 时停手。我们把前 8K 之外的 token 叫作少见 token。全文拿 " memor"(#16,420)举例:128K 给它单独分了输入行和输出行;8K 词表把它拆成 " mem" 和 "or";字节词表则直接读六个字节。下面我们就来测一测,多训几个 epoch 时,这些专属行会带来什么影响。
Matched 1-epoch and 8-epoch runs compare 256-byte to 128K vocabularies成对跑 1-epoch 和 8-epoch,对比 256 字节到 128K 词表
Training for multiple epochs on a small dataset hurts validation loss on unseen text2. The opening video shows how we measure this from the 256-byte vocabulary upward. Using FineWeb-Edu documents, we train a matched pair of runs for the same number of steps at each vocabulary size. The 1-epoch run trains for 1 epoch on unique text, while the 8-epoch run trains for 8 epochs on a random eighth of the text. We measure validation loss in macro bits per byte across the 16 Paloma domains, converting loss to bytes so we can compare vocabularies fairly. We define multi-epoch regret as the validation loss of the 8-epoch run, trained on one eighth of the text, minus the validation loss of the 1-epoch run on unique text, with the same steps. The word comes from online learning; here it means a gap in validation loss at the same training step, not a running sum. At 128K, this regret is about 0.08 bits per byte. We use a 300m model, untied input and output tables, and MuonH, a Muon variant that fixes weight norms on a sphere. Our experiment page has the code and recipe and the runs with their training curves. Next, we track how regret changes as vocabularies add rare tokens like " memor".
拿小份数据训多个 epoch,模型在没见过的文本上验证损失会变差2。开头的视频展示了我们怎么从 256 字节词表开始测量这一点。在同样的 FineWeb-Edu 文档上,每个词表都训一对步数相同的模型:1-epoch 跑在不重复文本上训 1 个 epoch;8-epoch 随机抽八分之一文本训 8 个 epoch。我们用 Paloma 16 个领域的宏平均比特/字节来算损失(也就是把损失折算到每个字节上,方便跨词表比较)。我们把 multi-epoch regret 定义为:在八分之一文本上训 8 个 epoch 的验证损失,减去步数相同、在不重复文本上训 1 个 epoch 的验证损失。regret 这个词来自在线学习,但这里指同一训练步上的验证损失之差,不是累积量。在 128K 上,regret 约 0.08 比特/字节。实验用 300m 模型、MuonH 优化器(一种把权重范数固定在球面上的 Muon 变体),输入表和输出表不共享。实验主页放了代码和配方,还有运行记录与训练曲线。下面看看词表加入 " memor" 这类少见 token 后,regret 怎么变。
Larger tokenizers suffer more multi-epoch regret at 8 epochs训 8 个 epoch,分词器越大,multi-epoch regret 越高
This study grew out of an earlier experiment. The hashed 2-gram and 3-gram input tables of the Over-Tokenized Transformer (Huang et al., 2025) lower the loss up to 520m and overfit when the data repeats. At 1.2B, which trains for 2.4 epochs, the gain becomes a loss. We therefore asked whether the vocabulary of a plain tokenizer has the same problem.
这项研究源于我们更早的一个实验。Over-Tokenized Transformer(Huang 等人,2025)的哈希 2-gram 和 3-gram 输入表在 520m 及以下能降低损失,但数据一重复就过拟合。到了 1.2B,数据要训 2.4 个 epoch,收益就变成了损失。所以我们想知道,普通分词器的词表是不是也有同样的问题。
Sampled Softmax with Over-Tokenized Transformer
The earlier experiment: a sampled softmax from 130m to 1.2B, and the over-tokenized input tables that overfit repeated data.更早的实验:130m 到 1.2B 上的采样 softmax,以及在重复数据上过拟合的 over-tokenized 输入表。
Figure 1 shows that multi-epoch regret grows with vocabulary size at 300m. With fixed 4096-token windows (dashed line), regret rises from near zero on the 256-byte vocabulary to about 0.08 bits per byte at 128K. Vocabularies from 512 to 8K sit on a flat plateau. Above 8K, every doubling pushes regret higher and wipes out most of 128K's 1-epoch lead over 8K. Over 8 epochs, 128K lowers training loss only slightly more, yet every memorized bit hurts unseen text much more.
图 1 测了 300m 模型下不同词表的 multi-epoch regret。虚线是固定 4096 token 窗口的结果:regret 从 256 字节词表的几乎为零,涨到 128K 的约 0.08 比特/字节。512 到 8K 词表停在一个平缓的平台上。过了 8K,词表每翻一倍,regret 就往上涨一截,几乎吃掉了 128K 在 1 个 epoch 下对 8K 的优势。训 8 个 epoch 时,128K 的训练损失只多降了一点点,但它每多背下 1 比特,在未见文本上损失都多得多。
Even when every window holds the same text (solid line), multi-epoch regret still rises above 4K. With 4096-token windows, a smaller vocabulary packs less text per window and takes more steps to read the corpus, nearly five times as many for bytes as for 128K. Matching the text per window puts every run at the same step count. Then vocabularies from 256 bytes to 4K sit level, at 0.02 to 0.03 bits per byte, so bytes no longer sit near zero. Above 4K, regret still climbs with vocabulary size. 16K and 32K swap order compared with the 4096-token windows. Changing the window length replaces almost all the documents in the 8-epoch subset, which may explain that swap and the rise at bytes.
词表越小,4096 token 窗口装的文本就越少,读完同样多的文本要走更多步数:字节词表的步数接近 128K 的五倍。图里的实线改成让每个窗口装同样的文本,每个 run 的步数就都一样了。这么对齐后,256 字节到 4K 词表的 multi-epoch regret 都在 0.02 到 0.03 比特/字节,字节词表不再接近零。4K 往上,regret 还是随词表变大而上升。16K 和 32K 的顺序跟 4096 token 窗口时反了过来。换个窗口长度,8-epoch 子集里几乎全换了一批文档,这可能解释了这个颠倒,也可能解释字节词表的上升。
In the right panel of Figure 1, we test an over-vocab setup on 128K. It adds hashed 2- and 3-gram input tables (tens of millions of rows that map adjacent token groups to vectors) and a second 2-gram output head. Its 1-epoch loss drops a little, but its multi-epoch regret jumps to about nine times 128K's. The same panel shows a one-stage H-Net (Hwang, Wang and Gu, 2025). H-Net learns byte chunks directly from bytes without giving them lookup rows. It aims at the length of 128K tokens and reaches somewhat shorter chunks on the training text. Its regret is about a third of 128K's. With a longer target, its chunks grow longer than 128K's tokens and its regret stays low, although its 1-epoch loss is higher. So compressing the sequence as far as 128K does not by itself create 128K's regret.
在图 1 右栏,我们给 128K 加上哈希 2-gram 和 3-gram 输入表(共两千多万行,把相邻两三个 token 哈希到表里查向量),再加第二个预测 2-gram 的输出头,记作 over-vocab。它的 1-epoch 损失略有下降,但 multi-epoch regret 暴涨到 128K 的约 9 倍。同一栏还画了单阶段 H-Net(Hwang、Wang 和 Gu,2025)。它直接从字节学出块,但不给这些块建查表行。它的目标是 128K token 的长度,在训练文本上实际的块稍短一些。它的 regret 约为 128K 的三分之一。把目标调长后,块比 128K 的 token 还长,regret 仍然很低,不过 1-epoch 损失更高。所以把序列压得和 128K 一样短,本身并不会带来 128K 那样的 regret。
Figure 2 tests 130m and 520m models and finds the same vocabulary ordering as 300m. At 520m, multi-epoch regret wipes out 128K's 1-epoch lead over 8K, leaving them tied. Still, this overall average does not tell us where the regret lands: on common tokens, or on rare tokens like " memor" and unfamiliar domains.
图 2 测了 130m 和 520m 两个规模,词表的排序跟 300m 一样。在 520m 上,multi-epoch regret 抹平了 128K 在 1 个 epoch 下对 8K 的领先,最后两者打平。不过光看整体平均分,还看不出 regret 到底是落在常见 token 上,还是落在 " memor" 这类少见 token 和陌生领域上。
Multi-epoch regret lands on unfamiliar text and rarely seen tokensmulti-epoch regret 集中在陌生文本和很少出现的 token 上
Unfamiliar domains suffer much higher multi-epoch regret at 128K. Following Bergsma et al.3, Figure 3 breaks regret down by domain. On the 8-epoch training subset, 128K memorizes about 1.8 times as many bits per byte as the 256-byte vocabulary. On unseen text, 128K's regret grows from about 0.02 bits per byte on unread training-distribution text to about 0.32 on code. Meanwhile, 8K and the 256-byte vocabulary barely move.
照着 Bergsma 等人3的做法,图 3 看 multi-epoch regret 落在哪些领域。在训了 8 个 epoch 的那份数据上,128K 每字节背下的比特数约为 256 字节词表的 1.8 倍。到了没见过的文本上,同分布的未读训练文本只让 128K 多出约 0.02 比特/字节的 regret,到了代码上就涨到约 0.32;而 8K 和 256 字节词表几乎没动。
Much of 128K's multi-epoch regret sits on tokens that the 8-epoch subset rarely holds. Figure 4 groups evaluation positions by how often the target token appears in the 8-epoch subset. Two effects stand out. First, 128K puts many targets into low-count bins, whereas nearly all byte targets appear over 10,000 times. Second, at the same count (from a few hundred upward), 128K has up to twice the regret per byte of 8K. Splitting tokens into ten frequency bins shows the same spike in 128K's rarest tenth, whether grouped by input token or predicted token. At 128K, tokens seen fewer than 1,000 times make up under a tenth of the text, yet hold nearly half of the regret. The 8K rank cutoff itself matters less: tokens outside the first 8K hold about as much of the regret as of the text, and half of them appear far less often than " memor". Next, we ask whether the byte vocabulary also degrades if we shrink the subset and run more epochs.
图 4 按目标 token 在 8-epoch 训练子集里的出现次数,把评测位置分组。这里能拆出两件事:第一,128K 把很多目标切进了低频档,而字节词表几乎所有目标都出现超过一万次;第二,就算出现次数一样(几百次往上),128K 每字节的 multi-epoch regret 最高也是 8K 的两倍。按训练词频分成十等份,不管是按输入 token 还是预测 token 分,128K 最少见的十分之一都会冒出同样的尖峰。在 128K 里,出现不到 1,000 次的 token 占文本不到十分之一,却占了近一半的 regret。前 8K 这条分界线本身反倒没那么关键:8K 之外的 token 占 regret 的比例和占文本的比例差不多,其中一半出现得远比 " memor" 少。看到这儿还有个问题:要是把训练子集缩得更小、训更多 epoch,字节词表自己会不会也跟着变差?
The 256-byte vocabulary holds through 8 epochs and degrades from 16256 字节词表扛得住 8 个 epoch,16 个起开始变差
Does the byte vocabulary ever overfit? Yes, just later. In Figure 5, we fix the step count and shrink the training subset to run more epochs. The 256-byte vocabulary stays flat through 8 epochs and degrades from 16 epochs onward. Still, a smaller vocabulary packs fewer bytes into a window and takes more steps on the corpus. Next, we check whether window length or step count explains the vocabulary gap.
字节词表也会过拟合吗?会,只是来得更晚。图 5 固定总步数,不断缩小训练子集:256 字节词表在 8 个 epoch 以内一直很稳,从 16 个 epoch 开始变差。不过小词表每个窗口装的字节少,跑完语料走的步数多。我们还得排查一下,前面看到的词表差距是不是窗口长度或者步数搞出来的。
Window length and step count do not explain the gap窗口长度和步数解释不了词表差距
Neither a shorter window nor taking more steps explains the multi-epoch regret gap. An 8K token has about a quarter fewer bytes than a 128K token, so an 8K window holds a quarter less text and takes a third more steps. Figure 6 tests both factors. On the left, giving 128K the window bytes or step count of 8K leaves 128K's regret at about 0.08 bits per byte. Also, where in the window the regret sits is flat across positions. On the right, stretching the byte window to match a 128K window's text and step count raises 256-byte regret to about 0.02 bits per byte, still under a quarter of 128K's regret. And as Figure 1 showed, at equal steps the byte vocabulary sits level with every vocabulary up to 4K. Even with matched windows and steps, though, the main network sees " memor" as one token instead of six bytes. We still need to check whether sequence compression causes the regret.
差距不是窗口更短或步数更多造成的。8K 的每个 token 比 128K 少约四分之一字节,所以 8K 的窗口少装四分之一文本,步数多出三分之一。图 6 排查了这两个因素。左栏把 128K 的窗口字节数或步数改成跟 8K 一样,128K 的 multi-epoch regret 还是停在约 0.08 比特/字节,regret 在窗口各个位置上的分布也是平的。右栏反过来,把字节窗口拉长,让它装的文本和走的步数都跟 128K 差不多;256 字节词表的 regret 涨到了约 0.02 比特/字节,还是不到 128K 的四分之一。在图 1 里,步数拉平后,字节词表跟 4K 以内的词表处在同一水平。不过就算对齐了窗口和步数,主干网络看到的 " memor" 还是一个 token,而不是六个字节。还得看看是不是序列压短本身惹的祸。
With smaller tables, 128K's multi-epoch regret nears that of smaller vocabularies把 128K 的表变小,multi-epoch regret 就接近小词表
Does multi-epoch regret come from the vocabulary itself or from the extra embedding parameters? Truncating a vocabulary shrinks both at once. Figure 7 shrinks only the parameters by giving 128K low-rank input and output tables (factoring each large table into two smaller matrices). This keeps 128K's tokens, windows, steps, and 8-epoch document subset intact. Tables of rank 96, 192 and 384 match the parameter counts of the 16K, 32K, and 64K tables, and they cut regret by up to half. That drop is the firm part. The match to a specific vocabulary size is looser, because the gaps between each rank and its matching vocabulary lie within what a different subset of documents can move. Because the compressed sequences stay identical while regret drops, sequence compression alone does not set the regret. Also, rank 96 fits unique text worse than 16K yet has about the same regret, pointing to parameter count rather than fit quality. Low-rank tables are no fix, though. After 8 epochs, ranks 96 and 192 end up worse in validation loss than plain 128K, and rank 384 finishes about even.
multi-epoch regret 来自词表变大本身,还是来自多出来的 embedding 参数?直接截断词表会把词表和参数一起变小,分不清是谁的作用。所以图 7 只砍参数:给 128K 换上低秩输入表和输出表(把大矩阵拆成两个小矩阵相乘来省参数),保留原本的 token、窗口、步数和 8-epoch 文档。秩为 96、192 和 384 的表,参数量分别跟 16K、32K 和 64K 的表一样,regret 最多降了一半。这个下降是可靠的。但具体跟哪个词表对齐就没那么准了:各个秩跟对应词表的差距,都在换一批文档就能挪动的范围内。序列压得一样短,regret 却降了下来,说明光靠序列压短定不了 regret。另外,秩 96 在不重复文本上比 16K 差,但两者的 regret 差不多,这更支持参数量的解释,而不是拟合好坏的解释。不过低秩表不能拿来救场:训完 8 个 epoch,秩 96 和 192 的验证损失比普通 128K 更差,秩 384 与它大致持平。
Regularizing rare input rows and weights removes about half of 128K's multi-epoch regret约束少见输入行和权重,能消掉约一半 128K multi-epoch regret
We suspect that much of 128K's multi-epoch regret comes from rare tokens' input rows. The intuition is simple: the input row of " memor" updates only when " memor" appears, so across epochs it sees the exact same contexts over and over. To test this, we build each rare input row from the mean of its 8K pieces' rows (using " mem" and "or" for " memor"). This removes nearly half of the regret 128K has beyond 8K. Freezing rare input rows after epoch 1 removes nearly two fifths. However, both fixes get much of this by fitting unique text worse: piece-built rows barely move the 8-epoch loss. Technique D below barely changes 1-epoch loss. Yet an untargeted control that swaps in random input tokens starting at epoch 5 reaches nearly the same 8-epoch loss. So these runs do not isolate the rare input rows. Figure 8 shows the 81 remedy setups we tested at 128K. The two fixes above use each setup's own 1-epoch loss. In Figure 8 and the rest of this section, a setup's regret is instead its 8-epoch loss minus plain 128K's 1-epoch loss, so a setup cannot cut regret by fitting unique text worse.
我们猜 128K 的 multi-epoch regret 有很大一部分出在少见 token 的输入行上。道理很简单:" memor" 的输入行只有碰到 " memor" 才更新,多训几个 epoch 就会反复看同一批上下文。为了验证,我们试着拿 8K 片段输入行的均值拼出少见输入行(比如 " memor" 就取 " mem" 和 "or" 的均值),这能消掉 128K 超出 8K 那部分 regret 的近一半;在第 1 个 epoch 后冻住少见输入行,也能消掉近五分之二。但这两种固定做法之所以能缩窄差距,很大程度是因为把不重复文本的拟合搞差了:用片段拼出来的输入行几乎没有降低 8-epoch 损失。下面要讲的技术 D 几乎不改变 1-epoch 损失;但我们还跑了个不挑少见 token 的对照,从第 5 个 epoch 起随机换掉输入 token,8-epoch 损失也差不多。所以这些实验还没有把少见输入行单独区分出来。图 8 画了我们在 128K 上试过的 81 种补救配置。上面两种做法用的是各自的 1-epoch 损失。在图 8 和本节余下的部分里,一个配置的 regret 改为它的 8-epoch 损失减去普通 128K 的 1-epoch 损失,这样配置就不能靠把不重复文本拟合得更差来压低 regret。
A rare token's input row is the mean of its 8K pieces' rows, plus a slowly learned residual.少见 token 的输入行等于它各个 8K 片段输入行的均值,再加一个慢速学习的残差。
Each epoch splits the same text into slightly different tokens, so a rare token does not appear the exact same way 8 times.每个 epoch 把同一段话切成略有不同的 token,免得少见 token 8 次都按同一种切法露面。
Each epoch shuffles the documents and reads them in a new order.每个 epoch 把同一批文档洗牌,换个顺序读。
In training, half of a rare token's occurrences use its 8K pieces' mean instead of its own row; evaluation always uses its own row.训练时,少见 token 有一半机会改用 8K 片段的均值,另一半用自己的输入行;评测时一律用自己的输入行。
Evaluate a moving average of the weights instead of the final weights.评测时不用最后一步的权重,改用权重的滑动平均。
Five techniques drive the progress in Figure 8. Technique A adds a slowly updated residual to each piece-built rare input row. Technique B resamples token splits each epoch using BPE-dropout (randomly skipping merges so the same text splits into different tokens) without hurting 1-epoch fit. Technique C shuffles document order each epoch. Used alone, Technique A still hurts unique-text fit, and Techniques B and C each cut less than a fifth of the multi-epoch regret. Technique D replaces a rare input row with the mean of its 8K pieces (" mem" and "or" for " memor") on half of its training occurrences, blocks gradients to the pieces, and uses the token's own row at evaluation. Most of D's gain comes from blocking the rare row's own gradient on that half of occurrences. The pieces' mean keeps the context intact.
图 8 的进展靠五项技术推进。技术 A 在拼好的少见输入行上加一个慢速更新的残差;技术 B 每个 epoch 用 BPE-dropout(合并时随机跳过一些规则,让同一句话每次切出不同的 token)重新切分,且不伤 1-epoch 拟合;技术 C 每个 epoch 打乱文档顺序。单拉出来用时,技术 A 还是会伤不重复文本的拟合,技术 B 和 C 各自只能消掉不到五分之一的 multi-epoch regret。技术 D 在训练时把少见输入行一半的出现位置换成 8K 片段的均值(" memor" 就换 " mem" 和 "or" 的均值),同时拦住传向片段的梯度,评测时再换回它自己的输入行。主要收益其实来自在那一半位置拦住了少见输入行自己的梯度,片段均值则让上下文保持完整。
Our two best setups cut about half of 128K's multi-epoch regret. The first is Technique E, which adds an exponential moving average of the weights at evaluation on top of C and D. The second combines tied input-output tables, a warmup-stable-decay learning-rate schedule (warmup, constant plateau, then decay), and the same weight averaging. The gap between them is within noise, so we treat the two setups as tied. Both slightly hurt unique-text fit, and both leave about half the regret intact. On the output side, freezing rare output rows after epoch 1 hurt 1-epoch fit, while self-distillation and tied tables helped a bit. Our experiment page lists each technique's individual results. All these runs use MuonH, which has no weight decay.
目前最好的两套方案能消掉约一半的 128K multi-epoch regret。一套是技术 E:在 C 和 D 的基础上,评测时改用权重的指数滑动平均。另一套把共享输入输出表、warmup-stable-decay 学习率调度(先预热、再恒定、最后衰减)和同样的权重平均绑在一起。两者的差距在噪声以内,我们算它们打平。这两套方案都会轻微拉低不重复文本的拟合,也都还剩下一半左右的 regret。在输出端,第 1 个 epoch 后冻住少见输出行会伤 1-epoch 拟合,自蒸馏和共享输入输出表能帮上一点忙。实验主页记下了每项技术单跑的结果,全都用的没有权重衰减的 MuonH。
Optimal weight decay grows with the epoch count训练 epoch 越多,最优权重衰减越大
Raising weight decay also cuts multi-epoch regret by about half, and the best weight decay climbs with the epoch count. Because MuonH locks weight norms on a sphere and has no weight decay to tune, Figure 9 switches to standard Muon using the setup of Wen et al.4 Standard Muon also changes the learning-rate schedule, so its losses cannot be compared directly with MuonH. In the left panel, raising weight decay on the 8-epoch run from the 1-epoch best to eight times that value cuts its regret against the best 1-epoch run by about half. However, the stronger decay needed for multiple epochs hurts unique-text loss, and even picking the best decay at each epoch count leaves over half the regret. In the right panel, the fitted optimal weight decay grows with the epoch count $R$: slowly up to 4 epochs, then roughly as $R^{1.44}$, close to the $R^{1.53}$ empirical fit of Baron et al.5 at fixed text. At 32 epochs, the optimum sits above the highest decay we tried. Zhai et al.6 reported the same direction on ImageNet in 2019. Sweeping the learning rate puts the 8-epoch optimum near half the 1-epoch optimum, matching Baron et al., although the 1-epoch rates score too closely to pin down that optimum.
直接调大权重衰减也能砍掉约一半 multi-epoch regret,但同样救不回全部。MuonH 把权重范数锁在球面上,没法调权重衰减,所以图 9 换成了 Wen 等人4配好的标准 Muon。标准 Muon 顺带改了学习率调度,所以绝对分数不能跟 MuonH 直接比。看左栏,把 8-epoch 的权重衰减从 1-epoch 的最优值调到它的 8 倍,它相对最优 1-epoch run 的 regret 能砍掉约一半。代价是多 epoch 需要的强衰减会拉差不重复文本的损失,而且就算每个 epoch 数都挑最优衰减,还是会留下一半以上的 regret。看右栏,拟合出来的最优权重衰减随 epoch 数 $R$ 一路涨:到 4 个 epoch 之前涨得慢,之后大概按 $R^{1.44}$ 增长,跟 Baron 等人5在固定文本量下拟合出的 $R^{1.53}$ 很接近。到了 32 个 epoch,最优值已经超过我们试过的最大衰减。Zhai 等人6早在 2019 年就在 ImageNet 上报告过同样的趋势。另外,扫学习率发现 8-epoch 的最优学习率大概是 1-epoch 的一半,这也符合 Baron 等人的结论,不过 1-epoch 各个学习率的分数太接近,最优点定不准。
New · Added Nov 5, 2026新增 · 2026 年 11 月 5 日
What if we mix the tokenizer during training?训练时混合分词器会怎样?
Qian Liu asked whether to shrink the vocabulary as data starts repeating, and proposed two ways. Drawing on Proxy Compression, Path 1 tokenizes each window with one of five nested tokenizers, with shares that shift toward smaller ones. Path 2 starts at 128K and cuts the vocabulary each time the epoch count doubles, dropping the cut rows and ending at 32K. In Path 1, all five tokenizers share one 128K table, so after training we score the same model with each of them (figure below).
Qian Liu 问数据开始重复时要不要缩小词表,并提了两种做法。Path 1 参考 Proxy Compression,每个窗口从五个嵌套分词器里抽一个来切分,比例逐渐偏向小分词器。Path 2 从 128K 开始,epoch 数每翻一倍就砍一次词表,砍掉的行不再训练,最后停在 32K。Path 1 的五个分词器共用一张 128K 表,所以训练完以后,我们可以用每个分词器分别给同一个模型打分(见下图)。
Two ways to shrink the vocab as data starts repeating数据开始重复时缩小词表的两种做法
Same text; a smaller tokenizer just does fewer BPE merges.文本相同,小分词器只是少做 BPE 合并。
Keeping the first K tokens is stopping BPE at K, so each cut drops roughly the rarest tokens first.保留前 K 个 token 等于让 BPE 停在 K,所以每次大致先砍最少见的 token。
Train once and score with each tokenizer训练一次后用每个分词器打分
Path 1 cuts regret, and Path 2 does not (Figure 10). From 16K up, Path 1's regret stays near 0.025, about a third of a fixed 128K's. Path 2 ends with more regret than a fixed 32K.
Path 1 降低了 regret,Path 2 没有(图 10)。从 16K 起,Path 1 的 regret 都在 0.025 左右,约为固定 128K 的三分之一。Path 2 最后的 regret 比固定 32K 还高。
The shares of Path 1, 1a and 1c in each epochPath 1、1a 和 1c 每个 epoch 的比例
The shift is not what works. Path 1a gives every epoch Path 1's average shares, and Path 1c runs Path 1's shift in reverse, from small tokenizers to large. From 16K up, both have about the same regret as Path 1 (Figure 11).
起作用的不是比例变化。Path 1a 在每个 epoch 都用 Path 1 的平均比例,Path 1c 把 Path 1 的比例变化倒过来,先用小分词器,后用大分词器。从 16K 起,两者的 regret 都和 Path 1 差不多(图 11)。
How Path 1a and 1b cut one window each epochPath 1a 和 1b 每个 epoch 怎样切同一个窗口
What lowers regret is letting the same rare tokens come back less often. Path 1b uses the same shares but keeps each window's first tokenizer, so its rare tokens come back on every epoch. Its text repeats no more than Path 1a's, yet its regret climbs back to a fixed 128K's (Figure 11). In Path 1a, a window's rare tokens appear in only about 2 of the 8 epochs. BPE-dropout cuts the text differently on every epoch but leaves about nine in ten rare tokens unchanged, so its regret barely falls.
降低 regret 的,是让同样的少见 token 少重复几次。Path 1b 的比例和 1a 相同,但每个窗口一直用第一次抽到的分词器,所以少见 token 每个 epoch 都会回来。它的文本并不比 1a 重复得多,regret 却回到固定 128K 的水平(图 11)。在 Path 1a 里,一个窗口的少见 token 在 8 个 epoch 里只出现约 2 次。BPE-dropout 每个 epoch 都换切法,但约九成少见 token 不变,所以 regret 几乎不降。
The price is paid on unique text, where Path 1a scores nearly flat across sizes and loses to a fixed vocabulary above 32K. Measured as in Figure 8, against plain 128K's unique-text loss, Path 1a at 128K closes only about a fifth of the gap, and our best setup closes half.
代价在不重复文本上:Path 1a 在各个大小上分数差不多,32K 以上就输给固定词表。按图 8 的算法,也就是和普通 128K 在不重复文本上的损失比,Path 1a 在 128K 上只缩小了约五分之一的差距,我们最好的方案缩小了一半。
Path 2 looks like a failure: it ends with more regret than a fixed 32K and barely beats it after 8 epochs. We think the mix pays off most at inference. A model trained on Path 1a's mix can serve with its largest tokenizer, which writes the same text in about a sixth fewer tokens than 16K, and at 128K it still beats a fixed 128K after 8 epochs.
Path 2 看起来失败了:它最后的 regret 比固定 32K 还高,训完 8 个 epoch 也只比固定 32K 好一点点。我们认为混合分词器的主要好处在推理阶段。按 Path 1a 的方式混合训练的模型可以用最大的分词器推理,同样的文本比 16K 少用约六分之一的 token;用 128K 推理时,它训完 8 个 epoch 仍然比固定 128K 好。
New · Added Nov 5, 2026新增 · 2026 年 11 月 5 日
Why does H-Net have less regret?H-Net 的 regret 为什么低?
H-Net reads raw bytes and learns where to cut them into chunks. It has no lookup row per chunk: it computes each chunk's vector from the bytes (figure below). Its regret is about a third of 128K's. Is that because it has no lookup rows, or because it learns its chunks?
H-Net 直接读字节,自己学怎么把字节切成块。它不给块建查表行,每个块的向量都由字节算出来(见下图)。它的 regret 约为 128K 的三分之一。原因是它没有查表行,还是它的块是学出来的?
How a 128K model and H-Net read the same word128K 模型和 H-Net 怎样读同一个词
It is the lookup rows. We give H-Net 128K's tokens as its chunks, so it cuts text exactly as 128K does but computes each chunk's vector from the bytes instead of looking up a row. Its regret falls to about a fifth of 128K's, near plain bytes, and rare tokens fall furthest (Figure 12). These boundaries tell the model a little about the bytes ahead, since where a BPE token ends depends on the whole word. H-Net's own chunks and cuts at spaces have no such leak and also stay far below 128K. Together with the mix above, 128K's regret needs both a row per token and the same tokens coming back.
原因是查表行。我们让 H-Net 直接用 128K 的 token 当块,所以它切文本的方式和 128K 完全一样,只是每个块由字节算出来,不再查表。regret 降到 128K 的约五分之一,接近字节词表,少见 token 降得最多(图 12)。这组的边界会透露一点后面的字节,因为 BPE token 在哪里结束要看整个词。H-Net 自己的块和按空格切都没有这种泄露,regret 也都远低于 128K。结合上一节的混合实验,128K 的 regret 要两个条件同时成立:每个 token 有自己的行,同样的 token 又反复出现。
The learned chunks are not the reason. Cutting at every space, or freezing the chunker after the first epoch, keeps H-Net's regret. Cutting every 5 bytes lowers it, at a worse 1-epoch loss.
学出来的块不是原因。按空格切,或者第 1 个 epoch 后冻住分块器,regret 都和 H-Net 一样。每 5 个字节切一次 regret 更低,但 1-epoch 损失更差。
How H-Net learns where to cutH-Net 怎样学会在哪里切
What regret H-Net has takes two things at once, both marked in the figure above: chunks that follow the text, and the moving average that blends them. Removing the average keeps the chunks much the same and takes regret to about zero. Keeping the average but stopping the gradient it sends to the chunker lowers regret far less than removing the average, so the blend itself does most of the work. Training the chunker with the chunk-count loss alone stops its chunks from following the text, and regret falls by more than half. Cutting at spaces fixes where chunks start, so the average does not blend, yet keeps H-Net's regret, more than half of it on one-byte whitespace chunks in code. Joining each run of whitespace into the chunk before it removes those chunks, yet code keeps nearly all of its regret, about four times plain bytes'. So the one-byte chunks are not the cause, and we have not found what is. The sentence below shows how each setup cuts the same text.
H-Net 自己的那部分 regret,要两样东西同时存在,上图标出了这两处:跟着文本走的块,以及把块混在一起的滑动平均。去掉滑动平均,块基本不变,regret 降到约为零。保留滑动平均、只切断它传给分块器的梯度,regret 的降幅远小于去掉滑动平均,所以起作用的主要是混合本身。只用块数损失训练分块器,块不再跟着文本走,regret 降了一半以上。按空格切时块的起点是固定的,所以滑动平均不混合,regret 却和 H-Net 一样,一半以上落在代码里只有一个字节的空白块上。把每一串连续空白并进它前面的块,这些单字节块就没有了,但代码的 regret 几乎没降,仍是字节词表的约四倍。所以原因不在这些单字节块上,真正的原因我们还没有找到。下图是各个设置对同一句话的切法。
Six ways cut one sentence同一句话的六种切法
Limitations局限性
Our experiments have clear limits. Most runs use a 300m model on FineWeb-Edu for 8 epochs with MuonH, evaluated only on Paloma macro bits per byte. Our smaller BPE vocabularies simply truncate the 128K tokenizer, which also shrinks embedding parameter counts when tables are untied. Both runs in a setup use the same subset of documents, so gaps below about 0.02 bits per byte across vocabularies can come from which documents fall in that subset. Gaps below about 0.01 sit within the noise. Finally, we pick our best setup using the same Paloma score we report.
说一下实验的局限。大部分运行都只跑了 300m 模型、FineWeb-Edu 数据、8 个 epoch 和 MuonH。打分只看 Paloma 宏平均比特/字节。小号 BPE 词表都是直接截断 128K 分词器得来的,在不共享输入输出表时 embedding 参数也跟着变少。同一套配置的两次运行重复的是同一批文档,所以不同词表之间小于约 0.02 比特/字节的差距,可能只是因为 8-epoch 子集抽到了不同的文档。小于约 0.01 的差距在噪声以内,分不出高下。另外,挑最优配置和报最终结果用的是同一个 Paloma 分数。
Takeaways核心结论
To sum up: a large vocabulary gives rare strings like " memor" their own rows, which helps on unique text, but much of the multi-epoch regret lands on rarely seen tokens. On a 300m model trained for 8 epochs on fixed text with equal text per window, vocabularies from 256 bytes to 4K have 0.02 to 0.03 bits per byte of regret, while 128K BPE has about 0.08. This regret opens up in the second half of training. It needs both a lookup row per token and the same tokens coming back: remove either, and three fifths or more of it goes. Our two best setups each cut about half of the 128K regret.
小结一下:大词表给 " memor" 这种少见字符串分了专属行,在不重复文本上确实有用;但多训几个 epoch 后,multi-epoch regret 有很大一部分落在了很少出现的 token 上。300m 模型在固定文本量上训 8 个 epoch、且每个窗口装同样文本时,256 字节到 4K 词表的 regret 是 0.02 到 0.03 比特/字节,128K BPE 约 0.08。这个差距在训练后半程拉开。它要两个条件同时成立:每个 token 有自己的查表行,同样的 token 又反复出现。去掉任何一个,它至少少掉五分之三。我们最好的两套方案各消掉了约一半的 128K regret。
Our practical advice: pick your vocabulary size with the epoch count in mind. If you must train a large vocabulary for many epochs, randomly replace rare input rows with the mean of their 8K pieces during training, shuffle the text each epoch, and average the weights. Together, those three steps cut nearly half of the multi-epoch regret. Alternatively, tying the input and output tables, using a warmup-stable-decay schedule, and averaging the weights cut about half. A mix of tokenizers redrawn each epoch (Path 1a) also helps, but less than these setups.
给实际训练的建议:定词表大小时,先想想数据要重复训几个 epoch。如果非得拿大词表训很多个 epoch,可以在训练时随机把少见输入行换成 8K 片段的均值、每个 epoch 重新打乱文本,再做权重滑动平均;这三招合起来消掉了近一半的 multi-epoch regret。或者共享输入输出表、用 warmup-stable-decay 学习率调度再加权重滑动平均,也能消掉约一半。每个 epoch 重抽分词器的混合(Path 1a)也有用,但效果不如这两套方案。
Open questions开放问题
Beyond these regularization techniques, what else can lower multi-epoch regret in this setup? Even our best setups leave about half of it.
除了这些正则化技术,还有什么办法能在这个设置下降低 multi-epoch regret?最好的方案仍然留下了约一半。
Why does blending chunks raise H-Net's regret? Keeping the moving average but stopping its gradient lowers regret far less than removing the average, so the blend itself matters most, and we do not know how it helps the model memorize. Cutting at spaces has no blend and still keeps H-Net's regret. On code, it and a cut that joins runs of whitespace into one chunk both keep about four times plain bytes' regret, at 4 and at 10 bytes per chunk, while chunks every 5 bytes keep none. Regret per byte along each chunk would show which part of a chunk the model memorizes.
为什么把块混在一起会抬高 H-Net 的 regret?保留滑动平均、只切断它的梯度,regret 的降幅远小于去掉滑动平均,所以起作用的主要是混合本身,但我们还不知道混合怎样帮模型记住重复的文本。按空格切时没有混合,regret 也和 H-Net 一样。在代码上,按空格切和把连续空白并成一个块这两种切法,regret 都约为字节词表的四倍,块长分别是 4 字节和 10 字节;每 5 字节切一块时,代码上没有 regret。按块内位置统计每个字节的 regret,可以看出模型记住的是块里的哪一部分。
Would a model that reads raw bits lower regret further? Bytes are the smallest unit we tried, and we found no language model trained on the bits of text. Work below the byte either splits bytes to shorten the sequence, as Bit-level BPE does, or writes each token's id in bits so that the model predicts bits instead of a softmax over the vocabulary, as CoBit and BitLM do. Compressors such as PAQ predict one bit at a time, but they adapt to a single file rather than learn from a corpus. A byte model already has no rare rows, so a bit model would test whether its last 256 rows matter at all. The test is to train our byte setup on two symbols, with sequences eight times longer, and compare its regret with that of plain bytes.
直接读比特的模型能不能把 regret 再降一些?我们试过的最小单位是字节,也没有找到在文本比特上训练的语言模型。已有的低于字节的工作分两种。一种是 Bit-level BPE,把字节拆开重组,为的是缩短序列。另一种是 CoBit 和 BitLM,把每个 token 的 id 写成比特,让模型预测比特,而不是在整个词表上做 softmax。PAQ 这类压缩器也是一次预测一个比特,但它们只在单个文件上在线适应,不从语料里学习。字节模型本来就没有少见的查表行,所以比特模型要检验的是,这最后 256 行到底有没有影响。做法是把我们的字节设置换成两个符号,序列变成 8 倍长,再和字节词表比 regret。
Acknowledgements致谢
Compute came from Princeton Language and Intelligence on the Della cluster. We thank the Marin project for its codebase, tokenizer, and training recipe, Xingyu Dang for suggestions on the weight decay runs, and Qian Liu for proposing a vocabulary that shrinks as data repeats.
实验算力来自普林斯顿语言与智能中心(PLI)的 Della 集群。感谢 Marin 项目的代码库、分词器和训练配方,感谢 Xingyu Dang 对权重衰减实验的建议,感谢 Qian Liu 提出让词表随数据重复而缩小的想法。
References参考文献
Citation
@misc{chai2026vocabmultiepoch,
title = {Larger Tokenizers Suffer More Multi-Epoch Regret},
author = {Chai, Wenhao},
year = {2026},
howpublished = {Blog post},
url = {https://wenhaochai.com/blogs/vocab-multi-epoch.html}
}