wikillm

Paper · 2024-05-23 · cs.LG, cs.AI

TimeMixer: Decomposable Multiscale Mixing for Time Series Forecasting

TimeMixer is an MLP-only forecaster. It average-pools the input into several scales, splits each scale into seasonal and trend parts, mixes seasonal parts bottom-up and trend parts top-down, then sums one linear predictor per scale. Author-reported: lowest MSE on all 8 long-term benchmarks (input 96) and best scores on PEMS and M4.

Time series forecastingMulti-layer perceptron (MLP)Multi-scale feature fusiontime-seriesforecastingmultiscalemlpseries-decompositionlong-term-forecastingshort-term-forecasting

arXivPDFCodeMarkdown19 min read

AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Forecasting a time series is hard when the signal mixes several kinds of change at once: a slow drift over months, a repeating daily or weekly rhythm, and short bursts. A series looks different depending on how far you zoom out. Fine detail shows the short rhythms, while a coarse view shows the drift.

TimeMixer uses this idea. It makes a stack of copies of the past input, each one smaller than the last, so the model sees the same history at several zoom levels. For each zoom level it separates the signal into a repeating part and a slow-moving part. The repeating detail from fine levels is blended upward into coarser levels, and the slow trend from coarse levels is blended downward into finer ones. Last, a simple linear predictor at each zoom level makes its own guess at the future, and the guesses are added together.

The network uses only linear layers and GELU activations, with no attention. The authors report that this makes it efficient to run, and that it forecasts more accurately than the models they compare it against.

TL;DR

  • TimeMixer forecasts from the past at several downsampled scales, using only MLP blocks §3.
  • Each scale is split into seasonal and trend parts §3.2 eq. 3. Seasonal parts are mixed bottom-up and trend parts top-down eq. 4 eq. 5.
  • The final forecast is the sum of one predictor per scale §3.3 eq. 6.
  • Author-reported: best MSE and MAE on all eight long-term benchmarks at input length 96 tab. 2, and best error on the PEMS and M4 short-term tables tab. 3 tab. 4.
  • Use it when you want a small MLP forecaster with explicit multiscale structure. Check the code-vs-paper differences before you reimplement it.

Problem

Real series combine many kinds of variation, such as increasing, decreasing and fluctuating patterns, and these are hard to separate §1. Earlier deep forecasters handled this with series decomposition (seasonal plus trend) or multiperiodicity analysis, and used CNN, RNN, Transformer or MLP backbones §1 §2. The authors argue that the signal at different sampling scales should be used directly: fine scales show detailed patterns and coarse scales show macro variation, and the future depends on both §1. Prior multiscale models (Pyraformer, SCINet) do not use past information from all scales together when they predict the future §2.

Method

The paper has three parts: a multiscale input, a past-mixing stack (PDM) and a future-prediction block (FMM) §3.

3.1 Multiscale mixing architecture §3.1. The past series x of length P and C variates is average-pooled M times. Scale m has length floor(P/2^m), and scale 0 is the input itself §3.1. Each scale is embedded into d_model channels §3.1. Stacked PDM blocks (L of them) then mix the past across scales eq. 1.

3.2 Past-Decomposable-Mixing (PDM) §3.2 eq. 3. For block l, each scale is split into a seasonal part and a trend part by a moving-average decomposition (from Autoformer) §3.2. Then:

  1. Seasonal parts are mixed bottom-up: scale m gets a residual term from scale m-1 eq. 4. The mixer is two linear layers over time with a GELU between them, from length P/2^{m-1} to P/2^m §3.2. The width between the two layers is not stated, and the code uses P/2^m (see Pitfalls).
  2. Trend parts are mixed top-down: scale m gets a residual term from scale m+1, computed the same way as step 1 but in the opposite direction eq. 5 §3.2.
  3. The mixed seasonal and trend parts are added, passed through a feed-forward block (two linear layers with GELU, over channels), and added back to the block input as a residual eq. 3 §3.2.

The authors argue that seasonal detail is most useful when it flows from fine to coarse, and trend is most useful when it flows from coarse to fine §3.2. They also test the opposite directions and removing either mixing or decomposition, and report that these variants are worse tab. 5 §4.2.

3.3 Future-Multipredictor-Mixing (FMM) §3.3 eq. 2 eq. 6. After the last PDM block, each scale m has its own predictor. Each predictor is one linear layer over time from floor(P/2^m) to F, and then a projection to C variates §3.3. The final forecast is the sum over scales eq. 6. The authors state that the predictors use different information and so are complementary §3.3 fig. 4.

Overall pipeline, in the paper's notation:

  • Multiscale input: X = {x_0, ..., x_M}, scale m of length floor(P/2^m) §3.1.
  • Past mixing: X^l = PDM(X^{l-1}) for l = 1..L eq. 1.
  • Future: x_hat = FMM(X^L) eq. 2.

Pseudocode for one forward pass. The paper does not describe normalization, so the per-scale normalization step is taken from the code and marked as such:

Pseudocode
# TimeMixer forward pass, channel-independent setting (code default)
# Input: past (B, P, C)     Output: forecast (B, F, C)
# M = down-sampling steps, L = PDM blocks  [§3.1] [app. A, tab. 7]

def timemixer(past):
    # 1. Build M+1 scales by average pooling; each step halves the
    #    length  [§3.1]
    scales = [past]
    for m in 1 to M:
        scales.append(avg_pool(scales[m - 1], window=2))  # (B, P/2^m, C)

    # 2. Per-scale instance normalisation. Code only, not in the paper
    #    [code: models/TimeMixer.py#L213-L218]
    stats = [normalise_stats(s) for s in scales]

    # 3. Channel independence: each variate becomes its own univariate
    #    series  [code: models/TimeMixer.py#L349-L350]
    series = [reshape_per_variate(s) for s in normed]  # (B*C, P/2^m, 1)

    # 4. Embed every scale into d_model channels  [§3.1]
    #    [code: layers/Embed.py#L176-L194]
    hidden = [embed(s) for s in series]  # (B*C, P/2^m, d_model)

    # 5. L PDM blocks mix seasonal and trend parts across scales
    #    [eq. 1] [eq. 3]
    for block in pdm_blocks:
        hidden = pdm_block(hidden)

    # 6. Per-scale linear predictor over time, then a projection to one
    #    channel  [§3.3]
    preds = []
    for m in 0 to M:
        y = predict_layers[m](hidden[m])  # (B*C, d_model, F)
        preds.append(projection(y))       # (B*C, F, 1)

    # 7. Sum the scale predictions  [eq. 6]
    out = sum(preds)

    # 8. Undo normalisation with scale-0 statistics
    #    [code: models/TimeMixer.py#L382]
    return reshape_back(denormalise(out, stats[0]))  # (B, F, C)
Pseudocode
# One Past-Decomposable-Mixing block  [§3.2] [eq. 3]
# Input: list of M+1 scales, each (B*C, T_m, d_model)

def pdm_block(hidden):
    # 1. Split each scale into seasonal and trend parts with a moving
    #    average, kernel 25 by default  [eq. 3]
    #    [code: layers/Autoformer_EncDec.py#L21-L53]
    seasonal = []
    trend = []
    for h in hidden:
        s, t = moving_average_decomp(h)
        seasonal.append(s)
        trend.append(t)

    # 2. Bottom-up seasonal mixing: fine to coarse, residual  [eq. 4]
    #    The code uses the already-updated finer scale
    #    [code: models/TimeMixer.py#L61-L67]
    for m in 1 to M:
        seasonal[m] = seasonal[m] + bottom_up(seasonal[m - 1])

    # 3. Top-down trend mixing: coarse to fine, residual  [eq. 5]
    #    The code uses the already-updated coarser scale
    #    [code: models/TimeMixer.py#L105-L111]
    for m in M - 1 down to 0:
        trend[m] = trend[m] + top_down(trend[m + 1])

    # 4. Recombine each scale, add the feed-forward block (d_model to
    #    d_ff and back), keep the residual  [eq. 3]
    out = []
    for m in 0 to M:
        mixed = seasonal[m] + trend[m]
        out.append(hidden[m] + feed_forward(mixed))  # (B*C, T_m, d_model)
    return out

