Layer-Probing

I studied how information evolves in the residual streams of DeepSeek and Qwen, using trained probes to measure how readable their final predictions become.

DeepSeek-R1-Distill-Qwen-7B / Qwen2-7B-Instruct

Reading the residual stream

The residual stream is the hidden state carried between layers. Each block updates it. A trained probe measures how readable the model's final prediction is from that state.

28 blocks · frozen model
PrefixFull model predictionResidual streamLayer 22Frozen RMS normLinear probe · trainable
1 · first28 · last

The probe bypasses later layers; the full model supplies the target.

How I trained the probes

A forward hook captured one layer’s residual output. On GSM8K reference-solution prefixes, a separate linear probe per layer learned the full model’s next-token distribution. Only probe weights changed.

Frozen modelForward hookCaptured residualFrozen RMS normTeacher predictionProbe predictionUpdate probe weights onlyLater layers + frozen readout

One layer shown · symbolic states and predictions

Trained on an AMD Instinct MI300X, with 256 training questions and 64 held-out questions per model.

Prediction readability across layers

Both models showed their largest increase in agreement between layers 22 and 23. This measures how closely a trained probe matches its own model, not where reasoning begins.

Original paired comparison of teacher-to-probe KL, excess cross entropy, top-token agreement, and reference-token accuracy for all 28 layers.
The saved plots use code indices 0–27. Their jump from index 21 to 22 is layer 22 to 23 in the diagram above. Both models used the same questions. Shading resamples held-out questions. KL is teacher to probe, despite the original chart's reversed wording.
Residual magnitude and direction changes
Measured median relative residual updates and direction changes for DeepSeek and Qwen at the final prompt token.
Activation size and direction changes at the final formatted prompt token. The plot omits the large embedding-to-first-layer transition. These changes do not themselves measure reasoning quality.
Seed checks and experiment details
Three-seed comparison showing each model's largest adjacent agreement increase from code index 21 to 22.
The same jump appeared across all six runs. Lines show seed means; shading shows the observed range across three seeds.
DeepSeek's full-probe seed range and rank-128 probe, with the shared late-layer transition and lower agreement of the smaller readout.
A rank-128 probe reduced parameters from 545 million to 20 million. It retained the jump but matched late-layer predictions less closely. This control used one seed and the same examples.

The frozen models ran in BF16. I trained independent FP32 affine probes for one epoch with learning rate 0.0005, accumulation over four examples, and a 512-token limit. Evaluation covered 7,676 supplied solution tokens. Each selected activation passed through the model's frozen final RMS normalization.

The objective was KL(teacher || probe). A large readout trained on a small sample reflects fitting and optimization as well as the representation. Even the last-layer probe must learn its weights.

Saved measurements, model revisions, and source-file hashes.

Geometry shows the method, not the shape or motion of measured activations.