vix.ing · top · new · best · stats

Understanding Addition and Subtraction in Transformers

2024/02/04 by Philip Quirke, Clement Neo, Quirke, Philip +3 · 1 citation
Engineering · Social Sciences · #Access Control and Trust #Computer science #Electrical engineering #Electronic circuit #Engineering #Ferroelectric and Negative Capacitance Devices #Linguistics #Philosophy #Reuse

paper · pdf · doi:10.48550/arxiv.2402.02619

published in arXiv (Cornell University) (Cornell University)

openalex publication_date 2024/02/04 · openalex created_date 2024/02/07 · openalex updated_date 2026/07/28

Abstract

We use integer addition and subtraction as a controlled, exactly-solvable testbed for what can be said with confidence about the algorithm a low-loss transformer implements - logically and mechanically. We train small transformers (2-3 layers) from scratch, find the edge cases they fail (long carry and borrow cascades), and enrich the training data with them; most resulting models reach >99.999% accuracy on 5-15 digit problems in under an hour, solving cascades such as 555555555+444444448=+1000000003. Interpretability analysis of these accurate models - not an a-priori guess - surfaces the structure from which we derive novel, sound, exact left-to-right algorithms for both operations, matching the causal ordering transformers must use. We then put these algorithms back to the models: across 46 models varying in seed, depth, digit-length, and operation, the accurate ones share one circuit skeleton, and in representative models deeper causal analysis (activation and edge path-patching, with controls) confirms the multi-digit resolved-carry sub-task that earlier analyses left open - while ruling out several candidate mechanisms. The skeleton recurs across model sizes and operations, and mixed-model nodes are polysemantic across addition and subtraction whether initialized from an addition model or trained from scratch. We release the models, analysis, and a reproducible interpretability toolkit.

Citations

Cited by

Related