Abstract: We show that standard ResNet architectures can be made invertible, allowing the same model to be used for classification, density estimation, and generation. Typically, enforcing invertibility requires partitioning dimensions or restricting network architectures. In contrast, our approach only requires adding a simple normalization step during training, already available in standard frameworks. Invertible ResNets define a generative model which can be trained by maximum likelihood on unlabeled data. To compute likelihoods, we introduce a tractable approximation to the Jacobian log-determinant of a residual block. Our empirical evaluation shows that invertible ResNets perform competitively with both state-of-the-art image classifiers and flow-based generative models, something that has not been previously achieved with a single architecture.
Introduction
In the landscape of deep learning, a significant divide exists between discriminative models, such as Residual Networks (ResNets) optimized for classification, and generative models, such as Normalizing Flows designed for data synthesis. Discriminative models are highly effective but inherently non-invertible, discarding information as it progresses through the network. Conversely, generative models achieve invertibility through specific architectural constraints—like coupling layers—which often compromise their performance on standard discriminative tasks.
This paper introduces Invertible Residual Networks (i-ResNets), a novel approach that bridges this gap. The authors demonstrate that the ubiquitous ResNet architecture can be made fully invertible without sacrificing its core structure, enabling a single model to excel at classification, density estimation, and data generation.
Methods: Achieving Invertibility
The transition from a standard ResNet to an invertible one is achieved through two primary technical innovations.
Enforcing Invertibility via Lipschitz Constraints
The authors prove that a residual block, defined by the transformation $y = x + g(x)$, is guaranteed to be bijective (invertible) if the Lipschitz constant of the residual function $g$ is strictly less than 1 ($Lip(g) < 1$). In practice, this is enforced by applying Spectral Normalization to the weights of the convolutional layers using power iteration. This constraint ensures that the mapping remains a contraction, preventing the "path crossing" or "collapsing" of inputs that typically occurs in standard, unconstrained networks.
Tractable Log-Determinants for Density Estimation
To utilize i-ResNets as generative models, it is necessary to compute the log-determinant of the Jacobian for maximum likelihood training. Direct computation for high-dimensional data is computationally prohibitive ($O(d^3)$). The authors circumvent this by introducing a tractable stochastic approximation. They utilize a power series expansion of the log-determinant combined with the Hutchinson trace estimator, allowing for efficient estimation using only vector-Jacobian products. For the inverse operation (generation), the model employs fixed-point iteration, which converges exponentially fast due to the enforced Lipschitz constraint.
Empirical Evaluation
The i-ResNet architecture was evaluated across several standard benchmarks to assess its performance in both discriminative and generative regimes.
Classification Performance
On the CIFAR-10 dataset, i-ResNet achieved a competitive 6.78% error rate, closely trailing a standard non-invertible ResNet-164 (5.50%). Notably, it significantly outperformed other invertible architectures like Glow, which exhibited an error rate of approximately 12% when adapted for classification. This suggests that i-ResNets retain the powerful feature-learning capabilities of standard ResNets.
Generative Modeling and Density Estimation
In generative tasks, i-ResNet achieved 3.45 bits/dim on CIFAR-10, placing it on par with specialized flow models such as Real-NVP (3.49) and Glow (3.35). Visualizations on 2D toy datasets further demonstrate the model's ability to capture complex, multi-modal distributions more accurately than previous flow-based methods.
Discussion and Future Directions
While i-ResNets provide a unified framework for classification and generation, they are not without limitations. The power series used for log-determinant estimation is a biased estimator, although empirical results suggest this bias is negligible. Furthermore, while the forward pass is efficient, sampling via fixed-point iteration is slower than the analytic inverses found in coupling-based flows.
Future research directions include refining Lipschitz constraints to apply to entire residual blocks rather than individual layers and exploring the application of i-ResNets to hybrid tasks, such as joint classification and out-of-distribution detection.
Summary based on "Invertible Residual Networks" by Behrmann et al. (2019).
Summary updated