Lune

EMNLP2024Top-tier venue

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

Hyungjoo Chae, Yeonghyeon Kim, Seungone Kim, Kai Tzu-iunn Ong, Beong-woo Kwak, Moohyeon Kim, Sunghwan Kim, Taeyoon Kwon, Jiwan Chung, Youngjae Yu, Jinyoung Yeo

Abstract

Algorithmic reasoning tasks that involve complex logical patterns, such as completing Dyck language, pose challenges for large language models (LLMs), despite their recent success. Prior work has used LLMs to generate programming language and applied external compilers for such tasks. Yet, when on the fly, it is hard to generate an executable code with the correct logic for the solution. Even so, code for one instance cannot be reused for others, although they might require the same logic to solve. We present THINK-AND-EXECUTE, a novel framework that improves LLMs' algorithmic reasoning: (1) In THINK, we discover task-level logic shared across all instances, and express such logic with pseudocode; (2) In EX-ECUTE, we tailor the task-level pseudocode to each instance and simulate the execution of it. THINK-AND-EXECUTE outperforms several strong baselines (including CoT and PoT) in diverse algorithmic reasoning tasks. We manifest the advantage of using task-level pseudocode over generating instance-specific solutions one by one. Also, we show that pseudocode can better improve LMs' reasoning than natural language guidance, even though they are trained with natural language instructions.

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.

13 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Incentivizing Reasoning for Advanced Instruction-Following of Large Language Models cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Incentivizing Reasoning for Advanced Instruction-Following of Large Language Models cites Large Language Models are Zero-Shot Reasoners
  • Incentivizing Reasoning for Advanced Instruction-Following of Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Learning to Reason via Program Generation, Emulation, and Search cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Learning to Reason via Program Generation, Emulation, and Search cites PAL: Program-aided Language Models
  • Learning to Reason via Program Generation, Emulation, and Search cites Large Language Models are Zero-Shot Reasoners
  • Learning to Reason via Program Generation, Emulation, and Search cites Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them
  • Learning to Reason via Program Generation, Emulation, and Search cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Self-Consistency Improves Chain of Thought Reasoning in Language Models cites Large Language Models are Zero-Shot Reasoners
  • Large Language Models are Zero-Shot Reasoners cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Self-Consistency Improves Chain of Thought Reasoning in Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to Deliberation cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to Deliberation cites Large Language Models are Zero-Shot Reasoners
  • Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to Deliberation cites When Thinking Fails: The Pitfalls of Reasoning for Instruction-Following in LLMs
  • Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to Deliberation cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Linguistic Generalizability of Test-Time Scaling in Mathematical Reasoning cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Linguistic Generalizability of Test-Time Scaling in Mathematical Reasoning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • PAL: Program-aided Language Models cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • PAL: Program-aided Language Models cites Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them
  • PAL: Program-aided Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Large Language Models are Zero-Shot Reasoners cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • When Thinking Fails: The Pitfalls of Reasoning for Instruction-Following in LLMs cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them cites Large Language Models are Zero-Shot Reasoners
  • Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers13

  1. When Thinking Fails: The Pitfalls of Reasoning for Instruction-Following in LLMsXiaomin Li, Zhou Yu, Zhiwei Zhang, Xupeng Chen et al.NeurIPS 2025 · 63 citations
  2. Linguistic Generalizability of Test-Time Scaling in Mathematical ReasoningGuijin Son, Jiwoo Hong, Hyunwoo Ko, James ThorneACL 2025 · 36 citations
  3. Incentivizing Reasoning for Advanced Instruction-Following of Large Language ModelsYulei Qin, Gang Li, Zongyi Li, Zihan Xu et al.NeurIPS 2025 · 17 citations
  4. Learning to Reason via Program Generation, Emulation, and SearchNathaniel Weir, Muhammad Khalifa, Linlu Qiu, Orion Weller et al.NeurIPS 2024 · 16 citations
  5. Unlocking the Power of Multi-Agent LLM for Reasoning: From Lazy Agents to DeliberationZhiwei Zhang, Xiaomin Li, Yudi Lin, Hui Liu et al.ICLR 2026 · 13 citations

Builds on13

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
  3. PAL: Program-aided Language ModelsLuyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon et al.ICML 2023 · 700 citations
  4. Self-Consistency Improves Chain of Thought Reasoning in Language ModelsXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le et al.ICLR 2023 · 681 citations
  5. Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve ThemMirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann et al.ACL Findings 2023 · 253 citations

Related papers

  1. Reversal of Thought: Enhancing Large Language Models with Preference-Guided Reverse Reasoning Warm-upJiahao Yuan, Dehui Du, Hao Zhang, Zixiang Di et al.ACL 2025 · 12 citations
  2. Chain of Code: Reasoning with a Language Model-Augmented Code EmulatorChengshu Li, Jacky Liang, Andy Zeng, Xinyun Chen et al.ICML 2024 · 155 citations
  3. How Do Humans Write Code? Large Models Do It the Same Way TooLong Li, Xuzheng He, Haozhe Wang, Linlin Wang et al.EMNLP 2024 · 1 citation
  4. CoT-RAG: Integrating Chain of Thought and Retrieval-Augmented Generation to Enhance Reasoning in Large Language ModelsFeiyang Li, Peng Fang, Zhan Shi, Arijit Khan et al.EMNLP Findings 2025 · 11 citations
  5. Fine-Tuning Large Vision-Language Models as Decision-Making Agents via Reinforcement LearningSimon Zhai, Hao Bai, Zipeng Lin, Jiayi Pan et al.NeurIPS 2024 · 214 citations
Dusk over the sea between two cliffs drawn in fine vertical lines