WorksComputer Science
TS-RSI: Recursive Self-Improvement in Long-Term Time Series Forecasting
Abstract
Forecasting systems increasingly let LLMs write programs and revise them from validation feedback, a loop of recursive self-improvement (RSI). We introduce TS-RSI, a pre-registered testbed on long-term time series forecasting that pairs every loop with a trivial competitor encoding the same structure by hand. TS-RSI-Code uses one LLM-written program per dataset as a feature generator for a ridge correction to a closed-form CycleNet-style learner, with gap-matched fitting and a per-horizon fallback against drift. Relative to the CycleNet cycle, it lowers error by 14-27% on the held-out PEMS datasets and costs at most 1% on the other held-out datasets. The PEMS gain is a weekly cycle: choosing a daily or weekly cycle on validation does at least as well without an LLM, and iterating on the program improves the median by at most 0.8% while validation overstates its gains. TS-RSI-Struct instead lets the LLM search the cycle length from validation feedback. Starting from a one-day prior on every dataset, it reaches the weekly cycle within three evaluations, beats random search by 4-7% with three LLMs and ties the trivial competitor, for 0.24 CNY. When the prior is wrong on two structural choices, the loop falls behind random search.
Introduction
LLMs now write forecasting code that runs, and a growing body of work places them in loops that propose a program, score it on validation data and keep the best candidates for the next round [11, 23, 24]. In time series, such loops write complete forecasting pipelines [34], adapt the deployment of foundation models [14], and learn when to trust which expert [9, 30]. Their gains are measured after many rounds of validation-based selection. When what the LLM contributes is a piece of structure, such as a seasonal profile, a model that is handed that structure directly tells whether the loop adds anything.
TS-RSI measures this on the long-term forecasting (LTSF) benchmark on which most forecasting architectures are compared [17, 21, 33, 37, 40]. An LLM can improve a forecaster in two places (Figure 1): the code of a forecasting program, and a structural choice of a closed-form model, here its cycle length. TS-RSI instantiates both. Code and supplementary materials for TS-RSI are available at https://anonymous.4open.science/r/TS-RSI. Our contributions are summarized as follows:

Figure 1. Overview of TS-RSI. (a) TS-RSI-Code: the LLM writes a program once, its arrays () become features of a ridge head on CYC*, and a validation gate decides per horizon. Iterating (dashed) changes the median by about 1%. (b) TS-RSI-Struct: the LLM proposes the next cycle length from the validation MSE of those tried.
A testbed with trivial competitors. Four development and eight held-out datasets, deterministic closed-form learners on one CPU core, a ledger of every API call, and a pre-registration document for each of nine experiments (§ 3).
Program grounding (TS-RSI-Code). One LLM-written program per dataset serves as a feature generator for a ridge correction to a CycleNet-style learner, with gap-matched fitting and a per-horizon fallback against drift. Relative to the CycleNet cycle, it lowers error by 14–27% on the held-out PEMS datasets and costs at most 1% on the others (§ 4.1 and § 4.2).
What program search finds. Five pre-registered ways of spending more calls and a ten-round loop improve the median by at most 0.8%, and validation overstates their gains (§ 4.3). On PEMS the program contributes a weekly cycle, which a two-way choice on validation also finds (§ 4.4).
Structure-space self-improvement (TS-RSI-Struct). With validation feedback the LLM leaves its one-day prior, matches exhaustive search, beats random search with three LLMs and ties the trivial competitor. When the prior is wrong on two structural choices at once, it falls behind random search (§ 4.5).
Related Work
LLM Program Search
FunSearch [24], AlphaEvolve [23] and ShinkaEvolve [11] evolve programs with LLM mutations and an automatic evaluator. LLM-SR fits the numeric parameters of LLM-written equation skeletons [26], and LLaMEA-HPO tunes the parameters of LLM-designed heuristics inside the loop [29]. Our grounding step divides the labour the same way, but fits weights on the internal variables of the program rather than on exposed parameters. CAAFE keeps LLM-written tabular features that improve validation [7]. Our additive loop is its analogue for forecasting programs. Gideoni et al. find simple baselines competitive with code evolution [5].
LLMs as Optimizers and Hyperparameter Tuners
OPRO shows an LLM the solutions scored so far and asks for better ones [36]. The same loop tunes hyperparameters: the LLM proposes configurations from a task description and the scores of earlier trials, and matches or beats random search and Bayesian optimization at small budgets [39] or the best human trials [16]. LLM-AutoOpt combines Bayesian optimization with an LLM that reads dataset meta-features to tune time-series forecasters [25]. TS-RSI-Struct is a loop of this kind over one structural choice.
LLM-Based Forecasters
SEA-TS evolves forecasting code with a self-evolving agent [34], TimeRSI lets a coding agent revise the pipeline around a time-series foundation model (TSFM) [14], and ELATE evolves feature code [19]. Online systems select or re-weight TSFMs from realised errors [9, 30] or evolve the guidance text of an LLM forecaster [18]. The latter reports, as we do, that most of the gain arrives in the first round of reflection. The LLM component of LLM-based forecasting models can often be removed without loss [27], and a recent survey reports similar ablations for agents [35].
Selection Bias and Simple Baselines
Selecting among many candidates on one validation split biases the selected score [2]. The reusable holdout limits the bias by releasing only coarse validation information [4]. The effect has been documented for research agents [6, 28] and for keep-if-better self-improvement loops [8]. Time-series evaluation must respect temporal order and leave a gap between fitted and evaluated data [1, 3]. Our gap-matched grounding applies this to a stacked correction [31]. Timestamp features help linear forecasters [20, 38], and CycleNet [13] uses a daily cycle on PEMS and Solar and a weekly cycle on ECL and Traffic. Our trivial competitor lets validation choose between the two.
TS-RSI
Protocol
Data and splits. We use the 12 datasets and splits of the Time-Series-Library protocol [32]: ETTh1, ETTh2, ETTm1, ETTm2 [40], Electricity (ECL), Traffic, Weather [33], Solar [10] and PEMS03, PEMS04, PEMS07, PEMS08 [15], with look-back , horizons ( for PEMS), channels -normalised with training statistics, and MSE on the normalised scale. ETTh1, Weather, ECL and PEMS04 serve to develop every component, and no component is fitted or tuned on the other eight. All fitting uses the training split, and the validation split decides every selection and fallback. Test scores of the program-space runs are computed after a run has finished. For the structure-space loops, the validation and test scores of every candidate are computed once in advance, and the LLM sees only the validation scores of the candidates it has tried.
Pre-registration. For each of the nine experiments on the held-out datasets we wrote a document that fixes the method, the datasets, numeric success criteria with their interpretation, and MD5 prefixes of the code that would run [22]. The documents are not entries in an external registry, and their header times were typed by hand: for three of them the header time is up to eight minutes later than the first LLM call of the experiment in our API ledger. The held-out datasets were reused by all nine experiments, and each experiment after the first was designed with earlier held-out results known. § 5 lists the cases that matter most. Analyses outside these documents are marked as exploratory.
Deviations. The weekly-cycle document required the trivial competitor as the reference of the main table, the program re-grounded on its base as the main result, and no claim that TS-RSI-Code improves on a CycleNet-style learner. We keep CYC* and TS-RSI-Code in Table 1 because every program-space arm was pre-registered against them, add the trivial competitor and the change relative to it, and state gains of TS-RSI-Code only relative to the CycleNet cycle. The re-grounded program fails its criterion (§ 4.4). No criterion was changed after its results were known. In one document, the recorded hash of the generation script predates the prompt without component examples, which was added before the first call. One script was patched and its run repeated after a network error had prevented any LLM answer.
| Dataset | Naive | Published | Ours (Closed Form) | vs. CYC* (%) | vs. CYC*val (%) | |||||||||||
| ETTh1 | 1.321 | 0.600 | 0.456 | 0.469 | 0.454 | 0.446 | 0.432 | 0.457 | 0.424 | 0.424(.549) | 0.439 | 0.436 | 0.0 | +3.5 | −2.8 | +0.6 |
| Weather | 0.352 | 0.371 | 0.265 | 0.259 | 0.258 | 0.272 | 0.254 | 0.243 | 0.293 | 0.340(.352) | 0.293 | 0.293 | +16.0 | 0.0 | +16.0 | 0.0 |
| ECL | 1.612 | 0.231 | 0.212 | 0.205 | 0.178 | 0.219 | 0.170 | 0.168 | 0.170 | 0.167(.167) | 0.170 | 0.170 | −1.8 | 0.0 | −1.8 | 0.0 |
| PEMS04 | 0.623 | 0.200 | 0.295 | 0.195 | 0.111 | 0.526 | 0.144 | 0.119 | 0.154 | 0.101(.117) | 0.097 | 0.097 | −34.3 | −36.8 | +3.8 | 0.0 |
| ETTh2 | 0.539 | 0.483 | 0.559 | 0.387 | 0.383 | 0.374 | 0.383 | 0.388 | 0.370 | 0.370(.373) | 0.370 | 0.370 | 0.0 | 0.0 | 0.0 | 0.0 |
| ETTm1 | 1.271 | 0.489 | 0.403 | 0.387 | 0.407 | 0.414 | 0.386 | 0.379 | 0.386 | 0.386(.386) | 0.386 | 0.386 | −0.1 | 0.0 | −0.1 | 0.0 |
| ETTm2 | 0.385 | 0.358 | 0.350 | 0.281 | 0.288 | 0.286 | 0.272 | 0.266 | 0.273 | 0.274(.274) | 0.273 | 0.273 | +0.2 | 0.0 | +0.2 | 0.0 |
| Traffic | 2.765 | 0.634 | 0.625 | 0.481 | 0.428 | 0.626 | 0.485 | 0.472 | 0.486 | 0.483(.485) | 0.486 | 0.486 | −0.6 | 0.0 | −0.6 | 0.0 |
| Solar | 1.451 | 0.341 | 0.330 | 0.270 | 0.233 | 0.369 | 0.235 | 0.210 | 0.248 | 0.233(.234) | 0.250 | 0.248 | −5.8 | +1.1 | −5.8 | +1.1 |
| PEMS03 | 0.572 | 0.275 | 0.278 | 0.180 | 0.113 | 0.495 | 0.139 | 0.118 | 0.146 | 0.126(.124) | 0.122 | 0.122 | −13.7 | −16.4 | +3.2 | 0.0 |
| PEMS07 | 0.603 | 0.169 | 0.329 | 0.211 | 0.101 | 0.505 | 0.138 | 0.113 | 0.141 | 0.103(.112) | 0.081 | 0.081 | −26.8 | −42.5 | +27.4 | 0.0 |
| PEMS08 | 0.641 | 0.302 | 0.379 | 0.280 | 0.150 | 0.529 | 0.176 | 0.150 | 0.187 | 0.153(.159) | 0.134 | 0.134 | −18.3 | −28.5 | +14.2 | 0.0 |
Table 1. Test MSE averaged over four horizons (top: development datasets). Naive: last value; SNval: seasonal naive with a daily or weekly period picked on validation (both exploratory). Published numbers from [13, 17] (CN: CycleNet). CYC*: CycleNet cycle; CYC*val: trivial competitor; Code: first generation, mean of three in parentheses; Struct: after three evaluations, mean of three seeds. Bold/underlined: best/second.
LLM and compute. Unless stated otherwise the LLM is DeepSeek-V4.1-Flash (non-thinking mode, temperature 0.7) behind an OpenAI-compatible API. DeepSeek-V4-Pro serves as the stronger LLM and Qwen3.6-Plus as a second model family. All learners are closed form, deterministic and run on one CPU core without a GPU, so run-to-run variation comes only from LLM sampling.
Closed-Form Bases
Both instantiations of TS-RSI improve a closed-form forecaster. For a window ending at time , a forecaster maps to . RLinear* is RLinear [12]: a channel-shared linear map, fitted by ridge regression on instance-normalised windows. CYC* is a closed-form analogue of CycleNet/Linear [13]. For a cycle length it estimates, for every channel , the mean of the training series at each phase,
removes it from the window, , normalises the remainder with its window mean and standard deviation , and forecasts with a ridge-fitted map shared across channels:
By default follows CycleNet (24 for ETTh, 96 for ETTm, 144 for Weather and Solar, 168 for ECL and Traffic, 288 for PEMS). The cycle length is the structural choice that TS-RSI-Struct searches.
TS-RSI-Code: Program Space
Generation. The LLM receives a short description of the dataset and an interface: a class with fit(train) and a vectorised predict(x, t_start), where t_start is the absolute time index of the first forecast step. The prompt asks for an explicit combination of components, each in its own variable, and lists examples such as level, damped trend, seasonal naive, daily and weekly profiles and cross-channel factors. A program is accepted after a smoke test and a scale check: fitted on the first 80% of the training split, its MSE on the last 20% must not exceed three times that of repeating the last value. A failing program is returned to the LLM for repair.
Grounding. A generated program can compute useful components even when its hand-set weights fit the data poorly, so we use it as a feature generator and learn the weights. Let be the end of the fitted rows (the end of the training split) and . The base and the program are first fitted on the rows before , and the head is fitted on the windows whose targets lie in , which are out of sample for both (at most 256 windows and 32 channels). The predict method of is rewritten to record its forecast and every assigned array whose shape aligns with the forecast. Arrays that are constant across windows or nearly duplicate another array (correlation above 0.999) are dropped, and each remaining intermediate is kept only if perturbing it changes the forecast of . This leaves features . Each is clipped to the 2nd and 98th percentiles of its values on , so that a drifting intermediate cannot extrapolate the correction, and standardised with its mean and standard deviation on , . For every horizon step the grounded forecast corrects the base,
where is the solution of a ridge regression of the base residual, pooled over channels and windows,
The intercept is not penalised, , and is chosen on a chronological 70/30 split of . For deployment the base and the program are refitted on all rows before , keeping and the clipping and standardisation constants.
Robust grounding. The test split begins rows (one validation length) after the fitted rows, while the windows directly follow the rows the head-fit models saw. In gap-matched fitting these models are fitted on the rows before instead of , so that sees the same distance between fitted rows and evaluated windows as the test split. Deployment again uses the models refitted up to . In the per-horizon fallback, for each forecast length the grounded forecast is used only if it beats the base on validation:
TS-RSI-Code uses both (§ 4.2 explains why). Grounding on without them is called CLG and serves as an ablation.
Iterating in program space. Starting from TS-RSI-Code, we pre-registered five ways of spending more calls, all scored with the same grounding and fallback. The additive loop grow adds programs to a pool whose features share one head: in each of three rounds the LLM sees residual diagnostics on a feedback fold inside the training split (error by horizon, phase of day, day of week, cross-channel structure) and writes two complementary programs, and the better one is kept only if both the feedback fold and validation improve by more than 2%. (The grow and evolve prompts describe the base as a fixed linear model and do not mention the periodic profile of .) The rewrite loop evolve rewrites the current best program after seeing validation diagnostics and keeps the candidate with the best validation MSE (three rounds of two candidates). Best-of-3 and union-3 draw three independent programs and select one on validation or pool their features. The stronger-LLM arm generates once with DeepSeek-V4-Pro. A later experiment runs evolve for ten rounds.
TS-RSI-Struct: Structure Space
The structure we vary is the cycle length of , drawn from six candidates per dataset, steps, where is the number of steps per day (no cycle, 12 hours, and 1, 2, 7 and 14 days). A candidate is scored by the validation MSE of with that cycle length, averaged over the four horizons,
TS-RSI-Struct, an LLM-as-optimizer loop [36, 39], proposes a first candidate from the dataset description alone and then, in each round, sees the candidates tried so far with their scores and proposes an untried one,
and deploys the best candidate on validation after evaluations ( rounds of feedback), . The LLM never sees test data. We ran three seeds per dataset and deploy unless stated. An invalid or repeated answer is replaced by the first untried candidate.
Reference rules. Three rules choose the cycle length without iterating on test data. Default uses the CycleNet value. The trivial competitor CYC*val picks the daily or the weekly cycle by validation, , without an LLM. The LLM prior ranks the six candidates from the dataset description alone (three samples, Borda consensus). Three reference searches complete the comparison: six-way validation search, ; random search over candidates, whose test MSE is the expectation over all subsets; and the LLM’s static ranking truncated at .
Aggregating over datasets. We report the change of a method relative to a method as the geometric mean of over a set of datasets , minus one, and use the median of the per-dataset ratios where a criterion says so.
Experimental Results
One Generated Program Helps Where Seasonality Matters
The closed-form bases track their published counterparts: RLinear* is within ±4.2% of RLinear on all 12 datasets, and CYC* is within ±1% of CycleNet/Linear on ETTm1, ETTm2, ECL and Traffic, better on ETTh1 and ETTh2, and worse on Solar (+5%), PEMS (+2 to +7%) and Weather (+15%).
On the held-out datasets all three pre-registered criteria for TS-RSI-Code against CYC* hold (Table 1). It is within 1% of CYC* on 8 of 8 datasets, against 6 of 8 for plain CLG, which loses 12% on ETTh2 and 6% on ETTm2; its median change is −3.2%; and it keeps a median 99% of the gain wherever CLG gains at least 5%. The gains come from calendar-driven data: −13.7% on PEMS03, −26.8% on PEMS07, −18.3% on PEMS08 and −5.8% on Solar. The published models stay ahead on ETTm1, ETTm2, Traffic, Solar and Weather, and iTransformer on PEMS03 (0.113 against 0.122).
Table 1 reports the program generated first, which was fixed before the other two. Over three independent generations the held-out median change of TS-RSI-Code is −3.2%, −3.2% and −2.5%, and every generation stays within 1% of on at least 7 of the 8 held-out datasets. Averaged over the three generations, the PEMS gains are 15.0%, 20.3% and 14.9%. The spread is large only on PEMS07 (−29.8% to −4.5%) and on the development dataset ETTh1, where the first program is the one gap-matched fitting was developed on (§ 4.2).
The gain grows with the horizon (Figure 2). On PEMS07 TS-RSI-Code is 7.3% better than at 12 steps and 36.4% better at 96 steps. On PEMS08 the change goes from 0.0% to −30.8% and on PEMS03 from +0.7% to −20.2%. A seasonal profile matters little for the next hour, which the look-back window already describes, and a great deal for the next eight hours.
Figure 2. Test MSE per horizon. On PEMS the gain of TS-RSI-Code and TS-RSI-Struct over grows with the horizon, and TS-RSI-Struct coincides with .
Figure 3 shows two PEMS08 test windows: where the daily and weekly profiles disagree, TS-RSI-Code stays close to the weekly one. Where they agree, it is worse than both, and the per-horizon fallback, which decides on averages over the validation split, cannot avoid such windows.
Figure 3. PEMS08 forecasts from 06:00 where the daily and weekly profiles of CYC agree most (a) or disagree most (b), for the sensor where they differ most.
Grounding Under Drift
Two choices in TS-RSI-Code come from a failure on the development datasets. CLG improved validation by 6% on ETTh1 and Weather and lost 46% and 15% on test. Figure 4 (left) shows the screen that located the cause. A head that is exactly shift-equivariant, with no term that anchors the forecast to the training-period level, removes the ETTh1 loss but also all of the ECL gain and a third of the PEMS04 gain. Regressing toward the training-period level helps on stationary data and hurts under drift, and validation, which directly follows the training data, cannot tell the two apart. Fitting the head at the deployment gap lets validation see the drift: on ETTh1 at the validation change turns from −9.6% to +2.6%, the fallback switches to the base, and the ECL and PEMS04 gains are unchanged. With the fallback, the shift-equivariant head would also have protected Weather, where the gap-matched head loses 16%.
Figure 4. Left: change of CLG relative to CYC on the development datasets for three correction heads. Right: TS-RSI-Code relative to CYC in % (top: development, bottom: held out) for generations g0–g2, the stronger LLM (pro), union-3 and evolve.
The fix is partial (Figure 4, right). On the held-out datasets each single program stays within 1% of the base on at least 7 of 8 datasets, and the union of three programs on 6 of 8. On ETTh1 the fix protects only the program it was developed on: with the other programs, validation still improves at long horizons while test loses 12–50%. Weather loses 14–23% with every program.
Iterating on the Program Adds Little
Spending more calls on the program changes little (Figure 5). None of the five pre-registered arms improves the held-out median by more than 0.4%. In the mean, only the stronger LLM gains more than 1% (−1.2%), and union-3 loses 1.6%. The additive loop accepted a program on only two datasets, and both became slightly worse on test. A multi-fold version of the rewrite loop, run earlier on the development datasets, failed both of its criteria (better on 2 of 4, mean +5.7%).
Figure 5. Test MSE change of each program-space arm relative to TS-RSI-Code, per held-out dataset (negative is better). The last panel is relative to its round-0 program.
Validation overstates gains. The pre-registered criterion holds: on 5 of the 7 held-out datasets where the rewrite loop replaced the starting program, the selected program gained less on test than on validation, by a median of 1.0 percentage points. Over all 44 runnable programs the loop proposed (exploratory), validation ranks them well (rank correlation 0.79), and 30 of them did better on validation than on test (Figure 6a).

