                                                                Sparse Autoencoders, Again?



                                                                                2.2. Alternative Variational Routes to SAE

                                                                                Although originally proposed as a form of deep genera-

                                                                                tive model for drawing new synthetic samples that approxi-

                                                                                mately follow the ground-truth measure ω, it has recently

                                                                                been shown that VAEs (Kingma & Welling, 2014; Rezende

                                                                                et al., 2014) can actually be repurposed to handle sparse au-

                                                                                toencoding tasks (Dai et al., 2021). Broadly speaking, VAE

                                                                                models can be viewed as stochastic autoencoders, whereby

                                                                                the corresponding encoder and decoder modules now define

                                                                                distributions over z and sample reconstructions respectively.

                                                                                For models of continuous data (our focus), these distribu-

                 Dark colors = Adaptive Sparse Representation

                   All colors = Fixed Sparse Representation

                                                                                tions are commonly expressed as

                                                                                                                                   2 

Figure 1: Fixed vs. adaptive sparsity. Depicted are two

                                                                                                                          

                                                                                      qϕ (z|x) = N z µz [x; ϕ], diag σ z (x; ϕ)

manifolds {M1 , M2 } with dim[M1 ] = dim[M2 ] = 2,                                                                     

and data points x1 ∈ M1 and x2 ∈ M 2 . Adaptive sparse                                pθ (x|z) = N x µx [z; θ], γI ,                      (2)

representations require only two informative/active latent

dimensions for either x1 or x2 (the dark colored elements of                    where the functions µz and µx now serve as encode-decoder

{z1 , z2 } which vary across samples). Meanwhile, fixed                         mean networks, while σ z (upon squaring) defines a corre-

sparse representations involve shared active dimensions                         sponding variance network. In accordance with typical

across all samples (the union of dark and light elements).                      use cases, the decoder variance is defined by a single pa-

                                                                                rameter γ > 0, which may be trained along with other

                                                                                parameters. The corresponding VAE objective is given by

SAE Advantages: After suitable training, the SAE for-                           LVAE (θ, ϕ) :=

mulation from (1) is quite powerful, capable of producing                       Z n

                                                                                                                              o

sparse representations of input samples drawn from ω. In                             −Eqϕ (z|x) log pθ (x|z) +KL qϕ (z|x)||p(z) ω(dx)

                                                                                 X

particular, a trained SAE can exhibit what is known as adap-                                                                                  (3)

tive or dynamic sparsity (Ponti & Martins, 2024), whereby                       with p(z) = N (z|0, I); the first term above represents

the support pattern (meaning location of nonzero elements)                      a reconstruction factor analogous to the first term in (1),

of a given latent code z can vary for different input sam-                      while the latter KL term enacts VAE-specific regularization.

ples x. See Figure 1 for an illustration. This flexibility is                   Notably, for any encoder       distribution qϕ (z|x), it follows

critical because, as we will further detail in Section 4, it

                                                                                                          R

                                                                                that LVAE (θ, ϕ) ≥ − X log pθ (x)ω(dx), with equality iff

allows the SAE encoder to differentiate samples that lie on                     qϕ (z|x) = pθ (z|x) almost surely. Using a simple reparam-

distinct manifold structures (as frequently encountered in                      eterization trick, it is possible to directly minimize (3) using

practice (Brown et al., 2022)), or expand and contract the                      SGD (Kingma & Welling, 2014; Rezende et al., 2014).

number of nonzero latent dimensions in accordance with

sample-specific manifold complexity. As a representative                        The stochastic VAE design obscures its ability to behave

example, the images of MNIST hand-written digits ‘1’ may                        as a sparse autoencoder, and indeed, the mechanism for

generally require fewer degrees-of-freedom to reconstruct                       pruning unneeded dimensions of the latent space is dis-

than an observably more complex digits ‘8’.                                     tinct from canonical SAEs. While we defer details to prior

                                                                                work, the crux of the idea is that superfluous dimensions

                                                                                of z are flooded with uninformative white noise that is sub-

SAE Disadvantages: On the downside, minimizers of                               sequently filtered by the decoder to avoid compromising

(1) will typically be sensitive to the selection of λ1 and λ2 ,                 accurate reconstructions. Mathematically, we have that

as well as the specific curvature of h. And for the latter,                     qθ (zj |x) ≈ N (zj |0, 1) for unneeded dimension j, which

tighter approximations to the ℓ0 norm are relatively more                       in the sequel we will refer to as an inactive dimension.

difficult to optimize, with potentially numerous suboptimal                     This is in contrast with a so-called active dimension j ′

local minimizers introduced in tandem with highly noncon-                       used to support reconstruction, which      is characterized by

vex penalties. Meanwhile, looser approximations such as                         qθ (zj ′ |x) ≈ N zj ′ |µz (x; ϕ)j ′ , O(γ) . Because under rele-

the ℓ1 norm, although easier to minimize, may not gener-                        vant circumstances the optimal decoder variance will satisfy

ate optimally sparse latent representations. Hence for a                        γ → 0 during training, there exists a nearly deterministic

given reconstruction error, ∥z∥0 may be significantly larger                    pathway for producing arbitrarily accurate VAE reconstruc-

compromising interpretability. Appendix A.3 provides an                         tions using these active dimensions (Dai et al., 2021; Zheng

illustrative example of this contrast.                                          et al., 2022).



                                                                            3

