Transformers in Pseudo-Random Number Generation: A Dual Perspective on Theory and Practice
Ran Li, Lingshu Zeng
Abstract
Pseudo-random number generators (PRNGs) are high-nonlinear processes, and they are key blocks in optimization of Large language models. Transformers excel at processing complex nonlinear relationships. Thus it is reasonable to generate high-quality pseudo-random numbers based on transformers. In this paper, we explore this question from both theoretical and practical perspectives, highlighting the potential benefits and implications of Transformer in PRNGs. We theoretically demonstrate that decoder-only Transformer models with Chain-of-Thought can simulate both the Linear Congruential Generator (LCG) and Mersenne Twister (MT) PRNGs. Based on this, we conclude that the log-precision decoder-only Transformer can represent non-uniform AC 0 . Our simulative theoretical findings are validated through experiments. The random numbers generated by Transformerbased PRNGs successfully pass the majority of NIST tests, whose heat maps exhibit clear statistical randomness. Finally, we assess their capability in prediction attacks.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
Lineage
- Chain of Thought Empowers Transformers to Solve Inherently Serial Problems cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Chain of Thought Empowers Transformers to Solve Inherently Serial Problems cites Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites O(n) Connections are Expressive Enough: Universal Approximability of Sparse Transformers
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
Builds on6
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
- Chain of Thought Empowers Transformers to Solve Inherently Serial ProblemsZhiyuan Liu, Hong Liu, Denny Zhou, Tengyu MaICLR 2024 · 259 citations
- O(n) Connections are Expressive Enough: Universal Approximability of Sparse TransformersChulhee Yun, Yin-Wen Chang, Srinadh Bhojanapalli, Ankit Singh Rawat et al.NeurIPS 2020 · 111 citations
Related papers
- Learning Pseudorandom Numbers with Transformers: Permuted Congruential Generators, Curricula, and InterpretabilityTao Tao, Maissam BarkeshliICLR 2026
- (How) Can Transformers Predict Pseudo-Random Numbers?Tao Tao, Darshil Doshi, Dayal Singh Kalra, Tianyu He et al.ICML 2025
- Language Models are Realistic Tabular Data GeneratorsVadim Borisov, Kathrin Seßler, Tobias Leemann, Martin Pawelczyk et al.ICLR 2023 · 45 citations
- Language Models are Injective and Hence InvertibleGiorgos Nikolaou, Tommaso Mencattini, Donato Crisostomi, Andrea Santilli et al.ICLR 2026 · 36 citations
- How Numerical Precision Affects Arithmetical Reasoning Capabilities of LLMsGuhao Feng, Kai Yang, Yuntian Gu, Xinyue Ai et al.ACL Findings 2025 · 5 citations
