Introduction
Normalizing flows, such as Real NVP or Glow, are powerful generative models that transform a simple probability distribution into a complex one using a sequence of invertible mappings (bijections). However, bijections are topologically restrictive: they must preserve the "connectedness" of the space. The RAD (Real and Discrete) approach extends normalizing flows by replacing strict bijections with surjective, piecewise invertible mappings. This allows the model to "fold" multi-modal data distributions into a single unimodal latent space, enabling exact inference and sampling for complex, disjoint datasets that traditional flows struggle to represent.
The Problem: Topological Restrictions and Mode Linking
If your data consists of several disjoint clusters (like a mixture of Gaussians) or has "holes," a standard continuous flow must stretch and squeeze the latent space to connect these separate regions. Because bijections cannot tear the space, the model is forced to assign probability mass to the empty spaces between clusters—a phenomenon known as "mode linking." To avoid this, standard flows require extremely high-variance Jacobians, which leads to numerical instability and difficult optimization.
The RAD Method: Surjectivity and Folding
The core innovation of RAD is moving from bijective mappings to surjective, piecewise invertible mappings. Instead of trying to stretch one continuous blob into several disjoint ones, RAD "folds" the disjoint blobs on top of each other into a single latent region.
To achieve this, the authors introduce several key mechanisms:
- Domain Partitioning & Discrete Latent Variables: The input space is partitioned into disjoint subsets. Within each subset, the function is invertible. A discrete variable $K$ is introduced to identify which "fold" or partition a data point belongs to. The latent space thus contains both continuous ($Z$) and discrete ($K$) components.
- Folding (Surjection): The transformation is implemented using modified coupling layers where the mapping is a piecewise linear scalar function rather than a simple affine transformation. This creates the "folding" effect, allowing multiple points in the input space to map to the same point in the latent space (distinguished by the discrete variable $K$).
- Gating Network and Continuity: To keep training stable via stochastic gradient descent, the authors derive specific boundary conditions for a "gating network" ($p_{K|Z}$). By carefully weighting the gating network at the boundaries of the partitions, they ensure that the "pseudo log-Jacobian determinant" remains continuous even as points move across the boundaries of different partitions, preventing "jumps" in log-likelihood that would otherwise break gradient-based training.
Key Insights and Results
The authors provide a mathematical proof showing that repeatedly applying these "folding" transformations can transform any strictly positive density into a uniform distribution, theoretically proving the expressive power of the RAD approach.
The paper evaluates the model on six two-dimensional toy datasets (e.g., Grid Gaussian Mixture, Two Moons, Spiral) designed to test specific topological challenges. Key findings include:
- Higher Likelihood: In low-capacity regimes, RAD consistently achieved higher log-likelihoods than Real NVP across all toy problems.
- Better Mode Separation: RAD successfully isolates clusters, leaving the space between them empty as intended, whereas standard flows create unwanted "connecting tissue."
- Efficient Gaussianization: Visualizations of the latent space show that RAD fills the standard normal distribution more uniformly than Real NVP, which often leaves "holes" corresponding to the gaps between data clusters.
Limitations and Future Work
While the theory is general, current experiments are limited to 2D toy problems. Scaling this approach to high-dimensional spaces (like images) may require more complex architectural choices to avoid a combinatorial explosion of partitions. Additionally, the current implementation relies on element-wise piecewise linear functions; exploring more sophisticated ways to define partitions (e.g., learned decision boundaries) could further increase flexibility. Finally, finding the optimal way to integrate "folding" layers with standard bijective layers remains an open research question.
Summary updated