Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

fokker-planck-analyzer

БесплатноБез исполняемых скриптовНе проверен

Layer 5: Convergence to Equilibrium Analysis

plurigridот plurigrid★ 73 звезды на GitHub

Об этом скилле

fokker-planck-analyzer

Layer 5: Convergence to Equilibrium Analysis

bmorphism Contributions

"what would it mean to become the Fokker-Planck equation—identity as probability flow?" — bmorphism gist

Philosophical Frame: The Fokker-Planck equation describes how probability distributions evolve over time. bmorphism's question about "becoming" the equation points to the deep connection between identity and probability flow — the self as a dynamical system converging to equilibrium.

Active Inference Connection: Fokker-Planck dynamics underlie Active Inference in String Diagrams (Tull, Kleiner, Smithe) where free energy minimization drives probabilistic belief updates.

Version: 1.0.0 Trit: -1 (Validator - verifies steady state) Bundle: analysis Status: ✅ New (validates Fokker-Planck convergence)


Overview

Fokker-Planck Analyzer verifies that neural network training via Langevin dynamics has reached equilibrium. It checks whether the empirical weight distribution matches the theoretical Gibbs distribution predicted by Fokker-Planck theory.

Key Insight: Training that stops before reaching mixing time (τ_mix) ends up in different regions of the loss landscape than continuous theory predicts. This skill detects that gap.

The Fokker-Planck Equation

∂p/∂t = ∇·(∇L(θ)·p) + T∆p

Boundary condition: p(θ, 0) = p₀(θ) [initial distribution]
Steady state:      p∞(θ) ∝ exp(-L(θ)/T) [Gibbs distribution]

Where:

  • p(θ, t) = probability density of parameter θ at time t
  • L(θ) = loss function
  • T = temperature (controls noise scale)
  • ∆p = Laplacian (diffusion operator)

Core Concepts

Gibbs Distribution

At equilibrium, weights follow a Boltzmann-like distribution:

p∞(θ) ∝ exp(-L(θ)/T)

Interpretation:
- Lower loss → higher probability
- Temperature T controls sharpness:
  - Low T: Sharp peaks at good minima
  - High T: Broad, flat distribution

Mixing Time (τ_mix)

Time until the distribution converges to Gibbs:

τ_mix ≈ 1 / λ_min(H)

Where H = Hessian of loss landscape at equilibrium

For well-conditioned problems: τ_mix ∝ 1/λ_min
For ill-conditioned problems: τ_mix can be very large

Relative Entropy / KL Divergence

Measure how far current distribution is from Gibbs:

D_KL(p_t || p∞) = ∫ p_t(θ) log(p_t(θ) / p∞(θ)) dθ

At equilibrium: D_KL → 0
During training: D_KL > 0 (decreasing exponentially)

Capabilities

1. check-gibbs-convergence

Verify that trajectory is approaching Gibbs distribution:

from fokker_planck import check_gibbs_convergence

convergence = check_gibbs_convergence(
    trajectory=solution,
    temperature=0.01,
    loss_fn=loss_fn,
    gradient_fn=gradient_fn
)

print("Gibbs Convergence Analysis:")
print(f"  Mean loss (initial): {convergence['mean_initial']:.5f}")
print(f"  Mean loss (final):   {convergence['mean_final']:.5f}")
print(f"  Std dev (final):     {convergence['std_final']:.5f}")
print(f"  Gibbs ratio: {convergence['gibbs_ratio']:.4f}")

if convergence['converged']:
    print("✓ Reached Gibbs equilibrium")
else:
    print("⚠ Did NOT reach equilibrium (more training needed)")

2. estimate-mixing-time

Estimate τ_mix from loss landscape geometry:

from fokker_planck import estimate_mixing_time

# Method 1: From Hessian eigenvalues
hessian = compute_hessian(loss_fn, gradient_fn, current_θ)
eigenvalues = np.linalg.eigvalsh(hessian)
lambda_min = eigenvalues[0]
tau_mix = 1 / lambda_min

print(f"Hessian smallest eigenvalue: {lambda_min:.6f}")
print(f"Estimated mixing time: {tau_mix:.0f} steps")

# Method 2: From empirical convergence rate
convergence_rate = estimate_convergence_rate(trajectory)
tau_mix_empirical = -1 / np.log(convergence_rate)
print(f"Empirical mixing time: {tau_mix_empirical:.0f} steps")

3. measure-kl-divergence

Track distance from Gibbs distribution over time:

from fokker_planck import measure_kl_divergence

kl_history = []
for t in range(0, len(trajectory), skip=10):
    # Empirical distribution at time t
    p_t = estimate_empirical_distribution(
        trajectory[:t],
        bandwidth=0.01
    )

    # Gibbs distribution at equilibrium
    p_inf = gibbs_distribution(loss_fn, temperature=0.01)

    # KL divergence
    kl = compute_kl_divergence(p_t, p_inf)
    kl_history.append((t, kl))

# Plot convergence
import matplotlib.pyplot as plt
times, kls = zip(*kl_history)
plt.semilogy(times, kls)
plt.xlabel("Training steps")
plt.ylabel("D_KL(p_t || p∞)")
plt.title("Convergence to Gibbs Distribution")
plt.show()

4. validate-steady-state

Comprehensive validation that equilibrium has been reached:

from fokker_planck import validate_steady_state

validation = validate_steady_state(
    trajectory=solution,
    loss_fn=loss_fn,
    gradient_fn=gradient_fn,
    temperature=0.01,
    test_set=Non
Полный SKILL.md на GitHub

Установить fokker-planck-analyzer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл fokker-planck-analyzer?

Layer 5: Convergence to Equilibrium Analysis

Как установить скилл fokker-planck-analyzer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл fokker-planck-analyzer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить fokker-planck-analyzer с