Robust normalizing flows using Bernstein-type polynomials

Sameera Ramasinghe, Kasun Fernando, Salman Khan, Nick Barnes

TL;DR

This paper introduces a novel Normalizing Flow (NF) framework that uses Bernstein-type polynomials as coupling functions. By leveraging the optimal mathematical stability of the Bernstein basis, the proposed model achieves exceptional robustness against data noise and numerical instability while maintaining competitive generative performance.

What Problem Does This Paper Address?

Normalizing Flows (NFs) are powerful generative models capable of exact density estimation and efficient sampling. However, because they rely on complex nonlinear transformations, they are highly sensitive to noise and perturbations in the training data. Standard NFs often amplify these small initial errors, leading to poor generalization and numerical instability.

Additionally, existing polynomial-based NFs (such as Sum-of-Squares flows) suffer from training instability when scaling up to higher-degree polynomials because their output ranges are unbounded, leading to exploding gradients. This paper tackles the dual challenges of ensuring robustness against data noise and maintaining training stability in polynomial-based NFs.

Methods

The authors propose Bernstein-type Normalizing Flows (Bernstein-NFs). Instead of standard power-basis polynomials or splines, they employ Bernstein-type polynomials as the coupling functions within a triangular map architecture (implemented via a MADE-style network).

To ensure invertibility, the transformations must be strictly monotonic. The authors achieve this by enforcing a strict ordering on the polynomial coefficients ($\alpha_0 < \alpha_1 < \dots < \alpha_n$). They elegantly convert this constrained optimization problem into an unconstrained one using a reparameterization trick.

The overall architecture is structured across multiple layers to handle multi-dimensional distributions:

Overall Bernstein NF architecture

Datasets

The model was evaluated on a comprehensive suite of standard benchmarks:

  • Tabular/UCI Datasets: POWER, GAS, HEPMASS, and MINIBOONE.
  • Image Datasets: BSDS300, MNIST, and CIFAR10.
  • Synthetic Data: 2D toy datasets featuring complex, multi-modal geometries with sharp jumps to qualitatively test density estimation.

Key Insights and Ideas

  • Optimal Numerical Stability: Mathematically, the Bernstein polynomial basis possesses the lowest condition number among all non-negative bases on a given interval. This means that perturbations in the coefficients or inputs cause the smallest possible change in the output, making the architecture uniquely robust to noise.
  • Built-in Range Control: The boundaries of a Bernstein-type polynomial are strictly determined by its first and last coefficients ($\alpha_0$ and $\alpha_n$). By fixing these constants, the authors can perfectly bound the range of the transformation. This prevents exploding gradients, allowing the model to scale up to 100-degree polynomials without any training instability.
  • Constructive Universality: Unlike previous methods that rely on abstract existence proofs for universality, this paper provides a constructive proof. This offers explicit analytic expressions for approximating known density transformations with a clear theoretical convergence rate of $O(n^{-1})$.

Key Results

  • Competitive Performance: Bernstein-NFs achieve state-of-the-art or highly competitive test log-likelihoods across standard real-world and image datasets, often exhibiting lower standard deviations across trials.
Test log-likelihood comparison on real-world datasets
Test log-likelihood comparison on image datasets
  • Superior Robustness: When uniform random noise ($\text{Uniform}[0, 10^{-2}]$) was injected into the training data, competing NF models experienced severe performance degradation (with log-likelihood drops exceeding 6 standard deviations on datasets like BSDS300). In contrast, the Bernstein-NF remained remarkably stable, with performance drops typically staying well within an acceptable range (e.g., only 1.1 to 2.3 standard deviations).

Limitations and Future Work

While Bernstein-NFs offer superior stability and excellent theoretical guarantees, they require numerical root-finding methods (such as the parabolic hull approximation method) for inversion during sampling. Although the authors utilize highly efficient, cubically-convergent root solvers that benefit from the basis's numerical stability, this approach is still computationally heavier than spline-based flows, which enjoy closed-form analytic expressions for their inverses.

Future work could explore optimizing this inversion bottleneck or extending the framework to non-compactly supported target distributions without relying on initial coordinate transformations.

Summary updated

BibTeX
@inproceedings{ramasinghe2022robust,
  author = {Sameera Ramasinghe and Kasun Fernando and Salman Khan and Nick Barnes},
  title = {{Robust normalizing flows using Bernstein-type polynomials}},
  booktitle = {BMVC},
  year = {2022},
}
Figure