# Glow: Generative Flow with Invertible 1x1 Convolutions

Glow makes flow-based models stronger by swapping in learned channel mixing

Diederik P. Kingma, Prafulla Dhariwal · arXiv · 2018-7-9

- **Problem** Flow-based generative models offer exact likelihood and parallel synthesis but had received little attention. Earlier flows such as RealNVP used a fixed channel reversal that limited how well they fit data.
- **Method** Glow chains actnorm, a learned invertible 1x1 convolution and an affine coupling layer in each step. Instead of a fixed channel reversal, the 1x1 convolution mixes channels, and the steps are stacked in a multi-scale architecture.
- **Results** On CIFAR-10, Glow reaches 3.35 bits per dimension, against 3.49 for RealNVP.

## Why flows are worth revisiting

Likelihood-based generative models fall into three families: autoregressive models, variational autoencoders and flow-based models. Autoregressive models are simple, but their synthesis length grows with the dimensionality of the data, which is costly for large images and video. Variational autoencoders parallelize training and synthesis well, yet they optimize a lower bound on the log-likelihood and can be hard to optimize.

Flow-based models can be trained on the exact log-likelihood, infer latent variables exactly and run both inference and synthesis in parallel.

Flow-based models had received much less attention than GANs and variational autoencoders, and the earlier flows NICE and RealNVP rely on a fixed permutation that reverses the order of the channels. The question the authors take up is whether replacing that fixed reversal with a learned channel mixing, together with a normalization layer that tolerates small minibatches, improves log-likelihood on standard benchmarks.

They also ask whether the same plain log-likelihood training can produce realistic high-resolution faces with a usable latent space.

## How a flow turns a simple density into an exact likelihood

A flow maps a datapoint x through invertible transformations to a latent z, which has a simple density such as a spherical Gaussian. Inference follows the forward direction of the chain, and synthesis runs the inverse direction starting from a sample of z. Under the change of variables, the log-likelihood equals the latent log-density plus the sum of log-determinants of the Jacobian of each transformation, written as \\\\( \\\\log p\_\\\\theta(x) = \\\\log p\_\\\\theta(z) + \\\\sum\_{i=1}^{K} \\\\log\|\\\\det(dh\_i/dh\_{i-1})\| \\\\).

The determinant is expensive in general, but transformations whose Jacobian is triangular make it cheap, because it reduces to the sum of the logs of the absolute diagonal entries. For continuous data the objective adds uniform dequantization noise and a constant that depends on the data dimensionality, and the training loss is measured in nats or bits.

The parameters are optimized by stochastic gradient descent on minibatches.

## One Glow step and how steps stack

Each step applies actnorm first, then an invertible 1×1 convolution, then an affine coupling layer, and this chain is built on the NICE and RealNVP ideas.

Steps are combined in a multi-scale architecture with a depth of K steps and L levels, and Figure 2 shows the arrangement with splits between levels. The multi-scale design follows RealNVP, and the authors refer to that paper for the details of the split across levels.

## Actnorm instead of batch normalization

The authors motivate actnorm by a weakness of batch normalization: the noise it adds grows as the minibatch per processing unit shrinks, so performance degrades for small per-unit minibatches. Large images force a minibatch size of 1 per processing unit because of memory limits, which is the regime where this weakness matters.

Actnorm applies a scale and a bias per channel, similar to batch normalization, and both are set so that post-layer activations have zero mean and unit variance on an initial minibatch. This is a data-dependent initialization, and after it the scale and bias are ordinary trainable parameters that no longer depend on the data.

## Learned channel mixing with a 1×1 convolution

Earlier flows use a fixed permutation of channels, and the authors replace it with a learned invertible 1×1 convolution whose c×c weight matrix W is initialized as a random rotation. A 1×1 convolution with equal input and output channels generalizes a permutation, since a permutation matrix is one special choice of W.

A random rotation has log-determinant zero, so training starts from zero log-determinant, and the values move away from zero after the first SGD step.

The initial P is fixed from a sampled random rotation, while L, U and s are then optimized.

The affine coupling layer keeps the forward, reverse and log-determinant computations cheap, and its additive special case has s = 1 and zero log-determinant. Zero initialization of the last convolution of each coupling network makes each affine coupling layer start as an identity function, which the authors found helps training very deep networks.

