§14.6–14.7Learning Manifolds with Autoencoders · Contractive Autoencoders

Part III DL pp. 515–522 · ~9 min read

  • tangent plane
  • embedding

§14.6 Learning manifolds with autoencoders

Like many learning algorithms, autoencoders exploit the manifold hypothesis (§5.11.3): data concentrates near a low-dimensional manifold (or a small set of them). But where most algorithms merely behave correctly on the manifold, autoencoders aim to learn its structure.

The key characterization of a manifold is its set of tangent planes : at a point x\boldsymbol{x} on a dd-dimensional manifold, dd basis vectors span the local directions of variation allowed on the manifold — how you can nudge x\boldsymbol{x} infinitesimally while staying on it. The book’s fig 14.6 makes this concrete with a translated MNIST digit: vertical translation traces a 1-D curved manifold through 784-dimensional pixel space, and the tangent vector at each point is an image (which pixels brighten, which darken as the digit shifts). Revisit the geometry interactively — the tangent/normal split below is exactly the concept:

Tangent vs normal, revisited (reused from §7.14) — at each point of a manifold, the tangent direction is the variation that stays ON the manifold, the normal is the direction that leaves it. An autoencoder's representation should respond to the first and ignore the second.
class manifoldtangent vnormalx
Tangent prop: penalize the infinitesimal derivative Ω = (∇ₓf·v)² so f stays flat along the tangent v — without ever visiting a new point.

The classifier should be constant along the tangent (the factor of variation that keeps the class) and free to change along the normal (where the class changes).

The two forces. Every autoencoder training procedure is a compromise:

Reconstruction pulls one way, insensitivity the other

Force 1: learn h\boldsymbol{h} so that training examples can be approximately recovered through the decoder — crucially, only inputs probable under the data distribution need reconstructing. Force 2: satisfy the constraint or penalty, which prefers solutions less sensitive to the input. Either alone is useless (copying teaches nothing; ignoring the input teaches nothing). Together, they mean the autoencoder can only afford sensitivity to variations needed to reconstruct training examples — so if data hugs a low-dimensional manifold, h=f(x)\boldsymbol{h} = f(\boldsymbol{x}) becomes a local coordinate system for the manifold: responsive along tangent directions, indifferent orthogonal to them.

The one-dimensional picture (fig 14.7) shows the compromise vividly — an optimal reconstruction that is invariant near data and steep between:

Fig 14.7 (recreated) — a collection of 0-dimensional “manifolds” (single data points x₀, x₁, x₂). The optimal reconstruction r(x) crosses the dashed identity exactly at each data point with a SHALLOW slope (insensitivity where the data lives), and transitions steeply in between — the large in-between derivative maps corrupted points back onto the nearest manifold. Bottom arrows: the reconstruction direction r(x) − x, always pointing at the nearest data point.
identityoptimal r(x)x0x1x2r(x) − x

Embeddings, and the non-parametric alternative. A representation of a point on (or near) the manifold is its embedding — a vector with fewer dimensions than the “ambient” input space. Early manifold learning was mostly non-parametric: build a nearest-neighbor graph over training examples, associate each node with a tangent plane spanned by the difference vectors to its neighbors, then stitch a global coordinate system by optimization or a linear system — even a density, by tiling the manifold with flat Gaussian “pancakes” (manifold Parzen windows):

Figs 14.8–14.9 (schematic) — non-parametric manifold learning. Left: a nearest-neighbor graph over training examples; each node’s tangent plane comes from difference vectors to its neighbors. Right: tiling the manifold with locally flat Gaussian “pancakes” (large variance along the local tangent, tiny variance orthogonal) whose mixture estimates a density.
tangent from neighborsnearest-neighbor graph (fig 14.8)tiled Gaussian "pancakes" (fig 14.9)

The fundamental difficulty (Bengio & Monperrus 2005): these methods generalize only by interpolating between neighbors. If the manifold is not smooth — many peaks, troughs, twists — you need training examples covering every one. And AI manifolds are like that: watch one pixel xix_i as an image translates, and its value oscillates once per peak of brightness in the template. The complexity of the image’s brightness pattern drives the complexity of the manifold. This is the case for distributed representations and deep learning for manifold capture — parametric encoders that share structure across the whole space instead of memorizing local patches.

§14.7 Contractive autoencoders

The contractive autoencoder (Rifai et al. 2011) regularizes the code h=f(x)\boldsymbol{h} = f(\boldsymbol{x}) explicitly, demanding the encoder’s derivatives be as small as possible:

The contractive penalty (eq 14.18)

