Theory & Frontiers/Deep Equilibrium Models

Lesson 7.52,002 words

Deep Equilibrium Models

A deep network need not be a fixed stack of layers; it can be a single weight-tied layer iterated to convergence, its output defined implicitly as the fixed point z=fθ(z,x)z^\star = f_\theta(z^\star, x). The forward pass becomes root-finding and the backward pass becomes implicit differentiation, so training costs O(1) memory regardless of effective depth.

╌╌╌╌

Every architecture so far has been a recipe: an ordered list of layers, each applied once, the output read off the top of the stack. A residual block, an LSTM cell, a transformer block — all are functions you run. A deep equilibrium model (DEQ) instead defines a layer not by what it computes but by a condition its output must satisfy, and lets a black-box solver find whatever output meets the condition.1

A layer that calls itself

Take a single weight-tied transformation (one layer's worth of parameters, conditioned on the input ) and apply it over and over to its own output. If the iteration settles, it settles at a point that the layer maps to itself.

This describes an infinite-depth weight-tied network run to convergence. Stack the same block times and you compute ; as , if the iteration converges, independent of . The infinitely deep stack and the self-referential layer are two descriptions of one object.

As , a weight-tied stack collapses into one self-referential block whose output feeds back into itself: the fixed point .

The payoff is structural. A conventional -layer net stores sets of activations for the backward pass; the DEQ stores one, at any effective depth — provided we can solve and differentiate the fixed-point condition, which is the rest of this lesson.

Forward pass = root-finding

Finding is solving a nonlinear system. Rearrange the fixed-point condition into a residual whose zero is the equilibrium:

Any root-finder applies. The simplest is fixed-point iteration (literally re-running the layer), which converges when is a contraction.2

The contraction constant is governed by the Jacobian of : the iteration converges locally when the spectral radius , where evaluated near . Each step of plain fixed-point iteration multiplies the error by roughly , so convergence is linear and can be slow when is close to .

For example, take the one-dimensional layer , a contraction with . Its fixed point solves , so . Start at and iterate:

step error ratio to previous

The error halves every step, exactly the predicted geometric decay : reaching a tolerance of takes about steps (). Now sharpen the map to , still a contraction but with . Its fixed point is as well, but the error now shrinks by only per step, so the same tolerance needs about iterations — two orders of magnitude slower. This is why the slope of the map at , not just the fact that it is below , decides whether plain iteration is practical, and why the Newton and Broyden solvers below justify their extra per-step cost.

Cobweb plot of : the iterate spirals into the fixed point where meets , converging when the slope .

Plain iteration is rarely the fastest route. Treating as a general root-finding problem licenses quasi-Newton solvers (Newton and Broyden) that use (an approximation of) the Jacobian to take superlinear steps.3 The forward solver is genuinely a black box: the rest of the model needs only a point that satisfies the residual to tolerance, however it was found.

SolverUpdatePer-step costConvergence
Fixed-point iterationone layer evallinear, rate
Newtonsolve a linear systemquadratic (local)
Broyden, low-rank updatesuperlinear
Forward-solve convergence: plain fixed-point iteration decays linearly (error per step) while Broyden/Newton bend to superlinear, reaching tolerance in far fewer layer evals.
Algorithm:DEQForward(fθ,x,z0,tol)\textsc{DEQForward}(f_\theta, x, z_0, \texttt{tol}) — solve for the fixed point
  1. 1
    zz0z \gets z_0
    any initial guess, e.g. zeros
  2. 2
    repeat
  3. 3
    znextfθ(z,x)z_{\text{next}} \gets f_\theta(z, x)
    re-run the weight-tied layer (or a Newton/Broyden step)
  4. 4
    rznextzr \gets \norm{z_{\text{next}} - z}
    residual norm
  5. 5
    zznextz \gets z_{\text{next}}
  6. 6
    until rtolr \le \texttt{tol}
    converged to the equilibrium
  7. 7
    return zz
    this is zz^\star

Backward pass = implicit differentiation

To train the DEQ we need — how the equilibrium moves when the weights move. The naive route is to backprop through every solver iteration, storing each intermediate ; that destroys the memory advantage and ties the gradient to an arbitrary solver trajectory. The implicit function theorem lets us skip the solver entirely and differentiate the condition instead.4

The fixed point satisfies as an identity in . Differentiate both sides with respect to any quantity , whether or the input , and apply the chain rule, remembering that itself depends on :

Collect the terms on the left and factor:

This is a closed form for the layer's Jacobian that mentions only the fixed point and the local Jacobian — not a single solver iterate. The matrix is invertible exactly when , the same condition that made the forward pass converge.

For example, return to from the forward-pass trace, but read as a parameter: with , whose fixed point is . Here and , so the implicit-gradient formula gives

Check it directly: , so . The implicit formula and the explicit derivative agree exactly, and the factor is precisely the that a naive one-step derivative would miss — it accounts for the fact that changing moves the whole equilibrium, not just one application of . In many dimensions this scalar reciprocal becomes the matrix inverse , and the same the equilibrium shifts too correction is what the adjoint solve below recovers without ever forming that inverse.

In practice we never form : it is a huge dense matrix. We need only a vector–Jacobian product: the upstream gradient times the inverse. Define the adjoint by

which is itself a fixed-point equation — solvable with the same black-box solver used in the forward pass, since acts on a vector through one reverse-mode autodiff call on .5 Once is found, every parameter gradient is the cheap product .

Algorithm:DEQBackward(fθ,z,x,v)\textsc{DEQBackward}(f_\theta, z^\star, x, v) — implicit gradient via an adjoint solve
  1. 1
    uvu \gets v
    initialize the adjoint, v=L/zv = \partial \mathcal{L} / \partial z^\star
  2. 2
    repeat
  3. 3
    unextv+vjp(fθ,z,u)u_{\text{next}} \gets v + \textsc{vjp}(f_\theta, z^\star, u)
    vjp\textsc{vjp} computes JfTuJ_f^{T} u by one autodiff call
  4. 4
    runextur \gets \norm{u_{\text{next}} - u}
  5. 5
    uunextu \gets u_{\text{next}}
  6. 6
    until rtolr \le \texttt{tol}
    adjoint fixed point reached
  7. 7
    return uTfθ/θu^{T}\,\partial f_\theta / \partial \theta
    parameter gradient
Two-phase training: a forward root-solve returns the equilibrium and a backward adjoint solve yields the gradient, neither phase storing solver iterates.

Explicit deep net vs DEQ

The two designs compute related functions but the cost of depth falls in different places. The explicit net spends memory (one activation buffer per layer) and parameters (one weight set per layer); the DEQ spends solver iterations at run time and stores only a single equilibrium.

PropertyExplicit deep netDEQ
Depthfixed layerseffectively infinite (run to convergence)
Parameters distinct weight setsone weight-tied
Forward cost layer evalsvariable: solver iterations to tolerance
Training memory — store every activation — store only
Backward passbackprop through stored layersimplicit diff: one adjoint solve
Depth–memory couplinglinear (deeper more memory)decoupled (depth is free)
Training memory: the explicit net stores every layer's activation for backprop, while the DEQ keeps only , one buffer regardless of effective depth.

Convergence in practice

Because the forward pass is a solver, training surfaces a diagnostic the explicit net never had: the residual , which a healthy DEQ drives toward zero each step. A residual that stalls or grows signals — the layer is not contractive, the fixed point is not being reached, and gradients computed from a non-equilibrium are wrong. Stabilizing (via spectral normalization or a Jacobian regularizer) is the central engineering concern.

Residual versus solver iteration: a contractive layer decays geometrically to tolerance, while a non-contractive one stalls.

Tradeoffs and uses

The DEQ gains constant memory and infinite effective depth at the cost of solver time and stability:

GainCost
training memory regardless of depthforward/backward each run an iterative solver
infinite effective depth from one weight setwall-clock cost varies with input difficulty
decoupling depth from parameter countrequires ; can diverge if not
a single uniform module to tunegradients invalid if the solver hasn't converged

The natural fit is settings where depth helps but memory is the bottleneck and a single repeated transformation is a reasonable inductive bias: sequence models (a weight-tied recurrence iterated to equilibrium) and graph models (message passing run to a steady state over the graph). In both, a DEQ matches the accuracy of a deep explicit stack while training within a fixed memory budget.

Implicit layers as a family

DEQ is one member of a broader implicit-layer family, all of which replace run these operations with return the output satisfying this condition, and all of which train through the condition rather than the computation. The public literature gives three landmarks.

Deep equilibrium models (Bai, Kolter & Koltun, 2019) introduced the construction above and showed a single weight-tied DEQ block matches deep transformers and weight-tied LSTMs on sequence tasks at constant memory. The follow-up multiscale DEQ (Bai, Koltun & Kolter, 2020) drove a single implicit block to competitive ImageNet accuracy by solving for equilibria at several resolutions at once, evidence that the constant-memory trick scales beyond toy settings.

The open problem noted above — that nothing guarantees , so the solver can diverge — is what monotone DEQ (Winston & Kolter, 2020) addresses. By parameterizing the layer so the residual operator is provably monotone, it guarantees a unique fixed point and a convergent solver by construction, trading a little expressiveness for a stability certificate. This is the DEQ analogue of the certified defenses from adversarial robustness: prove the property rather than hope for it.

The closest cousin is the neural ODE (Chen et al., 2018), which takes the opposite limit of the same idea. Where a DEQ is a weight-tied layer iterated to a fixed point, a neural ODE is a residual block whose step size shrinks to zero, so the forward pass integrates and the backward pass solves an adjoint ODE — again memory, again differentiating a solver rather than storing its trace. Fixed-point equations and differential equations are two routes to the same infinite effective depth.

Implicit modelOutput defined byForward solverBackward
DEQfixed point root-find (Broyden/Newton)implicit-function adjoint
Monotone DEQfixed point, monotone operatorprovably convergent splitimplicit adjoint, guaranteed
Neural ODEODE flow numerical integratoradjoint ODE (reverse-time)
Optimization layerinner optimizerKKT differentiation

The last row, the optimization layer (OptNet, Amos & Kolter, 2017), closes the circle: its output is the argmin of an inner objective, differentiated through the optimality (KKT) conditions — the same implicit-function move, applied to a minimizer instead of a fixed point. All four share one design: define the output by a condition, make the condition differentiable, and let a solver and the implicit-function theorem do the rest.

Closing the loop

DEQ postdates Goodfellow (present it as a frontier method), but it is built entirely from machinery the course has already laid down: the autodiff of backpropagation, the fixed-point and Newton ideas from the optimization landscape, and the weight tying of recurrent networks. And it returns us to the very first idea of the course. We opened by saying a deep network is the composition of simple differentiable pieces learned by following the gradient; the DEQ shows that deep need not mean many stacked layers at all — a layer can be a condition a single transformation satisfies, run to convergence, differentiated through its own definition. From the perceptron's weighted sum to an infinite-depth network that fits in constant memory, the same principle applies: define what the output should satisfy, make it differentiable, and let the gradient do the learning.

Footnotes

  1. Deep equilibrium models (Bai, Kolter & Koltun, 2019) postdate Goodfellow (2016), which covers the components a DEQ is assembled from — feedforward layers (Ch. 6) and fixed-point/Newton methods (Ch. 8) — but not the implicit-layer construction itself.
  2. Goodfellow, Deep Learning, §8.2 — fixed-point iteration and the contraction condition under which converges to a unique equilibrium.
  3. Goodfellow, Deep Learning, §4.3 / §8.6 — Newton's method and curvature-based updates: using the Jacobian/Hessian to take superlinear root-finding steps.
  4. Goodfellow, Deep Learning, §6.5 — Back-Propagation: reverse-mode differentiation over the computational graph, here replaced by implicit differentiation of the fixed-point condition.
  5. Goodfellow, Deep Learning, §6.5.9 — vector–Jacobian products: backprop computes with one reverse-mode pass, never materializing the full Jacobian.

╌╌ END ╌╌