Unrolled Sparse Autoencoders That Certify Their Own Codes

Sparse autoencoders (SAEs) are the main tool for opening up large language models. An SAE learns a large dictionary of directions ("features") and rewrites each internal activation vector as a sparse, nonnegative mix of a few of them. Almost every SAE in use computes that mix with a single linear map followed by a threshold. Theory says this one-shot encoder cannot recover the right sparse code when features overlap, which they do in real models. Iterative sparse solvers fix the recovery problem but are too slow for auditing at scale. As a result, the feature activations people interpret come from an encoder whose errors are invisible. Nothing tells you, for a given token, whether "feature 4031 fired at 0.7" reflects the decoder's dictionary or an artifact of a lossy shortcut.

We propose replacing the SAE encoder with a short, fixed number of steps of a known sparse-coding algorithm (projected ISTA, the iterative shrinkage-thresholding algorithm), unrolled into network layers. The steps use weights tied to the decoder, and the dictionary is trained jointly with the solver's step sizes and thresholds. Three consequences follow. First, an activation's meaning is fixed entirely by the decoder dictionary. Second, each token's code can be checked against an explicit objective through a cheap optimality certificate, the duality gap. Third, the question "does closing the amortisation gap actually improve interpretability?" becomes testable on SAEBench's interventional metrics at matched compute.

Core Claim

Our central claim is that interpretability failures of SAEs on correlated features are partly inference failures, not dictionary failures. Feature absorption, blurred support, and brittleness under host-model compression come in part from the encoder. An encoder that runs $K$ unrolled steps of a stated sparse-coding objective, and that is trained jointly with the dictionary, should improve disentanglement metrics over one-shot encoders at equal compute. It should also degrade less when the host model is pruned, because it re-solves against the actual perturbed activation rather than applying a fixed projection. As a byproduct, every code carries a per-token certificate of how far it sits from the optimum.

Concretely, for activation $x \in \mathbb{R}^d$ and decoder $D \in \mathbb{R}^{d \times m}$ with unit-norm columns, the encoder approximately solves the nonnegative lasso $\min_{a \ge 0} \tfrac12\|x - Da\|^2 + \theta^\top a$. It does so with the update

$$a^{(k+1)} = \mathrm{ReLU}\big(a^{(k)} + \gamma_k D^\top (x - D a^{(k)}) - \gamma_k \theta_k\big), \quad k = 0,\dots,K-1,$$

where $a^{(0)} = 0$, $\gamma_k$ is a learned scalar step size, and $\theta_k \in \mathbb{R}^m$ is a learned per-feature threshold. The only large matrix is the decoder itself. This is the ALISTA insight from ALISTA: Analytic Weights Are As Good As Learned Weights in LISTA: that paper shows unrolled weight matrices can be fixed analytically from the dictionary, leaving only per-layer scalars to learn. We transplant it into the setting where the dictionary itself is being learned.

Because the objective is explicit, the per-token duality gap costs one extra matrix-vector product. The gap is the difference between the lasso objective at $a^{(K)}$ and the value of a feasible dual point built from the residual. It bounds how suboptimal the code is. We use it both as a diagnostic and as a flag for tokens whose feature readout should not be trusted.

Relation to Prior Work

Three papers motivate the gap. Compute Optimal Inference and Provable Amortisation Gap in Sparse Autoencoders proves that a linear-plus-nonlinearity encoder has a strictly nonzero amortisation gap, meaning a loss in code quality relative to the true optimum. On synthetic data, iterative LCA sparse coding is a Pareto improvement over SAEs. On GPT-2 activations, however, its unoptimized LCA scored about 0.60 median automated-interpretability F1, against 0.83 for an MLP encoder. The authors explicitly leave unfolding open.

Evaluating Sparse Autoencoders: From Shallow Design to Matching Pursuit shows that one-shot encoders implicitly assume near-orthogonal features. It unrolls greedy matching pursuit into MP-SAE, one atom per stage, and tests it on vision backbones using reconstruction. MP-SAE is the closest existing work. Our proposal differs in four ways. It updates all coordinates in parallel, so depth is $K$ rather than the sparsity $k$. It optimizes a convex objective that admits a certificate. It targets language models. And it is judged on SAEBench's interventional metrics rather than MSE.

