                                                 Sparse Autoencoders, Again?



We answer such questions in the affirmative based on the ob-          2.1. Canonical SAE Formulation

servation that both SAE and VAE designs have notable unre-

                                                                      Suppose we collect d-dimensional data points x ∈ X ⊆

solved, yet distinct, shortcomings. While details will be de-           d

ferred to Section 2, we summarize here that SAEs generally            R drawn from some probability measure ω such that

                                                                      R

                                                                       X

                                                                          ω(dx) = 1. Like traditional autoencoders (Bourlard

rely on multiple hyperparameters and potentially-nonconvex

                                                                      & Kamp, 1988; LeCun, 1987; Rumelhart et al., 1986), an

regularization factors that complicate both training and the

                                                                      SAE model is composed of an encoder that maps samples

interpretation of the latent representations produced by the

                                                                      x to a latent representation z ∈ Rκ , and a decoder that sub-

encoder. In contrast, VAEs benefit from a hyperparameter-

                                                                      sequently attempts to reconstruct x from z. These modules

free and smoother loss surface, but are presently ill-equipped

                                                                      are instantiated as functions given by µz ( · ; ϕ) : X → Rκ

to produce adaptive sparse representations like the SAE.

                                                                      and µx ( · ; θ) : Rκ → Rd respectively, with     the goal of

With this backdrop in mind, our contributions herein are

                                                                      learning parameters {θ, ϕ} such that x ≈ µx µz (x; ϕ); θ

encapsulated as follows:

                                                                      for all x ∈ X .1

                                                                      What differentiates SAEs from regular auto-encoders (AEs)

 • Algorithmic: Although both SAE and VAE models can                  is that, in addition to seeking an encoder-decoder pairing

   reconstruct data using sparse encoder representations,             capable of accurately reconstructing data samples, we also

   we carefully detail their disjoint strengths and weak-             favor latent representations z = µz (x; ϕ) that are sparse

   nesses in Section 2; subsequently we propose a hybrid              (Goodfellow et al., 2016; Ng, 2011; Ranzato et al., 2006;

   VAE-like approach in Section 3 that delivers the best of           2007). More formally, we ideally seek ∥z∥0 ≪ κ (or at

   both worlds. We refer to our model as VAEase, for an               least approximately so), where ∥ · ∥0 denotes the ℓ0 -norm

   easy-to-apply VAE with adaptive sparse estimation.                 that counts the number of nonzero elements in a vector. To

                                                                      operationalize this preference, SAE models are generally

 • Theoretical: In Section 4 we rigorously prove that for             trained with a loss in the form LSAE (ϕ, θ) :=

   data residing on a union of low-dimensional manifolds,                Z n

                                                                                          2             o

   globally-optimal VAEase solutions can provably recover                        x − µx z; θ     + λ1 h(z) ω(dx) + λ2 ∥θ∥22 (1)

                                                                             X                     2

   the underlying manifold structure, adapting to multiple

   distinct manifolds, unlike existing VAEs. Likewise, we             or a variant thereof, subject to z = µz (x; ϕ). In this ex-

   demonstrate simple illustrative settings whereby VAEase            pression, h : Rκ → R serves as a penalty designed to

   maintains fewer local minima relative to an analogous              approximate the ℓ0 norm while maintaining differentiability

   deterministic SAE model.                                           almost everywhere for trainingPpurposes. Candidates for

                                                                      h include the ℓ1 norm h(z) = j P      |zj | (the tightest convex

                                                                      relaxation to ℓ0 norm) or h(z) = j log(|zj | + ϵ) where

 • Empirical: Finally, we present complementary exper-

                                                                      ϵ > 0 is a small constant (Candes et al., 2008; Fazel et al.,

   iments in Section 5 that show VAEase outperforms ex-

                                                                      2003); there exist many other approximation possibilities

   isting SAE and VAE architectures, as well as related

                                                                      as well (Chen et al., 2017; Fan & Li, 2001; Palmer et al.,

   diffusion models, across tasks such as estimating mani-

                                                                      2006). However, a consequence of all these approximation

   fold dimensions or maximally sparse representations of

                                                                      candidates is the inevitable introduction of a scaling ambi-

   large language model activations.

                                                                      guity, whereby elements of z can be pushed arbitrarily close

                                                                      to zero, while a targeted subset of θ can be proportionately

We conclude this section by emphasizing that, although                increased towards infinity to compensate, such that the over-

our proposed approach explicitly relies on a variational              all decoder reconstruction is unchanged. The penalty term

chassis, the work itself as a whole is not directly related to        ∥θ∥22 in (1) is included to prevent this sort of degeneracy and

generative modeling per se, the original purpose for which            ensure that h induces non-trivial sparsity; see Appendix A.1

VAEs were designed. Instead, we are repurposing specific              for further details. A similar effect can be accomplished by

VAE attributes for new sparse autoencoding tasks.                     adding explicit constraints on the norm of θ during training

                                                                      (Cunningham et al., 2024) or allowing only the top k values

                                                                      of z to be nonzero (Gao et al., 2024; Makhzani & Frey,

2. Basics of Sparse Autoencoding                                      2013), although these approaches are effectively substitut-

In this section we will first present a broad SAE formulation         ing one form of hyperparameter for another. And finally,

covering typical use cases. Later, we will demonstrate how            we note that λ1 and λ2 in (1) are non-negative trade-off pa-

VAEs can be leveraged for similar purposes, before con-               rameters balancing regularization effects and reconstruction

cluding with a brief contextualization w.r.t. related diffusion       error.

models, as have recently been applied to learning manifold            1

                                                                          We remark that the range of µx need not be X exactly, and perfect

dimensions.                                                               reconstructions will not necessarily be feasible at all times.



                                                                  2

