Winding Numbers as a Guide to Which Past Model to Deploy Under Data Lag

A deployed model is almost always older than the world it serves. Data arrives late, retraining takes time, and many systems must run for weeks or months after their last training example. Under that lag, the usual advice is to deploy the most recently trained model. Careful studies show that cleverer schemes, which project the model's weights forward in time, rarely beat that default (Temporal Generalization: A Reality Check). Many real shifts, however, are not one-way drifts. Influenza activity, housing markets, news topics and rotating sensor setups partly come back to states they have been in before. When the deployment gap is long, the right model for the future may be a past model trained at the same point of an earlier cycle, not the newest one.

We propose to detect and exploit this recurrence with a tool from the topology of arrangement complements: logarithmic differential forms. Think of $dz/z$ on the punctured complex plane. Integrated along a path, its real part measures how far the path moved outward and its imaginary part measures how many times it wound around the origin. We embed the sequence of trained models as a path in a complex torus. A model's "function-space state" is its predictions on a fixed set of probe inputs, so we work with what models compute rather than with their weights. Integrating the torus's logarithmic forms along this path splits the drift into a one-way part and a cyclic part. Because these forms represent integral cohomology classes, the cyclic part must be an integer over any closed loop. That integrality lets us round noisy frequency estimates to exact values. It also gives a precise rule for how much history is needed before recurrence can be trusted at all. The deliverable is a deployment rule for lagged settings. It forecasts the function-space state $h$ steps ahead, retrieves the past checkpoint at the matching phase, and corrects it for the one-way drift. It also comes with a diagnostic that says when the observed history is too short for any of this to be valid.

Core Claim

The claim has two parts, and only the second is specific to the topological view. The first is that, on datasets with recurrent shift, deploying a phase-matched past checkpoint beats deploying the most recent one at horizons longer than one step. The second is that the cyclic component can be found without being told the periods, and its frequencies pinned down exactly, through integrality.

To make this concrete, let $z(t) \in (\mathbb{C}^*)^r$ be the low-dimensional complex state of the model trained at time $t$. We obtain it from function-space states by dynamic mode decomposition, which fits a linear dynamical system to the sequence and returns complex modes. Let $\gamma$ be the observed segment of the trajectory. For each coordinate $j$, the logarithmic form $\omega_j = dz_j/z_j$ is a generator of the first cohomology of the torus. Its integral along $\gamma$ is

$$\int_\gamma \omega_j = \log\frac{|z_j(t_1)|}{|z_j(t_0)|} + i\,\Delta\theta_j ,$$

where $\Delta\theta_j$ is the total accumulated phase. When the segment closes up, meaning the state returns near where it started, $\Delta\theta_j \in 2\pi\mathbb{Z}$. Rounding the estimated winding vector to the integer lattice and re-solving for a common fundamental period $P$ gives frequencies $\lambda_j = 2\pi k_j/P$ with integers $k_j$.

The payoff is about long horizons. A frequency error $\delta$ produces a phase error that grows like $\delta \cdot h$ at horizon $h$, because the phase is integrated linearly in time. Once frequencies are snapped to the lattice, the phase error stays bounded by the error in the initial phase offset. We therefore predict that the advantage over unconstrained linear-dynamics forecasting grows with horizon.

The second part of the claim is a scope statement. A cyclic component whose period exceeds the observed window does not close any loop, so it cannot be told apart from one-way drift. The integrality step must refuse to round in that case. Our diagnostic, the "loop coverage" of the history, is the fraction of estimated modes whose phase has completed at least one turn within the window. It predicts in advance on which datasets and window lengths the method can help.

Relation to Prior Work

The method draws on Orlik-Solomon type presentations for the cohomology algebra of toric arrangements. That work shows that the cohomology of a complex torus with subtori removed is generated by explicit logarithmic forms. It also shows that these forms are integral and satisfy their relations as forms, not only as cohomology classes. We use only the simplest case, the torus with nothing removed, together with the fact that its generators have integer periods. This is what justifies treating winding numbers as exact integers to be rounded rather than as real-valued features. Their arrangement generalization, with extra generators of the form $d\log(1-\chi)$ for a character $\chi$, would let known regime-change loci be removed and the trajectory's winding around them be counted. We deliberately leave this out of the main program, because nothing in the file shows such loci exist in temporal benchmarks.

Two lines of work motivate the proposal and also constrain it. Temporal Generalization: A Reality Check finds that Taylor-series weight extrapolation at best matches deploying the most recent model, and blames parameter non-identifiability: many different weight vectors compute the same function. We accept that diagnosis. That is why we never extrapolate weights. We forecast function-space states and deploy real checkpoints that were actually trained. Wild-Time: A Benchmark of in-the-Wild Distribution Shift over Time documents an average drop of about 20% from in-distribution to out-of-distribution performance, with domain generalization and continual learning methods failing to close it. Its annual snapshots, however, mostly hide within-year recurrence. That is a reason to expect our method to be neutral, not helpful, on most of Wild-Time.

