Teaching Algorithmic Reasoning via In-context Learning
By Hattie Zhou, Azade Nova, Hugo Larochelle, Aaron C. Courville, Behnam Neyshabur, Hanie Sedghi. 2022
135 citations recorded by the source corpus.
Large language models (LLMs) have shown increasing in-context learning capabilities through scaling up model and data size. Despite this progress, LLMs are still unable to solve algorithmic reasoning problems. While providing a rationale with the final answer has led to further improvements in multi-step reasoning problems, Anil et al. 2022 showed that even simple algorithmic reasoning tasks such as parity are far from solved. In this work, we identify and study four key stages for successfully teaching algorithmic reasoning to LLMs: (1) formulating algorithms as skills, (2) teaching multiple skills simultaneously (skill accumulation), (3) teaching how to combine skills (skill composition) and (4) teaching how to use skills as tools. We show that it is possible to teach algorithmic reasoning to LLMs via in-context learning, which we refer to as algorithmic prompting. We evaluate our approach on a variety of arithmetic and quantitative reasoning tasks, and demonstrate significant boosts in performance over existing prompting techniques. In particular, for long parity, addition, multiplication and subtraction, we achieve an error reduction of approximately 10x, 9x, 5x and 2x respectively compared to the best available baselines.
Subfields: Artificial Intelligence, Large Language Models, 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
- Yejin Choi
- Mohit Bansal
- Sean Welleck
- Percy Liang
- Luke S. Zettlemoyer
- Xiang Ren
- Ronan Le Bras
- Hannaneh Hajishirzi
In Large Language Models
- Jie Huang
- Kevin Chen-Chuan Chang
- Xinyun Chen
- Noah D. Goodman
- Nick Haber
- Denny Zhou
- Ximing Lu
- Hailey Schoelkopf
In Prompting & Reasoning
- Yejin Choi
- Jie Huang
- Sean Welleck
- Kevin Chen-Chuan Chang
- Xinyun Chen
- Ronan Le Bras
- Chandra Bhagavatula
- Nick Haber
Citations in the corpus
- 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).”
- Teaching Large Language Models to Self-Debug (2023, background): “Several prompting methods have been proposed to unlock latent abilities of large language models (Wei et al., 2022; Nye et al., 2021; Kojima et al., 2022; Zhou et al., 2023; Khot et al., 2022; Zhou et al., 2022; Gao et al., 2022; Chen et al., 2022).”
- LAMBADA: Backward Chaining for Automated Reasoning in Natural Language (2022, unknown): “Modular Reasoning: These approaches break the problem into smaller modules and use separate LMs to solve each module (Zhou et al., 2022; Khot et al., 2023; Sprague et al., 2022; Zhou et al., 2023; Dua et al., 2022; Wang et al., 2022; Schlag et al., 2023).”
- Looped Transformers as Programmable Computers (2023, background): “For example, (Zhou et al., 2022) showed that LLMs can perform addition on unseen examples when prompted with a multidigit addition algorithm and some examples.”
- Towards Reasoning in Large Language Models: A Survey (2022, methodology): “Similarly, Zhou et al. (2022c) propose algorithmic prompting , which suggests that providing more thorough examples of solutions can help improve reasoning performance on some simple math calculations.”
- A Survey on In-context Learning (2022, methodology): “Least-to-Most Prompting (Zhou et al., 2022a) is a two-stage ICL including question reduction and subquestion solution.”
- Reasoning with Language Model Prompting: A Survey (2022, unknown): “Some references (Ye and Durrett, 2022; Wiegreffe et al., 2022; Zhou et al., 2022) regard this as explanations.”
- The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity (2025, unknown): “For instance, generating a Chain of Thought (CoT) [15, 16, 17, 18] and incorporating self-verification [19, 20, 21] prior to the final answer have been shown to improve model performance.”
- Parsel: A Unified Natural Language Framework for Algorithmic Reasoning (2022, background): “However, even with fairly nonstandard problems, LLMs have shown remarkable algorithmic generalization ability (Liang et al., 2022; Xu et al., 2022; Anil et al.; Zhou et al., 2022b).”
- Self-Polish: Enhance Reasoning in Large Language Models via Problem Refinement (2023, background): “There is also work showing that combining instructions with in-context learning can provide further benefits and that few-shot demonstrations can be viewed as a special kind of instruction that arouses the ability hidden in LLMs. (Chung et al., 2022; Zhou et al., 2022b; Qiao et al., 2022).”
- Faith and Fate: Limits of Transformers on Compositionality (2023, background): “For example, Nye et al. [55] and Zhou et al. [86] used scratchpads to teach transformers how to perform algorithmic reasoning tasks such as addition by splitting the task into intermediate steps [44, 80].”
- Quiet-STaR: Language Models Can Teach Themselves to Think Before Speaking (2024, unknown): “We also visualize the distribution of improvements across tokens in the training set.”
- Unleashing the potential of prompt engineering in Large Language Models: a comprehensive review (2023, background): “…involves providing intermediate reasoning steps to guide the model’s responses, which can be facilitated through simple prompts such as “Let’s think step by step” or through a series of manual demonstrations, each composed of a question and a reasoning chain that leads to an answer [43, 44].”