Loss-landscape grooves: Bayesian influence functions on autoregressive MNIST

Across epochs · 2026-07-05

Added the developmental view the first cut was missing: a train/test loss curve confirming the model converges by epoch 30 with no overfitting gap (§1), an initialisation control on both the fine-tuning (§4) and clustering (§5) results, and clustering measured at every checkpoint. The headline addition: the digit structure is learned — at random init the loss landscape carries none of it (clustering at chance, fine-tuning class-agnostic), and it emerges within the first two epochs.

Rewritten · 2026-07-03

This piece has been rewritten top to bottom, same day, twice over. v1 studied a patch-level logistic-normal density model and reported that class grooves close at convergence; a same-day correction traced that headline to an SGLD estimator artifact. v2 — this page — drops the exotic density model entirely and redoes the study with the most standard recipe available: a pixel-level autoregressive transformer with tied embeddings and cross-entropy loss, plus the fixed estimator. The old model earned its retirement: everything below is cleaner, stronger, and reproducible at r ≥ 0.9 per result. v1 and the correction live in this site's git history.

If natural abstractions are real, they should leave marks on a trained model's loss landscape: datapoints that share a latent (say, being a four) should sit in the same groove, so that wiggling the weights moves their losses together. This piece tests that on MNIST with the , estimated by sampling around trained checkpoints (the standard recipe: train with AdamW, then sample the local posterior). Five results: same-class losses co-fluctuate under posterior sampling while cross-class correlations sit near zero — visible as clean blocks in the BIF matrix at every checkpoint; the BIF's class structure predicts what per-class fine-tuning actually does (r ≈ 0.3–0.5, sign correct 10/10, at early and converged checkpoints); unsupervised clustering of the BIF recovers digit classes better than clustering the raw images — the loss-landscape geometry carries more class information than pixel space; all three of these structures are learned — at initialisation the loss landscape carries no digit structure (clustering at chance, fine-tuning class-agnostic) and it emerges within the first two epochs; and none of this is measurable without fixing the estimator first (§2), which is half the story.

§1Setup

The model is deliberately boring — the point is that nothing below depends on an exotic objective. Each 28×28 digit is quantised to 16 grey levels and unrolled into 784 raster tokens; a small decoder-only transformer with tied input/output embeddings predicts each pixel token from the previous ones with plain cross-entropy. It is a language model whose language happens to be MNIST.

model
d128 · 4 layers · 4 heads (0.9M params); 784 tokens, vocab 16, tied embeddings; dropout 0.1
training
AdamW 3e-4, cosine, 30 epochs, batch 256 → 0.42 bits/pixel test; checkpoint every epoch
BIF
devinterp SGLD (localised, γ=100, nβ=m/ln m), 8 chains × 650–1,300 draws, ε calibrated per checkpoint (hottest stable), two fully independent runs per estimate, gated on agreement r ≥ 0.9
estimator
block-centred covariance (§2); every run self-reports split-half agreement, autocorrelation time, ESS
ground truth
per-class AdamW fine-tune (20 steps @ 1e-5) → ΔNLL on 510 class-balanced probes
code & artefacts
arcadia-impact/small-abstraction-test-{logs, mnist-ar} on HF (private)

The recipe starts from a properly converged model. Thirty epochs of AdamW take the test loss to 0.415 bits/pixel and hold it there — the last five epochs move it by less than 0.001 bpd, and train and test track each other with no widening gap, so nothing studied below is an overfit checkpoint (Fig 1).

Train and test loss in bits per pixel across 30 epochs; both fall steeply then plateau near 0.415 bpd by epoch 20, with no gap opening between them.
Fig. 1 · Training curve. Per-epoch test loss (dropout off) and the per-step training loss (dropout on) both converge to 0.415 bits/pixel by epoch 30 with no overfitting gap — every checkpoint the BIF is measured at is converged or converging, not overfit. (Test sits fractionally below train because train is a single dropout-on minibatch.)

What the model learns, visually: at epoch 1 it has discovered that MNIST has horizontal runs of ink; by epoch 2, stroke fragments; by epoch 5, digit-like glyphs; by epoch 10+, clean digits. The BIF cells below sit at epochs 2, 5, 10 and 30 of this trajectory — plus, now, the untrained model at epoch 0.

Five rows of free samples from the model at epochs 1, 2, 5, 10 and 30, evolving from horizontal noise stripes to stroke fragments to clean digits.
Fig. 2 · Free rollouts across training. The epoch-1 stripes are the raster autoregression learning row-length statistics before anything else.
An 8 by 8 grid: each row fixes the top half of one real digit and shows eight sampled completions of the bottom half, mostly completing as the same digit.
Fig. 3 · Conditioned completions at epoch 30: each row holds the top half of one real digit fixed and samples the bottom half eight times — the prefix picks a digit identity, not just a texture.

§2First, make the estimator converge

The BIF between probes i and j is the covariance of their losses under the local posterior, estimated from SGLD draws. The naive estimator — covariance over the whole trace — turns out to be quietly broken at the step sizes sharp minima force on you: the chain's loss level wanders on a timescale comparable to the entire run (integrated autocorrelation time τ ≈ 60 on 250-draw windows, ≈ 680 on 2,500-draw windows), so each chain contributes only ~4–7 effective samples no matter how long it runs. Two runs that differ only in RNG then disagree — and from within-run split-half agreement predicts the across-run agreement almost exactly, which is how you know the disagreement is pure sampling noise rather than anything systematic.

The fix is to stop asking the slow mode to average out: centre each short block of ~5–10 consecutive draws and average block covariances — a high-pass filter that keeps the fast, well-mixed fluctuations. On this model it lifts seed-to-seed agreement from 0.26–0.84 (raw, depending on how unlucky the cell is) to 0.88–0.98:

Dumbbell chart: for cells at epochs 2, 5, 10 and 30, seed-to-seed agreement jumps from 0.5-0.84 with the raw estimator to 0.88-0.98 with block centring; a dotted line marks the 0.9 gate.
Fig. 4 · Same traces, two estimators, four checkpoints. Every science cell in this piece ran as two fully independent SGLD runs and had to clear r ≥ 0.9 before its numbers were used (the epoch-5 cell needed a doubled draw budget to clear it — exactly what Spearman–Brown predicted).

Three recipe rules fell out of the debugging, and they now run automatically: every estimate is two independent runs with an agreement gate; every run self-reports split-half agreement, τ, and effective sample size (an underpowered estimate announces itself); and SGLD step size is calibrated per checkpoint to the hottest stable value, because mixing — not draw count — is what estimates are starved of. One more lesson worth stating plainly: anything computed from long-window covariances of SGLD traces inherits the slow mode's non-convergence silently. v1 of this piece is what that failure mode looks like when it gets published.

§3The grooves

With trustworthy estimates, the structural question is simple: do same-class probes co-fluctuate more than cross-class probes? Overwhelmingly. In correlation units, same-class pairs co-move at r ≈ 0.09–0.14 (cold cells) while cross-class pairs sit at 0.003–0.01 — a near-zero baseline, so the class blocks are visible to the naked eye in the sorted matrix:

Left: within-class, between-class and difference curves across epochs 2 to 30; the groove signal is positive everywhere with a peak at epoch 2. Right: 510 by 510 BIF correlation matrix at epoch 2 ordered by digit, showing clear red diagonal blocks for most digits.
Fig. 5 · Left: mean pairwise loss correlation within and between classes by checkpoint; the groove signal (dark line) is the difference, which cancels the temperature-dependent common mode of the hotter late-epoch cells. Right: the epoch-2 BIF correlation matrix with probes ordered by digit — within-class blocks for nearly every digit, plus visible cross-class structure (4↔9, 3↔5↔8).

Digit classes carve grooves into the loss landscape at every stage of training we can sample — same-class losses co-fluctuate under posterior perturbation while cross-class correlations sit near zero.

Two temperature facts worth recording. First, the step-size ceiling maps the local sharpness, and on this model it rises with training (epoch 5 tolerates only ε = 3×10⁻⁷; epoch 30 takes 10⁻⁶) — the converged minimum is the flat one. The logistic-normal model of v1 had it exactly backwards (its ceiling collapsed as its density head sharpened), which is what made its late-training estimates unmeasurable with the raw estimator. Second, hotter chains carry a global common mode (everything co-moves as the chain wanders farther) — harmless once you know it's there, poison if you ensemble matrices across temperatures without normalising.

§4Ground truth: the BIF predicts fine-tuning

The influence-function reading makes an operational claim: if BIF(i, j) is large, fine-tuning on i should reduce loss on j. Tested literally — fine-tune a fresh copy on a single class for 20 AdamW steps, measure ΔNLL on all 510 probes, correlate with the BIF's class-row prediction:

Left: per-class correlation between BIF prediction and fine-tuning effect at epochs 5 and 30, positive for all digits. Right: common-mode-removed class-specific fine-tuning effect at init, epoch 5 and epoch 30 — near zero at init (sign 4/10), strongly negative for the same class after training (sign 10/10).
Fig. 6 · Left: probe-level r between the BIF prediction and the actual fine-tuning effect, per fine-tuned class, at the two trained checkpoints. Right: the class-specific fine-tuning effect with the common mode removed — after training, fine-tuning on a digit helps that digit far more than the rest (solid vs barber-pole; sign-correct 10/10); at initialisation the effect is class-agnostic (sign 4/10, chance).

