Papers › Understanding Addition in Transformers

Understanding Addition in Transformers

19 Oct 2023arXiv:2310.13121archive 2025-07-28

Philip Quirke, Fazl Barez

Understanding the inner workings of machine learning models like Transformers is vital for their safe and ethical use. This paper provides a comprehensive analysis of a one-layer Transformer model trained to perform n-digit integer addition. Our findings suggest that the model dissects the task into parallel streams dedicated to individual digits, employing varied algorithms tailored to different positions within the digits. Furthermore, we identify a rare scenario characterized by high loss, which we explain. By thoroughly elucidating the model's algorithm, we provide new insights into its functioning. These findings are validated through rigorous testing and mathematical modeling, thereby contributing to the broader fields of model understanding and interpretability. Our approach opens the door for analyzing more complex tasks and multi-layer Transformer models.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2310.13121")

Code

Syntology Ran 0 of 16 code samples harvested from 1 repository linked to this paper; 16 have no recorded run.

By repository: community (archive-listed): 16 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

apartresearch/conceptual-interp officialmentioned in paperMIT report
apartresearch/integer_addition officialmentioned in paperMIT report
apartresearch/interger_addition officialmentioned in paperMIT report
PhilipQuirke/verified_transformers mentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 0 ran; 0 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

16unverified

Licence: 0 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from PhilipQuirke/verified_transformers. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

algo_task PhilipQuirke/verified_transformers/quanta_maths/maths_diagram.py community (archive-listed) unverified Apache-2.0 (permissive) · 399dff67cea1fa9e · report
analysis_repo_id PhilipQuirke/verified_transformers/quanta_maths/maths_model_loader.py community (archive-listed) unverified Apache-2.0 (permissive) · fd8e109236388bdb · report
calculate_ground_truth PhilipQuirke/verified_transformers/maths_catgen/maths_catgen.py community (archive-listed) unverified Apache-2.0 (permissive) · ca86994524345d15 · report
cascade_answer_digit PhilipQuirke/verified_transformers/quanta_maths/maths_cascade.py community (archive-listed) unverified Apache-2.0 (permissive) · ed83c1c9929d4951 · report
discover_behaviors PhilipQuirke/verified_transformers/quanta_maths/maths_analysis.py community (archive-listed) unverified Apache-2.0 (permissive) · dcdc4c6bf6ba15aa · report
discover_features PhilipQuirke/verified_transformers/quanta_maths/maths_analysis.py community (archive-listed) unverified Apache-2.0 (permissive) · 7901502e1427e114 · report
generate_number_pairs PhilipQuirke/verified_transformers/maths_catgen/maths_catgen.py community (archive-listed) unverified Apache-2.0 (permissive) · 1ab3a1296b48409c · report
get_maths_min_complexity PhilipQuirke/verified_transformers/quanta_maths/maths_complexity.py community (archive-listed) unverified Apache-2.0 (permissive) · 347a07a47fffdc12 · report
is_ground_truth_correct PhilipQuirke/verified_transformers/maths_catgen/maths_catgen.py community (archive-listed) unverified Apache-2.0 (permissive) · d0943274b76fe7d7 · report
maths_data_generator_start PhilipQuirke/verified_transformers/quanta_maths/maths_data_generator.py community (archive-listed) unverified Apache-2.0 (permissive) · 9053fb6a51465923 · report
power_of_two PhilipQuirke/verified_transformers/quanta_maths/model_sae_train.py community (archive-listed) unverified Apache-2.0 (permissive) · 3befe02a7e63e08a · report
produce_pos_of PhilipQuirke/verified_transformers/quanta_maths/maths_batch.py community (archive-listed) unverified Apache-2.0 (permissive) · 04ceb26cbeed6fe1 · report
tag_linxfer_nodes PhilipQuirke/verified_transformers/quanta_maths/maths_batch.py community (archive-listed) unverified Apache-2.0 (permissive) · 9f4c2eff18a07503 · report
tag_pca_nodes PhilipQuirke/verified_transformers/quanta_maths/maths_analysis.py community (archive-listed) unverified Apache-2.0 (permissive) · 61fcda345a9b3c25 · report
tag_stc_nodes PhilipQuirke/verified_transformers/quanta_maths/maths_batch.py community (archive-listed) unverified Apache-2.0 (permissive) · 84273f34067cbf8d · report
train_sae_epoch PhilipQuirke/verified_transformers/quanta_maths/model_sae_train.py community (archive-listed) unverified Apache-2.0 (permissive) · 32f2563daf495763 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections