GPT-2 layer-6 activation denoiser
A 1.316M-parameter sigma-conditioned residual MLP trained to reconstruct GPT-2 residual-stream activations after mixed isotropic/rank-one corruption. It targets the output of block 6 (1-indexed) of openai-community/gpt2.
The model was trained on 131,072 WikiText-2 train tokens and selected on a deterministic corrupted-activation validation split. It never observed any downstream steering vector. This repository also includes a full covariance eigensystem fitted to the bulk WikiText-2 activation distribution.
Result
On 80 held-out WikiText-2 prompts and 8 steering strengths, tangent-preserving inference achieved point Pareto hypervolume 0.866 versus 0.863 for plain activation addition. The paired bootstrap difference was +0.018 with 95% CI [-0.018, +0.049], so this checkpoint does not establish a statistically significant improvement. It does measurably reduce an off-distribution proxy: at relative strength 1, diagonal standardized energy fell from 2.995 to 2.733.
An extended study used sentiment for development and then froze all choices before testing four new AG News directions. A PCA vector filter improved development hypervolume by +0.166 [0.110, 0.221] but significantly hurt confirmatory topics by -0.189 [-0.305, -0.083]. The tangent denoiser was more stable but remained statistically indistinguishable from ordinary addition. These files are published as research artifacts, including the negative/inconclusive results—not as a production recommendation.
Files
model.safetensors: model state dict, including activation mean/scale buffers.denoiser_config.json: architecture, corruption protocol, intervention scaling, and base-model location.training_history.json: deterministic validation curve.pca_prior.safetensors: activation mean, all 768 eigenvalues, and the 768×768 row-wise eigenvector matrix.pca_prior_config.json: robust-fit details, explained-variance ranks, and the frozen development choice.
Architecture code, raw results, figures, and the full report are in the companion GitHub repository. The state dict loads into steerlab.denoiser.ResidualDenoiser with width 768 and bottleneck 256.
Intended inference
For direct denoising, apply D(h + alpha * median_norm * unit(v), alpha). For tangent-preserving inference, remove the denoiser correction parallel to v:
x = h + alpha * median_norm * v / v.norm()
d = denoiser(x, alpha) - x
u = v / v.norm()
h_out = x + d - (d * u).sum(-1, keepdim=True) * u
median_norm = 79.06928253173828 for the training activation distribution.
Spectral vector filtering
For a one-time, zero-inference-overhead filter, load components, keep the first k rows, and project/renormalize a new direction:
u = components[:k]
v_filtered = u.T @ (u @ v)
v_filtered = v_filtered / v_filtered.norm()
The sentiment-development choice was k=424 (90% bulk variance). It should not be treated as universally safe: the companion confirmatory experiment shows that low-variance components can carry causal topic semantics.
Model tree for Yaroslav574389/gpt2-layer6-steering-denoiser
Base model
openai-community/gpt2