Cubic-Spline Flows

Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios

Introduction

Normalizing flows are a powerful class of generative models that transform a simple probability distribution (like a Gaussian) into a complex one using invertible mappings. However, researchers have long faced a frustrating trade-off between flexibility and speed. Autoregressive flows (e.g., MAF, IAF) are highly flexible and excel at density estimation but are slow to invert, requiring sequential passes through a neural network. Conversely, coupling flows (e.g., Real NVP, Glow) are fast in both directions but often lack the local flexibility needed for complex density modeling due to their reliance on simple affine transformations.

Cubic-spline flows address this gap by introducing a new type of normalizing flow that combines the high flexibility of autoregressive models with the lightning-fast sampling of coupling-based models.

Methods

The core innovation is the monotonic cubic-spline coupling transform. Instead of simple scaling and shifting, the model uses a neural network to predict the parameters of a piecewise cubic spline.

The monotonic cubic-spline coupling transform (left) and its corresponding probability density function (right).

To ensure the transformation is always invertible, the spline must be monotonic. The authors utilize Steffen’s method to constrain derivatives at the "knots" (the points connecting the bins), ensuring the resulting curve is smooth ($C^1$ continuous) and strictly increasing. These spline layers are stacked with LU-decomposed linear layers to allow efficient interaction across all data dimensions. Crucially, while a cubic equation is more complex than a linear one, it still possesses an analytical solution, allowing the model to be inverted in a single pass without slow numerical optimization.

Key Results

The model was evaluated on standard benchmarks, including UCI tabular datasets, synthetic 2D densities, and image datasets like Fashion-MNIST.

Density estimation and sampling results on complex 2D synthetic datasets, demonstrating the model's ability to capture intricate patterns.

State-of-the-Art Performance

On UCI tabular datasets, cubic-spline flows outperformed FFJORD and were statistically superior to quadratic splines on the majority of tests. The model achieved results competitive with NAF and TAN—the gold standards for density estimation—while remaining significantly faster to sample from.

High-Fidelity Modeling

As shown in the synthetic data experiments, the model successfully captured extremely intricate patterns, such as a mixture of 225 Gaussians and an "Einstein" density map, which previous flows struggled to resolve. Furthermore, the model generates high-quality Fashion-MNIST samples in a single forward pass, unlike autoregressive models that require $D$ passes.

Conclusion

Cubic-spline flows demonstrate that coupling-based flows can match or exceed the performance of autoregressive models if the coupling function is sufficiently expressive. By providing local flexibility through splines while maintaining an analytical inverse, this architecture effectively breaks the speed-flexibility trade-off. Future work includes scaling these flexible splines to high-resolution natural images and addressing minor numerical stability issues at the extreme edges of the distribution.

Summary updated

Abstract

A normalizing flow models a complex probability density as an invertible transformation of a simple density. The invertibility means that we can evaluate densities and generate samples from a flow. In practice, autoregressive flow-based models are slow to invert, making either density estimation or sample generation slow. Flows based on coupling transforms are fast for both tasks, but have previously performed less well at density estimation than autoregressive flows. We stack a new coupling transform, based on monotonic cubic splines, with LU-decomposed linear layers. The resulting cubic-spline flow retains an exact one-pass inverse, can be used to generate high-quality images, and closes the gap with autoregressive flows on a suite of density-estimation tasks.
BibTeX
@inproceedings{durkan2019cubic,
  author = {Conor Durkan and Artur Bekasov and Iain Murray and George Papamakarios},
  title = {{Cubic-Spline Flows}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
}
Figure