Masked Autoregressive Flow
A masked autoregressive flow builds a flexible probability distribution by transforming simple noise through a chain of autoregressive layers, letting you both sample realistic data and compute exact likelihoods.
Many generative models can either produce realistic-looking samples (a GAN) or compute how likely a given data point is under the model (a Gaussian), but rarely both easily. A normalizing flow does both: it starts from simple noise, like a standard normal, and applies a chain of invertible transformations until the result matches a complicated real-world distribution — like the distribution of a stock's overnight return conditional on the past week.
A masked autoregressive flow builds each transformation autoregressively — every output depends only on earlier outputs, enforced through a masked neural network — which makes the whole transformation invertible and its likelihood computable, while still being expressive enough to model complex, skewed, fat-tailed data.
The "masked autoregressive" part refers to how each transformation layer is built: a single neural network with connections masked out so that the k-th output can only see inputs 1 through k-1, exactly like the masking used in autoregressive language models. That structure guarantees the transformation's Jacobian is triangular, so its determinant — needed to compute exact likelihood under a change of variables — is just the product of diagonal terms, cheap to calculate even for high-dimensional data.
Stacking several such layers, each conditioning on a different ordering or permutation of variables, lets the model capture dependencies that a single autoregressive pass would miss. In quant applications, this makes MAFs attractive for modeling joint return distributions across correlated assets or scenario-generating synthetic market paths that preserve realistic tail dependence, something a plain multivariate normal cannot do.
Related concepts
Practice in interviews
Further reading
- Papamakarios, Pavlakou, Murray, 'Masked Autoregressive Flow for Density Estimation'