wikillm

Paper · 2023-03-10 · cs.LG, cs.AI

TSMixer: An All-MLP Architecture for Time Series Forecasting

TSMixer is an all-MLP forecaster. It alternates a time-mixing layer, shared across variates, with a feature-mixing MLP, shared across time, using residuals and normalization, then projects input length to horizon. Author-reported: comparable to PatchTST on seven long-term benchmarks; lowest M5 test WRMSSE in each setting (0.737 without, 0.640 with auxiliary features).

Time series forecastingMulti-layer perceptron (MLP)time-seriesforecastingmlpmixermultivariatenormalizationretail-demand

arXivPDFCodeMarkdown21 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 means predicting the next stretch of a series of numbers that change over time, such as sales, electricity load or traffic. Many recent forecasters use attention or recurrent networks, which are large and slow. The paper first asks whether a plain linear model, which predicts each future step as a weighted sum of past steps, is enough. For series that repeat or change smoothly, the paper argues it can be enough, and proves this for a simple case.

TSMixer keeps that idea and wraps it in small fully connected layers. Its blocks alternate between two kinds of mixing: one combines values across time within each series, and one combines the different series (variables) at each time step. Both use skip connections, so a block that is not needed can be bypassed. The result is a model with few parameters and a simple layout.

The authors report that this simple design matches strong models on common benchmarks, where many multivariate models lose to univariate ones. It also does best on a large retail dataset, where the other series carry useful information. The numbers are the authors' own, and the card lists the places where the paper and the released code disagree.

TL;DR

TSMixer is an MLP-only forecaster that alternates a time-mixing layer (shared across variates) with a two-layer feature-mixing MLP (shared across time steps), adds residuals and normalization, and then maps input length to forecast length with one linear layer. Author-reported: comparable to PatchTST on seven long-term benchmarks and the lowest test WRMSSE on M5. The release covers only the basic multivariate model; the M5 extension is not published, and the shipped run script fails as written. Read the Pitfalls before reusing.

Problem

Multivariate forecasters built on Transformers were reported to be worse than a simple univariate linear model on common long-term benchmarks §1. The paper attributes this mainly to dataset bias rather than to cross-variate information being useless, and says the conclusion may not carry over to real-world data §2.

Linear models fit well when a series is periodic plus a smooth trend. A linear map over a lookback window of length L ≥ P+1 can reproduce a period-P signal exactly, and its error on a smooth trend is bounded §3, Theorem 3.1 eq. 2 eq. 3. A univariate linear model ignores other variables, so it cannot use cross-variate or auxiliary information §1. A fully connected layer over all L×C inputs would grow as O(LC) in parameters, while TSMixer's interleaved design grows as O(L+C) §4.

The linear analysis covers only univariate series with periodic or smooth structure. The paper states that volatile, non-periodic series are out of its scope §3, Limitations of the analysis.

Method

TSMixer takes the history X of shape L × C (L time steps, C variates) and returns a forecast of shape T × C_y. It uses only the historical values of the target series in the basic model app. B.3. Each block applies time mixing, then feature mixing; time mixing works on columns and feature mixing on rows §4.1 fig. 1.

The components §4.1 app. B.3:

  1. Time-mixing MLP: a single linear layer over the time axis, applied to each variate with the same weights, followed by ReLU and dropout. It maps L to L.
  2. Feature-mixing MLP: a two-layer MLP over the variates, applied to each time step with the same weights, with ReLU and dropout after the hidden layer and dropout after the output layer.
  3. Residual connections: around the time-mixing step and around the feature-mixing step §4.1.
  4. Normalization: applied over the whole (L, C) matrix of each sample, not per feature as in Transformers §4.1 app. B.3. The paper's own text says pre-normalization is used for long-term forecasting app. B.3. See Paper vs code for the normalization variant that the release uses.
  5. Temporal projection: one linear layer over time that maps input length L to horizon T, shared across variates, as in the linear baseline §4.1 app. B.3.