Ω(h)=λf(x)xF2\Omega(\boldsymbol{h}) = \lambda \left\lVert \frac{\partial f(\boldsymbol{x})}{\partial \boldsymbol{x}} \right\rVert_F^2
f(x)/x\partial f(\boldsymbol{x}) / \partial \boldsymbol{x}the Jacobian of the ENCODER — the local linear map describing how the code responds to input nudgesd × n
F2\lVert \cdot \rVert_F^2squared Frobenius norm: the sum of squared Jacobian entries — every sensitivity, of every code unit, to every input dimensionscalar
λ\lambdabalances against reconstruction error; the compromise leaves derivatives mostly tiny, with a FEW directions of significant sensitivitystrength

The name is earned: trained to resist input perturbations, the CAE maps a neighborhood of inputs to a smaller neighborhood of codes — it contracts locally. In the linear-operator view, the Jacobian J\boldsymbol{J} at x\boldsymbol{x} approximates ff as linear, and a linear operator is formally contractive if it keeps Jx1\lVert \boldsymbol{J}\boldsymbol{x} \rVert \le 1 for every unit vector — if it shrinks the unit sphere. Watch a 2-D “Jacobian” act on the unit circle — the CAE’s ideal is an ellipse squashed in every direction except the manifold tangent:

The CAE's Jacobian, idealized (reused from §2.7) — a symmetric local linear map applied to the unit circle. Set one eigenvalue below 1 (contracted — perturbations in that direction die in the code) and one slightly above (the surviving direction of sensitivity ≈ the learned manifold tangent). Training drags MOST singular values below 1; reconstruction pressure keeps the largest-local-variance directions alive.
all unit vectors uv⁽¹⁾v⁽²⁾→ A →their images Auλ₁v⁽¹⁾λ₂v⁽²⁾

A = [[1.04, 0.45], [0.45, 0.51]] (symmetric)

class: positive definite

Tangents are what survive the squeeze

Reconstruction error alone → identity (no contraction). The penalty alone → constant features (total contraction). The compromise: derivatives mostly tiny, with a small number of hidden units keeping significant derivatives — and since directions with large Jx\boldsymbol{J}\boldsymbol{x} change h\boldsymbol{h} rapidly, they are the directions the encoder chose to track: approximations of the manifold’s tangent planes. Experimentally most singular values of J\boldsymbol{J} fall below 1; the few that stay above mark the learned tangents. On CIFAR-10 images (fig 14.10), those tangent vectors show object parts moving — heads, legs — and beat local PCA’s tangents because the CAE shares parameters across all locations that share active hidden units, instead of fitting each neighborhood separately.

The DAE sibling. Alain & Bengio (2013): in the limit of small Gaussian input noise, denoising reconstruction error is equivalent to a contractive penalty on the reconstruction function gfg \circ f. In other words: DAEs make the reconstruction resist small-but-finite perturbations; CAEs make the feature extraction ff resist infinitesimal ones. (When pretraining features for a classifier, penalizing ff — as the CAE does — usually beats penalizing gfg \circ f; a contractive penalty on ff also connects to score matching, §14.5.1.) A useful footnote on locality: the CAE is contractive only at training points — globally, two distant inputs can map to codes farther apart, and ff plausibly expands in the gaps between manifolds (recall fig 14.7’s steep segments). With sigmoidal code units, an easy way to shrink the Jacobian is to saturate — so CAEs tend toward near-binary codes spread across the hypercube’s corners.

Two practical issues. Deep CAEs make the Jacobian penalty expensive; Rifai et al. instead train a stack of single-layer CAEs, each reconstructing the previous layer’s code, and compose them — not identical to a joint deep penalty, but locally contractive layer by layer, hence contractive as a whole. And the penalty has a degenerate escape: an encoder that just multiplies by a tiny ϵ\epsilon (with a decoder dividing by ϵ\epsilon) drives Ω(h)0\Omega(\boldsymbol{h}) \to 0 while reconstructing perfectly — having learned nothing. The fix is to tie the weights: both ff and gg are affine layers with elementwise nonlinearities, so set gg‘s weight matrix to the transpose of ff‘s and the rescaling cheat becomes impossible.

Next: a parametric encoder trained to predict the outcome of sparse-coding inference, and where autoencoders earn their keep in practice — predictive sparse decomposition & applications.

Check yourself — manifolds & contractive autoencoders

1.Every autoencoder training procedure balances two forces. Which pair — and why does either alone fail?

2.Predict the outcome — in fig 14.7's 1-D picture, what does the optimal reconstruction function's DERIVATIVE look like?

3.Why do non-parametric neighbor-graph manifold methods struggle on AI-scale problems?

4.What exactly does the CAE penalize, and what do the surviving large-derivative directions mean?

5.Encoder f(x) = εx, decoder g(h) = h/ε: as ε → 0 this drives Ω(h) → 0 with PERFECT reconstruction. How is the cheat blocked?

6.DAE vs CAE — whose perturbations, and of what size?

6 questions