|
Download README.md from At1uri/energy-based-model-vault: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/At1uri/energy-based-model-vault/resolve/main/README.md
- Command line
-
hf download hf://At1uri/energy-based-model-vault/README.md
-
curl -L -o README.md https://huggingface.co/At1uri/energy-based-model-vault/resolve/main/README.md
3.54 kB
| license: mit | |
| tags: | |
| - energy-based-models | |
| - ebm | |
| - langevin-dynamics | |
| - score-matching | |
| - sgld | |
| - mala | |
| - mcmc | |
| - research-vault | |
| - python | |
| # Energy-Based Model & Langevin MCMC Research Vault (`At1uri/energy-based-model-vault`) | |
| A cryptographic research repository containing foundational mathematical algorithms for **Energy-Based Models (EBMs)**, **Stochastic Gradient Langevin Dynamics (SGLD)**, **Metropolis-Adjusted Langevin Algorithm (MALA)**, and partition-free **Fisher / Implicit Score Matching (ISM)**. | |
| ## Mathematical Foundations | |
| ### 1. Unnormalized Densities & Score Functions | |
| Given an energy model $E_\theta(\mathbf{x}): \mathbb{R}^d \to \mathbb{R}$, the Boltzmann probability density function is: | |
| $$p_\theta(\mathbf{x}) = \frac{1}{Z_\theta(T)} \exp\left( -\frac{E_\theta(\mathbf{x})}{T} \right)$$ | |
| Evaluating $p_\theta(\mathbf{x})$ requires the intractable high-dimensional volume integral $Z_\theta(T) = \int_{\mathbb{R}^d} \exp(-E_\theta(\mathbf{x})/T) d\mathbf{x}$. | |
| However, the **Score Vector Field** $\mathbf{s}_\theta(\mathbf{x}) = \nabla_{\mathbf{x}} \log p_\theta(\mathbf{x})$ cancels $Z_\theta$ completely: | |
| $$\mathbf{s}_\theta(\mathbf{x}) = -\frac{1}{T} \nabla_{\mathbf{x}} E_\theta(\mathbf{x})$$ | |
| ### 2. Overdamped Langevin Stochastic Differential Equation (SDE) | |
| Langevin dynamics models a physical particle suspended in a potential landscape subjected to drag and Brownian collisions: | |
| $$d\mathbf{x}_t = -\nabla_{\mathbf{x}} E(\mathbf{x}_t) dt + \sqrt{2T} d\mathbf{W}_t$$ | |
| By the **Fokker-Planck Equation**, the stationary distribution of this continuous SDE is proven to converge asymptotically to the Boltzmann distribution $p(\mathbf{x}) \propto e^{-E(\mathbf{x})/T}$. | |
| ### 3. Partition-Free Score Matching Objectives | |
| - **Implicit Score Matching (HyvΓ€rinen 2005)**: | |
| $$\mathcal{L}_{\text{ISM}} = \mathbb{E}_{p_{\text{data}}}\left[ \frac{1}{2} \|\nabla_{\mathbf{x}} E_\theta(\mathbf{x})\|^2 - \text{Tr}(\nabla_{\mathbf{x}}^2 E_\theta(\mathbf{x})) \right]$$ | |
| - **Sliced Score Matching (Song et al. 2020)**: | |
| $$\mathcal{L}_{\text{SSM}} = \mathbb{E}_{\mathbf{v} \sim \mathcal{N}(0, I)}\left[ \mathbf{v}^T \nabla_{\mathbf{x}} \mathbf{s}_\theta(\mathbf{x}) \mathbf{v} + \frac{1}{2} (\mathbf{v}^T \mathbf{s}_\theta(\mathbf{x}))^2 \right]$$ | |
| --- | |
| ## Vault Contents & Modules | |
| ``` | |
| vault_ebm/ | |
| βββ MANIFEST.json # Cryptographic SHA-256 integrity manifest | |
| βββ README.md # Mathematical foundations and API documentation | |
| βββ src/ | |
| β βββ energy_model.py # EBM parameterization, analytical score backprop & Hutchinson trace | |
| β βββ langevin_sampler.py # ULA, MALA accept/reject, Annealed multi-scale Langevin | |
| β βββ score_matching.py # Implicit (ISM) & Sliced (SSM) partition-free loss evaluators | |
| βββ benchmarks/ | |
| βββ eval_ebm_convergence.py # Verification suite (score gradient error, MALA rate, annealed SDE) | |
| ``` | |
| --- | |
| ## Verification & Execution | |
| Run the research verification benchmark: | |
| ```bash | |
| python benchmarks/eval_ebm_convergence.py | |
| ``` | |
| ### Verified Benchmark Outputs: | |
| - **Analytical Score vs Finite Differences**: Error $< 1.27 \times 10^{-12}$ (machine precision). | |
| - **MALA Sampling Acceptance**: $100.0\%$ under adaptive step size. | |
| - **Annealed Multi-Scale Langevin Traversal**: Smooth convergence across multi-modal energy wells. | |
| - **Partition-Free ISM Loss**: Evaluated analytically without MCMC in inner loops. | |
| Developed by **Ramprasad Atluri (`At1uri`)**. | |