Autoregressive flows are a generalization of coupling flows that treat each input dimension as a separate “block”.

The -th dimension of the output is computed based on the first dimensions of the input :
The function is termed the transformer (nothing to do with attention), and the parameters are termed conditioners.
- Similar to coupling flows, the transformer must be invertible
- The conditioners can take any form and are usually neural networks
- If the transformer and conditioner are sufficiently flexible, autoregressive flows are universal approximators that can represent any probability distribution.
It’s possible to compute all of the entries of the output in parallel using a network with appropriate masks so that the parameters at position only depend on previous positions. This is known as masked autoregressive flow. The principle is very similar to masked self-attention; connections that relate inputs to previous outputs are pruned.
Inverting the transformation is less efficient. Consider the forward mapping:
This must be inverted sequentially:
This can’t be done in parallel as the computation for depends on (i.e., the partial results so far). Hence, inversion is time-consuming when the input is large.
Inverse autoregressive flows
Masked autoregressive flows are defined in the normalizing (inverse) direction. This is required to evaluate the likelihood efficiently and hence learn the model. However, sampling requires the forward direction, in which each variable must be computed sequentially at each layer, which is slow. If we use an autoregressive flow for the forward (generative) transformation, then sampling is efficient, but computing the likelihood (and training) is slow. This is known as inverse autoregressive flow.
A trick that allows fast learning and also fast (but approximate) sampling is to build a masked autoregressive flow to learn the distribution (teacher) and then use this to train an inverse autoregressive flow from which we can sample efficiently (student). This requires a different formulation of normalizing flows that learns from another function rather than a samples (Normalizing Flows for Approximating Densities).