NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Distilling the Knowledge from Normalizing Flows

Dmitry Baranchuk, Vladimir Aliev, Artem Babenko

Abstract

Normalizing flows (NFs) are powerful generative models known for stable training and exact likelihood estimation. However, their strict architectural requirements—specifically the need for invertibility and tractable Jacobian determinants—often lead to overparameterized, computationally expensive models. This paper presents a knowledge distillation framework that transfers the learned mapping of a heavy, conditional NF "teacher" to a lightweight, non-invertible feed-forward "student." Our results demonstrate that these student models can achieve up to a 10x speedup in tasks such as speech synthesis and image super-resolution while maintaining high perceptual quality.

Introduction

Normalizing flows map simple base distributions (e.g., Gaussian) to complex data distributions through a sequence of invertible transformations. While this approach avoids the training instabilities of Generative Adversarial Networks (GANs), it imposes significant architectural constraints. Because NFs must preserve dimensionality across layers, they are often forced to be excessively deep and memory-intensive.

This research addresses the practical limitations of NFs by asking whether the invertibility constraint can be relaxed after training. If the goal is rapid sample generation rather than density estimation, a feed-forward student can be trained to mimic the teacher's deterministic mapping, effectively stripping away the mathematical overhead required for invertibility.

Methodology

The proposed method utilizes a straightforward knowledge distillation objective to bridge the gap between flow-based teachers and feed-forward students.

The Distillation Objective

The student model is trained to approximate the teacher's mapping from a noise vector $z$ and a context $c$ to an output $x$. The loss function is a combination of a standard reconstruction loss (typically $L_1$ distance) and domain-specific perceptual losses, such as LPIPS for images or multi-resolution STFT loss for audio.

Architectural Relaxation

The primary innovation lies in the design of the student architecture. By removing the requirement for invertibility, the student can utilize more efficient building blocks:

  1. Flexible Dimensionality: Unlike NFs, the student can change inner representation dimensions, allowing for bottleneck layers or expansions that optimize computational flow.
  2. Optimized Modules: Mathematically constrained flow steps are replaced with high-performance feed-forward blocks, such as Residual-in-Residual Dense Blocks (RRDB) for vision or optimized WaveNet blocks for audio.
The teacher-student distillation framework for normalizing flows.

Experimental Results

The distillation framework was evaluated on two state-of-the-art conditional flow models: SRFlow for image super-resolution and WaveGlow for speech synthesis.

Speech Synthesis (Vocoding)

In speech synthesis tasks using the LJ Speech dataset, the WaveGlow Student achieved a Mean Opinion Score (MOS) comparable to the original teacher. As shown in the table below, the student models (WG Student V1-V3) significantly reduced parameter counts and increased inference speed. Specifically, WG Student V2 achieved a MOS of 3.89 (vs. the teacher's 3.92) while being over 9x faster and using roughly 14x fewer parameters.

Comparison of speech synthesis models showing MOS, parameter counts, and inference speed.

Image Super-Resolution

For super-resolution tasks on the DIV2K dataset, the SRFlow Student matched the teacher's perceptual quality (LPIPS) and fidelity (PSNR/SSIM). The student model was 2.1x faster for x4 scaling and 4.9x faster for x8 scaling, effectively halving the parameter count while maintaining the diversity of generated samples.

Discussion and Key Insights

  • Invertibility as a Bottleneck: Ablation studies confirm that the invertibility constraint is the primary source of inefficiency in NFs. Relaxing this constraint allows for significantly better performance within the same parameter budget.
  • Preservation of Diversity: Despite being a deterministic feed-forward network, the student successfully inherits the teacher's latent space characteristics. When conditioned on noise vectors, the student maintains the generative diversity of the original flow model.
  • The Trade-off: The student model loses the ability to compute exact likelihoods or perform exact latent variable inference. This makes the method ideal for production deployment where generation speed is paramount, but unsuitable for applications requiring density estimation.

Conclusion

Knowledge distillation provides a robust path for deploying normalizing flows in resource-constrained environments. By decoupling the stable training of NFs from their rigid inference requirements, practitioners can deploy models that rival GANs in speed while benefiting from the superior training dynamics of flow-based architectures. Future work may extend this approach to unconditional generation and other high-dimensional domains like 3D point clouds.

Summary updated

BibTeX
@inproceedings{baranchuk2021distilling,
  author = {Dmitry Baranchuk and Vladimir Aliev and Artem Babenko},
  title = {{Distilling the Knowledge from Normalizing Flows}},
  booktitle = {INNF @ ICML},
  year = {2021},
  url = {https://openreview.net/forum?id=fEPhiuZS9TV},
}
Figure