paper-with-me

홈 › Papers

Case-Based or Rule-Based: How Do Transformers Do the Math?

2024-02-27 · Yi Hu, Xiaojuan Tang, Haotong Yang, Muhan Zhang

Despite the impressive performance in a variety of complex tasks, modern large language models (LLMs) still have trouble dealing with some math problems that are simple and intuitive for humans, such as addition. While we can easily learn basic rules of addition and apply them to new problems of any length, LLMs struggle to do the same. Instead, they may rely on similar cases seen in the training corpus for help. We define these two different reasoning mechanisms as "rule-based reasoning" and "case-based reasoning". Since rule-based reasoning is essential for acquiring systematic generalization ability, we aim to explore exactly whether transformers use rule-based or case-based reasoning for math problems. Through carefully designed intervention experiments on five math tasks, we confirm that transformers are performing case-based reasoning, no matter whether scratchpad is used, which aligns with the previous observations that transformers use subgraph matching/shortcut learning to reason. To mitigate such problems, we propose a Rule-Following Fine-Tuning (RFFT) technique to teach transformers to perform rule-based reasoning. Specifically, we provide explicit rules in the input and then instruct transformers to recite and follow the rules step by step. Through RFFT, we successfully enable LLMs fine-tuned on 1-5 digit addition to generalize to up to 12-digit addition with over 95% accuracy, which is over 40% higher than scratchpad. The significant improvement demonstrates that teaching LLMs to use rules explicitly helps them learn rule-based reasoning and generalize better in length.

📄 PDF Abstract BibTeX arXiv:2402.17709

Code (1)

graphpku/case_or_rule 공식 구현 pytorch

Tasks

MathSystematic Generalization

Similar Papers 제목 키워드 기반

Learning Elementary Cellular Automata with Transformers

2024-12-02 · Mikhail Burtsev

Large Language Models demonstrate remarkable mathematical capabilities but at the same time struggle with abstract reasoning and planning. In this study, we explore whether Transformers can learn to abstract and generali…

Extracting Definienda in Mathematical Scholarly Articles with Transformers

2023-11-21 · Shufan Jiang, Pierre Senellart

We consider automatically identifying the defined term within a mathematical definition from the text of an academic article. Inspired by the development of transformer-based natural language processing applications, we …

ArticlesLanguage ModelingLanguage ModellingLarge Language Model+1

Logicbreaks: A Framework for Understanding Subversion of Rule-based Inference

2024-06-21 · Anton Xue, Avishree Khare, Rajeev Alur, Surbhi Goel 외

We study how to subvert large language models (LLMs) from following prompt-specified rules. We first formalize rule-following as inference in propositional Horn logic, a mathematical system in which rules have the form "…

Logical Reasoning

Le Nozze di Giustizia. Interactions between Artificial Intelligence, Law, Logic, Language and Computation with some case studies in Traffic Regulations and Health Care

2024-02-09 · Joost J. Joosten, Manuela Montoya García

An important aim of this paper is to convey some basics of mathematical logic to the legal community working with Artificial Intelligence. After analysing what AI is, we decide to delimit ourselves to rule-based AI leavi…

Transformers Can Learn Rules They've Never Seen: Proof of Computation Beyond Interpolation

2026-03-17 · Andy Gray arxiv

A central question in the debate over large language models is whether transformers can learn rules they have never seen, or whether they can only interpolate: predict new cases from their similarity to training examples…