mlsanityData to 7 Oct 2026

Code Simulation Challenges for Large Language Models

arXiv 2401.09074 ↗First posted 17 Jan 2024cs.LG cs.AI cs.CLcited by 15

Not on the map. Why?

Abstract (arXiv)

Many reasoning, planning, and problem-solving tasks share an intrinsic algorithmic nature: correctly simulating each step is a sufficient condition to solve them correctly. This work studies to what extent Large Language Models (LLMs) can simulate coding and algorithmic tasks to provide insights into general capabilities in such algorithmic reasoning tasks. We introduce benchmarks for straight-line programs, code that contains critical paths, and approximate and redundant instructions. We further assess the simulation capabilities of LLMs with sorting algorithms and nested loops and show that a routine's computational complexity directly affects an LLM's ability to simulate its execution. While the most powerful LLMs exhibit relatively strong simulation capabilities, the process is fragile, seems to rely heavily on pattern recognition, and is affected by memorisation. We propose a novel off-the-shelf prompting method, Chain of Simulation (CoSm), which instructs LLMs to simulate code execution line by line/follow the computation pattern of compilers. CoSm efficiently helps LLMs reduce memorisation and shallow pattern recognition while improving simulation performance. We consider the success of CoSm in code simulation to be inspirational for other general routine simulation reasoning tasks.

Key facts. Cited by 15 papers in the map (data through 7 Oct 2026). Builds on 46 of its 78 references that are in the map. First posted on arXiv 17 Jan 2024.

Builds on

46 of 78 references.

References · 46

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2023GPT-4 Technical Reportcited by 18,132
  4. 2022Training language models to follow instructions with human feedbackcited by 15,712
  5. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  6. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  7. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  8. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  9. 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
  10. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
  11. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  12. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
34 more
  1. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  2. 2022Code as Policies: Language Model Programs for Embodied Controlcited by 1,172
  3. 2023Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Promptingcited by 1,081
  4. 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
  5. 2023Reasoning with Language Model is Planning with World Modelcited by 846
  6. 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
  7. 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 399
  8. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  9. 2023Detecting Pretraining Data from Large Language Modelscited by 375
  10. 2023Who's Harry Potter? Approximate Unlearning in LLMscited by 366
  11. 2019Learning Deep Transformer Models for Machine Translationcited by 309
  12. 2023Mathematical Capabilities of ChatGPTcited by 263
  13. 2022Emergent Analogical Reasoning in Large Language Modelscited by 239
  14. 2023Looped Transformers as Programmable Computerscited by 224
  15. 2018Machine Theory of Mindcited by 222
  16. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
  17. 2021Thinking Like Transformerscited by 182
  18. 2023Embers of Autoregression: Understanding Large Language Models Through the Problem They are Trained to Solvecited by 175
  19. 2022Talking About Large Language Modelscited by 174
  20. 2023Emergent and Predictable Memorization in Large Language Modelscited by 147
  21. 2022Large Language Models Meet NL2Code: A Surveycited by 135
  22. 2023How well do Large Language Models perform in Arithmetic tasks?cited by 130
  23. 2021How much do language models copy from their training data? Evaluating linguistic novelty in text generation using RAVENcited by 124
  24. 2021Position Information in Transformers: An Overviewcited by 103
  25. 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
  26. 2023The Generative AI Paradox: "What It Can Create, It May Not Understand"cited by 97
  27. 2023One Small Step for Generative AI, One Giant Leap for AGI: A Complete Survey on ChatGPT in AIGC Eracited by 55
  28. 2023Memory Augmented Large Language Models are Computationally Universalcited by 45
  29. 2023When Do Prompting and Prefix-Tuning Work? A Theory of Capabilities and Limitationscited by 41
  30. 2023Code Execution with Pre-trained Language Modelscited by 33
  31. 2023Can Transformers Learn to Solve Problems Recursively?cited by 17
  32. 2023GPT is becoming a Turing machine: Here are some ways to program itcited by 16
  33. 2023Predicting Code Coverage without Executioncited by 9
  34. 2023Addressing Compiler Errors: Stack Overflow or Large Language Models?cited by 5

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 10; 2026: 2.

15 papers.

Sort:

By area: