| 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 | |
| ``` | |