Key equations, as printed in the paper:

\mathcal{X}^{l} = \operatorname{PDM}(\mathcal{X}^{l-1}) \qquad [\text{eq. 1}]

\widehat{\mathbf{x}} = \operatorname{FMM}(\mathcal{X}^{L}) \qquad [\text{eq. 2}]

\mathcal{X}^{l} = \mathcal{X}^{l-1} + \operatorname{FeedForward}\!\big(\operatorname{S\text{-}Mix}(\{\mathbf{s}_m^l\}) + \operatorname{T\text{-}Mix}(\{\mathbf{t}_m^l\})\big) \qquad [\text{eq. 3}]

\mathbf{s}_m^l \leftarrow \mathbf{s}_m^l + \operatorname{Bottom\text{-}Up\text{-}Mixing}(\mathbf{s}_{m-1}^l), \quad m = 1..M \qquad [\text{eq. 4}]

\mathbf{t}_m^l \leftarrow \mathbf{t}_m^l + \operatorname{Top\text{-}Down\text{-}Mixing}(\mathbf{t}_{m+1}^l), \quad m = M-1..0 \qquad [\text{eq. 5}]

\widehat{\mathbf{x}} = \sum_{m=0}^{M} \widehat{\mathbf{x}}_m, \qquad \widehat{\mathbf{x}}_m = \operatorname{Predictor}_m(\mathbf{x}_m^L) \qquad [\text{eq. 6}]

Hyperparameters

Paper configuration, from the appendix table app. A, tab. 7. "M" is the number of down-sampling steps, which the code calls down_sampling_layers. "Layers" is the number of PDM blocks, which the code calls e_layers. LR is the initial learning rate, which the code passes as max_lr to OneCycleLR. The scripts in the repository do not always match this table (see Paper vs code).

DatasetMLayersd_modelLRLossBatch sizeEpochsSource
ETTh132161e-2MSE12810app. A, tab. 7
ETTh232161e-2MSE12810app. A, tab. 7
ETTm132161e-2MSE12810app. A, tab. 7
ETTm232321e-2MSE12810app. A, tab. 7
Weather32161e-2MSE12820app. A, tab. 7
Electricity32161e-2MSE3220app. A, tab. 7
Solar-Energy321281e-2MSE3220app. A, tab. 7
Traffic32321e-2MSE820app. A, tab. 7
PEMS151281e-3MSE3210app. A, tab. 7
M414321e-2SMAPE12850app. A, tab. 7

Settings the paper does not state. Values are the code defaults, or what the run scripts pass. Each is cited to the code.

