langevin-dynamics
БесплатноБез исполняемых скриптовНе проверенLayer 5: SDE-Based Learning Analysis via Langevin Dynamics
от plurigrid★ 73 звезды на GitHubОб этом скилле
langevin-dynamics-skill
Layer 5: SDE-Based Learning Analysis via Langevin Dynamics
bmorphism Contributions
"what would it mean to become the Fokker-Planck equation—identity as probability flow?" — bmorphism gist
Active Inference Connection: Langevin dynamics is the generative model underlying Active Inference in String Diagrams (Tull, Kleiner, Smithe). The gradient descent + noise duality maps to:
- Drift term (−∇L) → Action: minimizing surprise
- Diffusion term (√2T dW) → Perception: sampling uncertainty
Philosophical Frame: bmorphism's question about "becoming the Fokker-Planck equation" points to identity as probability flow — the self is not a fixed point but a trajectory through parameter space, converging toward equilibrium while maintaining exploratory uncertainty.
Ergodic Convergence: For ergodic systems, time averages equal ensemble averages. This is the mathematical foundation for the GF(3) ERGODIC trit — the neutral state that connects BACKFILL (-1) and LIVE (+1) through mixing.
Version: 1.0.0 Trit: 0 (Ergodic - understands convergence) Bundle: analysis Status: ✅ New (based on Moritz Schauer's approach)
Overview
Langevin Dynamics Skill implements Moritz Schauer's approach to understanding neural network training through stochastic differential equations (SDEs). Instead of treating training as a black-box optimization, this skill instruments the randomness to reveal:
- Temperature control: How noise scale affects exploration vs exploitation
- Fokker-Planck convergence: When training reaches equilibrium
- Mixing time: How long until the network reaches steady state
- Discretization effects: How learning rate affects continuous theory
Key Contribution (Schauer 2015-2025): Continuous-time theory is a guide, not gospel. Real training is discrete. We instrument and verify empirically.
Research Foundation
Based on Moritz Schauer's work:
- Bayesian Inference for Discretely Observed Diffusion Processes (Ph.D. Thesis, 2015)
- Guided Proposals for Simulating Multi-Dimensional Diffusion Bridges (van der Meulen, Schauer & van Zanten, 2017)
- Automatic Backward Filtering Forward Guiding for Markov Processes (Schauer & van der Meulen, 2020)
- Controlled Stochastic Processes for Simulated Annealing (2025)
Schauer emphasizes that:
"Don't use continuous theory as a black box. Solve the SDE numerically, compare different discretizations, then verify empirically."
Core Concepts
Langevin Dynamics SDE
dθ(t) = -∇L(θ(t)) dt + √(2T) dW(t)
Where:
θ = network parameters
L = loss function
∇L = gradient (drift)
T = temperature (noise scale)
dW = Brownian motion (noise)
Fokker-Planck Equation
The distribution of θ evolves according to:
∂p/∂t = ∇·(∇L·p) + T∆p
Stationary distribution: p∞(θ) ∝ exp(-L(θ)/T)
Convergence to this Gibbs distribution governs learning dynamics.
Mixing Time (τ_mix)
τ_mix ≈ 1 / λ_min(H)
Where H = Hessian of loss landscape
Time until the network reaches equilibrium. Training that stops before equilibration reaches different minima than continuous theory predicts.
Capabilities
1. solve-langevin-sde
Solve Langevin SDE with multiple discretization schemes:
from langevin_dynamics import LangevinSDE, solve_langevin
# Define SDE
sde = LangevinSDE(
loss_fn=neural_network_loss,
gradient_fn=compute_gradient,
temperature=0.01,
base_seed=0xDEADBEEF
)
# Solve with different solvers
solutions = {}
for solver in [EM(), SOSRI(), RKMil()]:
sol, tracking = solve_langevin(
sde=sde,
θ_init=initial_params,
time_span=(0.0, 1.0),
solver=solver,
dt=0.01
)
solutions[solver.__class__.__name__] = (sol, tracking)
# Compare solutions to understand discretization effects
2. analyze-fokker-planck-convergence
Check if trajectory is approaching Gibbs distribution:
from langevin_dynamics import check_gibbs_convergence
convergence = check_gibbs_convergence(
trajectory=solution,
temperature=0.01,
loss_fn=loss_fn,
gradient_fn=gradient_fn
)
print(f"Mean loss (initial): {convergence['mean_initial_loss']:.5f}")
print(f"Mean loss (final): {convergence['mean_final_loss']:.5f}")
print(f"Std dev (final): {convergence['std_final']:.5f}")
print(f"Gibbs probability ratio: {convergence['gibbs_ratio']:.4f}")
if convergence['converged']:
print("✓ Trajectory has reached Gibbs equilibrium")
else:
print("⚠ Training stopped before equilibration")
3. estimate-mixing-time
Estimate how long until network reaches steady state:
from langevin_dynamics import estimate_mixing_time
tau_mix = estimate_mixing_time(
solution=trajectory,
gradient_fn=gradient_fn,
temperature=T
)
print(f"Estimated mixing time: {tau_mi
Установить langevin-dynamics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл langevin-dynamics?
Layer 5: SDE-Based Learning Analysis via Langevin Dynamics
Как установить скилл langevin-dynamics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл langevin-dynamics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic