Code Prompting: a Neural Symbolic Method for Complex Reasoning in Large Language Models
On the map: LLM reasoning → Prompting and chain-of-thought reasoning
Abstract (arXiv)
Large language models (LLMs) have scaled up to unlock a wide range of complex reasoning tasks with the aid of various prompting methods. However, current prompting methods generate natural language intermediate steps to help reasoning, which can cause imperfect task reduction and confusion. To mitigate such limitations, we explore code prompting, a neural symbolic prompting method with both zero-shot and few-shot versions which triggers code as intermediate steps. We conduct experiments on 7 widely-used benchmarks involving symbolic reasoning and arithmetic reasoning. Code prompting generally outperforms chain-of-thought (CoT) prompting. To further understand the performance and limitations of code prompting, we perform extensive ablation studies and error analyses, and identify several exclusive advantages of using symbolic promptings compared to natural language. We also consider the ensemble of code prompting and CoT prompting to combine the strengths of both. Finally, we show through experiments how code annotations and their locations affect code prompting.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Placed in Prompting and chain-of-thought reasoning, one of 17 directions in LLM reasoning. Builds on 28 of its 42 references that are in the map. First posted on arXiv 29 May 2023.
Builds on
28 of 42 references.
Closest ancestors · 7
Same direction, newest first
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks22 Nov
- 2022Automatic Chain of Thought Prompting in Large Language Models7 Oct
- 2022Complexity-Based Prompting for Multi-Step Reasoning3 Oct
- 2022Large Language Models are Zero-Shot Reasoners24 May
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Models21 May
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Models21 Mar
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Models28 Jan
Other references · 21
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2022LaMDA: Language Models for Dialog Applicationscited by 1,218
- 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,054
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2021Are NLP Models really able to Solve Simple Math Word Problems?cited by 861
- 2023AGIEval: A Human-Centric Benchmark for Evaluating Foundation Modelscited by 701
9 more
- 2019MathQA: Towards Interpretable Math Word Problem Solving with Operation-Based Formalismscited by 653
- 2022PAL: Program-aided Language Modelscited by 635
- 2022Decomposed Prompting: A Modular Approach for Solving Complex Taskscited by 554
- 2023Is ChatGPT a General-Purpose Natural Language Processing Task Solver?cited by 486
- 2016Solving General Arithmetic Word Problemscited by 353
- 2022Binding Language Models in Symbolic Languagescited by 224
- 2023Solving Math Word Problems by Combining Language Models With Symbolic Solverscited by 124
- 2020Compositional Generalization via Neural-Symbolic Stack Machinescited by 80
- 2018Semantically-Aligned Equation Generation for Solving and Reasoning Math Word Problemscited by 49
Built on by
Citing papers per year: 2023: 7; 2024: 3; 2025: 6.
16 papers.
Sort:
By area:
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
- 2023Phenomenal Yet Puzzling: Testing Inductive Reasoning Capabilities of Language Models with Hypothesis Refinementcited by 89
- 2024Unlocking the Capabilities of Thought: A Reasoning Boundary Framework to Quantify and Optimize Chain-of-Thoughtcited by 56
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2024Flow of Reasoning: Training LLMs for Divergent Reasoning with Minimal Examplescited by 29
- 2023When Do Program-of-Thoughts Work for Reasoning?cited by 19
- 2023Mixed Distillation Helps Smaller Language Model Better Reasoningcited by 18
- 2025SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoningcited by 16
- 2023Natural Language Embedded Programs for Hybrid Language Symbolic Reasoningcited by 15
- 2024A Theory for Length Generalization in Learning to Reasoncited by 11
- 2023Graph Elicitation for Guiding Multi-Step Reasoning in Large Language Modelscited by 10
- 2023Conditions for Length Generalization in Learning Reasoning Skillscited by 7
4 more
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendmentcited by 6
- 2025FinCoT: Grounding Chain-of-Thought in Expert Financial Reasoningcited by 5
- 2025RBF++: Quantifying and Optimizing Reasoning Boundaries across Measurable and Unmeasurable Capabilities for Chain-of-Thought Reasoningcited by 4
- 2025FinCoT: Grounding Chain-of-Thought in Expert Financial Reasoning19 Jun 2025
- 2025RBF++: Quantifying and Optimizing Reasoning Boundaries across Measurable and Unmeasurable Capabilities for Chain-of-Thought Reasoning19 May 2025
- 2025SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoning14 Apr 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendment17 Feb 2025
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMs17 Feb 2025
- 2024Unlocking the Capabilities of Thought: A Reasoning Boundary Framework to Quantify and Optimize Chain-of-Thought8 Oct 2024
- 2024Flow of Reasoning: Training LLMs for Divergent Reasoning with Minimal Examples9 Jun 2024
- 2024A Theory for Length Generalization in Learning to Reason31 Mar 2024
- 2023Mixed Distillation Helps Smaller Language Model Better Reasoning17 Dec 2023
- 2023Conditions for Length Generalization in Learning Reasoning Skills22 Nov 2023
- 2023Graph Elicitation for Guiding Multi-Step Reasoning in Large Language Models16 Nov 2023
4 more
- 2023Phenomenal Yet Puzzling: Testing Inductive Reasoning Capabilities of Language Models with Hypothesis Refinement12 Oct 2023
- 2023Natural Language Embedded Programs for Hybrid Language Symbolic Reasoning19 Sep 2023
- 2023When Do Program-of-Thoughts Work for Reasoning?29 Aug 2023
- 2023OctoPack: Instruction Tuning Code Large Language Models14 Aug 2023
- 2023Phenomenal Yet Puzzling: Testing Inductive Reasoning Capabilities of Language Models with Hypothesis Refinementcited by 89
- 2024Unlocking the Capabilities of Thought: A Reasoning Boundary Framework to Quantify and Optimize Chain-of-Thoughtcited by 56
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2024Flow of Reasoning: Training LLMs for Divergent Reasoning with Minimal Examplescited by 29
- 2023When Do Program-of-Thoughts Work for Reasoning?cited by 19
- 2023Mixed Distillation Helps Smaller Language Model Better Reasoningcited by 18
- 2025SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoningcited by 16
- 2023Natural Language Embedded Programs for Hybrid Language Symbolic Reasoningcited by 15
- 2023Graph Elicitation for Guiding Multi-Step Reasoning in Large Language Modelscited by 10
- 2023Conditions for Length Generalization in Learning Reasoning Skillscited by 7
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendmentcited by 6
- 2025FinCoT: Grounding Chain-of-Thought in Expert Financial Reasoningcited by 5
12 most cited of 13 All 13 (JSON)
- 2025FinCoT: Grounding Chain-of-Thought in Expert Financial Reasoning19 Jun 2025
- 2025RBF++: Quantifying and Optimizing Reasoning Boundaries across Measurable and Unmeasurable Capabilities for Chain-of-Thought Reasoning19 May 2025
- 2025SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoning14 Apr 2025
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb 2025
- 2025Unveiling the Magic of Code Reasoning through Hypothesis Decomposition and Amendment17 Feb 2025
- 2024Unlocking the Capabilities of Thought: A Reasoning Boundary Framework to Quantify and Optimize Chain-of-Thought8 Oct 2024
- 2024Flow of Reasoning: Training LLMs for Divergent Reasoning with Minimal Examples9 Jun 2024
- 2023Mixed Distillation Helps Smaller Language Model Better Reasoning17 Dec 2023
- 2023Conditions for Length Generalization in Learning Reasoning Skills22 Nov 2023
- 2023Graph Elicitation for Guiding Multi-Step Reasoning in Large Language Models16 Nov 2023
- 2023Phenomenal Yet Puzzling: Testing Inductive Reasoning Capabilities of Language Models with Hypothesis Refinement12 Oct 2023
- 2023Natural Language Embedded Programs for Hybrid Language Symbolic Reasoning19 Sep 2023
12 newest of 13 All 13 (JSON)
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
- 2024A Theory for Length Generalization in Learning to Reasoncited by 11
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMs17 Feb 2025
- 2024A Theory for Length Generalization in Learning to Reason31 Mar 2024
- 2023OctoPack: Instruction Tuning Code Large Language Models14 Aug 2023
Similar, not cited
Close in wording, no citation either way
- 2024Investigating Symbolic Capabilities of Large Language Models
- 2024Code Prompting Elicits Conditional Reasoning Abilities in Text+Code LLMs
- 2023Large Language Models as Analogical Reasoners
- 2024Large Language Models are Contrastive Reasoners
- 2023Empirical Investigation of Neural Symbolic Reasoning Strategies
- 2024Towards Generalist Prompting for Large Language Models by Mental Models
- 2023Reasoning in Large Language Models Through Symbolic Math Word Problems
- 2026Evaluating Prompting and Execution-Based Methods for Deterministic Computation in LLMs