NameValueWhereNotes
Input length P96§4 tab. 2All main-table runs. Hyperparameter search covers 96, 192, 336, 512 app. E
Prediction length F (long-term)96, 192, 336, 720tab. 2Results averaged over the four lengths
Prediction length F (PEMS)12tab. 3
Prediction length F (M4)6 to 48tab. 4Per frequency
Feed-forward width d_ff32 (ETT), 64 (Traffic), 256 (PEMS), 2048 (Solar)TimeMixer_ETTh1_unify.sh TimeMixer_unify.sh TimeMixer.shNot in the paper. Set per script; run.py default is 32 run.py
Down-sampling window2TimeMixer_ETTh1_unify.shNot stated in the paper. Average pooling: §3.1
Down-sampling methodavgrun.pyMatches the paper
Moving-average kernel (decomposition)25run.pyNot stated in the paper
Dropout0.1run.pyNot stated in the paper
OptimizerAdam, default betasexp_long_term_forecasting.py app. A, tab. 7Paper states Adam with (0.9, 0.999)
LR scheduleOneCycleLR, pct_start 0.2exp_long_term_forecasting.py run.pyNot stated in the paper
Early-stopping patience15 (run.py default); 10 (ETTh1 script), 3 (Solar script), 20 (M4 script)run.pyNot stated in the paper
Loss (long-term, PEMS)MSEexp_long_term_forecasting.pyPaper: "L2 loss" §4
Loss (M4)SMAPETimeMixer.shPaper: SMAPE app. A, tab. 7
Normalisationper-scale instance norm with learnable affine, on by defaultrun.py StandardNorm.pyNot in the paper. The Solar script sets use_norm 0
Channel independence1 (default)run.pySolar script sets 0
Embeddingvalue conv (kernel 3, circular, no bias) plus time featuresEmbed.py Embed.pyPaper: "embedding layer" §3.1, not specified
Batch size (default)16run.pyScripts override it
Epochs (default)100run.pyThe Traffic script sets no epochs flag, so this default applies
MetricsMAE, MSE, RMSE, MAPE for PEMS; SMAPE, MASE, OWA for M4app. A, metric detailsSee Paper vs code

Benchmark data sizes and forecastability, from app. A, tab. 6. "Series Length" in that table is the prediction horizon for M4, not the input length.

DatasetDimSeries length(Train, Val, Test)FrequencyForecastability
ETTm17{96, 192, 336, 720}(34465, 11521, 11521)15 min0.46
ETTm27{96, 192, 336, 720}(34465, 11521, 11521)15 min0.55
ETTh17{96, 192, 336, 720}(8545, 2881, 2881)15 min0.38
ETTh27{96, 192, 336, 720}(8545, 2881, 2881)15 min0.45
Electricity321{96, 192, 336, 720}(18317, 2633, 5261)Hourly0.77
Traffic862{96, 192, 336, 720}(12185, 1757, 3509)Hourly0.68
Weather21{96, 192, 336, 720}(36792, 5271, 10540)10 min0.75
Solar-Energy137{96, 192, 336, 720}(36601, 5161, 10417)10 min0.33
PEMS0335812(15617, 5135, 5135)5 min0.65
PEMS0430712(10172, 3375, 3375)5 min0.45
PEMS0788312(16911, 5622, 5622)5 min0.58
PEMS0817012(10690, 3548, 265)5 min0.52
M4-Yearly16(23000, 0, 23000)Yearly0.43
M4-Quarterly18(24000, 0, 24000)Quarterly0.47
M4-Monthly118(48000, 0, 48000)Monthly0.44
M4-Weekly113(359, 0, 359)Weekly0.43
M4-Daily114(4227, 0, 4227)Daily0.44
M4-Hourly148(414, 0, 414)Hourly0.46

Results

Author-reported. Setup: input length 96 for every model, results averaged over the 4 prediction lengths, averaged over 3 runs, one NVIDIA A100 80GB §4 tab. 2 app. A. Baselines are re-run with a unified setting, not copied from their papers §4. The hyperparameter-searched upper bounds are in app. E and are not reproduced here.

Long-term forecasting (MSE / MAE, averaged over four horizons) tab. 2.

