Universal Clock Regularization for Recurrent Dynamics
Implementation & benchmark of arXiv:2607.15472 — Ptolemy's Equant Equates to a Universal Dynamical Clock via Machine Learning
Source paper: Ptolemy's Equant Equates to a Universal Dynamical Clock via Machine Learning arXiv:2607.15472 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Add a learned phase coordinate to an RNN, state-space model, or latent neural ODE and train it to advance at constant angular velocity along recurrent trajectories. This separates genuine phase progression from amplitude and embedding distortions, encouraging coherent long-horizon oscillations while providing a quantitative monitor for impending loss of a limit cycle.
Formulas
Mathematical statement
For a continuous system \(\dot{\mathbf{x}}=\mathbf{F}(\mathbf{x})\), assume an attractive limit cycle \(\mathbf{C}\) and a phase function \(\phi(\mathbf{x})\in[0,2\pi)\) satisfying \(d\phi/dt=\omega\). By the chain rule, the defining clock equation is \(\nabla_{\mathbf{x}}\phi(\mathbf{x})\cdot\mathbf{F}(\mathbf{x})=\omega\), where \(\omega\) is the natural angular frequency. For a neural trajectory \(\mathbf{h}_k\) sampled at interval \(\Delta t\), use a phase encoder \(\phi_\theta(\mathbf{h})\) and estimate \(\widehat{\omega}_k=\operatorname{unwrap}(\phi_\theta(\mathbf{h}_{k+1})-\phi_\theta(\mathbf{h}_k))/\Delta t\). The adapted clock loss penalizes deviation from a trajectory-specific constant frequency: \(L_{\mathrm{clock}}=\operatorname{Var}_k(\widehat{\omega}_k)\), together with a cycle-rate loss matching the mean frequency to a learnable positive scalar \(\omega_\theta\). The property doing the work is low phase-velocity variance; its breakdown is predicted to precede amplitude or hidden-state divergence.
Implementation notes
Integrate this at the hidden-state update of a GRU, vanilla RNN, S4-like state-space model, or latent neural ODE. Add a small phase head \(\phi_\theta\) that outputs \((s,c)\), normalize it as \((s,c)/(s^2+c^2)^{1/2}\), and compute the angle with \(\operatorname{atan2}(s,c)\); unwrap angles only within each short training window. Pseudocode: roll out hidden states \(h_0,\ldots,h_T\); compute \(\phi_k=\operatorname{atan2}(s_k,c_k)\); form unwrapped differences \(d_k=\operatorname{unwrap}(\phi_{k+1}-\phi_k)\); set \(\hat\omega_k=d_k/\Delta t\); compute \(\bar\omega=\operatorname{mean}_k\hat\omega_k\); add \(\lambda_{clock}\operatorname{mean}_k[(\hat\omega_k-\bar\omega)^2]\) to the task loss; then backpropagate through the phase head and recurrent model. The paper supplies the phase equation and attractive-limit-cycle assumption; the phase encoder, finite-difference velocities, and variance are estimated from minibatch rollouts. Start with a cheap experiment on a GRU forecasting noisy Van der Pol and Lorenz-63 trajectories, comparing standard teacher-forced training against clock regularization at matched parameter counts. Evaluate free-running prediction for 10, 50, and 200 periods. The falsifiable prediction is that the clock model has lower normalized frequency error \(\mathcal{E}_{clock}\) and slower phase drift. During a parameter or learning-rate sweep, \(\mathcal{E}_{clock}\) should rise sharply before hidden-state norms or forecast error diverge. Sweep \(\lambda_{clock}\): insufficient regularization should leave high phase variance, whereas excessive regularization should suppress non-periodic behavior. Record the first value at which long-horizon phase error decreases without increasing one-step task loss by more than 5%.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Inconclusive
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a self-contained clock regularization MVP with a phase head, wrapped short-window phase differences, variance/cycle losses, analytical toy sweeps, and a fixed-seed GRU comparison. The core predictions manifested: phase-distortion variance and normalized clock error matched the derived scalings within 0.004% and 0.002%, noisy finite differences matched the 2σ²/Δt² law within 0.27%, and unwrap remained correct through increment 3.13 then switched branches above π as predicted. In the GRU toy, clock_E fell from 17.25 to 0.307 (98.2% lower), while one-step MSE worsened from 0.00519 to 0.00591 (13.8% higher), so this is a mechanism success and promising phase-consistency signal, not evidence of improved forecasting accuracy.
- Agent confidence
- 8/10
- Baseline
- Toy GRU: one_step_mse=0.00519336, clock_E=17.2536
- Idea
- Toy GRU: one_step_mse=0.00591047, clock_E=0.307416; analytical max relative errors: distortion variance 3.98e-5, distortion E 1.91e-5, noise variance 0.00270; unwrap boundary observed at π
Limitations: Only a short synthetic sinusoid GRU was tested; no Van der Pol, Lorenz-63, long-horizon free-running forecasts, λ sweep, limit-cycle breakdown prediction, matched-parameter phase-head ablation, or multi-seed confidence intervals were run. CUDA/cuDNN failed with CUDNN_STATUS_INTERNAL_ERROR_HOST_ALLOCATION_FAILED, so the reported GRU run used the implemented CPU fallback.
How to run: python3 clock_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.15472)
Ahead of the baseline (−7.2%) but not statistically significant (p=0.5604, wins 3 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0003
- Idea mean
- 0.0003
- Effect (Δ)
- -0 (−7.2%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.5604 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±26.3%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
Only the registered built-in dynamics task and 24 epochs were tested. Long-horizon free-running 10/50/200-period evaluation, Van der Pol/Lorenz data, lambda-clock sweeps, and precursor timing analysis were not performed.
How to run: python3 bench_clock.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
Implemented Universal Clock Regularization on the registered built-in dynamics track using a shared rnn_small GRU and phase head; baseline and idea differed only in whether the clock/cycle loss was applied. The mechanism prediction was confirmed on trained benchmark models, with phase-velocity variance falling from 9.041786 to 0.005593 and normalized clock error from 13.826433 to 0.469028. Task MSE improved from 0.0003420520 to 0.0003175788, but the paired permutation test was non-significant (p=0.5604), so the required significant-win verdict is false.
- Baseline
- 8-seed test MSE mean 0.000342052033, std 0.000169648038; tuned lr=0.01
- Idea
- 8-seed test MSE mean 0.000317578835, std 0.000121424379; best idea lr=0.01
- Mechanism
- phase velocity variance 9.041786 -> 0.005593; normalized clock error 13.826433 -> 0.469028; confirmed=true
- Paired delta
- -0.000024473198 (idea - baseline; lower is better)
- Permutation p
- 0.5604
Benchmark result
Ahead of the baseline (−7.2%) but not statistically significant (p=0.5604, wins 3 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0003
- Idea mean
- 0.0003
- Effect (Δ)
- -0 (−7.2%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.5604 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±26.3%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
Only the registered built-in dynamics task and 24 epochs were tested. Long-horizon free-running 10/50/200-period evaluation, Van der Pol/Lorenz data, lambda-clock sweeps, and precursor timing analysis were not performed.
How to run: python3 bench_clock.py
Artifacts
- bench_clock.py 7.1 KB View Raw
- bench_report.json 3.6 KB View Raw
- clock_experiment.py 3.9 KB View Raw
- report.md 1.7 KB View
- report_bench_2026-08-31T113806.md 5.5 KB View
- results.json 5.2 KB View Raw