Papers
Topics
Authors
Recent
Search
2000 character limit reached

Spike-and-Slab Sparse Coding (S3C)

Updated 25 February 2026
  • Spike-and-Slab Sparse Coding (S3C) is a probabilistic latent variable model that combines spike-and-slab priors with directed sparse coding to control sparsity and amplitude.
  • It employs a structured variational EM procedure with parallel, GPU-friendly updates to efficiently learn features and decompose signals.
  • S3C achieves competitive performance in low-label and transfer learning scenarios, demonstrating state-of-the-art accuracy in image classification tasks.

Spike-and-Slab Sparse Coding (S3C) is a probabilistic latent variable model combining spike-and-slab priors with a directed sparse coding architecture. It forms a highly regularized framework for unsupervised feature learning and signal decomposition, enabling decoupled control over sparsity and magnitude of latent activations. S3C has been demonstrated to provide state-of-the-art feature representations, especially in low-label and transfer-learning regimes, and admits scalable variational inference procedures well-suited for GPU acceleration (Goodfellow et al., 2012, Goodfellow et al., 2012).

1. Generative Model: Architecture and Priors

S3C models observed data vectors xRDx \in \mathbb{R}^D as generated by NN latent "spike-and-slab" units. For each factor i=1,,Ni=1,\dots,N:

  • Spike prior: Each spike variable zi{0,1}z_i \in \{0,1\} is drawn independently from a Bernoulli,

p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),

with σ()\sigma(\cdot) denoting the logistic sigmoid and bib_i a learned bias.

  • Slab prior: Given ziz_i, the real-valued slab hiRh_i \in \mathbb{R} is Gaussian:

p(hizi)={N(hiμi,αi1)if zi=1 N(hi0,αi1)if zi=0p(h_i \mid z_i) = \begin{cases} \mathcal{N}(h_i \mid \mu_i, \alpha_i^{-1}) & \text{if } z_i=1 \ \mathcal{N}(h_i \mid 0, \alpha_i^{-1}) & \text{if } z_i=0 \end{cases}

where NN0 is the slab mean (when the spike is active) and NN1 is precision.

  • Observation model: The visible data is generated as

NN2

where NN3 is a dictionary, NN4 denotes elementwise product, and NN5 is the noise precision (often isotropic or diagonal).

The full joint is

NN6

The spike variable NN7 gates the contribution of NN8 to reconstruction, yielding strict control over sparsity, while the slab provides amplitude modulation (Goodfellow et al., 2012, Goodfellow et al., 2012).

2. Approximate Inference: Structured Variational EM

Exact posterior inference for NN9 is intractable due to the explaining-away interactions among spikes. S3C employs a structured mean-field variational posterior of the form

i=1,,Ni=1,\dots,N0

where i=1,,Ni=1,\dots,N1 is tightly coupled, but factors across i=1,,Ni=1,\dots,N2. The optimal form is given by

i=1,,Ni=1,\dots,N3

with i=1,,Ni=1,\dots,N4 and i=1,,Ni=1,\dots,N5 as variational parameters.

Fixed-point updates for these parameters are:

  • Slab-mean update:

i=1,,Ni=1,\dots,N6

  • Spike-probability update:

i=1,,Ni=1,\dots,N7

with residual i=1,,Ni=1,\dots,N8 (Goodfellow et al., 2012). Updates employ parallelization, damping, and clipping for numerical stability—enabling fully vectorized GPU implementations (Goodfellow et al., 2012).

3. Learning: Parameter Estimation via Variational EM

Parameters i=1,,Ni=1,\dots,N9 are learned by maximizing the variational lower bound (evidence lower bound, ELBO) via variational EM:

  • E-step: Run the above fixed-point updates to obtain variational parameters zi{0,1}z_i \in \{0,1\}0 for each data point.
  • M-step: Maximize the expected complete-data log-likelihood

zi{0,1}z_i \in \{0,1\}1

Closed-form updates exist for zi{0,1}z_i \in \{0,1\}2, zi{0,1}z_i \in \{0,1\}3, zi{0,1}z_i \in \{0,1\}4, zi{0,1}z_i \in \{0,1\}5, zi{0,1}z_i \in \{0,1\}6, though in practice small gradient steps are often preferred for stability (Goodfellow et al., 2012).

  • zi{0,1}z_i \in \{0,1\}7 is updated (with column normalization) via:

zi{0,1}z_i \in \{0,1\}8

Analogous analytic updates are provided for noise, biases, and slab parameters.

The E- and M-steps are alternated until convergence. Convergence in the E-step typically requires only a small number of parallel iterations (Goodfellow et al., 2012, Goodfellow et al., 2012).

4. Computational Scalability and Parallel Inference

S3C's GPU-adapted variational inference is based on fully parallel updating of all spike and slab parameters, with per-variable damping and sign-flip clipping. Each E-step iteration consists of batched matrix-vector operations and non-linearities, decomposing into parallelizable BLAS calls (Goodfellow et al., 2012, Goodfellow et al., 2012). The algorithmic structure is:

  • Initialize zi{0,1}z_i \in \{0,1\}9 and p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),0.
  • For p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),1 iterations:

    1. Compute p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),2 for all p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),3 in parallel, apply clipping and damping.
    2. Compute p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),4 for all p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),5 in parallel, apply damping.