SAEBench: A Comprehensive Benchmark for Sparse Autoencoders in Language Model Interpretability evaluates more than 200 SAEs, all single-pass. It shows that reconstruction fidelity does not predict downstream utility (the "proxy trap"). This constrains us: lower MSE from unrolling proves nothing by itself.

The unfolding literature supplies the method. ALISTA provides decoder-tied analytic weights. Sparse Coding with Gated Learned ISTA proves that thresholded unrolled solvers systematically shrink nonzero coefficients. It adds gain gates to correct this, which matters because SAE activation magnitudes are what gets interpreted and steered. Neurally Augmented ALISTA predicts per-sample thresholds from residual norms with negligible overhead, and we use it as an optional variant. All three are tested only on synthetic compressed sensing or imaging, with known, fixed dictionaries. None examines learned concept dictionaries or interpretability.

The application pressure comes from per-instance solvers used for interpretability and steering. Interpreting CLIP with Sparse Linear Concept Embeddings (SpLiCE) runs LASSO/ADMM per embedding. PaCE: Parsimonious Concept Engineering for Large Language Models runs elastic net per token during generation and trades speed against intervention fidelity. Both show that people already want exact sparse codes and pay for them.

Finally, When Pruning Meets Interpretability: Preserving Sparse Autoencoder Robustness in LLMs shows that fixed shallow SAEs lose up to 60% of spurious-correlation removal (SCR) and up to 80% of targeted probe perturbation (TPP) under 50% magnitude pruning, while KL divergence stays above 0.96. It studies only shallow encoders. That silent failure is our robustness test.

Research Program

We build the unrolled SAE in three variants. The first is tied ISTA ($W = D$). The second adds ALISTA-style coherence-reduced weights, where $W$ is re-derived from $D$ every few thousand steps. The exact quadratic program in ALISTA is too expensive at $m = 16\text{k}$ atoms, so we approximate it with a few gradient steps on $\|W^\top D - I\|$ warm-started from the previous $W$. We report the cost and whether this variant ever beats tied weights. The third adds GLISTA gain gates on the final layer.

The dictionary is trained end-to-end through the $K$ unrolled steps, with $K \in \{2, 4, 8\}$. We control sparsity with the learned thresholds plus a sparsity penalty, and optionally with a top-$k$ at the last layer to match baselines exactly.

The analysis has three parts. First, we measure the amortisation gap of each trained encoder directly. We run FISTA to convergence on the same dictionary and report the code-space distance, support overlap, and duality gap as functions of $K$. Second, we test whether the gap predicts the SAEBench metrics across architectures. This is the question the proxy trap leaves open: whether solver error, rather than reconstruction error, is the variable that matters. Third, we study the certificate. We check whether tokens with large duality gap concentrate the failures that feature-absorption and probing metrics detect, which would make the gap a usable "don't trust this readout" signal for auditors.

Baselines

The naive reference point is a standard TopK SAE of the same dictionary size, trained on the same activations with the same token budget. It is what practitioners actually use, and any added depth must beat it to be worth anything. We also take off-the-shelf Gemma-Scope checkpoints as an external sanity check.

The strongest existing single-pass method on disentanglement is the Matryoshka SAE. SAEBench reports that it improves SCR by 30–40% in specific regimes over other architectures (SAEBench). No absolute SCR value is given in our file, so we will rerun it ourselves at identical dictionary size, layer, and tokens.

The strongest competitor on the amortisation question is the MLP encoder of Compute Optimal Inference and Provable Amortisation Gap in Sparse Autoencoders. It reports median automated-interpretability F1 of 0.83 on GPT-2 Small / OpenWebText, versus about 0.60 for SAEs and LCA sparse coding. We give it hidden width chosen so its encoder FLOPs equal $K$ unrolled steps.

