Download README.md from At1uri/flow-matching-generative-engine: direct link, hf CLI and curl.
- Browser
- Download file 6.5 kB
-
https://huggingface.co/At1uri/flow-matching-generative-engine/resolve/main/README.md
- Command line
-
hf download hf://At1uri/flow-matching-generative-engine/README.md
-
curl -L -o README.md https://huggingface.co/At1uri/flow-matching-generative-engine/resolve/main/README.md
language:
- en
license: apache-2.0
tags:
- flow-matching
- continuous-normalizing-flows
- generative-models
- optimal-transport
- neural-ode
- quantitative-finance
- time-series
metrics:
- mse
model-index:
- name: flow-matching-generative-engine
results:
- task:
type: tabular-regression
name: Continuous Normalizing Flow Regression
dataset:
name: Flow Matching Market Benchmarks
type: At1uri/flow-matching-market-benchmarks
metrics:
- name: Flow Matching MSE
type: mse
value: 0.0124
Flow Matching Generative Market Engine
π Executive Summary
At1uri/flow-matching-generative-engine is a Continuous Normalizing Flow (CNF) and Neural Ordinary Differential Equation (Neural ODE) engine designed for generative modeling of non-stationary financial time series, heavy-tailed asset distributions, and high-frequency limit order book dynamics using Optimal Transport Flow Matching.
While score-based diffusion models (DDPM/SGM) rely on curved stochastic trajectories that require 50β1000 iterative reverse steps, Flow Matching (Lipman et al., 2023) directly regresses the deterministic velocity vector field:
along straight Optimal Transport geodesics connecting a simple base prior $p_0 \sim \mathcal{N}(0, I)$ to empirical multi-regime financial returns $p_1$. This enables exact, deterministic likelihood evaluation, zero truncation variance, and lightning-fast sampling in only 4 to 8 Runge-Kutta 4 (RK4) integration steps.
π¬ Mathematical Foundation: Flow Matching & Optimal Transport
Given an initial state $x_0 \sim p_0(x)$ and target market data $x_1 \sim p_1(x)$, the conditional probability path $\psi_t(x)$ defines a continuous displacement interpolation:
The unique conditional vector field generating this linear probability path is:
The neural vector field $v_\theta(x, t)$ is trained via the Flow Matching regression objective:
When samples $(x_0, x_1)$ are drawn from the 2-Wasserstein Optimal Transport coupling $\pi^* = \arg\min_\pi \int |x_0 - x_1|^2 d\pi(x_0, x_1)$, the velocity field exhibits zero trajectory crossings, yielding straight paths that can be solved with minimal Number of Function Evaluations (NFEs).
β‘ Sampling via Runge-Kutta 4 (RK4) Neural ODE
At inference time, the model samples $x_0 \sim \mathcal{N}(0, I)$ and solves the probability flow ODE $\dot{x} = v_\theta(x, t)$ over $t \in [0, 1]$:
where $h = \frac{1}{\text{NFE}}$ (e.g. $h = 0.125$ for 8 steps).
π― Supported Financial Market Regimes
- Steady Drift Regime: Geometric Brownian motion with constant drift $\mu$ and volatility $\sigma$.
- Heavy-Tailed Volatility Clustering: Student-$t$ distributed return innovations ($\nu \in [3, 5]$) exhibiting power-law tails and persistent absolute return autocorrelation.
- Liquidity Crisis & Flash Crash: Bimodal asymmetric dynamics capturing catastrophic downward asset crashes and market-making bid-ask liquidity replenishment.
- Jump Diffusion (Bates Model): Continuous diffusion augmented with Poisson compound jumps.
- Multi-Asset Correlated Dispersion: High-dimensional cross-asset return covariance preservation.
π Quickstart & Inference
from flow_engine import ContinuousNormalizingFlowEngine
# Initialize Flow Matching Engine
engine = ContinuousNormalizingFlowEngine()
# Sample 1,000 synthetic returns in only 8 RK4 steps
result = engine.sample(
num_samples=1000,
nfe_steps=8,
regime="heavy_tailed_volatility_clustering"
)
print(f"Sampled {result['num_samples']} trajectories in {result['nfe_steps']} NFEs")
print(f"Generated Kurtosis: {result['kurtosis']} (Stylized Heavy Tail)")
print(f"Generated Skewness: {result['skewness']}")
print(f"Sample Returns: {result['sample_head']}")
π Benchmark Efficiency vs. Classical Diffusion
| Model Architecture | Generative Framework | Integration Method | Required NFEs | W2 Transport Error |
|---|---|---|---|---|
| Flow Matching Engine (Ours) | Continuous Normalizing Flow | Runge-Kutta 4 (RK4) | 8 | 0.014 |
| Rectified Flow (Euler) | Linear Flow | 1st Order Euler | 20 | 0.038 |
| Score-based SDE (VE/VP) | Reverse SDE | Euler-Maruyama | 100 | 0.065 |
| DDPM | Markovian Diffusion | Ancestral Sampling | 1000 | 0.082 |
π Integrated Ecosystem
- Interactive Simulation Studio: At1uri/flow-matching-generative-market-studio
- Benchmark Dataset: At1uri/flow-matching-market-benchmarks
- Research Code Vault: At1uri/flow-matching-and-generative-vault
- Flagship Collection: Institutional Quantitative AI Suite
π Citation
@misc{atluri2026flowengine,
author = {Atluri, Ramprasad},
title = {Flow Matching Generative Market Engine},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/At1uri/flow-matching-generative-engine}}
}