Residual Flows & iResNet
Free-form flows via Lipschitz-constrained residual connections: invertible ResNets, spectral normalization for invertibility, unbiased log-likelihood estimation, and Russian roulette estimators.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- Invertible Residual Networks
- Lipschitz Constraint for Invertibility
- Log-Determinant via Power Series
- Unbiased Estimation: Russian Roulette
- Spectral Normalization
- Comparison with Coupling Flows
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- State the sufficient condition for a residual network to be invertible.
- Derive the power series expansion for the log-determinant of .
- Explain the Russian roulette estimator for unbiased truncation.
- Apply spectral normalization to enforce the Lipschitz constraint.
- Compare free-form (residual) vs structured (coupling/autoregressive) flows.
Notation
- — Lipschitz constant of
- — spectral norm (largest singular value) of
- — random truncation point
Core Intuition
Coupling and autoregressive flows constrain architecture severely (splits, masking, triangular structure). Residual flows take a different approach: use a standard ResNet and constrain to have Lipschitz constant less than 1. This guarantees invertibility via the Banach fixed-point theorem, while allowing ALL dimensions to interact simultaneously.
Residual Flow (f = I + g)
Invertible Residual Networks
i-ResNet (Behrmann et al., 2019): The residual mapping
is invertible if .
Proof: is a contraction mapping perturbation of identity. By Banach fixed-point theorem, exists and can be found iteratively:
Converges geometrically: .
Lipschitz Constraint for Invertibility
Sufficient condition: , i.e., for all with .
For a neural network with layers :
where is the activation function (, ).
Enforcement: Normalize each weight matrix so where .
Log-Determinant via Power Series
The Jacobian is . Log-determinant:
Convergence: Guaranteed when (spectral radius of is less than 1).
Stochastic estimation using Hutchinson:
Each computed by JVPs (Jacobian-vector products via autodiff). Total cost: for -term truncation.
Unbiased Estimation: Russian Roulette
Problem: Truncating the series at terms gives a BIASED estimate.
Solution: Russian roulette estimator. Draw (e.g., geometric distribution), then:
Property: (unbiased).
Variance: Depends on distribution . Geometric with gives reasonable variance with average terms evaluated.
Spectral Normalization
Method to enforce :
Power iteration to estimate :
One iteration per training step (amortized). Cost: two matrix-vector products.
Practical target: Set per layer; with layers: .
Comparison with Coupling Flows
| Aspect | Coupling (RealNVP) | Residual (i-ResNet) |
|---|---|---|
| Expressiveness/layer | Low (half dims frozen) | High (all dims interact) |
| Jacobian cost | Exact, | Approximate, |
| Inversion | Exact, analytic | Iterative (fixed-point) |
| Architecture freedom | Constrained splits | Nearly unconstrained |
| Likelihood | Exact | Unbiased estimate |
When to use residual flows: When modeling complex high-dimensional densities where coupling flows would need impractically many layers.
Common Pitfalls
Pitfall 1. Setting Lipschitz constant too close to 1 (e.g., 0.99). Inversion converges slowly and the power series needs many terms. Use –.
Pitfall 2. Using only 1 Hutchinson vector for trace estimation. The variance is high; use 5-10 vectors for stable training.
Pitfall 3. Forgetting that inversion is iterative. If you need fast exact inversion (e.g., for real-time generation), coupling flows are better despite lower expressiveness.
Summary
- Residual flows: with .
- Invertibility via Banach fixed-point theorem; iterative inversion.
- Log-det via power series + Hutchinson's trace estimator.
- Russian roulette gives unbiased estimates without infinite series.
- Spectral normalization enforces Lipschitz constraint efficiently.
- More expressive per layer than coupling flows; less exact.
Exercises
Exercise 1. For with : compute and verify invertibility.
Exercise 2. Compute the first 3 terms of the power series for where .
Exercise 3. How many fixed-point iterations are needed to invert to accuracy ?
Exercise 4. Design a Russian roulette estimator with geometric() distribution. Compute expected number of terms and prove unbiasedness.
Exercise 5. Compare the wall-clock time for training a 10-layer residual flow vs 30-layer Glow on CIFAR-10 (estimate FLOPs per training step).