ModelWeatherSolar-EnergyElectricityTrafficETTh1ETTh2ETTm1ETTm2
TimeMixer0.240 / 0.2710.216 / 0.2800.182 / 0.2720.484 / 0.2970.447 / 0.4400.364 / 0.3950.381 / 0.3950.275 / 0.323
PatchTST0.265 / 0.2850.287 / 0.3330.216 / 0.3180.529 / 0.3410.516 / 0.4840.391 / 0.4110.406 / 0.4070.290 / 0.334
TimesNet0.251 / 0.2940.403 / 0.3740.193 / 0.3040.620 / 0.3360.495 / 0.4500.414 / 0.4270.400 / 0.4060.291 / 0.333
Crossformer0.264 / 0.3200.406 / 0.4420.244 / 0.3340.667 / 0.4260.529 / 0.5220.942 / 0.6840.513 / 0.4950.757 / 0.610
MICN0.268 / 0.3210.283 / 0.3580.196 / 0.3090.593 / 0.3560.475 / 0.4800.574 / 0.5310.423 / 0.4220.353 / 0.402
FiLM0.271 / 0.2910.380 / 0.3710.223 / 0.3020.637 / 0.3840.516 / 0.4830.402 / 0.4200.411 / 0.4020.287 / 0.329
DLinear0.265 / 0.3150.330 / 0.4010.225 / 0.3190.625 / 0.3830.461 / 0.4570.563 / 0.5190.404 / 0.4080.354 / 0.402
FEDformer0.309 / 0.3600.328 / 0.3830.214 / 0.3270.610 / 0.3760.498 / 0.4840.437 / 0.4490.448 / 0.4520.305 / 0.349
Stationary0.288 / 0.3140.350 / 0.3900.193 / 0.2960.624 / 0.3400.570 / 0.5370.526 / 0.5160.481 / 0.4560.306 / 0.347
Autoformer0.338 / 0.3820.586 / 0.5570.227 / 0.3380.628 / 0.3790.496 / 0.4870.450 / 0.4590.588 / 0.5170.327 / 0.371
Informer0.634 / 0.5480.331 / 0.3810.311 / 0.3970.764 / 0.4161.040 / 0.7954.431 / 1.7290.961 / 0.7341.410 / 0.810

Headline numbers from the text §4.1: the Weather MSE is 9.4% lower than PatchTST's, and the Solar-Energy MSE is 24.7% lower. The authors also note good performance on low-forecastability datasets such as Solar-Energy and ETT §4.1.

Short-term forecasting, PEMS (input 96, horizon 12) tab. 3. Bold is TimeMixer's row.

DatasetMetricTimeMixerSCINetCrossformerPatchTSTTimesNetMICNFiLMDLinearFEDformerStationaryAutoformerInformer
PEMS03MAE14.6315.9715.6418.9516.4115.7121.3619.7019.0017.6418.0819.19
PEMS03MAPE14.5415.8915.7417.2915.1715.6718.3518.3518.5717.5618.7519.58
PEMS03RMSE23.2825.2025.5630.1526.7224.5535.0732.3530.0528.3727.8232.70
PEMS04MAE19.2120.3520.3824.8621.6321.6226.7424.6226.5122.3425.0022.05
PEMS04MAPE12.5312.8412.8416.6513.1513.5316.4616.1216.7614.8516.7014.88
PEMS04RMSE30.9232.3132.4140.4634.9034.3942.8639.5141.8135.4738.0236.20
PEMS07MAE20.5722.7922.5427.8725.1222.2828.7628.6527.9226.0226.9227.26
PEMS07MAPE8.629.419.3812.6910.609.5711.2112.1512.2911.7511.8311.63
PEMS07RMSE33.5935.6135.4942.5640.7135.4045.8545.0242.2942.3440.6045.81
PEMS08MAE15.2217.3817.5620.3519.0117.7622.1120.2620.5619.2920.4720.96
PEMS08MAPE9.6710.8010.9213.1511.8310.7612.8112.0912.4112.2112.2713.20
PEMS08RMSE24.2627.3427.2131.0430.6527.2635.1332.3832.9738.6231.5230.61

Short-term forecasting, M4 (univariate, single variate per series) tab. 4. Bold is TimeMixer's column. The table's header abbreviations are kept: FED. is FEDformer, Auto. is Autoformer, Pyra. is Pyraformer, In. is Informer. N-BEATS was run without its ensemble tab. 4 caption.

