# Flow-CAD: Flow Matching for Contextual Anomaly Detection and Explanation in Tabular Data

arXiv: https://arxiv.org/abs/2611.16184 · HTML: https://mlsanity.com/paper/2611.16184/

## Key facts

- No citing papers in the map yet (data through 24 Nov 2026).
- Placed in Flow matching, time series and science, one of 14 directions in Diffusion models.
- Builds on 19 of its 41 references that are in the map.
- Submitted 12 Nov 2026.

## Placed in

- Diffusion models / [Flow matching, time series and science](https://mlsanity.com/diffusion/flow-matching-time-series-and-science/)

## Builds on (most cited first, 19 of 19)

- [Adam: A Method for Stochastic Optimization](https://mlsanity.com/paper/1412.6980/) (2014)
- [Flow Matching for Generative Modeling](https://mlsanity.com/paper/2210.02747/) (2022)
- [Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow](https://mlsanity.com/paper/2209.03003/) (2022)
- [Variational Inference with Normalizing Flows](https://mlsanity.com/paper/1505.05770/) (2015)
- [Building Normalizing Flows with Stochastic Interpolants](https://mlsanity.com/paper/2209.15571/) (2022)
- [Improving and generalizing flow-based generative models with minibatch optimal transport](https://mlsanity.com/paper/2302.00482/) (2023)
- [Do Deep Generative Models Know What They Don't Know?](https://mlsanity.com/paper/1810.09136/) (2018)
- [ADBench: Anomaly Detection Benchmark](https://mlsanity.com/paper/2206.09426/) (2022)
- [On Diffusion Modeling for Anomaly Detection](https://mlsanity.com/paper/2305.18593/) (2023)
- [LUNAR: Unifying Local Outlier Detection Methods via Graph Neural Networks](https://mlsanity.com/paper/2112.05355/) (2021)
- [A Survey on Explainable Anomaly Detection](https://mlsanity.com/paper/2210.06959/) (2022)
- [A Geometric Explanation of the Likelihood OOD Detection Paradox](https://mlsanity.com/paper/2403.18910/) (2024)
- [Scalable, Explainable and Provably Robust Anomaly Detection with One-Step Flow Matching](https://mlsanity.com/paper/2510.18328/) (2025)
- [Robust Contextual Outlier Detection: Where Context Meets Sparsity](https://mlsanity.com/paper/1607.08329/) (2016)
- [Explainable Contextual Anomaly Detection using Quantile Regression Forests](https://mlsanity.com/paper/2302.11239/) (2023)
- [Diffusion and Flow Matching Models for Tabular Data: A Survey](https://mlsanity.com/paper/2502.17119/) (2025)
- [Flow Mismatching: Unsupervised Anomaly Detection via Velocity Discrepancies in Flow Matching Models](https://mlsanity.com/paper/2605.23070/) (2026)
- [Dealing with Uncertainty in Contextual Anomaly Detection](https://mlsanity.com/paper/2507.04490/) (2025)
- [Unsupervised Anomaly Detection Using Flow Matching on Tabular Data](https://mlsanity.com/paper/2608.19801/) (2026)

## Abstract (arXiv)

Contextual anomaly detection in tabular data aims to identify objects whose behavior is unexpected under their contextual conditions. In data-engineering pipelines, this task screens table rows whose measurements violate context-dependent integrity relationships. Most existing approaches rely on either shallow conditional models with limited distributional expressiveness or localized estimators that require per-context modeling, making it difficult to capture complex conditional relationships and scale to high-dimensional settings. We propose Flow-CAD, a new framework for contextual anomaly detection based on Flow Matching. Flow-CAD learns a single global and amortized conditional generative model that flexibly represents behavioral distributions conditioned on context, without assuming simple parametric forms or retraining local models. To enable robust and interpretable anomaly scoring, we introduce a scale-normalized and truncated residual energy derived from the learned conditional flow, which stabilizes anomaly scores, mitigates domination by extreme deviations, and supports feature-wise attribution. We further provide theoretical insights showing that the proposed residual-based anomaly score is stable under velocity estimation error, and that its Monte Carlo estimator satisfies concentration bounds. Experiments on 20 benchmark datasets with 13 competitors demonstrate that Flow-CAD has the best average rank for PR AUC, ROC AUC, and P@n, highlighting its effectiveness and practicality for contextual anomaly detection in tabular data. We provide the source code at https://github.com/ZhongLIFR/FlowCAD.
