mlsanityData to 7 Oct 2026

Language Models as Compilers: Simulating Pseudocode Execution Improves Algorithmic Reasoning in Language Models

arXiv 2404.02575 ↗First posted 3 Apr 2024cs.CLcited by 20

On the map: LLM reasoning → Reasoning for agents, planning and code

Abstract (arXiv)

Algorithmic reasoning refers to the ability to understand the complex patterns behind the problem and decompose them into a sequence of reasoning steps towards the solution. Such nature of algorithmic reasoning makes it a challenge for large language models (LLMs), even though they have demonstrated promising performance in other reasoning tasks. Within this context, some recent studies use programming languages (e.g., Python) to express the necessary logic for solving a given instance/question (e.g., Program-of-Thought) as inspired by their strict and precise syntaxes. However, it is non-trivial to write an executable code that expresses the correct logic on the fly within a single inference call. Also, the code generated specifically for an instance cannot be reused for others, even if they are from the same task and might require identical logic to solve. This paper presents Think-and-Execute, a novel framework that decomposes the reasoning process of language models into two steps. (1) In Think, we discover a task-level logic that is shared across all instances for solving a given task and then express the logic with pseudocode; (2) In Execute, we further tailor the generated pseudocode to each instance and simulate the execution of the code. With extensive experiments on seven algorithmic reasoning tasks, we demonstrate the effectiveness of Think-and-Execute. Our approach better improves LMs' reasoning compared to several strong baselines performing instance-specific reasoning (e.g., CoT and PoT), suggesting the helpfulness of discovering task-level logic. Also, we show that compared to natural language, pseudocode can better guide the reasoning of LMs, even though they are trained to follow natural language instructions.

Key facts. Cited by 20 papers in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 20 of its 23 references that are in the map. First posted on arXiv 3 Apr 2024.

Builds on

20 of 23 references.

Closest ancestors · 1

Same direction, newest first

  1. 2023Reasoning with Language Model is Planning with World Model24 May

Other references · 19

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  3. 2021Training Verifiers to Solve Math Word Problemscited by 9,743
  4. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  5. 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
  6. 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
  7. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  8. 2022Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Themcited by 1,767
  9. 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
  10. 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
  11. 2022PAL: Program-aided Language Modelscited by 635
  12. 2023Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Modelscited by 550
7 more
  1. 2023Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoningcited by 379
  2. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
  3. 2022Text and Patterns: For Effective Chain of Thought, It Takes Two to Tangocited by 128
  4. 2022Teaching Algorithmic Reasoning via In-context Learningcited by 111
  5. 2024Self-Discover: Large Language Models Self-Compose Reasoning Structurescited by 108
  6. 2020Language Generation with Multi-Hop Reasoning on Commonsense Knowledge Graphcited by 57
  7. 2023Chain of Thought Prompting Elicits Knowledge Augmentationcited by 21

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 9; 2025: 8; 2026: 3.

20 papers.

Sort:

By area:

  1. 2024To CoT or not to CoT? Chain-of-thought helps mainly on math and symbolic reasoningcited by 257
  2. 2025When Thinking Fails: The Pitfalls of Reasoning for Instruction-Following in LLMscited by 51
  3. 2025Linguistic Generalizability of Test-Time Scaling in Mathematical Reasoningcited by 33
  4. 2024Automatically Generating UI Code from Screenshot: A Divide-and-Conquer-Based Approachcited by 24
  5. 2024MRWeb: An Exploration of Generating Multi-Page Resource-Aware Web Code from UI Designscited by 23
  6. 2025Incentivizing Reasoning for Advanced Instruction-Following of Large Language Modelscited by 17
  7. 2024Meta-Designing Quantum Experiments with Language Modelscited by 12
  8. 2025Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to Deliberationcited by 11
  9. 2024Learning to Reason via Program Generation, Emulation, and Searchcited by 9
  10. 2025CodeAgents: A Token-Efficient Framework for Codified Multi-Agent Reasoning in LLMscited by 9
  11. 2024FLARE: Faithful Logic-Aided Reasoning and Explorationcited by 7
  12. 2024Semantic Graphs for Syntactic Simplification: A Revisit from the Age of LLMcited by 4
8 more
  1. 2025Token Signature: Predicting Chain-of-Thought Gains with Token Decoding Feature in Large Language Modelscited by 4
  2. 2024Watch Your Steps: Observable and Modular Chains of Thoughtcited by 3
  3. 2025Abductive Logical Rule Induction by Bridging Inductive Logic Programming and Multimodal Large Language Modelscited by 3
  4. 2025Semi-structured LLM Reasoners Can Be Rigorously Auditedcited by 2
  5. 2026Exploration of Fast-Slow Latent Recurrence for Train-Short, Test-Long Generalizationcited by 2
  6. 2024Large Language Models Are Self-Taught Reasoners: Enhancing LLM Applications via Tailored Problem-Solving Demonstrationscited by 1
  7. 2026Shaping Schema via Language Representation as the Next Frontier for LLM Intelligence Expandingcited by 1
  8. 2026The Periodic Table of LLM Reasoning: A Structured Survey of Reasoning Paradigms, Methods, and Failure Modescited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2026Is Code Better Than Language for Algorithmic Reasoning
  2. 2026Pseudo2CodeQA: A Benchmark for LLM-Based Structured Algorithmic Reasoning in Code Generation
  3. 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models
  4. 2024Distilling Algorithmic Reasoning from LLMs via Explaining Solution Programs
  5. 2025Can Language Models Falsify? Evaluating Algorithmic Reasoning with Counterexample Creation
  6. 2025An Empirical Study of Reasoning Steps in Thinking Code LLMs
  7. 2025Chain of Execution Supervision Promotes General Reasoning in Large Language Models
  8. 2025L0-Reasoning Bench: Evaluating Procedural Correctness in Language Models via Simple Program Execution