GroupMetricTimeMixerTimesNetN-HiTSN-BEATSSCINetPatchTSTMICNFiLMLightTSDLinearFED.StationaryAuto.Pyra.In.
YearlySMAPE13.20613.38713.41813.43618.60516.46325.02217.43114.24716.96513.72813.71713.97415.53014.727
YearlyMASE2.9162.9963.0453.0434.4713.9677.1624.0433.1094.2833.0483.0783.1343.7113.418
YearlyOWA0.7760.7860.7930.7941.1321.0031.6671.0420.8271.0580.8030.8070.8220.9420.881
QuarterlySMAPE9.99610.10010.20210.12414.87110.64415.21412.92511.36412.14510.79210.95811.33815.44911.360
QuarterlyMASE1.1661.1821.1941.1692.0541.2781.9631.6641.3281.5201.2831.3251.3652.3501.401
QuarterlyOWA0.8250.8900.8990.8861.4240.9491.4071.1931.0001.1060.9580.9811.0121.5581.027
MonthlySMAPE12.60512.67012.79112.67714.92513.39916.94315.40714.01413.51414.26013.91713.95817.64214.062
MonthlyMASE0.9190.9330.9690.9371.1311.0311.4421.2981.0531.0371.1021.0971.1031.9131.141
MonthlyOWA0.8690.8780.8990.8801.0270.9491.2651.1440.9810.9561.0120.9981.0021.5111.024
OthersSMAPE4.5644.8915.0614.92516.6556.55841.9857.13415.8806.7094.9546.3025.48524.78624.460
OthersMASE3.1153.3023.2163.39115.0344.51162.7345.0911.4344.9533.2644.0643.86518.58120.960
OthersOWA0.9821.0351.0401.0534.1231.40114.3131.5533.4741.4871.0361.3041.1875.5385.879
Weighted averageSMAPE11.72311.82911.92711.85115.54213.15219.63814.86313.52513.63912.84012.78012.90916.98714.086
Weighted averageMASE1.5591.5851.6131.5592.8161.9455.9472.2072.1112.0951.7011.7561.7713.2652.718
Weighted averageOWA0.8400.8510.8610.8551.3090.9982.2791.1251.0511.0510.9180.9300.9391.4801.230

Ablations tab. 5. Run on M4, PEMS04 and the ETTm1 predict-336 setting. The official design is case 172. ↗ is bottom-up mixing and ↙ is top-down. A check mark means the component is present and × means absent.

CaseDecomposeSeasonal mixingTrend mixingMultipredictorM4 SMAPEM4 MASEM4 OWAPEMS04 MAEPEMS04 MAPEPEMS04 RMSEETTm1 MSEETTm1 MAE
172 (official)✓↗↙✓11.7231.5590.84019.2112.5330.920.3900.404
173✓↗↙×12.5031.6340.92521.6713.4534.890.4020.415
174✓×↙✓13.0511.6760.96224.4916.2838.790.4110.427
175✓↗×✓12.9111.6550.94122.9115.0237.040.4050.414
176✓↙↙✓12.0081.6280.87120.7813.0232.470.3920.413
177✓↗↗✓11.9781.6260.85921.0913.7833.110.3960.415
178✓↙↗✓13.0121.6570.95422.2715.1434.670.4120.429
179×↗ (both parts)✓11.9751.6170.85121.5113.4734.810.3950.408
180×↙ (both parts)✓11.9731.6220.85021.7914.0335.230.3930.406
181×× (no past mixing)✓12.4681.6710.91624.8716.6639.480.4050.412

Other §4.2 claims, reported in text and figures only: the seasonal mixing weights are periodic and the trend mixing weights are local fig. 3. The predictions from fine scales track detail and those from coarse scales track trend fig. 4. The number of scales M is set to 3 for long-term and 1 for short-term forecasting, to trade off accuracy and cost §4.2 app. D.

Efficiency, training memory and time app. B, tab. 8. Batch size is not given in the table; fig. 5 says batch size 16 on ETTh1, averaged over 100 iterations.

