Sampling¶
These examples draw samples from a fixed, known target. Nothing is learned; the subject is the dynamics and the numerics.
- MCMC: Langevin dynamics and Hamiltonian Monte Carlo, with chains as a batch dimension, so one call runs thousands of them.
- Integrators: the numerical engines inside the samplers, with their order of accuracy measured against an exact solution.
- Flow: continuous-time generation, where
FlowSamplerintegrates a velocity field as an ODE or an SDE using those same integrators.
Start with Langevin Dynamics 101; the integrator and flow examples show the numerics that both MCMC and generative sampling stand on.
Theory: Sampling and Integration.
Next: Training, where the target is learned from data.
| Example | Summary | Level |
|---|---|---|
| Langevin Dynamics 101 | Sample a 2D energy with Langevin; trade step size against noise. | intro |
| HMC 101 | Hamiltonian Monte Carlo on a correlated Gaussian; trade leapfrog steps against gradient cost and chain autocorrelation. | intro |
| Parallel Chains | 10,000 vectorized Langevin chains in one call; population statistics without long single-chain runs. | intro |
| Integrator Comparison | Euler, Heun, and RK4 against the exact solution of a harmonic oscillator; measure order of accuracy directly. | intermediate |
| FlowSampler ODE 101 | Integrate a closed-form velocity field from noise to a Gaussian target; study steps vs fidelity without training. | intermediate |