Mean per-class r = +0.49 at epoch 5 (10/10 classes positive) and +0.30 at epoch 30 (sign correct 10/10) — the local posterior sees the same structure that gradient fine-tuning exploits, at both ends of training.

The right panel is the control. At initialisation, fine-tuning on a digit lowers every probe's loss by almost exactly the same amount — a ~540-nat common mode as the untrained model learns basic pixel statistics — and once that common mode is removed there is no class specificity left: fine-tuning helps the same class more than the rest for only 4 of 10 digits, i.e. chance. (The raw BIF-vs-fine-tuning correlation at init is ~1.0, but that too is pure common mode.) The BIF↔fine-tuning correspondence is something the model acquires, not a property its architecture starts with.

§5The goal: recovering the classes unsupervised

Everything above uses the labels to check the structure. The actual goal is to recover the abstraction without them: cluster the BIF matrix and see whether digit classes fall out. v1's honest negative was that they don't (ARI ≤ 0.08 after every denoising trick we had). With the standard model and the fixed estimator, they now do — imperfectly but unmistakably. But first, a developmental question: is that structure there from the start, or built by training? Clustering the BIF at each checkpoint answers cleanly — it is learned (Fig 7).

Left: adjusted Rand index and NMI of BIF clustering versus training epoch — near zero at init, rising to a plateau by epoch 2. Right: five BIF correlation matrices ordered by digit, featureless at init and showing diagonal digit blocks from epoch 2 onward.
Fig. 7 · Clustering across training. Left: agreement (ARI, NMI) between a spectral clustering of the single-checkpoint BIF and the digit labels, by epoch — at chance at initialisation (ARI 0.06, NMI 0.15), it jumps to the raw-pixel baseline by epoch 2 (ARI 0.31) and holds. Right: the BIF correlation matrix ordered by digit at each checkpoint — featureless at init, clean diagonal blocks from epoch 2 on. The init point is the BIF's γ→∞ limit (see below); the rest are the SGLD estimate.

The initialisation point needs a note, because it is not measured the same way. A random-init model's gradients are so large that a localised SGLD chain cannot stay put — it flows downhill to roughly epoch-1 loss for any tether strength that doesn't outright diverge, so there is no finite-γ local posterior to sample. But the localised BIF has a clean limit: as the tether γ→∞ the posterior covariance becomes isotropic and Cov[ℓi, ℓj] → ⟨∇ℓi, ∇ℓj⟩ — the similarity of the two probes' loss gradients. That gradient Gram is the only well-defined local BIF at initialisation, and it is featureless by digit: before training, same-digit probes' gradients are no more aligned than cross-digit ones (they are in fact almost all aligned — a single common mode). The grooves are carved by learning, not present in the architecture.

With that settled, how well does the converged system recover the classes?

Left: ladder of adjusted Rand index values from 0.08 for the old model to 0.36 for the checkpoint-ensembled BIF, with the raw-pixel k-means baseline at 0.30 marked. Right: per-digit cluster recall, high for 0, 2, 8, near zero for 3 and 7.
Fig. 8 · Left: unsupervised digit recovery (spectral clustering, k = 10). The BIF ensemble beats k-means on the raw images — the landscape carries more recoverable class structure than pixel space. Right: per-digit recall of the consensus clustering — the failures are not random.

Spectral clustering of the checkpoint-ensembled BIF recovers digit classes at ARI ≈ 0.36 — above the raw-pixel k-means baseline (0.30) and 4–5× the logistic-normal model's ceiling.

Three ingredients matter, in order: the estimator (raw-covariance matrices cluster at chance); ensembling across checkpoints (epoch 2 + 5 + 30 matrices, z-scored then averaged — different training stages contribute complementary class information, and the z-scoring is what stops the hot cells' common mode from drowning the cold cells' signal); and kNN-sparsifying the affinity before the spectral step. One thing that does not help: quadrupling the probe set (a 2,050-probe epoch-2 cell clusters at ARI 0.29 by itself) — per-pair estimate quality binds, not node count. The per-digit anatomy is the most interesting part: 0, 2, 8 recover cleanly (recall 0.78–0.82) and 1, 5, 6, 9 substantially (0.55–0.67), while 3 and 7 dissolve — each into its shape family (3 into the loops-and-curves cluster with 5 and 8; 7 into the angular-stroke cluster with 9 and 1), with 4 borderline (0.45). The grooves that exist are shape-family grooves first and digit grooves second — which is itself a statement about which abstraction the landscape actually encodes.

Sweeping the number of clusters — and stepping across training — makes that taxonomy concrete (Fig 9; use the tabs to move through checkpoints). At initialisation the clusters are digit-mixed at every k, ARI never above 0.06: there is no taxonomy yet. Once trained a clear hierarchy appears, and its first cuts are shape families — strokes versus curves, then enclosed loops versus open curves — rather than individual digits; digits crystallise out one at a time as k grows, with the most confusable pair (4 and 9) the last to separate. Agreement with the digit labels peaks just above k = 10 (ARI ≈ 0.32 at k = 12 for the converged model, vs 0.28 at k = 10), because letting the sticky shape families over-split into style variants recovers more digit information than forcing exactly ten clusters. The grooves encode a shape taxonomy first and a digit taxonomy second — and that taxonomy is carved during training, absent at initialisation.

checkpoint
1 k = 2 ARI 0.04 179 k = 3 ARI 0.05 026 58 1 k = 4 ARI 0.08 235 8 1 06 479 k = 6 ARI 0.24 35 6 48 479 1 0 23 k = 8 ARI 0.27 35 8 479 23 1 6 0 47 1 k = 10 ARI 0.29 49 04 35 235 8 79 6 1 23 0 1 k = 12 ARI 0.32 6 479 23 79 8 49 0 1 056 1 23 35 4689 k = 14 ARI 0.30 0 1 2 3 4 5 6 7 8 9 hover a cluster to see its members · click to pin
Fig. 9 · The cluster hierarchy across training — spectral clustering of the single-checkpoint BIF at k = 2…14 (columns, ARI against digit labels underneath), nodes stacked by digit composition and labelled with their dominant digits. Use the tabs to move through training; hover any cluster for sixteen of its members, click to pin. At initialisation (epoch 0, the γ→∞ gradient-Gram BIF) the clusters are digit-mixed at every k — no taxonomy; by epoch 5 the shape families have appeared, and the converged model resolves them toward digits.

§6Limits and honest notes

claimstatusevidence
grooves exist at all sampled checkpointsrobustgated cells, r 0.88–0.98
BIF predicts fine-tuningrobustr +0.49 / +0.30, sign 20/20
structure is learned (absent at init)robustclustering ARI 0.06→0.31 by ep2; fine-tune class-agnostic at init (sign 4/10)
clustering beats raw-pixel baselineyes, modestlyARI ~0.37 vs 0.30
full digit recoveryno3, 7 dissolve into shape families
groove depth comparisons across settingstemperature-ladenmagnitudes scale ~ε^1.7; only matched-protocol contrasts are meaningful

Absolute BIF magnitudes are a property of the sampling temperature as much as of the landscape (a 6× step-size change scales covariances ~20×, while the pattern correlates at r ≈ 0.85–0.98 across temperatures). Everything quantitative above is therefore normalised (correlations, ratios) or matched-protocol. And the class-covariance structure keeps developing for thousands of SGLD steps after burn-in looks flat, so budget-matched comparisons are mandatory — several of v1's numbers died of exactly this.

The epoch-0 point is measured differently from the trained cells, of necessity. A random-init model has no finite-γ local posterior to sample — its gradients drag any non-diverging chain downhill to ~epoch-1 loss — so the initialisation BIF is taken in the γ→∞ limit (gradient similarity), whereas the trained cells use the recipe's γ = 100. Both ask the same question — do same-digit losses co-move under local perturbation? — but they are different metrics, so the init result should be read as "the initialisation's loss geometry has no digit structure," not as a temperature-matched extrapolation of the trained numbers. The convergence check (Fig 1) is the other half of reading these honestly: the model is neither under-trained nor overfit at any checkpoint studied.

§7What's next

Code · small-abstraction-test (local repo; v2 study commits 674f9966f01df7+ — pixel-CE model, block estimator, replica-batched sampler, VQ tokenizer for the CIFAR follow-up; across-epochs update a02eba3 — loss curve, epoch-0 gradient-Gram control, clustering-by-checkpoint).
Artefacts · HF arcadia-impact/small-abstraction-test-logs (every SGLD trace, BIF matrix and study ledger of v1 and v2; epoch-0 control at mnist-ep0-20260705) · arcadia-impact/small-abstraction-test-mnist-ar (checkpoints).
Compute · v1: 4090 + A100, ≈ $7. v2 (recipe debugging + pixel study + clustering): 4× 4090, ≈ $9. v2.1 (across-epochs update: loss curve + epoch-0 control): 1× 4090, ≈ $1. Pods stopped/deleted after verified upload.