Does the Optimizer Decide How Much History a Forecaster Can Use?

Time series forecasters behave unlike language models when given more input history. Lengthening the lookback window (the stretch of past observations the model reads before predicting) first helps and then hurts, producing a U-shaped error curve with a best window length. Work that explains this curve treats it as a property of the data and the model alone: more history lowers irreducible uncertainty, but every extra time step adds input dimensions the model must learn to ignore. A separate literature shows that adaptive optimizers such as Adam, which rescale each parameter's step by its own gradient history, settle on different solutions than plain stochastic gradient descent (SGD), and that these solutions often generalize worse because they put weight on rare, spurious input directions. Distant, weakly informative lags in a long lookback window are exactly that kind of direction.

This note proposes to test whether the rising right side of the lookback U-curve is partly caused by the optimizer. The concrete hypothesis is that coordinate-wise adaptive methods move the best window length to shorter values and make the curve rise more steeply beyond it. It further predicts that this shift is small when training samples greatly outnumber input dimensions and large when they do not. If the hypothesis holds, two things follow. Published claims about how much history a forecaster can use were made under one fixed optimizer and are biased by it. And moving toward less adaptive updates may be a cheaper route to long-context forecasting than sharpness-aware training or extra architectural modules.

Core Claim

Scaling Law for Time Series Forecasting explains the U-curve as a competition between a Bayesian loss $B(L)$ and an approximation loss. $B(L)$ is the irreducible error given a window of length $L$, and it falls as $L$ grows. The approximation loss rises with $L$ because input dimension grows while sample count $n$ stays fixed. That paper holds the training procedure constant. We claim the approximation term also depends on the optimizer $\mathcal{O}$:

$$ \mathcal{E}(L) = B(L) + A(L;\, n, \mathcal{O}), $$

Here $\mathcal{E}(L)$ is test error. The optimizer's contribution to $A$ should grow as the ratio $n/(L \cdot C)$ shrinks, where $C$ is the number of input channels a model mixes.

The reason is that implicit bias only matters when the data do not pin down a unique solution. For a linear forecaster trained from zero, SGD stays in the span of the training inputs and finds the minimum-$\ell_2$-norm fit. That fit concentrates weight on lags with large, consistent gradients, which are typically recent lags and lags one season back. The Marginal Value of Adaptive Gradient Methods in Machine Learning shows that adaptive methods instead follow a sign-like, $\ell_\infty$-flavoured geometry that boosts low-gradient coordinates. The prediction is that Adam spreads weight onto distant, noisy lags.

We will measure this directly with a far-lag mass statistic: the fraction of the squared weight (or gradient-times-input attribution, for deep models) assigned to lags beyond twice the dominant period. If the claim is right, Adam's far-lag mass should exceed SGD's at matched training loss. The gap should shrink as $n$ grows. And Padam's partial-adaptivity exponent should interpolate between the two optimizers, both in far-lag mass and in the location of the best window $L^*$.

Research Program

The program begins with a setting where the answer is known exactly. We will generate synthetic autoregressive and seasonal series whose optimal linear predictor is available in closed form, so $B(L)$ can be computed analytically. We then train linear forecasters with SGD with momentum, Adam, AdamW, and Padam. Closing the Generalization Gap of Adaptive Gradient Methods in Training Deep Neural Networks introduced Padam, which divides by $v_t^p$ with $p \in \{0, 1/8, 1/4, 1/2\}$, so that $p=0$ is SGD with momentum and $p=1/2$ is Adam-like. We sweep $L$ and $n$ jointly, crossing the point where $L \cdot C$ approaches $n$. Because $B(L)$ is known, any optimizer-dependent difference in $\mathcal{E}(L)$ is attributable to $A$. We report results both at convergence and at validation early stopping, since in the overdetermined regime the optimizer can only matter through the stopping point.

The program then moves to real benchmarks and deep models. The models are NLinear, iTransformer, PatchTST, and SAMformer, the last from the official code in romilbert/samformer. The datasets are ETTh1, ETTh2, ETTm1, ETTm2, Weather, ECL, Traffic, and Exchange. We add the Lorenz and Double Pendulum systems from Channel Dependence, Limited Lookback Windows, and the Simplicity of Datasets, whose inter-channel dependence is known by construction. The lookback grid is $L \in \{96, 192, 336, 512, 720, 1440, 2880\}$, truncated where memory fails. Efficiently Enhancing Long-term Series Forecasting via Ultra-long Lookback Windows reports that PatchTST runs out of memory at 3600 on Weather. Training-set fractions are 10%, 25%, 50%, and 100%.

Every run uses reversible instance normalization from Reversible Instance Normalization for Accurate Time-Series Forecasting against Distribution Shift. This normalizes each input window and restores its statistics on the output. Using it everywhere rules out distribution shift as the explanation for any optimizer effect. For each cell of the grid we record test MSE and MAE, the estimated $L^*$ and the steepness of the curve beyond it, far-lag mass, and the tail index of minibatch gradient noise.

The tail index tests a second, conditional prediction. Why ADAM Beats SGD for Attention Models attributes Adam's advantage on attention models to heavy-tailed gradients that destabilize SGD. Towards Theoretically Understanding Why Sgd Generalizes Better Than Adam in Deep Learning argues that Adam's smoothing removes the heavy-tailed jumps that let SGD escape sharp minima. These two papers pull in opposite directions for time-attention models. If time-wise attention makes gradient tails heavier as $L$ grows, then SGD should fail for those models at long windows and partial adaptivity should be the best choice. If tails stay mild, the claim above should hold for those models as well.

