PapersWithELO
← ICLR 2024 leaderboard

Learning the greatest common divisor: explaining transformer predictions

Francois Charton

physical sciencesmathematicsarithmetictransformersexplainability
23.20100
Fused
band ≈ ±15 pct pts (from σ = 0.30)
31.80100
Mimo
band ≈ ±21 pct pts (from σ = 0.43)
17.10100
DeepSeek
band ≈ ±20 pct pts (from σ = 0.41)

OpenReview ground truth

Accepted

TL;DR — Transformers can learn to predict greatest common divisors, their predictions can be fully explained, training distribution matters

Abstract

The predictions of small transformers, trained to calculate the greatest common divisor (GCD) of two positive integers, can be fully characterized by looking at model inputs and outputs. As training proceeds, the model learns a list $\mathcal D$ of integers, products of divisors of the base used to represent integers and small primes, and predicts the largest element of $\mathcal D$ that divides both inputs. Training distributions impact performance. Models trained from uniform operands only learn a handful of GCD (up to $38$ GCD $\leq100$). Log-uniform operands boost performance to $73$ GCD $\leq 100$, and a log-uniform distribution of outcomes (i.e. GCD) to $91$. However, training from uniform (balanced) GCD breaks explainability.

Author context

Most prolific author: 1 submissions (credibility 1.00).

No mass-submission penalty for this paper (authors within normal submission volume).

Aggregate statistics only — no individual author rankings.

Ranking trajectory

Percentile by tournament round — convergence indicates rating stability.

Battle history — 36 comparisons

Ranked above opponent in 54% of matchups.

Judge assessments

Mean overall score 0.0 ± 0.0 (n = 36)