Augmented KRnet for density estimation and approximation

Xiaoliang Wan, Kejun TangarXiv 2021

Abstract

In this work, we have proposed augmented KRnets including both discrete and continuous models. One difficulty in flow-based generative modeling is to maintain the invertibility of the transport map, which is often a trade-off between effectiveness and robustness. The exact invertibility has been achieved in the real NVP using a specific pattern to exchange information between two separated groups of dimensions. KRnet has been developed to enhance the information exchange among data dimensions by incorporating the Knothe-Rosenblatt rearrangement into the structure of the transport map. Due to the maintenance of exact invertibility, a full nonlinear update of all data dimensions needs three iterations in KRnet. To alleviate this issue, we will add augmented dimensions that act as a channel for communications among the data dimensions. In the augmented KRnet, a fully nonlinear update is achieved in two iterations. We also show that the augmented KRnet can be reformulated as the discretization of a neural ODE, where the exact invertibility is kept such that the adjoint method can be formulated with respect to the discretized ODE to obtain the exact gradient. Numerical experiments have been implemented to demonstrate the effectiveness of our models.

Introduction

Density estimation—the task of learning the underlying probability distribution of a dataset—is a cornerstone of machine learning. However, as dimensionality increases, models often succumb to the "curse of dimensionality." Flow-based generative models address this by learning an invertible mapping between a complex data distribution and a simple prior.

Despite their promise, these models face a critical trade-off between invertibility and expressivity. For instance, the original KRnet requires three iterations for a full nonlinear update across all dimensions to maintain exact invertibility. Furthermore, while continuous models like Neural Ordinary Differential Equations (ODEs) are theoretically invertible, they often lose this property upon numerical discretization, complicating gradient calculations. This paper introduces Augmented KRnet to overcome these limitations by utilizing extra "buffer" dimensions to facilitate more efficient information exchange.

Methodology

Augmented Dimensions and Architecture

The primary innovation of Augmented KRnet is the introduction of augmented dimensions ($\gamma$). These dimensions serve as a communication channel between data dimensions, allowing for complex interactions without the restrictive coupling patterns typically required for invertibility. By passing information through this augmented channel, the model reduces the iterations needed for a full nonlinear update from three to two.

Overall architecture of Augmented KRnet with augmented dimensions.

The model's structure is further refined by incorporating the Knothe-Rosenblatt (K-R) rearrangement, which maintains a block-triangular structure to ensure the mapping remains manageable and invertible. Each transformation block $f^{\text{outer}}$ is composed of several specialized layers.

Internal structure of a single transformation block in Augmented KRnet.

As shown in the detailed block structure, each iteration includes a rotation layer ($L_R$), scale and bias layers, affine coupling layers, and a squeezing layer ($L_S$), culminating in a nonlinear invertible layer ($L_N$). This multi-layered approach ensures high expressivity while preserving the mathematical requirements for flow-based modeling.

Discrete-to-Continuous Bridge

Augmented KRnet can be viewed as a first-order discretization of a Neural ODE. Unlike standard Neural ODEs, where the adjoint method for gradient calculation is applied to the continuous form (introducing errors during discretization), Augmented KRnet allows the adjoint method to be formulated directly on the discrete model. Since the discrete model is exactly invertible, the resulting gradients are exact to machine precision, bridging the gap between discrete efficiency and continuous theoretical properties.

Experimental Results

The authors evaluated Augmented KRnet across several complex synthetic distributions to test its robustness and boundary-handling capabilities.

Datasets and Setup

  • 1D Distributions: Logistic, Lognormal, and Uniform distributions, including those with discontinuities.
  • 2D Mixture of Gaussians: Six standard Gaussians arranged in a circular pattern.
  • High-Dimensional Irregular Totals: 4D and 8D Logistic distributions featuring "elliptic holes"—regions of zero probability that present significant challenges for standard models.

Key Findings

  • Efficiency and Accuracy: Augmented KRnet achieves a fully nonlinear update in 33% fewer iterations than the original KRnet. In 2D Gaussian mixture tests, the "Augmented KRnet with Rotation and Nonlinear layers" (R&N) achieved a significantly lower error ($6.79 \times 10^{-4}$) compared to the standard KRnet ($5.46 \times 10^{-3}$).
  • Handling Discontinuities: The model demonstrated a superior ability to resolve sharp edges and zero-density boundaries, particularly in 8D "hole" experiments, outperforming both Real NVP and standard KRnet.
  • Convergence: The augmented models showed faster error decay relative to the number of Degrees of Freedom (DOFs) in high-dimensional tests.

Conclusion

Augmented KRnet successfully enhances flow-based generative modeling by introducing augmented dimensions for faster information exchange and providing a robust discrete-to-continuous framework. While the current link to Neural ODEs relies on first-order discretization, which limits numerical accuracy in the continuous path, the discrete model remains highly effective and efficient. Future work will focus on higher-order discretization methods and improving the computational speed of the ODE-based variants to make them more competitive for large-scale training.

Summary updated

BibTeX
@misc{wan2021augmented,
  author = {Xiaoliang Wan and Kejun Tang},
  title = {{Augmented KRnet for density estimation and approximation}},
  year = {2021},
  eprint = {2105.12866},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.12866},
}
Figure