Pseudocode
# TSMixer forward pass for long-term forecasting  [§4.1] [app. B.1]
# Input:  history (batch, L, C), with L = 512 on the benchmarks  [§5.1]
# Output: forecast (batch, T, C)

def tsmixer_forward(history, blocks, time_head):
    # Per-instance mean and std over time, per variate  [app. B.1]
    # The release detaches these statistics from the gradient
    # [code: tsmixer/tsmixer_basic/models/rev_in.py#L175-L182]
    mean = history.mean(axis=1, keepdims=True)  # (batch, 1, C)
    stdev = sqrt(variance(history, axis=1, keepdims=True) + eps)
    x = (history - mean) / stdev  # (batch, L, C)
    # Alternate time mixing and feature mixing, one pair per block  [§4.1]
    for block in blocks:
        x = time_mixing(x, block)
        x = feature_mixing(x, block)
    # Map input length L to horizon T, shared over variates [§4.1] [app. B.3]
    x = time_head(x)  # (batch, T, C)
    # Undo the normalization on the forecast  [app. B.1]
    return x * stdev + mean  # (batch, T, C)


def time_mixing(x, block):
    # Normalize the whole (L, C) matrix per sample  [app. B.3]
    normed = normalize_matrix(x)  # (batch, L, C)
    # One linear layer over time, shared by all variates: L -> L  [§4.1]
    mixed = relu(time_dense(normed))  # (batch, L, C)
    # Dropout, then a residual add to the block input  [app. B.3]
    return x + dropout(mixed)  # (batch, L, C)


def feature_mixing(x, block):
    # Normalize the whole (L, C) matrix per sample  [app. B.3]
    normed = normalize_matrix(x)  # (batch, L, C)
    # Two-layer MLP over variates, shared by all time steps  [§4.1] [app. B.3]
    hidden = relu(feature_up(normed))  # (batch, L, H)
    hidden = dropout(hidden)
    out = dropout(feature_down(hidden))  # (batch, L, C)
    # Residual around the feature MLP
    # [code: tsmixer/tsmixer_basic/models/tsmixer.py#L47]
    return x + out  # (batch, L, C)

The affine step of reversible instance normalization (a learned weight initialised to 1 and bias to 0 per variate, applied after the standardization and undone before the de-normalization) is in the release, but the paper's text does not state it app. B.1 rev_in.py. Include it only if you follow the release; the pseudocode leaves it out.

Key equations from §3, the linear baseline that TSMixer extends:

\hat{\boldsymbol{Y}} = \boldsymbol{A}\boldsymbol{X} \oplus \boldsymbol{b} \in \mathbb{R}^{T \times C_x} \quad \text{with } \boldsymbol{A} \in \mathbb{R}^{T \times L},\ \boldsymbol{b} \in \mathbb{R}^{T \times 1} eq. 1

For an exactly periodic series with period P < L, one solution has A_ij = 1 when j = L − P + (i mod P), zero otherwise, and b = 0 eq. 2. For an affine-transformed periodic series, x(t) = a·x(t−P) + c, the same pattern with A_ij = a and b_i = c works eq. 3. Indices are not stated as 0- or 1-based; the proof in app. A uses 1-based indices, so use those.

Theorem 3.1 (§3) says: if x(t) = g(t) + f(t), with g periodic of period P and f Lipschitz-smooth with constant K, then a linear model with L ≥ P+1 satisfies |y_i − ŷ_i| ≤ K(i + min(i, P)) for every horizon step i. This is a statement about linear models, not about TSMixer.

Auxiliary-information extension (TSMixer-Ext) §4.2 app. B.3: static features S (one row, C_s values) and known-future features Z (T rows, C_z values) are aligned to the hidden width H and concatenated with the history before mixing. Static features are repeated over time, and conditional feature-mixing layers take them as an extra input. The output head produces either real values or the parameters of a negative binomial distribution, as in DeepAR §4.2. The code for this variant is not released (see Paper vs code).

