Manuscript Offprint

arXiv:2610.07389

Inference and learning in sparse autoencoders as natural gradient flow

Hadi Vafaii, Tejas Rao, David Chanin, Thomas Fel, Jacob L. Yates, Bruno Olshausen, David Klindt, Dileep George, Miguel Lázaro-Gredilla

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Sparse autoencoders are widely used to uncover interpretable features in neural networks, yet reliable recovery remains difficult when features overlap or activate infrequently. These challenges involve both inferring which features explain an input and learning the dictionary that represents them. Here, we unify inference and dictionary learning as natural-gradient flows on a shared variational free energy. We instantiate this framework as BeFOND, an encoder-free sparse coding model with closed-form inference and learning dynamics. We show how recurrent explaining away reduces interference between overlapping features, while Fisher preconditioning can compensate for the slow learning of rare features. On synthetic data, BeFOND improves dictionary recovery and rare-feature detection, with a growing advantage over amortized baselines as superposition increases. On language-model activations, it improves single-feature concept detection and selective intervention, outperforming pretrained reference SAEs with substantially less training data. Its feature quality continues to improve with dictionary width, whereas the evaluated baselines largely plateau. Together, these results show how improving inference and learning within a unified probabilistic framework can make better use of data and dictionary capacity to interpret and intervene on neural representations.

1 INTRODUCTION

Sparse autoencoders (SAEs) infer sparse representations of data in terms of a learned, overcomplete dictionary of features. Their roots lie in sparse coding (Olshausen & Field, 1996; Lewicki & Sejnowski, 2000), motivated by the organization of sensory representations in biological systems (Olshausen & Field, 1997; 2004). SAEs have since become central in interpreting neural network representations (reviewed in Klindt et al., 2026), especially those of language models (Yun et al., 2021; Bricken et al., 2023; Cunningham et al., 2024; Templeton et al., 2024; Gao et al., 2025).

Despite these successes, SAEs face challenges in both inference and dictionary learning. Standard SAEs use a trained neural network to perform one-pass inference—known as amortized inference—which can struggle to disentangle overlapping features in superposition (O'Neill et al., 2025). But improving inference alone is insufficient. In controlled experiments, Barin-Pacela et al. (2026) identified dictionary learning as the bottleneck: replacing an SAE's encoder with iterative inference on the same learned dictionary failed to close the feature-recovery gap. These problems are coupled during training: the dictionary determines which explanations of the data are available, while inferred feature activations shape the learning signal used to update the dictionary. Therefore, inference errors can compromise dictionary learning, and a poor dictionary can limit what inference can recover.

Unlike standard SAEs, classical sparse coding methods typically perform inference through iterative, per-sample optimization (Rozell et al., 2008; Gregor & LeCun, 2010). More recently in this lineage, Vafaii et al. (2025) introduced the Free-energy Online Natural-gradient Dynamics (FOND) framework, which formulates inference as natural-gradient flow on variational free energy. FOND's guiding principle is to respect the intrinsic geometry of the statistical manifold: updates are measured by their effect on the represented probability distribution through the Fisher information metric (Amari, 1998; Martens, 2020; Khan & Rue, 2023). However, FOND did not address learning through the same

SAEBench with Gemma-2-2B, layer 12 residual

Amortized inference: BatchTopK Matryoshka JumpReLU (Gemma Scope) Iterative variational inference: Mean-field + Adam BeFOND (ours)

a Training dynamics (524k models)

b Final performance

Figure

Tokens processed

Dictionary width

C Training dynamics (524k models)

d Final performance

Tokens processed

Dictionary width

Figure 1: Feature quality and sample efficiency on Gemma-2-2B activations. a,c: Training dynamics at 524k width. b,d: Final performance across dictionary widths. Details in section 5.

geometric principle. Its generative model parameters were learned by backpropagating through the inference trajectory, with the associated computational and memory costs.

Here, we extend this principle to learning. Just as inference follows natural-gradient flow on free energy with respect to variational parameters, we define learning as natural-gradient flow on the same objective with respect to generative parameters. Both processes thus respect the statistical geometry of the distributions they update. We instantiate this extended FOND framework as BeFOND: an encoder-free iterative SAE with Bernoulli latents, a factorized prior, and a linear Gaussian decoder. We derive closed-form expressions for its inference and learning dynamics, allowing the dictionary to be learned without backpropagating through the inference trajectory.

On the inference side, BeFOND implements explaining away through recurrent interactions between overlapping features, enabling lateral competition leading to sparse, disentangled representations. We isolate the contribution of these interactions and show that they become increasingly important as feature superposition increases. On the learning side, we show how infrequent activation slows Euclidean dictionary learning. We prove that Fisher preconditioning removes this frequency dependence, giving rare and common features the same local learning rate. Motivated by this result, we hypothesize that Fisher preconditioning would improve rare-feature recovery in BeFOND. Empirically, BeFOND learns more accurate dictionaries and detects rare features with few misses or false positives, while using substantially fewer training samples than SAE baselines and Euclidean ablations.

We evaluate BeFOND on synthetic data with known ground-truth features using SynthSAEBench (Chanin & Garriga-Alonso, 2026), and on language-model representations using SAEBench (Karvonen et al., 2025). Baselines include amortized SAEs—BatchTopK (Bussmann et al., 2024), Matryoshka BatchTopK (Bussmann et al., 2025), and JumpReLU (Rajamanoharan et al., 2024b)—and an iterative mean-field variational baseline with Adam decoder learning (Kingma & Ba, 2015).

On Gemma-2-2B layer-12 activations, BeFOND outperforms all evaluated baselines on both sparse probing (Kantamneni et al., 2025) and RAVEL disentanglement (Huang et al., 2024). BeFOND's performance continues to improve as we increase dictionary width from 16k to 524k latents, whereas the baselines plateau (Fig. 1b,d). These gains also emerge with substantially less training data: at a dictionary width of 524k, BeFOND matches the evaluated Gemma Scope JumpReLU checkpoints (Lieberum et al., 2024) in sparse probing after just ~6M training tokens, compared with the 8B tokens used to train those checkpoints, achieving over 1,000× reduction in training tokens (Fig. 1a).

Summary of our contributions and paper outline:

(1) We review necessary background (section 2). We then extend FOND (Vafaii et al., 2025) to unify inference and learning as natural-gradient flows on variational free energy, instantiate it as Bernoulli-distributed BeFOND, and derive its dynamics in closed-form (section 3 and section B).

(2) We analyze BeFOND’s recurrent “explaining away” (section 4.1) and use ablations to establish its contribution to feature recovery under increasing superposition (section C.3.1).

(3) We characterize how Fisher preconditioning in BeFOND’s learning rule compensates for feature rarity (section 4.2), and test its consequences for dictionary learning through theoretical analysis (theorem 4.2), synthetic experiments, and optimizer ablations (sections C.3.2, C.4 and C.5).

(4) We evaluate BeFOND on language-model representations, examining feature quality, sample efficiency, and scaling with dictionary width (section 5).

References (71)