Shift workers, jet-lagged travellers and late-night eaters suffer because their internal clocks stop agreeing with each other. The brain's master clock follows light, while clocks in the liver, gut and kidney follow meals and activity. That disagreement is linked to kidney disease, mental illness and metabolic disease. Yet no wearable can measure it, because the clock state lives in gene-expression levels deep inside tissues. We propose to estimate it the way predictive coding says the brain estimates hidden causes. Predictive coding is the theory that the brain keeps a model that predicts its inputs and adjusts its hidden beliefs only in response to the mismatch, or "prediction error." Our model predicts a person's heart rate, skin temperature and step counts minute by minute. Its slowest hidden layer is not a free neural network layer. It is a pair of physically meaningful oscillators, one central and light-driven, one peripheral and activity-driven. The model infers their phases by nudging them to reduce prediction error over a sliding window.
The deliverable is a continuously updated estimate of the phase gap between the two clocks, computed from consumer-wearable data alone, together with a test of whether that gap explains shift-work sleep disruption and daily fatigue better than existing rhythm features. If it works, circadian control methods gain the missing piece they explicitly lack: an estimate of the internal state they assume they can observe.
Core Claim
Our central claim is narrow. A hierarchical predictive model has fast learned layers that explain minute-scale heart-rate and activity fluctuations, and a top layer made of two coupled limit-cycle oscillators whose phase and amplitude are inferred by error regression. Error regression means refining hidden states by gradient descent on recent prediction errors, rather than reading them out in one forward pass. We claim this model recovers central–peripheral phase misalignment that single-rhythm summaries miss. We also claim this misalignment carries outcome-relevant information beyond time-of-day and rhythm-amplitude features.
The new element is not using predictive coding for estimation in general. It is three choices taken together: placing mechanistic two-oscillator dynamics at the top of a learned predictive hierarchy, treating the inferred phase gap as the measured quantity, and evaluating it against outcomes in real shift workers.
Where This Sits in Prior Work
The motivating gap comes from circadian control. Time optimal entrainment control for circadian rhythm computes minimum-time light schedules on the third-order Jewett-Forger-Kronauer model, a standard set of equations for the human central clock. It shows that phase-only reductions mis-predict entrainment because bright light temporarily collapses oscillator amplitude. Rapid Circadian Entrainment in Models of Circadian Genes Regulation reaches the same amplitude conclusion in gene-network models.
Both papers assume full knowledge of the internal state, and both treat the body as one lumped oscillator. We keep their lesson that amplitude must be a state variable. We drop both assumptions: we infer the state rather than assume it, and we represent two clocks rather than one.
The physiological motivation for two clocks comes from chronobiology. Pamela Pulimeno et al., 2012 show that human peripheral cells keep oscillating without input from the brain. Chunfeng Lu et al. associate late meal timing with diabetic kidney disease, attributing the link to peripheral–central misalignment. These are associations measured without any per-person estimate of misalignment, which is exactly what we aim to produce.
The method comes from predictive coding. Predictive Coding for Dynamic Visual Processing shows that in a multi-timescale recurrent network, slow upper layers form limit-cycle attractors. It also shows that error regression roughly halves imitation error relative to passively driving the network with input (MSE 0.0333 vs 0.0620). We reuse error regression and the fast-to-slow layering, but replace its free slow layer with constrained oscillators so that the inferred states have physiological meaning.
A predictive processing model of episodic memory and time perception accumulates prediction errors to model duration judgments over seconds. It shows that predictive models can carry a sense of time, but only up to about a minute. We push the slowest level to 24 hours.
Monte Carlo predictive coding adds noise to inference so the model samples a posterior rather than a single best guess. It reports a FID of 60.6 versus 115.2 for standard predictive coding on MNIST. We adopt it optionally to obtain uncertainty bands on inferred phase, which matter because a clinician should not act on a confident wrong phase.
On the data side, CovidRhythm shows that cosinor rhythm parameters added to a recurrent network lift infection-detection AUC from 0.69 to 0.79. Cosinor parameters are the fitted mean level, amplitude and peak time of a 24-hour cosine. This result constrains our design: any gain must be shown beyond explicit rhythm features, not merely beyond raw signals.
Research Program
The generative model has three levels. The bottom level is a small recurrent network that predicts the next minute of heart rate, skin temperature where available, and step count. It takes the current activity and sleep state as inputs, so that masking is explained at this level and not absorbed into the clock. Masking is the direct effect of movement on heart rate.
The middle level carries slow modulators on the scale of hours, analogous to sleep pressure in the three-process model of Human Alertness Optimization with a Three-Process Dynamic Model. The top level is two amplitude-phase oscillators. The central one is driven by a light proxy, the peripheral one by activity and meal proxies, and they are weakly coupled. Their combined output sets the baseline that the lower levels predict around.
Fitting proceeds in two stages. First, the network weights and the oscillator coupling parameters are learned across the population. Second, each person's oscillator states are inferred online by error regression over a trailing 72-hour window. The misalignment index is the wrapped difference between the two inferred phases. Its uncertainty comes from Langevin sampling in the style of Monte Carlo predictive coding.
The main risk is identifiability: can two phases be separated from heart rate and steps alone? We address it before touching real data. In simulation, a Jewett-Forger-Kronauer central oscillator and a separately driven peripheral oscillator generate synthetic wearable streams under day work, rotating night shifts and late-eating schedules, so the true misalignment is known.
TILES-2018 has no light sensor, so central-clock drive is approximated by sleep/wake timing, which stands for eyes closed in the dark. We state this as a limitation and test its cost in simulation by giving the model the proxy rather than the true light input.
Baselines
The naive reference is time of day alone. For each outcome, we fit a model using clock time and hours awake. In the multiple sclerosis fatigue cohort of Meaningful digital biomarkers, these were already the strongest predictors, and the reported generalized additive model explains 26.2% of fatigue variance. Our misalignment index must add explained variance on top of that model, under the same participant-wise cross-validation, to count as useful.
For shift-work outcomes, the strongest existing results on our main dataset come from TILES-2018. A Random Forest reaches ROC-AUC 0.754 for day versus night shift, and the SleepNet recurrent network reaches macro F1 0.543 on four-stage sleep classification and 0.585 for REM. We rerun these baselines on our splits and retune them with the same hyperparameter budget as our model. Beating them means a higher shift AUC from the misalignment features alone or combined, with confidence intervals from participant-level bootstrap.
Shift status is partly observable from raw activity timing, so the more meaningful TILES test is sleep quality and REM fragmentation. For sleep quality, TILES reports only that the Random Forest beat a zero-shot medical language model, with no numeric value; no reported result was found on Lacuna for that score.
The strongest rhythm-aware competitor is sliding-window cosinor features fed to a GRU with attention, following CovidRhythm. Its reported AUC of 0.79 is on a different task and a 25-person cohort, so we reimplement it on our data rather than compare numbers across papers.
Two ablations isolate our key ingredients. The first replaces the two-oscillator top layer with a single oscillator, testing whether two clocks matter. The second replaces it with a free slow recurrent layer in the style of the multi-timescale network, testing whether mechanistic structure matters. For phase recovery in simulation, the natural reference is a filter on the true generative model; no reported result was found on Lacuna for wearable-based circadian phase error.
Why not just…?
Why not just fit a cosinor curve to heart rate in a sliding window? This is cheap and gives a phase. However, it yields one phase, and it confounds endogenous rhythm with activity-driven heart rate. Night-shift work shifts both at once. The amplitude-quenching results in Time optimal entrainment control for circadian rhythm also imply that phase estimates from a fixed-amplitude cosine will be biased exactly during re-entrainment, when estimates matter most. The simulation measures this bias directly, and the cosinor-GRU baseline tests whether it matters for outcomes. If cosinor matches us on outcomes, we will report that the extra machinery is not justified.
Why not just run a Kalman or particle filter on a circadian model? This is the real threat. Error regression over a window is closely related to smoothing, and on a correctly specified model a particle filter may estimate phase as well or better. We therefore include a particle filter on the identical two-oscillator generative model as a baseline. The question then becomes whether the learned lower layers, which absorb masking and ultradian structure, improve estimation under model mismatch. Simulation tests this with deliberately misspecified masking, and real data tests it through outcomes. If the filter ties, our contribution reduces to the two-clock generative model and the misalignment index, and we will frame it that way.
Why not just train a large sequence model such as an LSTM or TimesNet with time-of-day inputs? It might predict outcomes equally well. However, it gives no interpretable internal state for a light-scheduling controller to act on. TILES-2018 also shows that such models achieve only modest stage-classification scores on shift workers. We report its outcome performance alongside ours. A tie on prediction would leave the interpretability and control argument intact but weaken the scientific claim, so we will state which result occurred.
Proposed Experiments
The first decisive check is in simulation. Across shift schedules, inferred misalignment must track the true phase gap with lower circular error than the cosinor and single-oscillator alternatives. This must hold with the sleep-timing light proxy, not only with true light input. If the two phases are not separable here, the project stops and reports the identifiability limit.
The second check uses TILES-2018. Inferred misalignment should be larger in night-shift workers. More importantly, it should predict REM-to-light-sleep transition rates and sleep-quality scores beyond time-of-day and cosinor features. It should also rise and decay plausibly across shift rotations over the 10 weeks.
The third check uses the multiple sclerosis fatigue cohort, which records skin temperature, a stronger clock marker. There, misalignment should add explained fatigue variance above the 26.2% baseline, and the effect should differ between patients with functional and dysfunctional autonomic nervous systems. The latter would show that the index tracks physiology rather than schedule.
A closing demonstration feeds inferred states into the neural feedback controller of Time optimal entrainment control for circadian rhythm in simulation. We compare re-entrainment time with the controller's reported full-state performance, under 150 hours for a 12-hour shift, to quantify what estimation error costs in control.
References
- Time optimal entrainment control for circadian rhythm
- Rapid Circadian Entrainment in Models of Circadian Genes Regulation
- Autonomous and self-sustained circadian oscillators displayed in human islet cells
- A late eating midpoint is associated with increased risk of diabetic kidney disease: a cross-sectional study based on NHANES 2013–2020
- Predictive Coding for Dynamic Visual Processing: Development of Functional Hierarchy in a Multiple Spatiotemporal Scales RNN Model
- A predictive processing model of episodic memory and time perception
- Learning probability distributions of sensory inputs with Monte Carlo predictive coding
- CovidRhythm: A Deep Learning Model for Passive Prediction of Covid-19 Using Biobehavioral Rhythms Derived From Wearable Physiological Data
- Human Alertness Optimization with a Three-Process Dynamic Model
- Meaningful digital biomarkers derived from wearable sensors to predict daily fatigue in multiple sclerosis patients and healthy controls
- TILES-2018 Sleep Benchmark Dataset: A Longitudinal Wearable Sleep Data Set of Hospital Workers for Modeling and Understanding Sleep Behaviors