CouplingTransform implements a coupling scheme that splits inputs into two parts and applies a transformation to one part conditioned on the other.
Mathematical Formulation
The coupling transformation splits the input into two parts and transforms only one part: where is a conditional transformation parameterized by . The split is defined by a binary mask.Class Definition
A function which returns a transformation given . This meta-function receives the constant part and produces a transformation for the transformed part.
A coupling mask defining the split . Ones correspond to the constant split and zeros to the transformed split .
Properties
- Domain:
constraints.real_vector - Codomain:
constraints.real_vector - Bijective:
True
Implementation Details
Splitting and Merging
The transform maintains indices for efficient splitting:Forward Pass
The forward pass keeps constant and transforms :Inverse Pass
The inverse is computed efficiently in a single pass:Usage Examples
Basic Coupling Transform
Checkerboard Coupling Pattern
Multi-Scale Coupling Flow
RealNVP-Style Coupling
Key Considerations
Mask Design
The coupling mask determines expressiveness:- Split at midpoint: Simple, balanced computation
- Alternating patterns: Better mixing between layers
- Checkerboard: Good for spatial data (images)
- Random: Can be effective but less interpretable
Inverse Efficiency
Coupling transforms have an efficient inverse because:- The constant part is unchanged:
- The inverse only needs to invert :
- No iterative refinement is needed
- Sampling from learned distributions
- Variational inference
- Applications requiring fast inverse computation
Expressiveness vs Autoregressive
Coupling advantages:- Fast inverse (single pass)
- Parallelizable computation
- Stable gradients
- More expressive per layer
- Full autoregressive conditioning
Related Transforms
- AutoregressiveTransform - Alternative with different trade-offs
- MonotonicAffineTransform - Simple conditional transformation
- MonotonicRQSTransform - Expressive conditional transformation
- PermutationTransform - Mix dimensions between coupling layers
References
NICE: Non-linear Independent Components Estimation
NICE: Non-linear Independent Components Estimation
Dinh, L., Krueger, D., & Bengio, Y. (2014). NICE: Non-linear Independent Components Estimation.
https://arxiv.org/abs/1410.8516
https://arxiv.org/abs/1410.8516
Density Estimation using Real NVP
Density Estimation using Real NVP
Dinh, L., Sohl-Dickstein, J., & Bengio, S. (2016). Density estimation using Real NVP.
https://arxiv.org/abs/1605.08803
https://arxiv.org/abs/1605.08803
Glow: Generative Flow using Invertible 1x1 Convolutions
Glow: Generative Flow using Invertible 1x1 Convolutions
Kingma, D. P., & Dhariwal, P. (2018). Glow: Generative Flow using Invertible 1x1 Convolutions.
https://arxiv.org/abs/1807.03039
https://arxiv.org/abs/1807.03039
