Inside the Black Box: A Canonical Basis for Transformers

Gianluca Gernone published something quietly remarkable today. Version 2 of his Canonical Basis for Language Models — a method that rotates a transformer's hidden space so every single axis becomes independently measurable and controllable. Losslessly. It doesn't change what the model outputs. It just shows you what was there all along.

The findings are the kind that make you sit up. Zero out axis 62 — 0.11% of Qwen 2.5 0.5B — and MMLU collapses from 47.50% to 21.25%. Perplexity jumps from 4.24 to 23,858. The model stops making sense. Zero out its anti-correlated partner axis 570 and facts degrade while fluency stays intact. Zero any of five control axes and nothing happens. That's not noise. That's architecture.

I cloned the repo, ran the pre-computed data through the verification scripts, and read the full paper. What follows is what I found.

The Method: Why the Standard Basis is Meaningless

A transformer's hidden state is a vector in ℝd. In the standard basis — the one the training converged to — dimension i carries no semantic meaning. You can't compare dimension 5 at layer 3 to dimension 5 at layer 17. They're different spaces wearing the same index.

The canonical basis solves this. The procedure is elegant:

  1. Absorb normalization gains — fold the per-channel gains of RMSNorm into the adjacent weight matrices so the normalization becomes uniform and commutes with any orthogonal rotation.
  2. Build the rotation — average the top singular vectors of the FFN down-projection across layers, orthonormalize, and complete with Householder reflectors into a full orthogonal matrix R.
  3. Apply — FROM-d_model matrices rotate with W @ RT; TO-d_model matrices rotate with R @ W. The embedding output gets rotated in, the final hidden state gets rotated out.

For LayerNorm architectures (like Pythia), they use a DC-preserving rotation that fixes the ones-vector. Same result, verified lossless: Pythia 1.4B PPL goes from 9.2286 → 9.2359 — that's within floating-point noise of lossless, and greedy generation produces identical output.

That last verification took me all of 30 seconds to confirm with their pre-computed JSON:

import json
p = json.load(open('data/pythia_dc_bridge_results.json'))
print(p['ppl_original'], '->', p['ppl_canonical'], 'lossless:', p['lossless'])
# 9.2286 -> 9.2359 lossless: True

What You See After the Rotation

Once in the canonical basis, structures emerge that were smeared across all 896 dimensions before. Five phenomena, each independently measured and quantified:

The Bipolar Oscillator

The 896 axes split into 309 positive-pole and 292 negative-pole axes. 83% of positive-pole axes have a dedicated inhibitory partner. The master pair — axis 62 ↔ axis 570 — has a correlation of ρ = −0.97. When one fires, the other suppresses. This isn't a learned behavior for specific tasks; it's a structural property of the geometry.

Respiration

The POS/NEG activation ratio oscillates across the 24 layers in a fixed four-phase pattern — invariant to input content:

graph LR
    E[Encode
L0-L4
POS/NEG=1.36] --> P[Process
L5-L20
POS/NEG=0.42-0.88] P --> D[Decode
L21-L22
POS/NEG=1.28] D --> O[Output
L23
POS/NEG=0.54]

The same five layers — [21, 3, 23, 2, 22] — are the top activators for every prompt tested. The model breathes in a fixed rhythm regardless of what you ask it.

Homeostasis

Any intermediate perturbation of the residual stream is erased within exactly two layers. Amplify a signal 5× at layer 0: by layer 2, it's back to baseline. This is architectural, not learned — the combined action of RMSNorm, attention softmax, and the SiLU operating range forms a built-in stabilizer.

Spectral Collapse

The singular value magnitudes are nearly identical across all 24 layers (rank-1/24, ratio 23.2×). Layer identity lives in the geometry — the U and V matrices — not in the spectrum. But the activation spectrum collapses 41× more than the weight spectrum: the weights are diverse, but the model only uses a sliver of that diversity in practice.

Single-Axis Ablation: The Causal Proof

This is the one that matters. Version 1 of the paper described phenomena. Version 2 proves they're functional by destroying specific axes and measuring what breaks.

Verification from the repo's data — I ran this locally:

import json
d = json.load(open('data/single_axis_ablation.json'))
bl = d['baseline']['mmlu']['accuracy']
results = [(k, v['mmlu']['accuracy']) for k,v in d.items() if k.startswith('axis_')]
results.sort(key=lambda x: x[1])
print(f'Baseline MMLU: {bl}')
for k, acc in results:
    print(f'  {k}: MMLU={acc:.4f} ({acc-bl:+.4f})')
# axis_62: MMLU=0.2125 (-0.2625) ← catastrophic
# axis_0:  MMLU=0.3792 (-0.0958) ← significant
# axis_570: MMLU=0.4458 (-0.0292) ← mild fact degradation
# control axes: no effect (≤ ±0.0125)

Zeroing 0.11% of the model destroys 55% of its accuracy. The description in the paper says it better than I can: "PPL 4.24 → 23858" — the model degenerates into incoherent token noise.

Architectural Generality

The method isn't specific to Qwen. They measured native cross-layer U-alignment across eight architectures with a single consistent method:

ArchitectureAlignment
Qwen 2.5 0.5B0.651
Qwen 3.5 4B0.606
Falcon3 3B0.474
StarCoder 3B0.475
Nemotron-Mini 4B0.249
DeepSeek-Coder 6.7B0.157
OLMo2 7B0.020

The spread from 0.02 (OLMo2 — essentially none) to 0.65 (Qwen) is itself a finding: normalization type alone doesn't determine alignment. Something deeper about architecture and training shapes this geometry.

MoE models? OLMoE-1B-7B (64 experts) shows per-expert cross-layer alignment of 0.086 and cross-expert alignment of 0.111 — the expert structure is per-expert, not shared.

Why This Matters

Most interpretability research looks at individual neurons, attention heads, or circuits. This looks at the geometry of the entire residual stream and finds it's structured — tightly, repeatedly, architecture-spanningly structured.

The fact that a single axis controls whether a model can think at all (axis 62) while its paired inhibitor (axis 570) controls precision is the kind of finding that rewires how you think about these systems. It suggests that the "sparse MoE" analogy — active sub-networks for different tasks — may be less true than a model-wide oscillator with knowledge-capture and filtering phases that cycle regardless of input.

The repo is fully reproducible. Every number backed by a script and a JSON file. No GPU needed to verify the results — the pre-computed data runs on any laptop. That's how research should be done.

Gernone is an independent researcher. No affiliation. No lab. Just someone who asked the right question and built the tools to answer it.

The bottom line: we now have a lossless microscope for transformer hidden spaces. The structures it reveals are functional, architectural, and span model families. Anyone working on model editing, safety, or compression should read this paper before their next experiment.