File size: 1,281 Bytes
d486718 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ---
license: apache-2.0
tags:
- normalizing-flows
- realnvp
- generative-modeling
- density-estimation
- gradio
---
# Flow Pocket
Flow Pocket trains an exactly invertible RealNVP density model on a curved
five-armed pinwheel distribution. Eight affine coupling layers transform data into
a standard Gaussian while tracking the exact change-of-variables log determinant.
The benchmark compares held-out negative log-likelihood and generated-sample MMD
against a fitted full-covariance Gaussian and a five-component Gaussian mixture.
It also measures forward/inverse cycle error to verify that the saved neural
transform is numerically invertible.
## Verified results
The flow trained on 40,000 samples and was evaluated on 10,000 independently
generated samples.
| Model | Held-out NLL | Sample MMD |
| --- | ---: | ---: |
| RealNVP | 2.2629 | 0.000236 |
| Five-component GMM | 2.5887 | 0.000436 |
| Full-covariance Gaussian | 3.3527 | 0.002800 |
The eight-coupling-layer RealNVP has 21,536 parameters. Its maximum absolute
forward/inverse reconstruction error over 2,000 held-out points was `5.78e-6`.
MMD uses independently randomized 1,000-sample subsets and a shared median
distance bandwidth.
## Reproduce
```powershell
uv run python projects/flow-pocket/train.py
```
|