Splits are made only along the channel dimension, not in the checkerboard pattern used by RealNVP.

## Channel mixing against fixed permutations on CIFAR-10

Three permutation choices were compared: channel reversal as in RealNVP, a fixed random permutation and the invertible 1×1 convolution, each combined with either additive or affine coupling layers. All these models use K = 32 and L = 3 with data-dependent initialization, and the comparison is on CIFAR-10 with all training conditions held constant.

The 1×1 convolution reached a lower average negative log-likelihood and converged faster than the other two choices, for both additive and affine coupling, with mean and standard deviation over three random seeds. Affine coupling models converged faster than additive coupling models.

The wallclock time of the 1×1 convolution model rose by about 7%, and the authors describe the operation as computationally efficient. Its parameter count is 0.2% larger than the baseline, which the authors call negligible.

## Benchmark gains over RealNVP

Preprocessing follows RealNVP, and each NN() has three convolutional layers, with two ReLU hidden layers of 512 channels, and 3×3 first and last convolutions around a 1×1 center. ImageNet is used at 32×32 and 64×64 downsampled versions, and LSUN is downsampled to 96×96 with random crops of 64×64.

On CIFAR-10, Glow reached 3.35 bits per dimension, against 3.49 for RealNVP. On ImageNet, Glow reached 4.09 at 32×32 and 3.81 at 64×64, against 4.28 and 3.98 for RealNVP.

On LSUN, Glow reached 2.38 for bedroom, 2.46 for tower and 2.67 for church outdoor, against 2.72, 2.81 and 3.08 for RealNVP. Table 2 reports best results per dataset, and the authors describe the improvement as present on all the datasets they tested.

## Faces at 256×256: synthesis, interpolation and attributes

The model was trained on CelebA-HQ, which has 30000 high-resolution images, at 256×256 with K = 32 and L = 6, on 5-bit images. Minibatch size is 1 per processing unit and gradient checkpointing is used because of device memory limits.

The authors describe the random samples as extremely high quality for a non-autoregressive likelihood model. To interpolate, two real images are encoded, their latents are linearly interpolated, and the intermediate latents are decoded, with almost all intermediate samples looking like realistic faces.

For attribute editing, the mean latent vector of images with a label is subtracted from the mean latent vector of images without it, and this difference is added to or removed from a latent code.

## Temperature and depth in sampling

Sampling at temperature T draws from a distribution proportional to the model density raised to the power T, and for additive coupling this is done by scaling the standard deviation of the latent prior by T. Figure 8 sweeps temperatures from 0 to 1.0 in steps of 0.25 to 0.6, 0.7, 0.8, 0.9 and 1.0.

The highest temperatures give noisy images, which the authors suggest may come from overestimating the entropy of the data distribution. A temperature of 0.7 was chosen as the sweet spot between diversity and quality of samples. Figure 7 shows 5-bit LSUN bedroom samples at temperature 0.875 at resolutions of 64, 96 and 128.

Figure 9 compares a shallow model with L = 4 against a deep model with L = 6 on their ability to learn long-range dependencies. The text gives no metric for this depth comparison, so it is a qualitative observation.

## Limitations

Autoregressive synthesis of high-dimensional data is reported to take multiple orders of magnitude longer than synthesis from flow models, and the authors rely on earlier work for that evidence.

Training on 5-bit images trades a slight decrease in color fidelity for better visual quality. The highest sampling temperatures produce noisy images.

The temperature mechanism is described only for additive coupling layers, and the text does not give the equivalent for affine coupling. The permutation comparison is on CIFAR-10 only, over three random seeds. The authors did not measure a large wallclock difference for the LU form in their networks, so its speed benefit is not shown in these experiments.

## Paper info

