fhat. Workspace

Universal and Identifiable Dissipative Dynamics

Recent

Infer a stationary landscape and irreversible drift from trajectories.

Zhu et al. 2026Also known as UIDD, I-OnsagerNet

Full skillv0.1.0

Use with your agent

Use the fhat method "uidd" (https://fhat.dev/methods/uidd/SKILL.md) for this problem. Check first whether it applies.

1. What this solves

Two systems can have the same stationary histogram while one circulates around its density contours. Timed trajectories let UIDD estimate the circulation as well as the landscape. Its outputs are a dimensionless potential, diffusion, reversible and irreversible drifts, and an entropy production rate (EPR) for a specified time reversal.

2. When to use

Use consecutive observations with known short, positive lags. Model a time-homogeneous Markov Itô diffusion on finite-dimensional Euclidean coordinates with a smooth, unique normalizable stationary density. The reference assumes nonsingular noise, natural boundaries and ordinary reversal of the recorded path. Training paths may begin out of equilibrium. Estimating a global stationary average requires credible steady-state coverage, either observed or simulated after equilibration.

Check whether trajectories from different starting regions approach the same late-time histogram, and compare the histogram across later time windows. Check confinement in the fitted model as well. For example, a V that grows at least quadratically outside a bounded region makes exp(−V) integrable on Euclidean space. Confinement of the model and agreement of finite histograms support different parts of the assumption. If the invariant law remains uncertain, record the density prerequisite as unknown, report supported finite-time predictions and leave stationary density and entropy production unresolved.

3. When not to use (and what to use instead)

Situation Use instead
Drift changes under an imposed protocol, or unconfined motion has no invariant density Model the protocol or the transient drift directly.
The requirement is to find extra coordinates that close a measured observable Fit Stochastic OnsagerNet with microscopic trajectories and validate the augmented Markov state.
A hard reflecting wall determines confinement Impose no flux at the wall and use a boundary-aware transition model there. A smooth confining potential on an open domain fits the reference assumptions.
Only independent stationary snapshots are available Estimate the density from samples. Obtain timed pairs to resolve current or entropy production.
Odd variables such as momentum require a parity flip under physical time reversal, or the noise is singular Specify the physical reversal and use an appropriate path-space formulation for those coordinates and noise directions.

4. Algorithm

  1. Choose smooth trainable functions V, σ and d−1 scalar band functions b on the d-dimensional state. Ensure exp(−V) is integrable. A squared nonlinear feature lift with a positive quadratic floor is one choice. Use a full-rank noise factor, e.g. a lower triangular matrix with positive diagonal. In dimensionless unit-temperature variables set M = σσᵀ/2. Set W[i,i+1] = b[i], W[i+1,i] = −b[i], all other entries zero.
  2. Compute each row divergence (div K)[i] = Σⱼ ∂K[i,j]/∂x[j]. Then f_rev = −M∇V + div M, f_irr = −W∇V + div W and f = f_rev + f_irr. The forward SDE is dX = f dt + σ dB. The drift of the stationary reversed path is f_rev − f_irr. Use Eqs. (1–3) of the paper. For constant M or W the corresponding divergence vanishes.
  3. Split by independent trajectory. Fit the three functions jointly by minimizing the mean Euler–Maruyama Gaussian negative log density. For a pair (x,y,τ), evaluate all heads at x, form r = y−x−τf and C = τσσᵀ. The loss per pair is [d log(2π) + log det C + rᵀC⁻¹r]/2. Factor C for the solve. Use a shorter observation lag to test discretization bias.
  4. For inference set ρ = exp(−V)/Z. Energy differences do not require Z. The stationary current is ρ f_irr. The local total EPR is q(x) = f_irrᵀM⁻¹f_irr. The global EPR is E_ρ[q] (Eq. 5). Use stationary_epr(states, dynamics) on equally weighted, well-mixed stationary samples, account for autocorrelation and report uncertainty in inverse time units. Under the stated reversal and ellipticity this average vanishes for a reversible stationary process.
  5. For the linear benchmark V = xᵀSx/2 with constant M,W and S positive definite, the stationary covariance is S⁻¹ and the exact global EPR is −tr(M⁻¹WSW) (Eq. 7). Use this to test orientation, noise normalization and stationary averaging. Published paper · Open equations and algorithm

5. Parameters

Parameter Choice
Potential gauge and scale In these units the noise fixes the energy scale. Set V at a reference state to zero for comparisons. State any physical temperature conversion.
Noise amplitude A triangular full-rank factor permits correlated increments. Monitor its smallest singular value and sensitivity of q to its conditioning.
Band functions Fit smooth functions of the whole state. Each fills one fixed oriented pair of matrix entries.
Timestep and derivatives Keep the actual lag on each pair. Use autodiff in a training framework. The CPU reference uses centered spatial differences with relative step 10⁻⁵ for general functions.
Stationary samples Check equilibration, coverage, effective sample size and sensitivity to timestep and initialization.

6. Applying it to your own code

The identifiability theorem pertains to the potential up to an additive constant, its force, and the two drift components on stationary support. Finite data can still underresolve them. Noise-factor rotations give the same mobility. Derivative propagation through σσᵀ and W must stay active during fitting. Use the same dimensionless time convention for f and the noise covariance.

The paper’s Eq. (1) and the executable drift add the row divergences. The displayed formula in the pinned project README and the dynamics class docstrings places them under an overall minus sign. At x=2, V=x²/2 and M=1+x², the correct reversible drift is −6 and the stationary current vanishes. Subtracting div M gives −14 and a spurious current divided by density of −8. Paper · README · Class docstring · Executable drift

The authors’ Euler–Maruyama likelihood scores the average velocity (y−x)/τ. The portable likelihood scores the endpoint y. The endpoint negative log likelihood equals the velocity negative log likelihood plus d log τ per observation. This shift is independent of the model parameters for fixed data. Authors’ likelihood

When writing generated code add the comment uidd v0.1.0, Zhu et al. (2026).

7. Verification

Step 1. Export the five operations specified in checks/cases.json from port_adapter.py in your working directory. Run python3 /path/to/uidd/checks/check_port.py and show the output. The two-dimensional variable_drift case supplies analytic state-dependent fields and asks the port to compute the full drift, including both row divergences. An independent analytic result checks this fixture. Other fixtures exercise a three-dimensional skew band, correlated diffusion and normalized likelihood. The fixed loss case checks gradients with respect to the potential stiffness and the noise scale, including the scale's contribution through the mobility divergence. The property checks rotate the Brownian basis and reverse the irreversible drift.

Step 2. Compare held-out increments and stationary histograms, check the forward and reversed currents, and vary the observation lag. Estimate a confidence interval over independent paths or sufficiently long blocks. Test a reversible control. For constant M,W the divergence-sign error is invisible.

Figure 2’s exact linear EPR at λ=1 is 47.0598338 in the authors’ notebook. Integrating the local EPR against the exact Gaussian second moments using the rounded true matrices gives 47.0598274. All five λ settings agree within 10⁻⁵ absolute. This checks Eq. (7) and the EPR normalization. The learned EPR of 48.88 at λ=1 was not reproduced. Authors’ Figure 2 notebook

The separate small fit uses symmetric synthetic innovations chosen to match the Euler–Maruyama likelihood’s first two conditional moments exactly. The correct coefficients are in its model class. It checks coefficient recovery and stationary EPR on this controlled problem. The Lyapunov equation for the inverse of the fitted precision is a structural identity of the linear UIDD model.

8. Failure signatures

Symptom Check
Correct analytic drift for constant coefficients but stationary current at equilibrium with variable mobility Check the row derivative index and both divergence signs.
Apparent stationary density changes when an arbitrary energy offset is added Normalize the density or compare potential differences.
Correct variance but reversed circulating motion Check the upper skew-band sign and the forward-time convention. EPR alone is insensitive to reversal.
EPR unstable across runs Check poorly sampled states, conditioning, equilibration, hidden coordinates and lag sensitivity.

9. Files and commands

Run python3 examples/fit_linear.py from this directory. reference/uidd.py provides general state-dependent function callbacks and the likelihood, reference/linear.py the small fitted model, and reference/fit.py the optimizer.

Run python3 checks/make_cases.py to emit the fixtures. Run python3 verify/check_cases.py, python3 verify/check_stationary.py and python3 verify/check_figure2.py for the broken-port controls, independent fit and source result.

10. Sources

A. Zhu, B. W. Soh, G. A. Pavliotis and Q. Li, Identifiable learning of dissipative dynamics, Nature Communications 17, 9460 (2026). See Eqs. (1–7), Theorem 1, the algorithm in Methods and the linear benchmark. The reference uses the published name UIDD. Paper · Authors’ implementation and benchmark outputs

Evidence

Output of the verification scripts, run on the reference implementation of version 0.1.0 when this page was built.

Passed verify/check_cases.py: Checks spatial drift against analytic row divergences, catches a column-divergence port, and checks both training derivatives against centered differences.
PASS 6 fixed cases and the independent property checks
PASS weight derivatives against centered differences of the training loss
PASS spatial drift against analytic row divergences
PASS caught subtracted divergences: state-dependent reversible drift
PASS caught transposed skew: two coupled skew bands with oriented row divergences
PASS caught missing one half in mobility: correlated mobility and positive rate
PASS caught column divergence of the skew field: row divergence through two-dimensional variable fields
PASS caught detached mobility divergence: variable-diffusion loss and two weight derivatives
Passed verify/check_stationary.py: Uses symmetric Euler–Maruyama innovations to verify synthetic coefficient recovery and EPR, and checks the linear covariance identity and variable-mobility drift.
learned stationary precision 1.50000, 2.50000 and upper skew band 0.40000
structural covariance balance passed, stationary EPR 1.54286, target 1.54286
state-dependent reversible drift -6.00000, reversed divergence gives current/density -8
Passed verify/check_figure2.py: Verifies Eq. (7) and EPR normalization by integrating local EPR on the true matrices for all five linear benchmark settings to within 0.00001 of the exact values.
lambda 1.000, stationary EPR 47.0598274, reported 47.0598338
lambda 0.500, stationary EPR 11.7649569, reported 11.7649584
lambda 0.250, stationary EPR 2.9412392, reported 2.9412396
lambda 0.125, stationary EPR 0.7353098, reported 0.7353099
lambda 0.000, stationary EPR 0.0000000, reported 0.0000000

More methods are coming.