This approach allows scaling to thousands of latent factors (up to p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),6 demonstrated), tens of millions of image patches, and large batch feature extraction (Goodfellow et al., 2012).

5. Applications: Feature Discovery and Classification Performance

S3C is principally used as an unsupervised feature learner for image classification, transfer learning, and semi-supervised learning scenarios (Goodfellow et al., 2012, Goodfellow et al., 2012). The standard processing pipeline on images is:

  1. Extract normalized, whitened patches (e.g., p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),7).

  2. Run S3C variational inference per patch to obtain p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),8 activations.
  3. Pool activations spatially on a coarse grid (e.g., p(zi=1)=σ(bi),p(zi=0)=1σ(bi),p(z_i=1) = \sigma(b_i), \qquad p(z_i=0) = 1-\sigma(b_i),9), yielding high-dimensional feature vectors.
  4. Train a linear SVM on pooled features for classification.

On CIFAR-10, S3C with 3x3 pooling and σ()\sigma(\cdot)0 factors achieved σ()\sigma(\cdot)1 accuracy, competitive with state-of-the-art sparse coding (σ()\sigma(\cdot)2) and outperforming spike-and-slab RBMs (σ()\sigma(\cdot)3). On the "self-taught" Transfer-Learning Challenge, S3C won the competition with σ()\sigma(\cdot)4 accuracy using only 120 labels and 100,000 unlabeled samples (Goodfellow et al., 2012). In low-label regimes, S3C outperforms both raw-pixel and logistic models due to flexible regularization.

S3C combines gated continuous latents (from sparse coding) with the explicit spike-and-slab prior (from spike-and-slab RBMs), providing independent control of sparsity (via σ()\sigma(\cdot)5) and scale (via σ()\sigma(\cdot)6, σ()\sigma(\cdot)7). As a directed model, S3C features a tractable partition function, avoiding the intractability of undirected models like RBMs and enabling efficient variational inference. The variational E-step captures some, though not all, posterior dependencies (“explaining-away” among spikes), surpassing fully factored mean-field approaches in tasks such as source separation and denoising (Sheikh et al., 2012, Lücke et al., 2011).

In contrast, MAP or greedy algorithms often employ convex relaxations (e.g., LASSO) or combinatorial support selection (as in adaptive ADMM methods), but do not model the full latent uncertainty structure of S3C (Bayisa et al., 2018).

7. Extensions and Empirical Observations

Empirical studies show the truncated EM approach—where the posterior is truncated to the most probable spike patterns—outperforms factored variational inference, particularly under high noise or for highly non-orthogonal dictionaries, due to its better approximation of multi-modal and correlated posterior mass (Sheikh et al., 2012). S3C continues to improve with increased latent dimensionality, unlike standard factored methods where performance often saturates or degrades.

Experiments on source separation, denoising, and image classification consistently demonstrate the value of the spike-and-slab framework in inducing both accurate and highly sparse representations (Goodfellow et al., 2012, Sheikh et al., 2012). The model's GPU-friendly inference and scalability enable applications to modern large-scale recognition and transfer-learning challenges (Goodfellow et al., 2012).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Spike-and-Slab Sparse Coding (S3C).