Design notes §4.3 app. B.3: the paper notes that its normalization is over time and features jointly, whereas MLP-Mixer's is over features and patches, and that TSMixer's feature-mixing hidden size H is a hyperparameter.

Hyperparameters

Author-reported unless marked as code. Values from the paper's appendix tables are the "best configuration" for each setting.

NameValueWhereNotes
input length L512 (long-term benchmarks); 35 (M5)§5.1Lookback sweep 96, 336, 512, 720 §5.1 app. D
horizon T96, 192, 336, 720 (long-term); 28 (M5)§5.1M5 horizon matches the competition
optimizerAdam§5.1Betas and epsilon not stated; the release uses the library defaults run.py
learning ratesearched {1e-3, 1e-4}; best per dataset in the table below; M5 1e-3app. ENo schedule stated
loss, long-termMSE§5.1 run.py
loss, M5negative binomial log-likelihood§5.1 app. B.3Parameters per time step; the M5 code is not released
blockssearched {1, 2, 4, 6, 8} (long-term); {1, 2, 3, 4} (M5)app. EBest per dataset in the table below
dropoutsearched {0.1, 0.3, 0.5, 0.7, 0.9} (long-term); {0, 0.05, 0.1, 0.3} (M5)app. EPassed as the Keras rate, so the fraction dropped; see Pitfalls tsmixer.py
hidden size Hsearched {8, 16, 32, 64} (ETT, Weather); {64, 128, 256, 512} (Electricity, Traffic, M5)app. EBest-config values for ETT and ETTm2 lie outside the listed space; see Pitfalls
activationReLUapp. ERelease also offers GELU run.py
normalizationper-series standardization on the training split; RevIN [TK22] for long-term; mean-scaling of sales for M5app. B.1 app. C.1
model-level normalizationBatchNorm (long-term); LayerNorm (M5)app. B.1Release default is BatchNorm run.py
batch sizenot stated—Release default is 32 run.py and the tuned script does not override it
epochs and early stopping, long-termmax 100 epochs, stop after 5 epochs without validation improvementapp. C.1Release defaults match run.py [run.py#L159]
epochs and early stopping, M5max 300 epochs, stop after 30 without improvementapp. C.2
M5 model selectiontop 8 settings by validation WRMSSE, each retrained for 4 extra trials (5 total); pick by mean validation WRMSSEapp. C.2
seeds5 seeds for the M5 tables; long-term seeds not statedtab. 4 tab. 5Release default seed is 0 run.py
M5 featuresstatic: state, store, category, department, item, mean sales; time-varying: SNAP flags (CA, TX, WI), event types 1 and 2, normalized price per item and per group, day of week, day of month, day of year; target: sales (history only)app. C.2Built following GluonTS and a Kaggle third-place solution app. C.2

Best long-term TSMixer configuration per dataset and horizon app. E:

DatasetTLearning rateBlocksDropoutHidden size
ETTh1961e-460.9512
ETTh11921e-340.9256
ETTh13361e-340.9256
ETTh17201e-320.964
ETTh2961e-440.98
ETTh21921e-310.98
ETTh23361e-410.916
ETTh27201e-420.964
ETTm1961e-460.916
ETTm11921e-440.932
ETTm13361e-440.964
ETTm17201e-440.916
ETTm2961e-380.9256
ETTm21921e-410.9256
ETTm23361e-480.9512
ETTm27201e-480.1256
Weather961e-440.364
Weather1921e-480.732
Weather3361e-420.78
Weather7201e-480.716
Electricity961e-460.732
Electricity1921e-480.716
Electricity3361e-460.764
Electricity7201e-360.764
Traffic961e-480.7256
Traffic1921e-480.7256
Traffic3361e-460.7512
Traffic7201e-420.9256

M5 best configuration for TSMixer app. E: learning rate 1e-3, 2 blocks, dropout 0, hidden size 64. No separate best configuration is listed for TSMixer-Ext.

Results

Author-reported. Setup: seven datasets, MSE and MAE on the standardized scale, input length 512 for the long-term benchmarks §5.1 app. C.1. The "*" marks baseline numbers the authors took from the PatchTST paper tab. 3. Bold and underline in the source are omitted here.

Datasets tab. 2:

DatasetSeries (M)Variates (C)StepsGranularitySplit (train/val/test)
ETTh1, ETTh21717,4201 hour12 / 4 / 4 months
ETTm1, ETTm217699,68015 minutes12 / 4 / 4 months
Weather12152,69610 minutes7 : 2 : 1 (as stated)
Electricity132126,3041 hour7 : 2 : 1 (as stated)
Traffic186217,5441 hour7 : 2 : 1 (as stated)
M530,49011,9421 day1886 / 28 / 28 days

Long-term forecasting, MSE / MAE tab. 3:

| Dataset | T | TSMixer MSE | MAE | TMix-Only MSE | MAE | LTSF-Linear MSE | MAE | PatchTST* MSE | MAE | FEDformer* MSE | MAE | Autoformer* MSE | MAE | Informer* MSE | MAE | TFT MSE | MAE | |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| | ETTh1 | 96 | 0.361 | 0.392 | 0.359 | 0.391 | 0.368 | 0.392 | 0.370 | 0.400 | 0.376 | 0.415 | 0.435 | 0.446 | 0.941 | 0.769 | 0.674 | 0.634 | | ETTh1 | 192 | 0.404 | 0.418 | 0.402 | 0.415 | 0.404 | 0.415 | 0.413 | 0.429 | 0.423 | 0.446 | 0.456 | 0.457 | 1.007 | 0.786 | 0.858 | 0.704 | | ETTh1 | 336 | 0.420 | 0.431 | 0.420 | 0.434 | 0.436 | 0.439 | 0.422 | 0.440 | 0.444 | 0.462 | 0.486 | 0.487 | 1.038 | 0.784 | 0.900 | 0.731 | | ETTh1 | 720 | 0.463 | 0.472 | 0.453 | 0.467 | 0.481 | 0.495 | 0.447 | 0.468 | 0.469 | 0.492 | 0.515 | 0.517 | 1.144 | 0.857 | 0.745 | 0.666 | | ETTh2 | 96 | 0.274 | 0.341 | 0.275 | 0.342 | 0.297 | 0.363 | 0.274 | 0.337 | 0.332 | 0.374 | 0.332 | 0.368 | 1.549 | 0.952 | 0.409 | 0.505 | | ETTh2 | 192 | 0.339 | 0.385 | 0.339 | 0.386 | 0.398 | 0.429 | 0.341 | 0.382 | 0.407 | 0.446 | 0.426 | 0.434 | 3.792 | 1.542 | 0.953 | 0.651 | | ETTh2 | 336 | 0.361 | 0.406 | 0.366 | 0.413 | 0.500 | 0.491 | 0.329 | 0.384 | 0.400 | 0.447 | 0.477 | 0.479 | 4.215 | 1.642 | 1.006 | 0.709 | | ETTh2 | 720 | 0.445 | 0.470 | 0.437 | 0.465 | 0.795 | 0.633 | 0.379 | 0.422 | 0.412 | 0.469 | 0.453 | 0.490 | 3.656 | 1.619 | 1.187 | 0.816 | | ETTm1 | 96 | 0.285 | 0.339 | 0.284 | 0.338 | 0.303 | 0.346 | 0.293 | 0.346 | 0.326 | 0.390 | 0.510 | 0.492 | 0.626 | 0.560 | 0.752 | 0.626 | | ETTm1 | 192 | 0.327 | 0.365 | 0.324 | 0.362 | 0.335 | 0.365 | 0.333 | 0.370 | 0.365 | 0.415 | 0.514 | 0.495 | 0.725 | 0.619 | 0.752 | 0.649 | | ETTm1 | 336 | 0.356 | 0.382 | 0.359 | 0.384 | 0.365 | 0.384 | 0.369 | 0.392 | 0.392 | 0.425 | 0.510 | 0.492 | 1.005 | 0.741 | 0.810 | 0.674 | | ETTm1 | 720 | 0.419 | 0.414 | 0.419 | 0.414 | 0.419 | 0.415 | 0.416 | 0.420 | 0.446 | 0.458 | 0.527 | 0.493 | 1.133 | 0.845 | 0.849 | 0.695 | | ETTm2 | 96 | 0.163 | 0.252 | 0.162 | 0.249 | 0.170 | 0.266 | 0.166 | 0.256 | 0.180 | 0.271 | 0.205 | 0.293 | 0.355 | 0.462 | 0.386 | 0.472 | | ETTm2 | 192 | 0.216 | 0.290 | 0.220 | 0.293 | 0.236 | 0.317 | 0.223 | 0.296 | 0.252 | 0.318 | 0.278 | 0.336 | 0.595 | 0.586 | 0.739 | 0.626 | | ETTm2 | 336 | 0.268 | 0.324 | 0.269 | 0.326 | 0.308 | 0.369 | 0.274 | 0.329 | 0.324 | 0.364 | 0.343 | 0.379 | 1.270 | 0.871 | 0.477 | 0.494 | | ETTm2 | 720 | 0.420 | 0.422 | 0.358 | 0.382 | 0.435 | 0.449 | 0.362 | 0.385 | 0.410 | 0.420 | 0.414 | 0.419 | 3.001 | 1.267 | 0.523 | 0.537 | | Weather | 96 | 0.145 | 0.198 | 0.145 | 0.196 | 0.170 | 0.229 | 0.149 | 0.198 | 0.238 | 0.314 | 0.249 | 0.329 | 0.354 | 0.405 | 0.441 | 0.474 | | Weather | 192 | 0.191 | 0.242 | 0.190 | 0.240 | 0.213 | 0.268 | 0.194 | 0.241 | 0.275 | 0.329 | 0.325 | 0.370 | 0.419 | 0.434 | 0.699 | 0.599 | | Weather | 336 | 0.242 | 0.280 | 0.240 | 0.279 | 0.257 | 0.305 | 0.245 | 0.282 | 0.339 | 0.377 | 0.351 | 0.391 | 0.583 | 0.543 | 0.693 | 0.596 | | Weather | 720 | 0.320 | 0.336 | 0.325 | 0.339 | 0.318 | 0.356 | 0.314 | 0.334 | 0.389 | 0.409 | 0.415 | 0.426 | 0.916 | 0.705 | 1.038 | 0.753 | | Electricity | 96 | 0.131 | 0.229 | 0.132 | 0.225 | 0.135 | 0.232 | 0.129 | 0.222 | 0.186 | 0.302 | 0.196 | 0.313 | 0.304 | 0.393 | 0.295 | 0.376 | | Electricity | 192 | 0.151 | 0.246 | 0.152 | 0.243 | 0.149 | 0.246 | 0.147 | 0.240 | 0.197 | 0.311 | 0.211 | 0.324 | 0.327 | 0.417 | 0.327 | 0.397 | | Electricity | 336 | 0.161 | 0.261 | 0.166 | 0.260 | 0.164 | 0.263 | 0.163 | 0.259 | 0.213 | 0.328 | 0.214 | 0.327 | 0.333 | 0.422 | 0.298 | 0.380 | | Electricity | 720 | 0.197 | 0.293 | 0.200 | 0.291 | 0.199 | 0.297 | 0.197 | 0.290 | 0.233 | 0.344 | 0.236 | 0.342 | 0.351 | 0.427 | 0.338 | 0.412 | | Traffic | 96 | 0.376 | 0.264 | 0.370 | 0.258 | 0.395 | 0.274 | 0.360 | 0.249 | 0.576 | 0.359 | 0.597 | 0.371 | 0.733 | 0.410 | 0.678 | 0.362 | | Traffic | 192 | 0.397 | 0.277 | 0.390 | 0.268 | 0.406 | 0.279 | 0.379 | 0.256 | 0.610 | 0.380 | 0.607 | 0.382 | 0.777 | 0.435 | 0.664 | 0.355 | | Traffic | 336 | 0.413 | 0.290 | 0.404 | 0.276 | 0.416 | 0.286 | 0.392 | 0.264 | 0.608 | 0.375 | 0.623 | 0.387 | 0.776 | 0.434 | 0.679 | 0.354 | | Traffic | 720 | 0.444 | 0.306 | 0.443 | 0.297 | 0.454 | 0.308 | 0.432 | 0.286 | 0.621 | 0.375 | 0.639 | 0.395 | 0.827 | 0.466 | 0.610 | 0.326 |

Average MSE improvement of TSMixer over each baseline, as the paper computes it tab. 3: TFT 51.94%, FEDformer 16.69%, Autoformer 24.51%, Informer 62.40%, TMix-Only −0.66%, LTSF-Linear 6.77%, PatchTST −1.53%.

The paper's reading: TSMixer is comparable to PatchTST and to TMix-Only on these benchmarks; feature mixing does not help here, and cross-variate information matters less on these datasets §5.1. TSMixer uses its longer lookback better than the other multivariate models: best at 336 or 512, flat at 720 §5.1 fig. 5.

M5, WRMSSE (lower is better), author-reported with mean ± std over 5 seeds tab. 4 tab. 5:

ModelMultivariateStaticFutureTest WRMSSEVal WRMSSE
Linearno——0.983 ± 0.0161.045 ± 0.018
PatchTSTno——0.976 ± 0.0140.992 ± 0.011
TMix-Onlyno——0.960 ± 0.0411.000 ± 0.027
Autoformeryes——0.742 ± 0.0290.640 ± 0.023
FEDformeryes——0.804 ± 0.0390.674 ± 0.014
TSMixeryes——0.737 ± 0.0330.605 ± 0.027
DeepARyesyesyes0.789 ± 0.0250.611 ± 0.007
TFTyesyesyes0.670 ± 0.0200.579 ± 0.011
TSMixer-Extyesnono0.737 ± 0.0330.000 ± 0.000
TSMixer-Extyesyesno0.657 ± 0.0460.000 ± 0.000
TSMixer-Extyesnoyes0.697 ± 0.0280.000 ± 0.000
TSMixer-Extyesyesyes0.640 ± 0.0130.568 ± 0.009

The three TSMixer-Ext validation entries of 0.000 are printed as they appear in the paper and are most likely placeholders tab. 5. The Autoformer and TSMixer test gap (0.742 vs 0.737) is smaller than either standard deviation.

Ablation on M5 with and without the auxiliary features: removing static features hurts more than removing future features, and both help §5.2.

Compute on M5, single NVIDIA Tesla V100 tab. 6 §5.2:

ModelMultivariateAuxiliaryParametersTraining time (s)Inference (steps/s)
Linearnono1K2958.18110
PatchTSTnono26.7K886.101120
TMix-Onlynono6.3K4073.72110
Autoformeryesno471K119087.6442
FEDformeryesno1.7M11084.4356
TSMixeryesno189K11077.9596
DeepARyesyes1M8743.55105
TFTyesyes2.9M14426.7922
TSMixer-Extyesyes244K11615.87108

Alternatives to the mixer app. F, MSE / MAE on ETTm2 and Weather. "Full MLP" applies one linear map over the flattened T×C input. "CNN" is a 1-D convolution followed by a linear layer:

DatasetTTSMixer MSEMAEFull MLP MSEMAECNN MSEMAE
ETTm2960.1630.2520.4410.4860.2320.334
ETTm21920.2160.2901.0280.7550.3230.410
ETTm23360.2680.3241.7651.0490.6160.593
ETTm27200.4200.4222.7241.3052.0091.214
Weather960.1450.1980.1900.2790.1490.220
Weather1920.1910.2420.2500.3380.1940.263
Weather3360.2420.2800.2980.3750.2420.306
Weather7200.3200.3360.3600.4220.2930.355

Paper vs code

Repository: google-research/google-research, folder tsmixer/tsmixer_basic, at commit 3ef52111c1fabc301880818f5a547570e926a76b, TensorFlow, Apache-2.0 requirements.txt. The paper's abstract links it, so no further search was needed. The root LICENSE file is Apache-2.0 LICENSE.

Discrepancies:

  • Scope. Only the basic model is released. The README lists the auxiliary-feature version, which the paper uses for M5, as "TBD" README.md. TMix-Only is not a separate model in the release. The M5 results cannot be reproduced from this code.
  • Normalization order. The Time-mixing formula in app. B.3 is post-normalization, Norm(X + Drop(σ(TP(X)))). The same appendix says pre-normalization is used for long-term forecasting app. B.3. The release is pre-norm in both blocks: the norm comes before each dense layer tsmixer.py. The release follows the appendix text, not the equation.
  • Normalization type. The paper uses BatchNorm for long-term forecasting and LayerNorm for M5 app. B.1. The release default is BatchNorm run.py, and it has no M5 code to check the LayerNorm variant against.
  • "2D normalization" with BatchNorm. The paper describes normalization over both time and features §4.1 app. B.3. The release calls BatchNormalization(axis=[-2, -1]) tsmixer.py. In Keras, the listed axes are the ones kept, so statistics are per (time step, variate) across the batch, not over the whole matrix. This is by reading the Keras API, not by running it. Only the LayerNorm variant matches the equation app. B.3.
  • RevIN wiring is broken as released. The paper uses reversible instance normalization for long-term forecasting §5.1 app. B.1. models/tsmixer_rev_in.py imports models.RevIN and models.TSMixer tsmixer_rev_in.py, but the files are models/rev_in.py and models/tsmixer.py. models/__init__.py imports tsmixer_rev_in [code: tsmixer/tsmixer_basic/models/init.py#L21], so import models should fail. This is by reading the imports; I did not run it.
  • Run script fails as written. run_tuned_hparam.sh passes --model TSMixerRevIN run_tuned_hparam.sh. run.py only treats names containing lowercase tsmixer as TSMixer models and looks up tsmixer_rev_in run.py [run.py#L200]. The name TSMixerRevIN matches neither, so the script raises "Unknown model type".
  • Tuned settings differ from the paper's best configurations (learning rates agree):
    • ETTm2, T=96: paper 8 blocks, hidden 256 app. E; script 2 blocks, ff_dim 64 run_tuned_hparam.sh.
    • Weather, T=96: paper hidden 64 app. E; script ff_dim 32 run_tuned_hparam.sh.
    • Electricity, T=96: paper 6 blocks, hidden 32 app. E; script 4 blocks, ff_dim 64 run_tuned_hparam.sh.
    • Traffic, T=96: paper hidden 256 app. E; script ff_dim 64 run_tuned_hparam.sh.
    • Inferred, not stated: the paper's hidden size H in feature mixing corresponds to the release's ff_dim app. B.3 tsmixer.py.
  • Dataset partition. The paper states train/validation/test as 7:2:1 for Weather, Electricity and Traffic tab. 2. The release splits at 70% for training and 80% for the end of validation, which gives 70% train, 10% validation and 20% test data_loader.py. The two readings disagree on validation and test.
  • Metrics on the standardized scale. The release evaluates on standardized data and does not inverse-transform run.py. The paper says it does not re-scale when evaluating app. C.1. Consistent.
  • Early stopping and horizon. Maximum 100 epochs, patience 5, input 512 match app. C.1 run.py [run.py#L159] [run_tuned_hparam.sh#L3]. Consistent.
  • Framework and timing. The cost table says all models are in PyTorch except TFT tab. 6. The release is TensorFlow requirements.txt. The timing numbers cannot be reproduced from this code.
  • Data source. The loader reads gs://time_series_datasets data_loader.py, which is not public. The README points to the Autoformer data on Google Drive README.md.
  • Not in the paper, in the release: RevIN's affine step, and stop-gradient on its mean and standard deviation rev_in.py [rev_in.py#L175-L182]; the default batch size of 32 [run.py#L150]; the Adam settings (library defaults) [run.py#L225].

Pitfalls

  • Dataset partition is unclear. The paper says 7:2:1 tab. 2. The release gives 70/10/20 for train, validation and test [data_loader.py#L82-L87]. Choose one, state which, and expect validation-based early stopping to differ between them.
  • Dropout is a drop fraction. The release passes dropout straight to Keras, so 0.9 drops 90% of units tsmixer.py. The paper never defines the value. Most best configurations use 0.7–0.9 app. E; a 0.9 setting is very aggressive and differs in meaning from a keep probability.
  • Hidden sizes outside the search space. The search space for ETT and Weather lists hidden sizes {8, 16, 32, 64} app. E, but the ETTh1 and ETTm2 best configurations use 256 and 512. Either the search space or the table is wrong. Test a few settings around both.
  • Batch size is missing. The paper does not state it. The release default is 32 [run.py#L150]. Results change with batch size, and BatchNorm statistics depend on it.
  • BatchNorm is not the 2D normalization the equation describes (see Paper vs code). Pick LayerNorm over the whole (L, C) matrix if you want the paper's equation to hold.
  • RevIN details are unstated in the paper: the affine parameters, their initialization, and whether gradients flow through the statistics rev_in.py. Without the affine step, the model is not the release.
  • The time-mixing residual order matters. The equation puts normalization after the residual; the release puts it before the dense layer. An implementer following the equation will get a different network app. B.3 [tsmixer.py#L31-L37].
  • Feature mixing is not beneficial on the long-term benchmarks. The paper's own result is that TSMixer and TMix-Only are similar there, so the cross-variate part adds little on those datasets §5.1. The gain is on M5 §5.2.
  • M5 numbers are hard to reproduce. The M5 code and the TSMixer-Ext code are not released; the feature engineering follows GluonTS and a third-place solution app. C.2; the WRMSSE aggregation follows the competition protocol §5.1. Expect differences in feature construction, the negative binomial parameterization and the hyperparameter search.
  • Several M5 validation entries are 0.000 for TSMixer-Ext tab. 5. Treat them as missing, not as perfect scores.
  • Small gaps are within noise. On M5, the TSMixer and Autoformer test gap is smaller than either standard deviation tab. 4. The paper reports no significance tests for the long-term tables tab. 3.
  • Theorem 3.1 is about linear models and requires periodic plus Lipschitz-smooth structure §3. Do not read it as a guarantee for TSMixer or for volatile real data, which the paper itself flags as out of scope §3.
  • Indexing in equations 2 and 3 is not stated. Use the 1-based indices of the proof app. A.
  • Cost numbers depend on the implementation. The paper's timings come from PyTorch models on a V100 tab. 6, and the release is TensorFlow. Do not compare them with your own runs without matching the framework and batch size.

Lineage

  • Builds on: MLP-Mixer (Tolstikhin et al., 2021), whose mixing layers the paper adapts to time series §2 §4; LTSF-Linear (Zeng et al., 2023), the linear baseline and its time-step-dependent weights §3 tab. 3; reversible instance normalization (Kim et al., 2022) app. B.1. None of these has a card here.
  • Compared against: Informer, Autoformer, FEDformer, PatchTST (Nie et al., 2023), TFT, DeepAR and TMix-Only (the paper's own time-mixing-only ablation) tab. 3 tab. 4.
  • Related cards in this wiki: TiDE and TimeMixer. The paper does not cite either.
  • Superseded by: not stated in this wiki.

Source and license

Adapted from “TSMixer: An All-MLP Architecture for Time Series Forecasting” by Si-An Chen, Chun-Liang Li, Nate Yoder, Sercan O. Arik, Tomas Pfister (arXiv:2303.06053), 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/google-research/google-research/tree/master/tsmixer at commit 3ef52111c1fa (Apache-2.0). Any quoted code is shown under that license.