atlas

Research map / Large language models / Instruction and fine-tuning

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

ICML 2024 · Large language models › Instruction and fine-tuning · approach: Calibration and knowledge in LLM tuning · 2 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Uses leave-square-out data interventions on five math tasks to show fine-tuned transformers rely on case-based rather than rule-based reasoning, then proposes Rule-Following Fine-Tuning (RFFT) that makes GPT-3.5 generalize from 1-5 digit to 12-digit addition.

Problem

LLMs fail at simple math such as addition on inputs longer than training data; it is debated whether transformers learn underlying rules or recall similar training cases.

Approach

Distinguish case-based from rule-based reasoning via data interventions that remove a square region of training examples and test whether accuracy holes appear; then teach rule-following by putting explicit rules (a Python program) in the input and fine-tuning the model to quote and execute each rule step by step.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Provide explicit addition rules and train the model to recite and follow them step by step instead of using direct-answer or scratchpad fine-tuningGPT-3.5-turbo-1106 · Addition, up to 12 digitsaccuracy: over 95%Helped
Provide explicit addition rules and train the model to follow them step by step rather than use scratchpad fine-tuningLlama-2-7B · Addition, 6- to 9-digit sumsaccuracy: 91.1%; less than 40%Helped
Use scratchpad fine-tuning instead of direct-answer training (ablation)GPT-2 and GPT-2-medium · Addition, Leave-Square-Out with square side length l_k≥20test accuracyHelped
Use scratchpad fine-tuning instead of direct-answer training (ablation)GPT-2 and GPT-2-medium · Addition, Leave-Square-Out with square side length l_k=10test accuracyHurt
Use scratchpad instead of direct-answer fine-tuning (ablation)GPT-3.5-turbo-1106 · Addition, including 15-digit additionaccuracy: 46.2% on 15-digit addition with direct answerHurt
Train on a leave-square-out split rather than a random split (ablation)GPT-2 and GPT-2-medium · Five math tasks: addition, modular addition, base addition, linear regression, and chicken & rabbittest accuracy: 100%; above 95%Hurt
Increase the left-out test-square side length (ablation)GPT-2 and GPT-2-medium · Addition, Leave-Square-Outtest accuracyHurt
Increase addition training range and scale the left-out square accordingly (ablation)GPT-2 · Addition, Leave-Square-Out over ranges [0,100), [0,200), and [0,500)test accuracyNo clear effect
Replace base-9 digits 0–8 with letters A–I (ablation)Fine-tuned Llama-2-7B · Base-9 addition, Leave-Square-Outtest accuracyHurt
Provide explicit rules in-context rather than direct-answer or scratchpad examples (ablation)GPT-3.5-turbo-0125 · Familiar base-10 additionaccuracyHurt
Provide explicit rules in-context rather than direct-answer or scratchpad examples (ablation)GPT-3.5-turbo-0125 · Unfamiliar base-9 additionaccuracyHelped
Train on a random split instead of leaving out a test square (ablation)Llama-2-7B trained from scratch · Base-9 additiontest accuracy: 30.2% to 92%Helped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic addition modular addition base-9 addition linear regression chicken & rabbit problems last-letter concatenation

Benchmarks: synthetic addition test sets (1-9 and 6-15 digits) leave-square-out test squares on five math tasks

Metrics: accuracy accuracy over test squares accuracy gap train vs test

Baselines: direct answer fine-tuning scratchpad fine-tuning

Builds on: scratchpad fine-tuning grokking chain-of-thought

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy