Instructions to use lawrencehui/chronos-2-empty-history-fix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chronos
How to use lawrencehui/chronos-2-empty-history-fix with Chronos:
pip install chronos-forecasting
import pandas as pd from chronos import BaseChronosPipeline pipeline = BaseChronosPipeline.from_pretrained("lawrencehui/chronos-2-empty-history-fix", device_map="cuda") # Load historical data context_df = pd.read_csv("https://autogluon.s3.us-west-2.amazonaws.com/datasets/timeseries/misc/AirPassengers.csv") # Generate predictions pred_df = pipeline.predict_df( context_df, prediction_length=36, # Number of steps to forecast quantile_levels=[0.1, 0.5, 0.9], # Quantiles for probabilistic forecast id_column="item_id", # Column identifying different time series timestamp_column="Month", # Column with datetime information target="#Passengers", # Column(s) with time series values to predict ) - Notebooks
- Google Colab
- Kaggle
Chronos-2, empty-history fix
This is amazon/chronos-2 with 1,536 of its 120 million weights changed, and no retraining. The change fixes one bug: when the history you give it is empty, Chronos-2 returns huge forecast ranges.
| History given to the model | Original 10%β90% range | This model |
|---|---|---|
| No data at all (all NaN) | β141,915 to +130,875 | β0.4 to 0.2 |
| One real value (7.0) | 5.2 to 8.9 | 7.0 to 7.0 |
| Normal series around 10 | 9.3 to 10.6 | 9.3 to 10.6, bit-identical |
With two or more real values in the history, the output is bit-for-bit identical to the original.
Use
Load it the same way as the original:
from chronos import Chronos2Pipeline
import numpy as np
pipe = Chronos2Pipeline.from_pretrained("lawrencehui/chronos-2-empty-history-fix", device_map="cpu")
pipe.predict_quantiles([{"target": np.full(500, np.nan, dtype=np.float32)}],
prediction_length=24, quantile_levels=[0.1, 0.5, 0.9])
What changed
One neuron in the last encoder block's MLP never activated. An AI agent (Claude Opus 5.5, in Claude Code) gave it a job, working from the weights and practice data, with 50 test runs allowed and no gradients. It used 11 runs and about 30 minutes.
encoder.block.11MLPwi, row 11 (768 weights): detects an empty historyencoder.block.11MLPwo, column 11 (768 weights): steers that forecast to a flat line near zero
The 8 KB delta, the agent's full notebook and all the evaluation code are in github.com/lawrencehui/Chronos-2-weight-space-fix.
Results on GIFT-Eval (test split)
Only 12 of the 97 tasks contain a series with at most one real value in its history, so only those can change. All of them are Bitbrains (cloud server logs), electricity/W or kdd_cup_2018.
| Task | Original | Fixed |
|---|---|---|
| bitbrains_rnd / 5T / medium | 1.0046 | 0.6700 (β33.3%) |
| bitbrains_rnd / 5T / long | 0.8730 | 0.6254 (β28.4%) |
| bitbrains_rnd / H / short | 0.8035 | 0.6702 (β16.6%) |
| 5 other Bitbrains tasks | 0.2β3.9% better | |
| Every other task | unchanged | |
| Overall normalised CRPS | 0.4854 | 0.4803 |
Point forecasts (MASE) are unchanged at 0.6978. On our computation that moves Chronos-2 from #79 to #69 of 164 on the leaderboard. This is not an official leaderboard submission.
Caveats
- A one-line code check ("empty history β flat forecast") fixes the same bug, and that's the fix we suggested upstream in amazon-science/chronos-forecasting#544. Prefer that if it lands. This model exists to show that the fix can live in the weights, and so you can try it.
- With exactly one real value, the forecast collapses onto that value (zero width). That's no worse than the original here, but it's not a calibrated range.
- Tested with
chronos-forecasting2.3.2 on CPU (Apple Silicon).
Credits
- Base model: amazon/chronos-2 by Amazon, Apache-2.0. All credit for the model is theirs; this repo only changes 1,536 weights.
- Method: Sparks of Weight-Space Programming by Rikiya Takehi, Jayden Teoh, Alex Zhang and Omar Khattab.
- Write-up: lawrenceh.xyz/writings/chronos-2-one-dead-neuron
- Downloads last month
- 25
Model tree for lawrencehui/chronos-2-empty-history-fix
Base model
amazon/chronos-2