- **Authors**: Diederik P. Kingma, Prafulla Dhariwal
- **Venue**: arXiv · Preprint
- **First published**: 2018-7-9
- **Added**: 2026-11-6
- **Updated**: 2018-7-10
- **Version**: v2
- **arXiv**: 1807.03039
- **Category**: stat.ML · cs.AI · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1807.03039v2) · [PDF ↗](https://arxiv.org/pdf/1807.03039v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Diederik P. Kingma, Prafulla Dhariwal (2018). Glow: Generative Flow with Invertible 1x1 Convolutions. arXiv:1807.03039v2. https://arxiv.org/abs/1807.03039v2

**BibTeX**

```
@misc{kingma2018glow,
  title = {{Glow: Generative Flow with Invertible 1x1 Convolutions}},
  author = {Diederik P. Kingma and Prafulla Dhariwal},
  year = {2018},
  eprint = {1807.03039},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1807.03039v2}
}
```

## Other paper commentary

- [Density estimation using Real NVP](https://refivu.com/en/papers/6e98cc2c-51ae-4105-a052-60a312be9b3d-density-estimation-using-real-nvp.md)
- [Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks](https://refivu.com/en/papers/f9c68dd2-7de8-40fa-9eb6-ea62d8856b71-model-agnostic-meta-learning-for-fast-adaptation-of.md)
- [BEHRT: Transformer for Electronic Health Records](https://refivu.com/en/papers/cadb146f-6d4d-4255-8058-89ac62ed2dc8-behrt-transformer-for-electronic-health-records.md)
- [PredRNN: A Recurrent Neural Network for Spatiotemporal Predictive Learning](https://refivu.com/en/papers/c0da3abd-5c1e-4383-ae59-22d04fe3eb7d-predrnn-a-recurrent-neural-network-for-spatiotemporal.md)
- [SuperSpike: Supervised learning in multi-layer spiking neural networks](https://refivu.com/en/papers/69e65b6b-2815-4179-aaac-1c5294019aba-superspike-supervised-learning-in-multi-layer-spiking-neural.md)
- [Attention Spiking Neural Networks](https://refivu.com/en/papers/2c52d99c-a249-4911-96bd-79f6720c0a09-attention-spiking-neural-networks.md)
- [Rainbow: Combining Improvements in Deep Reinforcement Learning](https://refivu.com/en/papers/b98e78e1-7a51-4f55-b8c6-f920fb30d547-rainbow-combining-improvements-in-deep-reinforcement.md)
- [Improved Techniques for Training GANs](https://refivu.com/en/papers/fa2b409d-90c8-47af-916c-aa43ebfdf357-improved-techniques-for-training-gans.md)
- [Variational Inference with Normalizing Flows](https://refivu.com/en/papers/681d4ceb-2dde-4627-a4ad-6ee307d4d2ec-variational-inference-with-normalizing-flows.md)
- [Deep Reinforcement Learning with Double Q-learning](https://refivu.com/en/papers/f2b03deb-df54-4587-b32e-077bd6c02e5b-deep-reinforcement-learning-with-double-q-learning.md)
- [Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset](https://refivu.com/en/papers/a36880da-386c-4bbc-b8bb-64ba26cb1619-quo-vadis-action-recognition-a-new-model-and.md)
- [Generative Adversarial Imitation Learning](https://refivu.com/en/papers/4c0dc7dc-4282-4fe9-8bb5-0b267ba684d1-generative-adversarial-imitation-learning.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [CIFAR-10](https://refivu.com/en/terms/19035a518d0a-cifar-10)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [Batch Normalization](https://refivu.com/en/terms/2b3e5f8509f6-batch-normalization)
- [Generative adversarial networks](https://refivu.com/en/terms/889f2a50b737-generative-adversarial-networks)
- [negative log-likelihood](https://refivu.com/en/terms/e6d7135ed9ca-negative-log-likelihood)
- [latent variable](https://refivu.com/en/terms/6dc3c308357f-latent-variable)
- [LSUN](https://refivu.com/en/terms/8199283e30fb-lsun)
- [temperature](https://refivu.com/en/terms/13dee949c770-temperature)
- [Autoregressive models](https://refivu.com/en/terms/66bedb44b32b-autoregressive-models)
- [gradient checkpointing](https://refivu.com/en/terms/6cd95a1f2d11-gradient-checkpointing)
- [NICE](https://refivu.com/en/terms/dc8b2ee78055-nice)
- [bits per dimension](https://refivu.com/en/terms/f10db2eb6597-bits-per-dimension)
- [log-determinant](https://refivu.com/en/terms/81684d5c1260-log-determinant)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/fb9c5b80-a221-4385-8910-2ae4413b604b-glow-generative-flow-with-invertible-1x1-convolutions)
