Implementation: Eq(3) via getMetric() • Eq(5) via detailed balance • Eq(6) via recursive entropy monitor • Eq(7) via curvature-mixing feedback
📖 Complete Guide
🎯 Overview
This is an interactive laboratory for exploring Recursive Markov Chain Monte Carlo (MCMC) sampling algorithms. You'll see three different samplers simultaneously exploring probability distributions in real-time.
The key innovation: sampling on a recursive substrate where depth (n) represents computational recursion levels, creating a 3D manifold (x, y, n) instead of just 2D space.
🤖 The Three Samplers
🌸 Random Walk Metropolis (RWM) - Pink
Classic baseline: Simple random walk with accept/reject
Behavior: Proposes random jumps, accepts based on probability ratio
Limitation: Can get stuck in low-density regions, slow mixing
💠 τon-RHMC (Riemannian HMC) - Cyan
Advanced method: Uses momentum and curved geometry
The "τon field": Information-theoretic force field that guides sampling
Depth recursion: Occasionally increases depth n to explore higher computational levels
Advantage: Efficient exploration, adapts to geometry
⭐ Klein-Flip - Gold
Topological sampler: Can "flip" through the manifold
Special moves: 10% chance to flip coordinates (−x, −y) and change depth
Advantage: Can escape local modes by topology-jumping
Watch the "Flips" counter to see when it performs these moves
🎮 Controls & Features
▶ Start/Pause
Begin or pause the simulation. Watch all three samplers explore simultaneously.
↻ Reset
Return all samplers to initial positions and clear history.
🔊 Audio On/Off
Enable sonification! Each sampler produces unique tones:
Pitch: Changes with position (x, y, n)
Volume: Reflects acceptance rate and curvature
Stereo pan: Maps to local curvature
Waveforms: RWM=sine, RHMC=triangle, Klein=square
⚡ Collapse—Reseed
Performs a "quantum collapse" on τon-RHMC and Klein-Flip:
Resets depth to n=0
Slightly randomizes position
Creates an audio pulse
Purpose: Simulates resetting recursion while maintaining locality
💾 Export CSV
Download all sampler data as a CSV file including:
Position (x, y), depth (n) for every sample
Acceptance rates and total moves
Timestamped filename for data analysis
⏺ Record Animation
Capture the visualization as an animation:
Click once to start recording (button turns green)
Click again to stop and save frames as JSON
Use external tools to convert JSON frames to video
Great for presentations and papers!
🎯 Quick Presets
One-click configurations for different scenarios:
Default: Clean start with bimodal distribution
Fast Mix: 5x speed with field lines for quick demos
Deep Explore: 4-mode mixture with all visualizations
Challenge: Neal's Funnel with curvature view (hardest)
🎚️ Speed Slider
Control simulation speed from 1x to 5x. Higher speeds show mixing behavior faster.
Target Distribution Selector
Bimodal Gaussian: Two peaks, tests mode-switching
Rosenbrock Banana: Curved, narrow valley (challenging)
4-Mode Mixture: Four corners, tests multi-modal exploration
🔬 Visualization Options
✓ Curvature heat map
Shows the geometric curvature of the probability distribution:
Purple regions: High positive curvature
Teal regions: High negative curvature
Curvature affects mixing efficiency
✓ τon field lines
Visualizes the information-theoretic force field that guides RHMC. Lines show the direction and strength of the τon field.
✓ Depth rings
Concentric circles representing recursion depth levels. Samplers can move between these levels in the 3D view.
✓ Flatten (classical)
Disables the recursive substrate—locks all samplers to n=0. Use this to see the difference between classical and recursive MCMC!
Shimmer Overlay
The subtle animated gradient on the 2D canvas visualizes τon field coupling. The shifting colors represent the dynamic information-theoretic landscape.
📱 Touch Controls (Mobile/Tablet)
On touch devices, the 3D view supports gesture controls:
Single finger drag: Rotate the 3D manifold
Swipe up/down: Adjust X-axis rotation
Swipe left/right: Adjust Z-axis rotation
All touch gestures work smoothly with 60fps rendering
📊 Understanding the Metrics
Accept Rate (%)
Percentage of proposed moves that are accepted. Ideal: 20-50% for RWM, 60-90% for HMC-style methods.
ESS (Effective Sample Size)
Basic efficiency metric based on acceptance rate. Higher is better.
ESSκ (Curvature-Adjusted ESS)
Advanced metric: ESS / (1 + |κ|)
Accounts for local curvature. Shows true mixing efficiency in curved spaces.
Depth n
Current recursion level (0-5). Higher n means deeper computational nesting.
ΔHr drift
Change in recursive entropy. Should fluctuate around zero for proper balance.
Drift Sparkline
Mini-graph showing recent entropy drift history. The cyan line traces drift over the last 100 iterations. Purple horizontal line = zero drift (equilibrium).
Color gradient: Shifts from teal→violet (balanced) to yellow→pink (diverging) based on drift magnitude
κ Gauge (top-right)
Real-time curvature indicator. Size and opacity reflect current system curvature.
🎓 Theory & Concepts
What is Recursive MCMC?
Traditional MCMC samples from probability distributions in flat spaces. Recursive MCMC adds a depth dimension representing computational recursion, creating a richer geometry.
The "3D Depth Manifold" shows the full (x, y, n) space. Watch how samplers move not just horizontally but also "up and down" through recursion levels!
Key Insight
Curvature κ controls mixing efficiency. High curvature = slow mixing. The recursive substrate and τon field help navigate curved spaces more efficiently.
💡 Tips for Exploration
Start simple: Begin with Bimodal distribution, audio off, default settings
Try presets: Click preset buttons for pre-configured scenarios
Compare algorithms: Watch the Algorithm Comparison panel to see which sampler performs best
Try challenging distributions: Switch to Banana or Funnel to see differences amplified
Enable audio: Hear the algorithms "sing" their exploration patterns
Export data: Download CSV for external analysis in Python/R
Record demos: Capture animations for presentations
Test flattening: Toggle Flatten mode to see how recursion helps
Watch the harmony: When it diverges, click Collapse—Reseed to restore balance
Switch to 3D: See the full recursive manifold in action
Mobile users: Use touch gestures to rotate the 3D view
📄 For technical details, click the paper link below the equations panel.