CATF: A Manager-Worker Framework for Context-Aware Time-Series Forecasting
Organizations: UC Davis, Davis, CA, USA
Abstract
We study context-aware time-series forecasting, in which a single target variable is predicted from its own history and a set of contextual variables, such as weather and calendar information. As the context becomes more diverse, a single model struggles to capture all of its regimes, while ensemble learning and Mixture-of-Experts approaches rely on manual data partitioning or soft routing, which increases the inference cost and hinders interpretability. We propose CATF, a Context-Aware Time-Series Forecasting framework built on a Manager-Worker architecture: a Transformer-based Manager routes each input to a single Worker based on the context, using hard routing during both training and inference. The Workers thus specialize without manual data partitioning, and any single-model forecaster can serve as a Worker. On five context-rich datasets, four horizons, and two normalization schemes, CATF improves over its standalone counterpart in 162 of 200 comparisons, the best CATF-enhanced model outperforms the best standalone baseline in 19 of 20 settings, and it outperforms the zero-shot Time-MoE foundation model in 15 of 20 settings. A case study on bike-sharing data shows that the Manager routes inputs by the calendar and that each Worker specializes in a different weekly pattern.
Figures & tables
| Dataset | iTransformer ( ( 2024a ) ) | TimesNet ( ( 2023a ) ) | FEDformer ( ( 2022 ) ) | Autoformer ( ( 2021 ) ) | Informer ( ( 2021 ) ) | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Global | Sample | Global | Sample | Global | Sample | Global | Sample | Global | Sample | ||||||||||||
| Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | Base | + CATF | ||
| Weather | 96 | 204.7 | 194.9 | 447.0 | 178.3 | 245.6 | 215.9 | 418.6 | 158.5 | 28,741 | 351.3 | 1,208,418 | 181.7 | 39,860 | 419.5 | 1,933,907 | 210.1 | 1,733 | 442.7 | 4,402 | 155.7 |
| 192 | 249.3 | 226.7 | 637.6 | 231.6 | 271.1 | 234.8 | 410.6 | 226.1 | 28,712 | 548.9 | 10,628,690 | 236.8 | 230,293 | 380.4 | 151,937 | 285.4 | 6,645 | 426.5 | 7,309 | 220.8 | |
| 336 | 254.6 | 232.3 | 749.2 | 254.8 | 264.8 | 243.3 | 456.7 | 241.8 | 50,859 | 559.7 | 380,781 | 267.3 | 70,468 | 279.8 | 157,994 | 270.1 | 77,472 | 460.2 | 3,729 | 240.1 | |
| 720 | 270.1 | 235.9 | 748.3 | 330.0 | 269.1 | 241.7 | 963.3 | 291.8 | 41,001 | 640.8 | 798,364 | 268.3 | 209,899 | 259.7 | 29,367 | 296.1 | 4,335 | 527.5 | 3,637 | 290.7 | |
| Dataset | Best baseline | Best CATF -enhanced | Time-MoE ( ( 2025 ) ) | |||
|---|---|---|---|---|---|---|
| Model | MSE | Model | MSE | MSE | ||
| Weather | 96 | iTransformer | 204.7 G | CATF -Informer | 155.7 S | 164.9 S |
| 192 | iTransformer | 249.3 G | CATF -Informer | 220.8 S | 215.0 S | |
| 336 | iTransformer | 254.6 G | CATF -iTransformer | 232.3 G | 225.6 S | |
| 720 | TimesNet | 269.1 G | CATF -iTransformer | 235.9 G | 233.5 S | |
| PM2.5-LA | 96 | iTransformer | 36.08 S | CATF -iTransformer | 35.20 S | 39.66 S |
| Setting | MSE | (%) | ||
| Default | 80.52 1.02 | – | – | |
| Loss | KL only | 81.87 2.75 | 0.347 | |
| Wasserstein only | 81.56 1.10 | 0.157 | ||
| Reg. | No reg. | 80.94 1.19 | 0.559 | |
| Manager | Small ( ) | 81.23 0.78 | 0.252 | |
| Large ( ) | 81.05 0.81 | 0.386 | ||
Appendix figures & tables22 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | #Variables | Target | Input Length ( ) | Output Length ( ) | Frequency | Dataset Size | Domain |
|---|---|---|---|---|---|---|---|
| Weather | 21 | CO 2 (ppm) | 96 | {96, 192, 336, 720} | 10 minutes | 52,696 | Meteorology |
| PM2.5-LA | 15 | PM2.5 ( g/m 3 ) | 96 | {96, 192, 336, 720} | 1 hour | 35,063 | Air quality |
| PM2.5-RV | 15 | PM2.5 ( g/m 3 ) | 96 | {96, 192, 336, 720} | 1 hour | 35,063 | Air quality |
| Bike Share | 12 | Rental count | 96 | {96, 192, 336, 720} | 1 hour | 17,379 | Transportation |
| Appliances | 26 | Energy use (Wh) | 96 | {96, 192, 336, 720} | 10 minutes | 19,735 | Energy |
| Model | #Layers | #Model Dimension | #Feedforward Dimension | #Attention Heads | #Dropout | #Attention Factor | #Learning Rate |
|---|---|---|---|---|---|---|---|
| i-Transformer | 2 | 128 | 128 | 8 | 0.1 | 3 | 0.0001 |
| TimesNet | 2 | 32 | 32 | 8 | 0.1 | 3 | 0.0001 |
| FEDformer | 2 | 512 | 2048 | 8 | 0.1 | 3 | 0.0001 |
| Autoformer | 2 | 512 | 2048 | 8 | 0.1 | 3 | 0.0001 |
| Informer | 2 | 512 | 2048 | 8 | 0.1 | 3 | 0.0001 |
| Model Type | #Layers | #Model Dimension | #Feedforward Dimension | #Attention Heads | #Dropout |
|---|---|---|---|---|---|
| Transformer | 2 | 512 | 2048 | 8 | 0.05 |
| Model | Manager LR | Worker LR |
|---|---|---|
| CATF-iTransformer | 0.00001 | 0.0001 |
| CATF-TimesNet | 0.00001 | 0.0001 |
| CATF-FEDformer | 0.001 | 0.0001 |
| CATF-Autoformer | 0.00001 | 0.0001 |
| CATF-Informer | 0.00001 | 0.0001 |
| Hyperparameter | Baseline | CATF Models |
|---|---|---|
| Shared Settings | ||
| Batch Size | 32 | 32 |
| Training Size | 0.8 | 0.8 |
| Validation Size | 0.1 | 0.1 |
| Test Size | 0.1 | 0.1 |
| Epochs | 10 | 30 |
| Dataset | iTransformer ( ( 2024a ) ) | CATF - iTransformer | TimesNet ( ( 2023a ) ) | CATF - TimesNet | FEDformer ( ( 2022 ) ) | CATF - FEDformer | Autoformer ( ( 2021 ) ) | CATF - Autoformer | Informer ( ( 2021 ) ) | CATF - Informer | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Weather | 96 | 204.7 2.29 | 194.9 5.19 | 245.6 10.69 | 215.9 21.53 | 28,741 16,160 | 351.3 97.78 | 39,860 35,693 | 419.5 104.1 | 1,733 830.7 | 442.7 35.52 |
| 192 | 249.3 3.11 | 226.7 8.12 | 271.1 13.23 | 234.8 8.91 | 28,712 19,726 | 548.9 19.67 | 230,293 340,357 | 380.4 53.86 | 6,645 10,171 | 426.5 44.44 | |
| 336 | 254.6 2.15 | 232.3 3.39 | 264.8 3.40 | 243.3 6.20 | 50,859 39,591 | 559.7 79.00 | 70,468 97,935 | 279.8 13.24 | 77,472 170,210 | 460.2 41.99 | |
| 720 | 270.1 2.85 | 235.9 6.54 | 269.1 5.97 | 241.7 4.23 | 41,001 22,172 | 640.8 66.33 | 209,899 267,336 | 259.7 12.00 | 4,335 4,652 | 527.5 59.48 | |
| PM2.5-LA | 96 | 37.05 0.39 | 37.02 0.28 | 37.32 1.68 | 44.42 3.64 | 57.75 4.31 | 42.29 1.29 | 86.25 24.26 | 71.18 6.13 | 45.34 4.37 | 45.04 6.22 |
| 192 | 40.64 0.30 | 41.17 0.24 | 40.16 1.94 | 42.52 2.36 | 65.63 1.73 | 45.25 0.86 | 66.43 8.03 | 64.94 4.65 | 46.80 3.08 | 42.66 0.25 |
| Dataset | iTransformer ( ( 2024a ) ) | CATF - iTransformer | TimesNet ( ( 2023a ) ) | CATF - TimesNet | FEDformer ( ( 2022 ) ) | CATF - FEDformer | Autoformer ( ( 2021 ) ) | CATF - Autoformer | Informer ( ( 2021 ) ) | CATF - Informer | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Weather | 96 | 447.0 47.15 | 178.3 9.00 | 418.6 150.0 | 158.5 10.52 | 1,208,418 1,398,675 | 181.7 6.57 | 1,933,907 1,800,987 | 210.1 24.66 | 4,402 3,262 | 155.7 6.54 |
| 192 | 637.6 71.19 | 231.6 4.39 | 410.6 120.8 | 226.1 6.49 | 10,628,690 15,360,229 | 236.8 9.04 | 151,937 325,720 | 285.4 31.47 | 7,309 2,449 | 220.8 15.75 | |
| 336 | 749.2 64.09 | 254.8 8.98 | 456.7 167.3 | 241.8 6.77 | 380,781 420,438 | 267.3 16.56 | 157,994 251,704 | 270.1 12.01 | 3,729 1,411 | 240.1 5.54 | |
| 720 | 748.3 46.15 | 330.0 35.88 | 963.3 360.3 | 291.8 17.00 | 798,364 652,673 | 268.3 18.87 | 29,367 28,419 | 296.1 33.97 | 3,637 1,223 | 290.7 16.44 | |
| PM2.5-LA | 96 | 36.08 0.96 | 35.20 0.96 | 40.18 4.20 | 35.43 1.30 | 60.91 9.88 | 42.11 2.02 | 57.60 6.91 | 58.89 3.52 | 41.30 2.24 | 37.90 1.28 |
| 192 | 40.93 0.48 | 40.81 0.46 | 42.62 3.67 | 39.25 1.73 | 64.07 2.94 | 43.77 1.81 | 61.37 14.40 | 65.62 8.96 | 42.06 1.10 | 39.62 0.90 |
| Dataset | iTransformer | TimesNet | FEDformer | Autoformer | Informer | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| G | S | G | S | G | S | G | S | G | S | ||
| Weather | 96 | +4.8 | +60.1 | +12.1 | +62.1 | +98.8 | +100.0 | +98.9 | +100.0 | +74.5 | +96.5 |
| 192 | +9.1 | +63.7 | +13.4 | +44.9 | +98.1 | +100.0 | +99.8 | +99.8 | +93.6 | +97.0 | |
| 336 | +8.7 | +66.0 | +8.1 | +47.1 | +98.9 | +99.9 | +99.6 | +99.8 | +99.4 | +93.6 | |
| 720 | +12.7 | +55.9 | +10.2 | +69.7 | +98.4 | +100.0 | +99.9 | +99.0 | +87.8 | +92.0 | |
| PM2.5-LA | 96 | +0.1 | +2.4 | -19.0 | +11.8 | +26.8 | +30.9 | +17.5 | -2.3 | +0.7 | +8.2 |
| Dataset | ( Liu et al., 2024a ) iTransformer | CATF - iTransformer | ( Wu et al., 2023a ) TimesNet | CATF - TimesNet | ( Zhou et al., 2022 ) FEDformer | CATF - FEDformer | ( Wu et al., 2021 ) Autoformer | CATF - Autoformer | ( Zhou et al., 2021 ) Informer | CATF - Informer | TimeMoE (zero-shot) | |
| Weather | 96 | 10.31 0.07 | 10.05 0.16 | 11.41 0.25 | 10.23 0.49 | 133.1 42.16 | 14.26 1.53 | 154.9 88.36 | 15.97 2.15 | 32.48 8.31 | 16.52 0.83 | 21.61 |
| 192 | 11.64 0.07 | 11.04 0.17 | 12.16 0.27 | 11.30 0.17 | 133.1 64.82 | 18.50 0.29 | 241.3 233.3 | 14.93 1.06 | 32.27 12.88 | 15.93 1.12 | 24.60 | |
| 336 | 12.03 0.05 | 11.43 0.11 | 12.25 0.08 | 11.72 0.10 | 195.6 75.97 | 18.37 1.31 | 150.0 121.0 | 12.79 0.34 | 46.55 63.01 | 16.70 0.97 | 26.44 | |
| 720 | 12.71 0.08 | 11.74 0.20 | 12.64 0.17 | 11.92 0.11 | 174.9 58.48 | 20.08 1.08 | 274.6 233.7 | 12.26 0.26 | 34.14 6.19 | 18.16 1.20 | 28.63 | |
| PM2.5-LA | 96 | 3.91 0.01 | 3.93 0.00 | 3.91 0.06 | 4.13 0.19 | 5.77 0.24 | 4.72 0.07 | 6.80 1.00 | 6.27 0.26 | 5.07 0.26 | 4.97 0.22 | 4.41 |
| 192 | 4.20 0.02 | 4.24 0.02 | 4.18 0.09 | 4.24 0.09 | 6.19 0.09 | 4.88 0.05 | 6.02 0.39 | 5.99 0.22 | 5.21 0.14 | 4.96 0.05 | 4.92 |
| Dataset | ( Liu et al., 2024a ) iTransformer | CATF - iTransformer | ( Wu et al., 2023a ) TimesNet | CATF - TimesNet | ( Zhou et al., 2022 ) FEDformer | CATF - FEDformer | ( Wu et al., 2021 ) Autoformer | CATF - Autoformer | ( Zhou et al., 2021 ) Informer | CATF - Informer | TimeMoE (zero-shot) | |
| Weather | 96 | 14.13 0.67 | 9.28 0.20 | 11.84 0.57 | 8.61 0.25 | 725.8 476.1 | 9.45 0.19 | 983.5 593.3 | 10.04 0.43 | 28.87 8.79 | 8.53 0.20 | 9.05 |
| 192 | 17.43 1.09 | 10.89 0.12 | 12.80 0.83 | 10.71 0.10 | 1,691 2,008 | 11.22 0.19 | 185.3 305.8 | 12.06 0.46 | 32.24 6.16 | 10.65 0.25 | 10.63 | |
| 336 | 19.16 0.73 | 11.76 0.17 | 13.89 1.76 | 11.44 0.19 | 380.7 239.9 | 12.32 0.37 | 194.7 123.2 | 12.12 0.22 | 29.58 7.54 | 11.47 0.10 | 11.14 | |
| 720 | 19.89 0.54 | 13.34 0.57 | 17.53 2.17 | 12.36 0.35 | 588.6 274.4 | 12.52 0.49 | 118.6 83.34 | 13.18 0.89 | 28.66 4.30 | 12.62 0.35 | 11.55 | |
| PM2.5-LA | 96 | 3.93 0.06 | 3.87 0.07 | 4.02 0.12 | 3.85 0.06 | 5.21 0.46 | 4.24 0.12 | 4.89 0.24 | 5.07 0.20 | 4.33 0.18 | 4.12 0.10 | 4.10 |
| 192 | 4.25 0.04 | 4.26 0.03 | 4.26 0.15 | 4.14 0.06 | 5.45 0.10 | 4.39 0.12 | 5.13 0.48 | 5.37 0.31 | 4.40 0.07 | 4.26 0.07 | 4.41 |
| Model | Weather | PM2.5-LA | PM2.5-RV | Bike Share | Appliances | #Global better | Median (all) |
| iTransformer | 11/20 | ||||||
| TimesNet | 13/20 | ||||||
| FEDformer | 17/20 | ||||||
| Autoformer | 14/20 | ||||||
| Informer | 14/20 | ||||||
| CATF -iTransformer | 9/20 |
| iTransformer | TimesNet | FEDformer | Autoformer | Informer | |||||||
| Dataset | Base | CATF | Base | CATF | Base | CATF | Base | CATF | Base | CATF | |
| Weather | 96 | 204.7 G | 178.3 S | 245.6 G | 158.5 S | 28,741 G | 181.7 S | 39,860 G | 210.1 S | 1,733 G | 155.7 S |
| 192 | 249.3 G | 226.7 G | 271.1 G | 226.1 S | 28,712 G | 236.8 S | 151,937 S | 285.4 S | 6,645 G | 220.8 S | |
| 336 | 254.6 G | 232.3 G | 264.8 G | 241.8 S | 50,859 G | 267.3 S | 70,468 G | 270.1 S | 3,729 S | 240.1 S | |
| 720 | 270.1 G | 235.9 G | 269.1 G | 241.7 G | 41,001 G | 268.3 S | 29,367 S | 259.7 G | 3,637 S | 290.7 S | |
| PM2.5-LA | 96 | 36.08 S | 35.20 S | 37.32 G | 35.43 S | 57.75 G | 42.11 S | 57.60 S | 58.89 S | 41.30 S | 37.90 S |
| Model | Time (s/ep.) | Mem. (GB) | Time (s/ep.) | Mem. (GB) | Time (s/ep.) | Mem. (GB) | Time (s/ep.) | Mem. (GB) | Epochs | |
| iTransformer | 17 | 0.04 | 19 | 0.04 | 33 | 0.09 | 23 | 0.05 | 7.1 | |
| CATF -iTransformer | 283 | 0.46 | 239 | 0.46 | 398 | 0.48 | 250 | 0.48 | 26.7 | |
| TimesNet | 76 | 0.13 | 95 | 0.15 | 728 | 0.20 | 205 | 0.29 | 7.0 | |
| CATF -TimesNet | 725 | 0.57 | 559 | 0.65 | 2,227 | 0.79 | 922 | 1.00 | 26.1 | |
| FEDformer | 301 | 1.62 | 329 | 1.78 | 1,443 | 2.07 | 499 | 2.68 | 6.7 | |
| Bike Share | PM2.5-RV | |||||||||
| Setting | MSE | MAE | (%) | MSE | MAE | (%) | #Params (M) | |||
| Default (KL + Wass., reg., , ) | 15,097 241 | 78.56 0.67 | – | – | 80.52 1.02 | 6.18 0.03 | – | – | 7.3 | |
| Manager loss | KL only | 15,452 282 | 79.36 0.71 | 0.065 | 81.87 2.75 | 6.15 0.03 | 0.347 | 7.3 | ||
| Wasserstein only | 15,407 372 | 80.48 0.83 | 0.163 | 81.56 1.10 | 6.21 0.04 | 0.157 | 7.3 | |||
| Regularization | No reg. | 15,169 184 | 79.01 0.40 | 0.609 | 80.94 1.19 | 6.14 0.03 | 0.559 | 7.3 | ||
| Manager arch. | Small ( , , 4 heads) | 15,155 298 | 79.32 0.77 | 0.743 | 81.23 0.78 | 6.19 0.04 | 0.252 | 1.1 | ||
| Model / routing | MSE | NMI |
|---|---|---|
| iTransformer (baseline) | 35.98 0.34 | – |
| CATF -iTransformer | 33.39 0.51 | 0.85 0.15 |
| Same trained workers, different routing | ||
| Random routing (same worker shares) | 50.69 4.18 | – |
| Best single worker for all samples | 43.77 1.76 | – |
| Untrained manager | 58.13 6.06 | 0.04 0.04 |
Time Series Forecasting
Time series forecasting predicts future values from ordered observations using statistical, neural, and probabilistic models to support decisions under uncertainty.
See all 894 papers