Figure 6. Validation overstates the gains of iterated programs. (a) Validation vs. test change of evolve’s candidates relative to the starting program (before fallback), with selected ones filled. Points above the diagonal gained less on test than on validation. (b) Best so far over ten rounds: validation relative to round 0, test (with fallback) relative to .
A larger budget. To test whether the loops are simply too short, we pre-registered ten rounds of evolve on PEMS03, PEMS08 and Solar, chosen after the results of § 4.4 were known: the trivial competitor picks the weekly cycle on the first two, and Solar is where TS-RSI-Code kept a gain over it. The loop starts from the TS-RSI-Code program re-grounded on the base chosen by the trivial competitor, so any gain is a gain over that competitor (Figure 6b). Against its round-0 program the median change is −0.8%, short of the pre-registered −1%. Against the trivial competitor it is −3.6%, which passes the second criterion. On Solar, −5.8% of the −6.6% is already in the round-0 program. Without the fallback, validation gains (−2.4%, −1.3%, −0.2%) again differ from test gains (−1.0%, −0.5%, −0.8%).
A Trivial Competitor Explains the Gain
Grounded the same way on RLinear, the LLM program beats a human-written calendar program (daily and weekly profiles) on 9 of 12 datasets with a median of −7.1%, is slightly worse than a human answer to the same prompt (better on 3 of 12, median +1.8%), and beats CYC on only 4 of 12 (Figure 7a). Without component examples in the prompt, 36 of 36 generations still succeed; their held-out median is −25.0% against RLinear, versus −26.1% with examples. What the program contributes is mostly periodic structure.
Figure 7. Where the gain comes from.
All twelve generated programs compute a time-of-week profile, and so do 9 of 12 programs generated for PEMS without examples. The large gains appear on PEMS, where CYC uses a daily cycle for traffic that follows a weekly one. After the held-out results of TS-RSI-Code were known, we therefore pre-registered the trivial competitor CYC with a criterion: if the median change of TS-RSI-Code against CYC on the held-out datasets is above −1%, the weekly cycle explains the gain of the LLM program.
The median is +0.1%: the weekly cycle explains the gain. Alone, it lowers the error of CYC by 16.4%, 42.5% and 28.5% on PEMS03, PEMS07 and PEMS08, more than TS-RSI-Code does: TS-RSI-Code has 3%, 27% and 14% higher error than the trivial competitor there, and 5.8% lower error on Solar (Figure 7b). On the development dataset ETTh1, validation picks the weekly cycle, which loses 2.9%. The same document pre-registered a second test: re-ground the program on the base that the trivial competitor selects and require a median gain of at least 3% over that competitor. It fails, with a median change of 0.0%. The re-grounded program stays within 1% of the competitor on 7 of 8 datasets, and PEMS07 loses 4.3%. Fitted in seconds on one CPU core, the trivial competitor is 12–41% more accurate than the published CycleNet/Linear on all four PEMS datasets.
Self-Improvement in Structure Space
The prior is wrong. The programs the LLM writes compute a weekly profile, but asked for the cycle length directly, the LLM does not supply this structure. Ranking the six cycle lengths from the dataset description, it puts one day first on all 12 datasets, unanimously across samples (36 calls, 0.04 CNY). Its choice equals the CycleNet default except on ECL and Traffic, where it is 24% worse than the weekly default, and it is 9.8% worse than six-way validation search at the median (Figure 8). Random search needs three validation evaluations to match it at the median.
Figure 8. Test MSE of CYC* for six cycle lengths, relative to the best (log scale on PEMS). Markers show each rule’s choice (TS-RSI-Struct: most frequent over three seeds).
The loop recovers from it. The first proposal of TS-RSI-Struct is always one day. After seeing the validation error of that choice, the LLM proposes the weekly cycle next in 30 of 36 runs and third in the remaining six. After one round of feedback () TS-RSI-Struct matches six-way search at the median, and with two or three evaluations it is 4.7% and 4.4% more accurate than random search over the same number of candidates. All three pre-registered criteria hold (Figure 9a). The static ranking truncated at two candidates also matches six-way search at the median over the 12 datasets, but the loop pulls ahead on PEMS, where the static ranking puts the weekly cycle fourth. There, three evaluations of TS-RSI-Struct match exhaustive search, while the static ranking is 48% and random search 14% worse. After three evaluations the held-out geometric-mean change of TS-RSI-Struct relative to is −12.4%, against −12.5% for the trivial competitor (Figure 9b), and −8.5% after two.
Figure 9. Self-improvement pays in structure space. (a) Test MSE relative to trying all six cycle lengths (mean over datasets, whereas the criteria use medians). Thin lines: DeepSeek-V4-Pro (dashed) and Qwen3.6-Plus (dotted). (b) Held-out geometric-mean change relative to . †Stronger LLM: about four times the cost per call.
Other LLMs. With the same prompts and criteria, DeepSeek-V4-Pro and Qwen3.6-Plus (another model family) both pass all three criteria: with two and three evaluations they are 7.2% and 4.4% (DeepSeek-V4-Pro) and 7.2% and 4.7% (Qwen3.6-Plus) more accurate than random search (Figure 9a, thin lines), and both tie the trivial competitor on the held-out datasets after three evaluations. Unlike DeepSeek-V4.1-Flash, both put the weekly cycle first on ECL, so their static rankings are already as good at the median. Of their 216 answers each, 15 and 38 were invalid and were replaced by the first untried candidate, as pre-registered.
Two wrong choices. In a further pre-registered experiment we added a second structural choice: whether the cycle profile is removed on the raw scale, as in , or after instance normalisation, as in CycleNet, which gives 12 configurations per dataset. The second choice leaves almost no room on the held-out datasets: the best normalised-profile configuration is at most 0.9% better than the best raw-profile one, and it is 30% worse on Solar and 76–149% worse on PEMS (Figure 10b). The LLM’s prior puts the daily cycle with the normalised profile first on all 12 datasets, and in the loop it mostly varies the cycle length under that choice. In 3 of 12 PEMS runs it never tries the raw profile in six evaluations. After four evaluations TS-RSI-Struct is 20% worse than the trivial competitor and 6.8% worse than random search, and all three criteria fail (Figure 10a).
Figure 10. Two structural choices: cycle length and profile scale (raw, as in CYC, or normalised, as in CycleNet). (a) Search over the 12 configurations (pre-registered comparison at ). (b) Best normalised vs. best raw configuration, per dataset.
Cost. Generating a program takes 1.75 calls on average (0.04 CNY) and grounding it a median of 14 CPU-seconds per dataset and horizon. The structure-space loop used 216 calls (0.24 CNY) for all 12 datasets and three seeds. All experiments in this paper, including development runs, failed variants and 68 pilot calls, used 1867 calls and 27.6 CNY (about 3.9 US dollars).
Limitations
Our evidence is limited to LTSF benchmarks, which leave little room for domain knowledge beyond seasonality, and to small structure spaces and short program loops. We did not separate the effects of proposing one candidate at a time and of seeing validation scores. Finally, the held-out data were reused: the robust-grounding criteria were written after the losses of CLG on ETTh2 and ETTm2 were known; evolve, best-of-3, union-3, the stronger LLM, the trivial competitor and the ten-round loop after the held-out results of TS-RSI-Code; TS-RSI-Struct and its criteria after the test scores of all six cycle lengths were known; and the human-written programs after we had seen LLM programs.
Conclusion
TS-RSI pairs every self-improvement loop on the LTSF benchmark with a trivial competitor. In program space, one grounded LLM-written program captures the LLM’s contribution, on PEMS a weekly cycle, and further rounds change the median by about 1% while inflating validation scores. In structure space, validation feedback moves the LLM off its prior within one or two rounds. The loop beats random search with three LLMs and ties the trivial competitor for 0.24 CNY, but fails when the prior is wrong on two choices. Self-improving forecasters should search small structure spaces with cheap, informative feedback, and be evaluated against a trivial competitor for the structure they exploit, on a test set kept out of selection.
Use of AI tools. Apart from the LLMs studied in this paper, AI tools were used only to polish the language of the manuscript. The authors reviewed all edited text and take full responsibility for the content.
References
- [1]Bergmeir, C., Benítez, J.M.: On the use of cross-validation for time series predictor evaluation. Information Sciences 191, 192–213 (2012)DOI
- [2]Cawley, G.C., Talbot, N.L.: Over-fitting in model selection and subsequent selection bias in performance evaluation. The Journal of Machine Learning Research 11, 2079–2107 (2010)DOI
- [3]De Prado, M.L.: Advances in financial machine learning. John Wiley & Sons (2018)
- [4]Dwork, C., Feldman, V., Hardt, M., Pitassi, T., Reingold, O., Roth, A.: The reusable holdout: Preserving validity in adaptive data analysis. Science 349(6248), 636–638 (2015)DOI
- [5]Gideoni, Y., Risi, S., Gal, Y.: Simple baselines are competitive with code evolution. arXiv preprint arXiv:2602.16805 (2026)arxiv.org/abs/2602.16805
- [6]Hambardzumyan, K., Baldwin, N., Toledo, E., Hazra, R., Kuchnik, M., Omari, B.A., Foster, T.S., Protopopov, A., Gagnon-Audet, J.C., Mediratta, I., et al.: Aira_2: Overcoming bottlenecks in ai research agents. arXiv preprint arXiv:2603.26499 (2026)arxiv.org/abs/2603.26499
- [7]Hollmann, N., Müller, S., Hutter, F.: Large language models for automated data science: Introducing caafe for context-aware automated feature engineering. Advances in Neural Information Processing Systems 36, 44753–44775 (2023)arxiv.org/abs/2305.03403
- [8]Hu, L., Tang, Y.: The winner’s curse in llm self-improvement loops: Selection noise, lock-in, and acceptance rules. arXiv preprint arXiv:2610.09239 (2026)arxiv.org/abs/2610.09239
- [9]Hu, Y., Dai, X., Qu, Z., Liu, Y., Dong, Z., Yang, J.m., Xu, Q.: When tomorrow becomes today: Self-evolving policies for agentic time-series forecasting. arXiv preprint arXiv:2609.24862 (2026)arxiv.org/abs/2609.24862
- [10]Lai, G., Chang, W.C., Yang, Y., Liu, H.: Modeling long-and short-term temporal patterns with deep neural networks. In: The 41st international ACM SIGIR conference on research & development in information retrieval. pp. 95–104 (2018)arxiv.org/abs/1703.07015
- [11]Lange, R., Imajuku, Y., Cetin, E.: Evolution: Towards open-ended and sample-efficient program evolution. In: International Conference on Learning Representations. vol. 2026, pp. 74026–74078 (2026)arxiv.org/abs/2509.19349
- [12]Li, Z., Qi, S., Li, Y., Xu, Z.: Revisiting long-term time series forecasting: An investigation on linear mapping. arXiv preprint arXiv:2305.10721 (2023)DOI
- [13]Lin, S., Lin, W., Hu, X., Wu, W., Mo, R., Zhong, H.: Cyclenet: Enhancing time series forecasting through modeling periodic patterns. Advances in Neural Information Processing Systems 37, 106315–106345 (2024)arxiv.org/abs/2409.18479
- [14]Liu, H., Fu, D., Fu, L., Jin, Y., Qiang, R., Kamarthi, H., Prakash, B.A.: Timersi: Towards self-improved agentic deployment for time-series foundation models. arXiv preprint arXiv:2610.19725 (2026)arxiv.org/abs/2610.19725
- [15]Liu, M., Zeng, A., Chen, M., Xu, Z., Lai, Q., Ma, L., Xu, Q.: Scinet: Time series modeling and forecasting with sample convolution and interaction. Advances in neural information processing systems 35, 5816–5828 (2022)arxiv.org/abs/2106.09305
- [16]Liu, S., Gao, C., Li, Y.: Echo: Large language model agent for hyper-parameter optimization. In: Conference on Parsimony and Learning. Proceedings of Machine Learning Research, vol. 280, pp. 1146–1169 (2025)arxiv.org/abs/2402.01881
- [17]Liu, Y., Hu, T., Zhang, H., Wu, H., Wang, S., Ma, L., Long, M.: itransformer: Inverted transformers are effective for time series forecasting. In: International conference on learning representations. vol. 2024, pp. 11116–11140 (2024)arxiv.org/abs/2310.06625
- [18]Mombaerts, L., Taws, J., Gargano, J., Gaddam, D., George, K., Tiwari, S., Rajesh, S.: Training-free continual learning for multimodal forecasting via prompt evolution. arXiv preprint arXiv:2610.27468 (2026)arxiv.org/abs/2610.27468
- [19]Murray, A., Dervovic, D., Cashmore, M.: Elate: Evolutionary language model for automated time-series engineering. arXiv preprint arXiv:2508.14667 (2025)arxiv.org/abs/2508.14667
- [20]Ni, R., Lin, Z., Wang, S., Fanti, G.: Mixture-of-linear-experts for long-term time series forecasting. In: International conference on artificial intelligence and statistics. pp. 4672–4680. PMLR (2024)arxiv.org/abs/2312.06786
- [21]Nie, Y., Nguyen, N., Sinthong, P., Kalagnanam, J.: A time series is worth 64 words: Long-term forecasting with transformers. In: International Conference on Learning Representations (2023)arxiv.org/abs/2211.14730
- [22]Nosek, B.A., Ebersole, C.R., DeHaven, A.C., Mellor, D.T.: The preregistration revolution. Proceedings of the National Academy of Sciences 115(11), 2600–2606 (2018)
- [23]Novikov, A., Vũ, N., Eisenberger, M., Dupont, E., Huang, P.S., Wagner, A.Z., Shirobokov, S., Kozlovskii, B., Ruiz, F.J., Mehrabian, A., et al.: Alphaevolve: A coding agent for scientific and algorithmic discovery. arXiv preprint arXiv:2506.13131 (2025)arxiv.org/abs/2506.13131
- [24]Romera-Paredes, B., Barekatain, M., Novikov, A., Balog, M., Kumar, M.P., Dupont, E., Ruiz, F.J., Ellenberg, J.S., Wang, P., Fawzi, O., et al.: Mathematical discoveries from program search with large language models. Nature 625(7995), 468–475 (2024)
- [25]Saadallah, O., Orosz, T.G., et al.: A meta-knowledge-augmented llm framework for hyperparameter optimization in time-series forecasting. arXiv preprint arXiv:2602.01445 (2026)arxiv.org/abs/2602.01445
- [26]Shojaee, P., Meidani, K., Gupta, S., Barati Farimani, A., Reddy, C.: Llm-sr: Scientific equation discovery via programming with large language models. In: International Conference on Learning Representations. vol. 2025, pp. 16054–16085 (2025)arxiv.org/abs/2404.18400
- [27]Tan, M., Merrill, M.A., Gupta, V., Althoff, T., Hartvigsen, T.: Are language models actually useful for time series forecasting? Advances in Neural Information Processing Systems 37, 60162–60191 (2024)arxiv.org/abs/2406.16964
- [28]Toledo, E., Hambardzumyan, K., Josifoski, M., Hazra, R., Baldwin, N., Audran-Reiss, A., Kuchnik, M., Magka, D., Jiang, M., Lupidi, A., et al.: Ai research agents for machine learning: Search, exploration, and generalization in mle-bench. Advances in Neural Information Processing Systems 38, 35309–35348 (2026)
- [29]Van Stein, N., Vermetten, D., Bäck, T.: In-the-loop hyper-parameter optimization for llm-based automated design of heuristics. ACM Transactions on Evolutionary Learning (2024)DOI
- [30]Wang, J., Wang, Y., Wu, W., Zhang, C.: Self-evolving time-series forecasting agents with episodic memory and online policy learning. arXiv preprint arXiv:2609.32689 (2026)arxiv.org/abs/2609.32689
- [31]Wolpert, D.H.: Stacked generalization. Neural networks 5(2), 241–259 (1992)DOI
- [32]Wu, H., Hu, T., Liu, Y., Zhou, H., Wang, J., Long, M.: Timesnet: Temporal 2d-variation modeling for general time series analysis. In: International Conference on Learning Representations (2023)arxiv.org/abs/2210.02186
- [33]Wu, H., Xu, J., Wang, J., Long, M.: Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. Advances in neural information processing systems 34, 22419–22430 (2021)arxiv.org/abs/2106.13008
- [34]Xu, L., Zhang, X., Tuo, Q., Li, R.: Sea-ts: Self-evolving agent for autonomous code generation of time series forecasting algorithms. arXiv preprint arXiv:2603.04873 (2026)arxiv.org/abs/2603.04873
- [35]Xu, X., Tang, J., Chen, J., Yan, Y., Tang, Z., Zhou, X., Hu, X., Wei, W., Wu, J., Chen, Q., et al.: Llm-based agents for forecasting and prediction: Methods, training, evaluation, and applications. arXiv preprint arXiv:2608.23058 (2026)arxiv.org/abs/2608.23058
- [36]Yang, C., Wang, X., Lu, Y., Liu, H., Le, Q.V., Zhou, D., Chen, X.: Large language models as optimizers. In: International Conference on Learning Representations. vol. 2024, pp. 12028–12068 (2024)arxiv.org/abs/2309.03409
- [37]Zeng, A., Chen, M., Zhang, L., Xu, Q.: Are transformers effective for time series forecasting? In: Proceedings of the AAAI conference on artificial intelligence. vol. 37, pp. 11121–11128 (2023)arxiv.org/abs/2205.13504
- [38]Zeng, C., Tian, Y., Zheng, G., Gao, Y.: How much can time-related features enhance time series forecasting? arXiv preprint arXiv:2412.01557 (2024)arxiv.org/abs/2412.01557
- [39]Zhang, M.R., Desai, N., Bae, J., Lorraine, J., Ba, J.: Using large language models for hyper-parameter optimization. arXiv preprint arXiv:2312.04528 (2023)arxiv.org/abs/2312.04528
- [40]Zhou, H., Zhang, S., Peng, J., Zhang, S., Li, J., Xiong, H., Zhang, W.: Informer: Beyond efficient transformer for long sequence time-series forecasting. In: Proceedings of the AAAI conference on artificial intelligence. vol. 35, pp. 11106–11115 (2021)arxiv.org/abs/2012.07436







