Visualizations of energy-based models using Extropic's THRML library. These demonstrate block Gibbs sampling on classic statistical mechanics systems.
Educational visualizations of energy-based models running on GPU using THRML—the same algorithms designed for Extropic's thermodynamic hardware, just simulated digitally.
Not claiming: Hardware breakthroughs or novel research Just showing: What energy-based inference looks like when systems find equilibrium
Spin field showing topological vortex-antivortex pairs at β=1.2. Colors represent spin angles.
Binary spins showing ferromagnetic domain formation and symmetry breaking.
Five-state spins competing for dominance at β=1.0.
Temperature sweeps showing phase transitions across all three models.
Videos: All generated videos are in the outputs/ directory (run scripts to generate locally). The main XY model video (outputs/energy_based/xy_massive_256x256_60fps_20s.mp4) is 252MB of 60fps high-quality visualization showing vortex dynamics in real-time.
256×256 lattice, 65,536 continuous-angle spins
- Energy:
H = -β Σ cos(θᵢ - θⱼ) - 16 discretized angle states
- Block Gibbs sampling with bipartite coloring
- Shows Kosterlitz-Thouless topological phase transition
- Visualizes vortex formation and annihilation
Key Parameters:
- Grid: 256×256 (65,536 spins)
- Beta: 1.2 (moderate temperature)
- Frames: 1,200 @ 60fps (20 seconds)
- Encoding: H.265 CRF 15 (high quality)
64×64 binary spins
- Classic ferromagnet with ±1 spins
- Shows symmetry breaking at critical temperature
- Domain formation dynamics
48×48 5-state spins
- Generalization of Ising to q=5 states
- Multi-color domain competition
- Temperature sweep showing phase transition
Important: These are traditional NumPy-based visualizations, NOT using THRML or energy-based computing.
Located in visualization_only/, these are standard iterative calculations visualizing the Mandelbrot set through different lenses:
- Potential Theory Visualization - Classic escape-time rendering with color mapping
- Iteration Evolution - Shows how the fractal boundary emerges over iterations
These are included for visual interest but are fundamentally different from the energy-based models above. The Mandelbrot set cannot be computed using THRML's thermodynamic sampling - it requires deterministic iteration, not probabilistic inference.
3D visualization of the Mandelbrot set potential field. Height and color represent escape time.
Evolution of the Mandelbrot set boundary across iterations, showing how the fractal structure emerges.
- Framework: THRML (Extropic's JAX-based library)
- Method: Block Gibbs sampling on bipartite graph
- Sampling:
steps_per_sample=1(one full sweep per frame) - Hardware: Currently runs on GPU via JAX
Sampling from the Boltzmann distribution:
p(x) ∝ exp(-E(x)/T)
This is energy-based computing — using energy functions to define probability distributions, then sampling to find low-energy configurations.
Not: Molecular dynamics or physical time evolution
Is: Probabilistic inference through thermodynamic sampling
The continuous XY model has spins ∈ [0, 2π). We discretize to 16 angle states for THRML's categorical samplers. This preserves the essential physics (topological defects, KT transition) while making it tractable for block Gibbs sampling.
# Install THRML
pip install thrml
# Install dependencies
pip install jax jaxlib numpy matplotlib networkxcd energy_based_systems
python xy_massive_256_60fps.pyThis will:
- Build a 256×256 grid with bipartite coloring
- Sample 1,200 frames using block Gibbs
- Encode to H.265 with high quality settings
- Output:
xy_massive_256x256_60fps_20s.mp4
Note: This takes several minutes and requires significant RAM.
# Ising model
python ising_phase_transition.py
# Potts model
python potts_model_thrml.py
# XY with vortex detection
python xy_model_vortices.pycd visualization_only
# Potential theory visualization
python mandelbrot_potential_theory.py
# Iteration evolution
python mandelbrot_iteration_evolution.pyNote: These are standard iterative calculations, not energy-based models.
energy_based_systems/ # Main implementations using THRML
├── xy_massive_256_60fps.py # Main XY model (256x256 @ 60fps)
├── xy_model_vortices.py # XY with vortex detection
├── xy_spin_field_enhanced.py # XY with arrow overlays
├── ising_phase_transition.py # Ising model
├── potts_model_thrml.py # Potts model
└── create_evolution_videos.py # Short evolution demos
visualization_only/ # NumPy visualizations (not THRML)
├── mandelbrot_potential_theory.py
└── mandelbrot_iteration_evolution.py
outputs/ # Generated files (not in git)
├── energy_based/ # THRML model outputs
│ ├── *.png # Phase diagrams
│ └── *.mp4 # Videos
└── visualization/ # Visualization outputs
├── *.png
└── *.mp4
documentation/ # Analysis and explanations
├── WHY_IT_CANT_WORK.md
├── VISUAL_EBM_IDEAS.md
├── CRITICAL_REVIEW.md
└── [other docs]
assets/ # Curated showcase images (in git)
├── MASTER_SHOWCASE.png
├── PHASE_DIAGRAMS_COMPARISON.png
└── SUMMARY_STATS.png
examples/ # Utility scripts
└── create_master_showcase.py
All generated files are in the outputs/ directory (not tracked in git - run scripts to generate).
Sample outputs are included in outputs/energy_based/ and outputs/visualization/:
- Phase diagrams showing temperature sweeps
- Vortex detection examples
- Domain formation snapshots
Videos are generated to outputs/ (excluded from git). Generate them locally or see examples on Twitter.
Recommended: outputs/energy_based/xy_massive_256x256_60fps_20s.mp4 (252MB)
- Highest quality, full resolution
- Shows complete vortex dynamics
- H.265 encoded, 60fps
The XY model is special because it has topological phase transitions. At high temperature, you get vortices—points where spins rotate by 2π around a defect. These are topologically protected (can't be smoothly removed).
As temperature decreases, vortex-antivortex pairs unbind and annihilate. Below the critical temperature (Kosterlitz-Thouless transition), all vortices disappear.
This isn't just math—this physics shows up in:
- Superconducting films
- Superfluids
- 2D materials
- Josephson junction arrays
Traditional computing: Force bits to be 0 or 1 (fight physics)
Thermodynamic computing: Use natural fluctuations (work with physics)
For sampling problems (which is most of AI), this can be orders of magnitude more efficient.
THRML lets you write the algorithms now. Extropic's TSU hardware will run them natively using p-bits.
- THRML works and is accessible
- Energy-based models find structure through sampling
- Block Gibbs on large systems is computationally feasible
- Statistical mechanics visualization can be beautiful
- That Extropic's hardware will achieve claimed efficiency
- That thermodynamic computing will beat GPUs
- Any novel research contribution
- That I fully understand the math (still learning!)
- Large memory usage for 256×256 lattice
- Video encoding is slow (10+ minutes)
- Discretization affects topological defect dynamics
If you:
- Find bugs in the sampling code
- Have ideas for better visualizations
- Want to add other spin models
- Improve the documentation
PRs welcome! Keep it honest, no hype.
- THRML: Extropic AI for building and open-sourcing the framework
- Physics: Kosterlitz, Thouless, Berezinskii for the KT transition
- Inspiration: e/acc community for actually building cool shit
MIT License - do whatever you want with this code.
Note: Videos use copyrighted music for personal use only. Don't redistribute audio files.
Built by @Lantos1618
Questions/comments welcome!
From the e/acc trenches to watching @extropic ship. Still learning, still building.