ModelMem 192 (MiB)s/iter 192Mem 384s/iter 384Mem 768s/iter 768Mem 1536s/iter 1536Mem 3072s/iter 3072
TimeMixer10030.00710430.00710750.00811510.00914110.016
PatchTST19190.01820970.01927490.02154650.032161190.094
TimesNet11480.02812450.02415850.04224910.04523530.073
Crossformer17370.02717990.02718950.02823030.03337590.035
MICN17710.01418010.01618730.01719910.01822390.020
DLinear10010.00210210.00310410.00310810.0.00412390.015
FEDformer25670.13259770.14171110.14391730.178124850.288
Autoformer17610.02821010.07032090.07153950.129100430.255

The authors attribute the speed gap to the fully MLP design app. B.

Paper vs code

Official code: https://github.com/kwuking/TimeMixer, Apache-2.0, cloned at commit e24610583b36fdd8c76cc17a8df4e65759a5f460. The paper links it §7. The code is the reference for every item below; the paper is silent on most of them.

  • Normalisation is missing from the paper. The paper never mentions it. The code wraps every scale in an instance normalisation with learnable affine parameters, and undoes it on the output with scale-0 statistics TimeMixer.py TimeMixer.py TimeMixer.py StandardNorm.py. Turned off by use_norm 0, which the Solar script sets TimeMixer_unify.sh.
  • Residual and feed-forward differ for channel-mixing. Eq. 3 adds a residual and a feed-forward block to every PDM block eq. 3. The code adds that residual only when channel_independence is 1 TimeMixer.py. For channel-mixing it applies a feed-forward (cross_layer) to the seasonal and trend parts before decomposition, and returns their sum with no residual TimeMixer.py TimeMixer.py.
  • Extra prediction path for channel-mixing. The paper's FMM is only a sum of per-scale predictors eq. 6. For channel-mixing the code adds a second regression path with its own per-scale linear layers, applied to the moving-average component of the input TimeMixer.py TimeMixer.py TimeMixer.py.
  • Projection layer shared across scales. The paper describes one predictor per scale that also projects to C variates §3.3. The code uses one projection module for all scales; only the time-axis linear layer is per scale TimeMixer.py.
  • Unused layer norm. PastDecomposableMixing defines a LayerNorm, but forward never calls it TimeMixer.py.
  • Mixer intermediate width is not stated. The paper gives the input and output lengths of each mixer, but not the width between its two linear layers. The code uses the output length P/2^m there, in both mixers TimeMixer.py TimeMixer.py.
  • Hyperparameters in the scripts differ from Table 7. Checked against app. A, tab. 7:
    • Solar: script d_model 512, d_ff 2048, LR 1e-3, 3 layers, 10 epochs, M=2, channel_independence 0 TimeMixer_unify.sh TimeMixer_unify.sh. Table: d_model 128, LR 1e-2, 2 layers, 20 epochs, M=3.
    • Weather and Electricity: script 3 layers TimeMixer_unify.sh TimeMixer_unify.sh. Table: 2 layers.
    • Traffic: script 3 layers and no epochs flag TimeMixer_unify.sh. Table: 2 layers, 20 epochs.
    • PEMS: script LR 3e-3 TimeMixer.sh. Table: 1e-3.
    • ETTh1, M4, PEMS (layers, d_model, batch) and Weather/ECL/Traffic batch sizes match the table.
    • The text says "By default, TimeMixer contains 2 PDM blocks" app. A. Table 7 and the scripts use 4 to 5 for M4 and PEMS.
  • Metric formulas. The appendix writes MAE and RMSE as sums over the horizon app. A, metric details. The code uses means: MAE and MSE are np.mean, and RMSE is the square root of MSE metrics.py.
  • Stated M is down-sampling steps. Table 7 "M" equals the code's down_sampling_layers run.py. The number of scales is M+1.

