EBM-Splats
Status: Research complete. Phase 1-3 empirical tests finished. Energy-guided generation continued in m2m-energy-fields.
Energy-Based Model with Gaussian Splats on a 640D hypersphere. Explores distributional representations for latent spaces, sampling via Langevin dynamics, Rectified Flow, and energy-guided masked diffusion.
Project Phases
Phase 1: EBM + PGLF (April 2026) — Discarded
EBM with Gaussian splats as attractors on S^639 + PGLF (projection over MiniLM with contrastive loss).
Result: PGLF degraded MiniLM on STS-B (-4.7%). Projection over pre-trained embeddings always destroys geometry.
Phase 1 Empirical: Discard Tests (July 2026)
3 empirical tests to discard or confirm alternatives. RTX 3090, real data.
| Test | Hypothesis | Result | Verdict |
|---|---|---|---|
| PGLF Grid (14 configs) | Can any config beat MiniLM? | 0/14 beat baseline (0.8672) | DISCARDED |
| OOD Detection | Does EBM energy detect OOD? | AUROC=1.0 (EBM) vs 0.999 (random baseline) | NO ADVANTAGE |
| RF vs Langevin | Does RF solve the speed bottleneck? | 29.4x faster (RF 5 vs Langevin 200 steps), better quality | CONFIRMED |
Key finding: The argument that "200 Langevin steps per token" is prohibitive no longer applies. Rectified Flow with 1-2 steps produces better samples than Langevin with 200 steps, 29.4-38.7x faster (tests/t11_rf_results.jsonl: RF 5 steps 0.0079s and RF 1 step 0.006s vs Langevin 200 steps 0.2322s).
Phase 2: Energy-Guided Generation (July 2026)
EBM as a generator that learns its own latent space (not as a layer over pre-trained models), with sampling via Rectified Flow.
| Test | Hypothesis | Result | Verdict |
|---|---|---|---|
| Energy-Guided Generation | Can energy manipulation steer generation? | 100% topic control at gs=1.0-2.0 | CONFIRMED |
| Concept Composition | Can multiple concepts be combined? | 4/4 mechanisms work | CONFIRMED |
Phase 3: EBM-Guided Masked Diffusion on LLaDA-8B (July 2026)
Can energy fields steer a large masked diffusion model (LLaDA-8B) via logit injection at each denoising step? 13-experiment autoresearch sweep using Karpathy methodology.
| Config | sim_mean | good% | Verdict |
|---|---|---|---|
| Baseline (α=5, constant) | 0.1845 | 62% | reference |
| Best (α=10, cosine schedule, cosine_all) | 0.2574 | 75% | ✅ +39% sim |
| Worst (z_score + linear_up) | 0.0916 | 12% | ❌ |
Best config: logit_additive + cosine_all scoring + cosine alpha schedule + abs_max norm + α=10
What works: Topics with distinctive vocabulary (horror sim=0.44, ocean sim=0.34) are steered effectively. Energy injection modifies token selection while maintaining coherence.
What doesn't work: "Common" topics (cooking sim=0.07, space sim=0.18) resist steering — the model's narrative priors dominate. All outputs begin "Once upon a time, there was a girl..." regardless of guidance target.
Fundamental limitation: Logit-level energy injection steers vocabulary selection but not narrative planning. The masked diffusion model's iterative denoising creates a commitment cascade that energy cannot redirect.
Security Implications
The Phase 3 experiments inadvertently revealed a novel attack surface in masked diffusion language models. Unlike autoregressive models (GPT, Llama) which have 1 logit injection point per token, MDLMs expose N injection points (one per denoising step, typically 128). Our experiments show that pre-computed energy vectors can steer generation toward arbitrary semantic targets while maintaining output coherence.
See docs/SECURITY_ANALYSIS.md for the full threat model, empirical evidence, and mitigation recommendations.
See docs/RESULTS.md for the full 13-experiment sweep with per-topic breakdowns.
Repository Structure
├── src/ebm/ # Core EBM modules (geometry, splats, energy, model, etc.)
├── pglf/ # PGLF (archived — discarded empirically)
├── scripts/ # Training and generation scripts
├── tests/
│ ├── phase1_t11_rf_vs_langevin.py # RF vs Langevin benchmark
│ ├── phase1_t12_pglf_grid.py # PGLF grid search
│ ├── phase1_t13_ood_energy.py # OOD detection test
│ ├── phase2_energy_guided.py # Energy-guided generation test
│ ├── phase2_composition.py # Concept composition test
│ └── t*_results.jsonl # Raw results
└── docs/
├── PHASE1_RESULTS.md # Full Phase 1 report
├── PHASE2_RESULTS.md # Phase 2 energy-guided generation report
└── ...
Detailed Results
See docs/PHASE1_RESULTS.md and docs/PHASE2_RESULTS.md for full empirical test reports.
Tech Stack
- Python, PyTorch (CUDA 12.4, RTX 3090)
- sentence-transformers, HuggingFace datasets
- Rust (M2M integration via HTTP)
Experimental GPU kernels
Optional Triton/CUDA-graph kernels for the hot paths, with automatic fallback
to the reference implementation (no CUDA, no Triton, or outside the winning
regime). Install with pip install -e ".[triton]" (Linux + CUDA GPU).
Official head-to-head (RTX 3090, 4000 splats × dim 640, B=64, seed 42,
correctness asserted before timing — benches/bench_headtohead.py):
| workload | reference | kernel | speedup | correctness |
|---|---|---|---|---|
| Langevin sampling (100 steps, B=8) | 660 ms | 51.2 ms | 12.9x | graph ≡ eager bit-exact; |ΔE| vs reference 0.0024 (sampler noise, 0.03%) |
| score forward | 0.96 ms | 0.30 ms | 3.22x | maxdiff 7.5e-8 |
| splat energy | 0.82 ms | 0.24 ms | 3.39x | maxdiff 9.5e-7 |
| find_neighbors (warm, memoized) | 0.02 ms | 0.02 ms | 0.80x | top-k set bit-exact |
Honest notes:
- The Langevin win is launch-overhead elimination (CUDA graph capture of the whole 100-step loop, ~176 kernels/step in eager mode), not math speedups. Capture costs ~0.7–1.2 s once per (shape, splats) configuration and is cached.
- The KNN kernel only wins on cold lookups at small batch; warm lookups are dominated by the LRU-1 memoization of the reference (0.02 ms) — the wrapper routes automatically and falls back outside its winning regime.
- The fused KNN variant (distance+top-k in one launch) was built, measured and rejected: 15–40x slower than the split path (bitonic merge dominates).
- With nearest-neighbour selection the d2 gaps INSIDE the top-k shrink to ~1e-6 (fp32 GEMM noise), so the returned neighbour ORDER depends on the GEMM that computed d2 (reference cuBLAS vs tiled Triton). The top-k SET is stable (cut gap ~3e-4). Tests therefore assert the set exactly and the order within a 1e-5 near-tie band.
find_neighborssemantic fix (2.1.0): the torch path selected the LARGEST d2 values — the FARTHEST splats — while the docstring said "nearest" and the legacy faiss path (highest inner product) disagreed with it. Both paths now select the k nearest splats, ascending. Results published before 2.1.0 (README results table) were measured with the old behaviour.
License
Apache-2.0
Metadata
Release files for ebm-splats 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ebm_splats-2.1.0.tar.gz | 71.1 kB | With provenance | Details for ebm_splats-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ebm_splats-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for ebm_splats-2.1.0-py3-none-any.whl |
Total release size: 140.8 kB
Release files / ebm_splats-2.1.0.tar.gz
| Download URL | ebm_splats-2.1.0.tar.gz |
|---|---|
| Size | 71.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dd1ef1cd51327259c38e2d7d4e49a332a969a3e95b7628641b3e411dfa99d65
|
|
BLAKE2b-256 checksum How to use checksums |
88048c6557a9abf089475da9e3e7f1fc1fabd22ec85ea842a808a9071dc33b44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / ebm_splats-2.1.0-py3-none-any.whl
| Download URL | ebm_splats-2.1.0-py3-none-any.whl |
|---|---|
| Size | 69.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56673524a23b7d6dfd468a9722f8664d70dd3fdba06a21c372e46312cb152634
|
|
BLAKE2b-256 checksum How to use checksums |
9f8c30480528f553ad28448015555ed0b6f09aed4372bfa90a09d58730835632
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for ebm-splats 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ebm_splats-2.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.