We also run MP-SAE (Evaluating Sparse Autoencoders: From Shallow Design to Matching Pursuit) on language activations, with its sparsity-limited depth reported alongside its FLOPs. No SAEBench or language-model number is reported for it on Lacuna.

All methods get the same activations, the same number of training tokens, a matched sweep of about ten hyperparameter configurations, and the same sparsity range. We compare on a sparsity-versus-metric frontier at matched encoder FLOPs.

The key ablation separates solver structure from joint training. We take a trained TopK SAE's dictionary and run $K$ FISTA steps at test time, which is SAE plus inference-time optimization (ITO). We then compare that against the jointly trained unrolled encoder at the same $K$. Beating the proposal requires that the unrolled SAE improve the mean of SCR, TPP, and absorption over both Matryoshka and the FLOP-matched MLP. The improvement must exceed seed-to-seed spread across three seeds, without losing more than a small margin in loss recovered.

Why not just…?

Why not just use a deeper MLP encoder? This is a real threat. The amortisation-gap paper found the MLP scored better on automated interpretability (0.83) than both SAEs and LCA (around 0.60). The case against it is structural rather than proven. An MLP's codes are not tied to the decoder, carry no certificate, and may exploit shortcuts that look interpretable to GPT-4o but fail interventions. If the FLOP-matched MLP equals the unrolled encoder on SCR, TPP, and the pruning test, we will report that the certificate is the only remaining advantage and narrow our claim accordingly.

Why not just run a few FISTA steps at inference on a standard SAE? This is the SAE-plus-ITO ablation, and it is cheap. Our hypothesis is that it underperforms because the dictionary was learned for a different, one-shot encoder, so the two are mismatched. The analogous sparsity-mismatch effect in TopK SAEs is documented for MP-SAE. If ITO matches joint training, the recommendation becomes "keep existing SAEs, refine codes at audit time." That would still be a useful result, and our pipeline would reveal it directly.

Why not just use MP-SAE? Matching pursuit is greedy and sequential. Its depth grows with the number of active features, and greedy selection is known to commit early to wrong atoms among correlated features. It also has no convex objective, so it offers no gap-based certificate. We run it head-to-head. If it wins on disentanglement despite higher latency, that favors greedy selection over thresholding, and we will say so.

Proposed Experiments

We work on Pythia-160M and Gemma-2-2B middle residual layers using SAEBench's full suite: sparse probing, feature absorption, automated interpretability, loss recovered, WMDP-bio unlearning, RAVEL, SCR on Bias in Bios and Amazon, and TPP. SAEBench takes about 65 minutes per SAE, so the sweep is affordable. We also train on GPT-2 Small / OpenWebText to reproduce the amortisation-gap setting and compare directly against its reported 0.83 and 0.60 medians.

The first decisive check is the frontier comparison: disentanglement metrics as a function of $K$ at matched FLOPs, against Matryoshka, the MLP, MP-SAE, and ITO.

The second is the pruning stress test from When Pruning Meets Interpretability. We prune Gemma-2-2B to 50% with magnitude pruning and with WANDA, calibrating on 128 OpenWebText samples. We then transfer each SAE unchanged and measure SCR and TPP retention in layers 9–17. That paper reports losses of up to 60% for SCR and up to 80% for TPP with magnitude pruning, and 15–25% with WANDA, for shallow SAEs. Our prediction is materially smaller losses for the unrolled encoder, and the duality gap should rise on exactly the tokens where interventions fail.

The third check tests the certificate. We rank tokens by duality gap and check whether discarding the top 5% improves probing accuracy and absorption scores more than discarding a random 5%.

The fourth is a latency measurement against PaCE-style elastic-net decoding. We time per-token concept decomposition, since PaCE's reported 3x speedup over orthogonal projection still relies on an iterative solver. This tells us whether unrolling makes exact-style concept readout cheap enough for use during text generation.

A null result on the first check, if the second and third also fail, would show that inference error is not what limits SAE interpretability. That too is worth knowing.