Pitfalls

  • Normalisation is the first thing to add. Without the per-scale instance normalisation the model will not match reported numbers, and the paper gives no hint of it. Decide which statistics to use for the output (scale 0, as in the code).
  • Channel independence changes the architecture. With the default channel_independence 1, each variate is an independent univariate series and the model is shared across variates TimeMixer.py. The paper's Eq. 3 with its residual and feed-forward matches this default TimeMixer.py. For channel-mixing (channel_independence 0, used by the Solar script) the code's block differs from Eq. 3 (see Paper vs code).
  • Mixer intermediate width is underspecified. The paper gives the mixer's input and output lengths only. The code's intermediate width is the output length P/2^m, and the second linear layer maps it to itself TimeMixer.py TimeMixer.py.
  • Mixing order matters and is sequential. Bottom-up mixing uses the already updated finer scale, and top-down mixing uses the already updated coarser scale TimeMixer.py TimeMixer.py. A parallel implementation will differ.
  • Ablation text and table disagree on cases 176 to 178. The appendix says cases 176 to 178 reverse the directions app. F. Table 5 shows 176 uses top-down on both parts and 177 bottom-up on both. Only 178 swaps the two directions. Implement the official design (172) and use the table as the reference.
  • Forecastability values disagree. Table 1 gives ETT 0.46 and Solar 0.33 tab. 1. The appendix gives ETTh1 0.38, ETTh2 0.45, ETTm1 0.46, ETTm2 0.55 app. A, tab. 6. The PEMS08 test size of 265 looks like a typo next to validation 3548 app. A, tab. 6. The M4 "Series Length" column is the horizon.
  • Hyperparameter search changes the picture. Under per-model search the gap to PatchTST shrinks, which the authors state app. E. Use the unified numbers for comparisons, and do not compare them with searched numbers from other papers.
  • Appendix efficiency table has a typo. One DLinear entry reads "0.0.004" app. B, tab. 8. Read it as 0.004 only if you can check it another way.
  • Error bars and full searched tables are not in this card. The standard deviations and significance tests app. C and the full searched long-term results app. E are in the paper. The full ablation grids app. F are in the paper's LaTeX and not reproduced here.
  • Costs the abstract hides. Efficiency depends on series length. At length 3072, TimeMixer takes 0.016 s per iteration and 1411 MiB, against 0.094 s and 16119 MiB for PatchTST app. B, tab. 8. The batch size of that table is not stated. The mixing layers are linear in input length, and the authors name the resulting parameter growth as a limitation for mobile use app. J.
  • Only the temporal dimension is mixed. The authors name variate mixing as future work app. J.
  • Scale choice is a dataset decision. M=3 suits long series and M=1 suits short ones §4.2 app. A. Test M on your own data.

Lineage

  • Builds on: series decomposition from Autoformer, used for the seasonal and trend split §3.2.
  • Related decomposition model: DLinear, which uses decomposition before linear regression §2.
  • Related multiscale designs: Pyraformer (pyramidal attention) and SCINet (bifurcate downsampling tree), which the authors say do not use past information at all scales together for the future prediction §2.
  • Mixing ideas: MLP-Mixer (channel and patch mixing) and FNet (Fourier token mixing) §2.
  • Compared against: PatchTST, TimesNet, SCINet, Crossformer, MICN, FiLM, DLinear, LightTS, FEDformer, Stationary, Pyraformer, Autoformer, Informer, N-HiTS, N-BEATS §4 tab. 2 tab. 3 tab. 4. Two concurrent MLP models (MTSMixer and TSMixer) and Scaleformer are in app. G, not in the main tables app. G.
  • Superseded by: not stated in this paper.

Source and license

Adapted from “TimeMixer: Decomposable Multiscale Mixing for Time Series Forecasting” by Shiyu Wang, Haixu Wu, Xiaoming Shi, Tengge Hu, Huakun Luo, Lintao Ma, James Y. Zhang, Jun Zhou (arXiv:2405.14616), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/kwuking/TimeMixer at commit e24610583b36 (Apache-2.0). Any quoted code is shown under that license.