A Normalizing Flow is a generative model that learns a complex probability distribution by applying a sequence of invertible and differentiable transformations to a simple base distribution, such as a standard Gaussian. Unlike VAEs or GANs, which approximate likelihoods, normalizing flows provide exact density estimation through the change-of-variables formula, making them uniquely suited for principled anomaly detection in financial transactions.
Glossary
Normalizing Flow

What is Normalizing Flow?
A generative model that transforms a simple probability distribution into a complex one through a sequence of invertible and differentiable mappings, enabling exact likelihood computation for anomaly scoring.
For fraud detection, the flow is trained exclusively on legitimate transaction patterns to learn the true probability density of normal behavior. An anomaly score is then derived directly from the negative log-likelihood of a new transaction under this learned distribution. The bijector layers composing the flow must have efficiently computable Jacobian determinants, with architectures like RealNVP and Masked Autoregressive Flow offering the tractable inverse mappings required for stable, high-dimensional financial data scoring.
Key Features of Normalizing Flows
Normalizing Flows provide a powerful framework for transforming simple base distributions into complex, multi-modal data distributions through a sequence of invertible mappings. This enables exact likelihood computation, making them uniquely suited for principled anomaly scoring in financial fraud detection.
Exact Likelihood Computation
Unlike VAEs or GANs which provide only a lower bound or implicit density, Normalizing Flows compute the exact log-likelihood of any data point via the change-of-variables formula. For fraud detection, this means an anomaly score is a true probability, not a heuristic. The log-likelihood is calculated as:
- Base distribution log-probability + sum of log-determinants of Jacobians
- Enables direct comparison of anomaly scores across different transactions
- Provides mathematically rigorous thresholds for alert generation
Invertible Architecture
The defining property of Normalizing Flows is bijectivity—every transformation must be perfectly reversible. This constraint ensures:
- No information loss during encoding or decoding
- The mapping from data space to latent space and back is deterministic
- The Jacobian determinant remains tractable for density evaluation
- Common architectures include RealNVP, Glow, and Masked Autoregressive Flows (MAF)
Change of Variables Formula
The mathematical foundation of Normalizing Flows is the change-of-variables theorem. Given a bijective transformation f: z → x, the density of x is:
p_X(x) = p_Z(f^{-1}(x)) * |det(J_{f^{-1}}(x))|- The Jacobian determinant accounts for volume changes during transformation
- Architectures are designed to make this determinant computationally cheap (e.g., triangular Jacobians)
- This formula enables direct sampling and density evaluation in a single framework
Anomaly Detection via Density Thresholding
Normalizing Flows learn the probability density function of normal transaction behavior. Anomaly scoring proceeds as:
- Train the flow on non-fraudulent transactions only (semi-supervised novelty detection)
- Compute the log-likelihood of each incoming transaction under the learned density
- Flag transactions falling below a density threshold as anomalous
- This approach naturally captures multi-modal normal behavior (e.g., different spending patterns by merchant category)
Composable Transformation Chains
The 'flow' in Normalizing Flow refers to the composition of simple transformations into a complex mapping. A flow is defined as:
x = f_K ∘ f_{K-1} ∘ ... ∘ f_1(z)where eachf_iis invertible- Each transformation adds expressive power while maintaining tractability
- Common layers include affine coupling layers, actnorm, and invertible 1x1 convolutions
- The depth of the chain controls the model's capacity to capture intricate fraud patterns
Stable Training Dynamics
Compared to GANs, Normalizing Flows offer stable and convergent training because they optimize a direct maximum likelihood objective rather than a minimax game. Benefits include:
- No mode collapse—the model is incentivized to cover all modes of the data distribution
- No discriminator to train, simplifying the architecture
- Loss curves directly reflect model quality (higher log-likelihood = better fit)
- Training stability is critical in regulated financial environments where model behavior must be predictable
Normalizing Flows vs. Other Generative Models for Anomaly Detection
A technical comparison of Normalizing Flows against Variational Autoencoders and Generative Adversarial Networks for density estimation and anomaly scoring in financial fraud detection.
| Feature | Normalizing Flow | Variational Autoencoder | GAN (AnoGAN) |
|---|---|---|---|
Exact Density Estimation | |||
Likelihood Computation | Exact log p(x) | ELBO lower bound | |
Anomaly Score Type | Direct log-likelihood | Reconstruction probability | Residual + discrimination loss |
Training Stability | Stable (MLE) | Stable | Unstable (mode collapse) |
Invertibility Guarantee | |||
Sampling Quality | High-fidelity | Blurred samples | Sharp but mode-dropping |
Computational Cost | High (Jacobian calc) | Moderate | High (adversarial training) |
Interpretability of Latent Space | Full bijection | Probabilistic mapping | No explicit encoder |
Frequently Asked Questions
Direct answers to the most common technical questions about normalizing flows, their mechanisms, and their application in anomaly detection for financial fraud.
A normalizing flow is a generative model that transforms a simple base probability distribution, such as a standard multivariate Gaussian, into a complex target distribution through a sequence of invertible and differentiable mappings. The core mechanism relies on the change of variables formula, which allows for the exact computation of the log-likelihood of any data point. Starting with a simple random variable ( z_0 ) drawn from a known density ( p(z_0) ), the flow applies a series of ( K ) bijective transformations ( f_k ), such that ( x = f_K \circ \dots \circ f_1(z_0) ). The log-density of the final data point ( x ) is computed exactly as:
codelog p(x) = log p(z_0) - Σ_{k=1}^{K} log |det(df_k/dz_{k-1})|
This tractable density is what makes normalizing flows uniquely powerful for anomaly detection. Unlike VAEs or GANs, which provide only a lower bound or an implicit density, a flow gives you the exact probability of a transaction under the learned distribution of normal behavior. A low likelihood directly flags an anomaly.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Foundational generative and density-estimation models that provide the theoretical underpinnings for Normalizing Flows, enabling exact likelihood computation for anomaly scoring.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us