The contrast between channel-mixing and channel-independent models tests a third prediction. Channel-mixing models are those that learn cross-variable interactions, such as SAMformer and iTransformer. Adam Reduces a Unique Form of Sharpness shows that Adam penalizes only diagonal curvature and does poorly when parameters must interact. Because channel-mixing models have a larger effective $C$, their optimizer-induced shift of $L^*$ should be larger than for channel-independent models.

Baselines

The naive reference point is current practice. That means Adam with the default learning-rate schedule from the Time-Series-Library (thuml/TimesNet), with the lookback window tuned per dataset. This is the protocol under which the Scaling Law paper and most benchmark tables locate $L^*$. If every optimizer yields the same $L^*$ and the same error curve once properly tuned, the hypothesis is false and current practice is vindicated.

The strongest existing method is SAMformer trained with sharpness-aware minimization. Sharpness-aware minimization minimizes the worst-case loss within a small parameter neighbourhood. SAMformer reports that it surpasses TSMixer by 14.33%, iTransformer by 6.58%, and PatchTST by 8.79% in average MSE. It is the strongest competitor because it is the one published fix that treats failures in time-series Transformers as an optimization problem. It costs two forward-backward passes per step, so we compare at equal wall-clock and equal gradient evaluations: single-pass optimizers receive twice the epochs or a matched compute budget. All methods get the same hyperparameter budget, a grid over learning rate, schedule, and weight decay of identical size per optimizer, following the tuning discipline of the Marginal Value paper.

The file reports no absolute per-dataset MSE values for SAMformer, so no reported result was found on Lacuna for SAMformer's absolute MSE on ETTh1 or any other single benchmark at a given horizon. We will reproduce SAMformer's numbers at $L=512$ from the released code before comparing. We count it as beaten if, at its best tuned window, Padam or SGD with momentum on the same architecture matches its MSE within seed noise at half the compute. Separately, we count it as beaten if any optimizer reaches lower error at a longer best window than SAMformer achieves at its own best window.

Two baselines address architecture rather than optimization. IRPA reports average MSE reductions of 9.7% for iTransformer, 15.0% for PatchTST, 14.4% for TimesNet, and 25.2% for DLinear. It is the competitor for any claim that ultra-long windows become usable, and we run it with Adam to test whether optimizer choice and input refinement are additive or redundant. The key ablation adds explicit ridge regularization on input-layer weights to Adam, with its strength tuned over a grid. This isolates whether the effect is a geometry difference or merely an amount of regularization.

Why not just…?

Why not just tune the lookback window separately for each optimizer and move on? That is the measurement at the heart of the proposal, not an alternative to it. The open question is whether the tuned $L^*$ and the error achieved there differ by optimizer and change predictably with sample count. The Scaling Law paper and the Channel Dependence paper both tune $L$ under a single optimizer, so neither can answer it.

Why not just add weight decay or an explicit $\ell_2$ penalty to Adam? This is the most serious threat. In linear models, a well-chosen ridge penalty recovers much of what SGD's implicit minimum-norm bias provides. The ridge ablation will settle the question. If tuned-ridge Adam matches SGD's error curve and far-lag mass at every $L$ and $n$, we will report that the optimizer effect is a substitutable implicit regularizer, a smaller but still useful finding for benchmark practice. The geometry claim survives only if differences remain after the regularization strength is tuned. Two results from the vision setting suggest they might: tuned Adam with decay schedules still trailed SGD in the Marginal Value paper, with CIFAR-10 test error of 7.65% for SGD versus about 10 to 12% for Adam, and Padam reached 93.78% against 92.21% for Adam on CIFAR-10. Whether this carries over to forecasting is unknown.

Why not just use sharpness-aware minimization, as SAMformer does? It may well be the best single fix, which is why it is a headline baseline. But it doubles per-step cost, and that cost grows with window length, which is the regime this note cares about. If sharpness-aware training with Adam still shows a steep right branch while Padam flattens it, the two methods address different problems. If sharpness-aware training dominates at matched compute, we will say so.

Why not just set the window to twice the dominant period? Context Saturation in Zero-Shot Time-Series Foundation Models proposes this rule for pretrained models used without fine-tuning. Its own results show the rule breaks under multiple overlapping seasonalities, with saturation at about 7 daily periods on Electricity, and on autoregressive data, which needed a window at least 32 times the memory order. The rule also says nothing about trained models whose $L^*$ depends on sample count.

Proposed Experiments

The first decisive check uses the synthetic linear setting. The hypothesis survives only if Adam's $L^*$ is shorter than SGD's and its far-lag mass is higher, and only if the size of this shift grows as $n/(L \cdot C)$ falls and approaches zero when samples are plentiful. A shift that does not vanish with abundant data would point to an artifact of early stopping or tuning, not implicit bias.

The second check uses the real benchmarks. On at least six of the nine datasets, at 25% training data, the hypothesis requires that the gap in $L^*$ between SGD and Adam has a consistent sign across seeds. It also requires that Padam's $L^*$ falls between the two and changes monotonically with $p$. The Exchange dataset, whose short optimal window the Scaling Law paper attributes to rapidly decaying relevance, serves as a near-null case where shifts should be smallest.

The third check is the ridge ablation described above.

The fourth check compares channel-mixing and channel-independent models on Lorenz. The diagonal-sharpness argument predicts that channel-mixing models show the larger optimizer-induced shift. If they show none, that reasoning does not transfer to forecasting.

Finally, we report the gradient tail index against $L$ for time-attention models. This settles which of the two opposing accounts of attention and Adam applies to long-window forecasting.