PAL: Program-aided Language Models
By Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, Graham Neubig. 2022
774 citations recorded by the source corpus.
Large language models (LLMs) have recently demonstrated an impressive ability to perform arithmetic and symbolic reasoning tasks, when provided with a few examples at test time ("few-shot prompting"). Much of this success can be attributed to prompting methods such as"chain-of-thought'', which employ LLMs for both understanding the problem description by decomposing it into steps, as well as solving each step of the problem. While LLMs seem to be adept at this sort of step-by-step decomposition, LLMs often make logical and arithmetic mistakes in the solution part, even when the problem is decomposed correctly. In this paper, we present Program-Aided Language models (PAL): a novel approach that uses the LLM to read natural language problems and generate programs as the intermediate reasoning steps, but offloads the solution step to a runtime such as a Python interpreter. With PAL, decomposing the natural language problem into runnable steps remains the only learning task for the LLM, while solving is delegated to the interpreter. We demonstrate this synergy between a neural LLM and a symbolic interpreter across 13 mathematical, symbolic, and algorithmic reasoning tasks from BIG-Bench Hard and other benchmarks. In all these natural language reasoning tasks, generating code using an LLM and reasoning using a Python interpreter leads to more accurate results than much larger models. For example, PAL using Codex achieves state-of-the-art few-shot accuracy on the GSM8K benchmark of math word problems, surpassing PaLM-540B which uses chain-of-thought by absolute 15% top-1. Our code and data are publicly available at http://reasonwithpal.com/ .
Subfields: Artificial Intelligence, Prompting & Reasoning
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Jianfeng Gao
- Mohit Bansal
- Graham Neubig
- Luke S. Zettlemoyer
- Percy Liang
- Yejin Choi
- Noah A. Smith
- Caiming Xiong
In Prompting & Reasoning
- Denny Zhou
- Minlie Huang
- Jie Huang
- Graham Neubig
- Kevin Chen-Chuan Chang
- Zhiyuan Liu
- Luke S. Zettlemoyer
- Pan Lu
Citations in the corpus
- Toolformer: Language Models Can Teach Themselves to Use Tools (2023, methodology): “…(Komeili et al., 2022; Thoppilan et al., 2022; Lazaridou et al., 2022; Shuster et al., 2022; Yao et al., 2022), web browsers (Nakano et al., 2021), calculators (Cobbe et al., 2021; Thoppilan et al., 2022), translation systems (Thoppilan et al., 2022) and Python interpreters (Gao et al., 2022).”
- Self-Refine: Iterative Refinement with Self-Feedback (2023, methodology): “We select two examples from the training set on which CODEX fails when prompted with PaL-styled prompts, and manually write the correct solution (yi+1) and reasoning (fbi) for REFINE and FEEDBACK.”
- Augmented Language Models: a Survey (2023, methodology): “When prompted with a new question, PAL generates a mix of executable code and explanation.”
- Llemma: An Open Language Model For Mathematics (2023, background): “…of strong mathematical reasoning are upstream of a number of research topics, such as reward modeling (Uesato et al., 2022; Lightman et al., 2023), reinforcement learning for reasoning (Polu et al., 2022; Lample et al., 2022), and algorithmic reasoning (Zhou et al., 2022; Zhang et al., 2023).”
- StarCoder: may the source be with you! (2023, positive): “Although the StarCoder models are principally developed to be Code LLMs, they have also been trained on a significant amount of natural language text.”
- MM-REACT: Prompting ChatGPT for Multimodal Reasoning and Action (2023, background): “Recent studies [11,24, 26,34] have attempted to merge the action and reasoning phases to enhance LLMs’ capabilities in solving complicated tasks that require advanced planning and reasoning.”
- ViperGPT: Visual Inference via Python Execution for Reasoning (2023, methodology): “Using Codex as the program generator and generating code directly in Python allows us to draw on training at scale on the Internet, where Python code is abundant.”
- C-Eval: A Multi-Level Multi-Discipline Chinese Evaluation Suite for Foundation Models (2023, background): “Compared to zero-shot COT, the few-shot version is more commonly used and achieves the state-of-the-art performance on various tasks (Gao et al., 2022; Wang et al., 2023; Zhou et al., 2023; Xie et al., 2023).”
- Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks (2022, background): “Baselines We report results for three different models including Codex (Chen et al., 2021a), GPT-3 (Brown et al., 2020), PaLM (Chowdhery et al., 2022) and LaMDA (Thoppilan et al., 2022).”
- Faithful Chain-of-Thought Reasoning (2023, methodology): “On the remaining three datasets (StrategyQA, Sports Understanding, and CLUTRR), Faithful CoT reasonably outperforms PAL/PoT.”
- Towards Reasoning in Large Language Models: A Survey (2022, background): “Madaan et al. (2022); Gao et al. (2022); Chen et al. (2022) find that LLMs trained with code, e.g., Codex (Chen et al., 2021), can achieve better performance on reasoning tasks by framing reasoning as code generation.”
- TheoremQA: A Theorem-driven Question Answering dataset (2023, methodology): “Another line of work (Gao et al., 2022; Chen et al., 2022b) was proposed to adopt Python programs as the demonstration for the ‘thought process’ to solve different reasoning tasks.”
- DeepSeek-Coder: When the Large Language Model Meets Programming - The Rise of Code Intelligence (2024, methodology): “These benchmarks includes GSM8K (Cobbe et al., 2021), MATH (Hendrycks et al., 2021), GSM-Hard (Gao et al., 2023), SVAMP (Patel et al., 2021), TabMWP (Lu et al., 2022), ASDiv (Miao et al., 2020) and MAWPS (Gou et al., 2023).”
- Large Language Models Can Be Easily Distracted by Irrelevant Context (2023, methodology): “Following prior work on solving GSM8K problems with code (Chowdhery et al., 2022; Gao et al., 2022; Chen et al., 2022), we include a Python program as the problem solution in the prompt, and execute the generated Python code using an external Python interpreter to obtain the final answer.”
- AgentBench: Evaluating LLMs as Agents (2023, background): “In code-related tasks, LLMs are likely to generate codes that cause compiling or run-time errors [12; 24].”
- ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases (2023, background): “The first category leverages the capabilities of LLMs, prompting them to interact with various tools, ranging from highly specialized ones such as code interpreters (Gao et al. 2022; Chen et al. 2022), search engines (Yao et al.”
- A Real-World WebAgent with Planning, Long Context Understanding, and Program Synthesis (2023, methodology): “Another line of work has investigated the tool augmentation of LLMs [52] by decoding API calls [56] or Python snippets to be parsed with the interpreter [20].”
- DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines (2023, methodology): “Task inconsistencies between text and evidence (Gao et al., 2023a).”
- MM-Vet: Evaluating Large Multimodal Models for Integrated Capabilities (2023, positive): “This superior performance may be attributed to the adopted PAL math tool (Program-aided Language Models) [30].”
- AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases (2024, neutral): “The LLM agent will execute the generated action by calling build-in tools [9] or external APIs.”