arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2510.26792cs.LGcond-mat.dis-nncs.CR
收藏

利用Transformer学习伪随机数:排列同余生成器、课程学习与可解释性

Learning Pseudorandom Numbers with Transformers: Permuted Congruential Generators, Curricula, and Interpretability

Department of Physics, University of Maryland, College Park, USA(大学物理系,马里兰大学,College Park, USA);Meta FAIR Joint Quantum Institute, University of Maryland(Meta FAIR联合量子研究所,马里兰大学)

Tao Tao, Maissam Barkeshli

AI总结:

本研究探讨了Transformer模型学习排列同余生成器生成的序列能力,揭示了课程学习在处理大模数时的重要性,并发现嵌入层中存在位旋转不变的聚类现象。

摘要:

我们研究了Transformer模型学习由排列同余生成器(PCG)生成的序列的能力,这是一种广泛使用的伪随机数生成器(PRNG)家族。PCG通过在隐藏状态上应用一系列位移、异或、旋转和截断操作,显著增加了线性同余生成器(LCG)的难度。我们证明,尽管如此,Transformer仍能成功地对未见过的序列进行上下文预测,这些序列来自多种PCG变体,并且这些任务超出了已发表的经典攻击范围。在我们的实验中,我们使用高达2^22的模数,模型参数多达5000万,数据集多达50亿个标记。令人惊讶的是,即使输出被截断为单个位,模型也能可靠地进行预测。当多个不同的PRNGs在训练期间一起呈现时,模型可以联合学习它们,识别不同排列的结构。我们展示了模数m的缩放定律:近完美预测所需的上下文序列元素数量随sqrt(m)增长。对于更大的模数,优化进入扩展停滞阶段;在我们的实验中,学习模数m≥2^20需要结合来自较小模数的训练数据,这表明课程学习是至关重要的。最后,我们分析了嵌入层,并揭示了一种新的聚类现象:顶部主成分会将整数输入自动分组到位旋转不变的聚类中,揭示了如何将表示从较小的模数转移到较大的模数。

英文摘要:

We study the ability of Transformer models to learn sequences generated by Permuted Congruential Generators (PCGs), a widely used family of pseudo-random number generators (PRNGs). PCGs introduce substantial additional difficulty over linear congruential generators (LCGs) by applying a series of bit-wise shifts, XORs, rotations and truncations to the hidden state. We show that Transformers can nevertheless successfully perform in-context prediction on unseen sequences from diverse PCG variants, in tasks that are beyond published classical attacks. In our experiments we scale moduli up to $2^{22}$ using up to $50$ million model parameters and datasets with up to $5$ billion tokens. Surprisingly, we find even when the output is truncated to a single bit, it can be reliably predicted by the model. When multiple distinct PRNGs are presented together during training, the model can jointly learn them, identifying structures from different permutations. We demonstrate a scaling law with modulus $m$: the number of in-context sequence elements required for near-perfect prediction grows as $\sqrt{m}$. For larger moduli, optimization enters extended stagnation phases; in our experiments, learning moduli $m \geq 2^{20}$ requires incorporating training data from smaller moduli, demonstrating a critical necessity for curriculum learning. Finally, we analyze embedding layers and uncover a novel clustering phenomenon: the top principal components spontaneously group the integer inputs into bitwise rotationally-invariant clusters, revealing how representations can transfer from smaller to larger moduli.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