The closest competitor is Koodos, from Continuous Temporal Domain Generalization. It encodes model weights into a space where drift becomes linear (a Koopman space) and evolves them with a neural ordinary differential equation, a network that learns a continuous-time rule for how a state changes. A linear flow with complex eigenvalues already describes rotation on a torus, so Koodos can in principle represent recurrence. It differs from our method in three ways: it works in weight space, it places no integrality constraint on its frequencies, and it has no way to report that its window is too short. Model Assessment and Selection under Temporal Distribution Shift supplies an adaptive rolling-window method for choosing among candidate models from recent loss differences. It assumes that recent performance predicts near-future performance. That assumption is exactly what fails at long lags under recurrence, and it is the contrast we test.

Research Program

We first build the trajectory pipeline. For each time step we train the same architecture on that step's window, the same checkpoints a "Recent" baseline would produce. We record logits on a fixed probe set drawn from the earliest training data, reduce them with PCA, and fit dynamic mode decomposition to obtain complex modes. The log-modulus and accumulated phase of each mode come from integrating $dz/z$ numerically along the observed sequence, using phase unwrapping between consecutive checkpoints. When loop coverage is sufficient, the winding vector is rounded to the lattice and a common period is fitted. Otherwise the mode is marked as one-way drift.

Deployment at horizon $h$ proceeds in three steps. We forecast each mode's phase at $t+h$ and find the past checkpoint whose phase vector is closest on the torus. We then apply the forecast change in log-modulus, either as a small fine-tuning correction on the most recent data or, in the simplest variant, not at all. The analysis part of the program tests the loop-coverage diagnostic directly. In synthetic settings with a known period, we sweep window length across the period and check that gains appear exactly when coverage turns on.

Baselines

The naive reference point is the Recent model: deploy the latest checkpoint unchanged at every horizon. Temporal Generalization: A Reality Check shows it is very hard to beat, and we run it with their released code divyam3897/TG so that the checkpoints are identical to ours. From the same codebase we also run parameter downscaling, which that paper reports as the only weight manipulation that consistently avoided degradation, and first-order Taylor extrapolation. Beating Recent means lower error at horizons $h \ge 2$, averaged over seeds, with no loss at $h = 1$.

The strongest existing method for continuous recurrent shift is Koodos. On Rotated 2-Moons it reports a 2.8% error rate, against 17.8% for DeepODE and 46.2% for DRAIN-$\Delta t$ (Continuous Temporal Domain Generalization). We will reproduce that 2.8% under their protocol before extending the test horizon. Koodos receives the same training timestamps and a tuning budget matched to ours in GPU-hours. Beating it means lower error at horizons beyond its reported setting, with a gap that grows with horizon, as the frequency-error argument predicts. Matching it at short horizons is acceptable.

The adaptive rolling window with tournament selection from Model Assessment and Selection under Temporal Distribution Shift is run over the same checkpoint pool as our retrieval step. Any gain then comes from choosing by forecast phase rather than by recent loss, not from having more candidates.

A seasonal-naive oracle deploys the checkpoint exactly one known period earlier. It is given the true calendar period, which our method is not. It sets an upper reference for single-period data.

The decisive ablation keeps the entire pipeline but skips rounding: it uses raw dynamic-mode frequencies. If this variant matches the full method at long horizons, the cohomological integrality contributes nothing, and we will report that.

Why not just…?

Why not just add sine and cosine features of calendar time? When the period is known and single, this is equivalent to our method, and the seasonal-naive oracle stands in for it. Our method should only win when periods are unknown, multiple, or tied to something other than the calendar. Rotated MNIST is an example: there the "period" is an angle schedule, not a season. If the oracle ties us on influenza and arXiv topic frequency, the honest conclusion is that the method is only useful for discovering periods.

Why not just use Koodos, since a linear Koopman flow already rotates? This is the real threat. Its frequencies are fitted, not constrained, so its phase error should grow linearly with horizon. Its weight-space state is also exposed to the non-identifiability problem documented by Madaan et al.. The horizon sweep on Rotated 2-Moons and Rotated MNIST, together with the no-rounding ablation, settles whether either difference matters.

Why not just let adaptive windowing pick among past checkpoints? The adaptive rolling window from Han et al. ranks models by recent loss. Under recurrence with a long lag, the best model for $t+h$ does poorly on recent data, so recent-loss selection should systematically favor the wrong phase. If it nonetheless matches phase retrieval, recurrence is too weak in these data to matter.

Proposed Experiments

The controlled tests are Rotated 2-Moons and Rotated MNIST from the Koodos benchmarks. Training covers less than one full rotation in one condition and more than one in another. The method predicts no gain in the first condition and a growing gain with horizon in the second. A failure in either direction falsifies the loop-coverage account.

The realistic tests are the Twitter Influenza Risk data, Dubai housing sales, and weekly arXiv deep-learning topic frequency. We found no reported result on Lacuna for any method on these three under a lagged-deployment protocol, so all baselines will be run fresh. Performance is reported against horizon $h$.

The negative controls are Yearbook and MIMIC-IV from Wild-Time. Their annual granularity should give low loop coverage, and the method should defer to Recent without harm. For reference, Wild-Time reports Yearbook out-of-distribution accuracy of about 79% and MIMIC-IV out-of-distribution AUC of 0.72.

The decisive check combines three outcomes. Loop coverage must predict, before testing, which datasets show gains. The full method must beat the no-rounding ablation by a margin that grows with $h$. It must also beat Recent at $h \ge 2$ on at least the influenza data. If coverage fails to predict where gains occur, or rounding adds nothing, the topological component is decorative. In that case we will report that phase-matched retrieval, not cohomology, is the contribution.