iTransformer Electricity with CST
Forecast 96 hourly readings across 321 electricity series given the previous 96 hours. This is an independent reproduction of the upstream Electricity 96→96 configuration. The CST variant replaces the outputs of the three 512→512 encoder FFN projections with 2,048 Polar Triweight Atoms per projection. The bias remains trainable. Each projection expands its final weight from input and output factors once per forward pass. Upstream recipe
Results
| Model | Standardized test MSE | Standardized test MAE | Selected epoch | Trainable parameters |
|---|---|---|---|---|
| Reference Dense | 0.14778 | 0.23948 | 8 | 4,833,888 |
| CST | 0.14982 | 0.24189 | 10 | 4,084,320 |
Both runs use seed 2023, batch size 16, up to 10 epochs, and the upstream validation-based checkpoint rule. Dense trained on an A100 MIG 3g.40gb with PyTorch 2.6.0+cu126 and four data-loader workers. CST trained on an RTX 4090 with PyTorch 2.9.1+cu128 and a single-process data loader. CST has 15.5% fewer trainable parameters. The official base learning rate is 0.0005. After 512 updates, the validation MSE was 0.15774 at 4× Atom learning rate and 0.15805 at 16×. The published CST checkpoint uses 4×.
| Device | Dense step (ms) | CST step (ms) | Dense peak (MiB) | CST peak (MiB) |
|---|---|---|---|---|
| RTX 4090 | 11.70 | 15.98 | 809.4 | 951.6 |
| A100 MIG 3g.40gb | 38.98 | 50.81 | 808.3 | 950.6 |
The paired probes use the same train windows on each device and time the transfer, forward pass, backward pass, and optimizer update. The table shows median time and peak allocated memory across 64 updates after eight warm-up steps. The CST factor-product path was checked against factored CSTLinear outputs, input gradients, and Atom gradients.

Forecast
Input is a CSV containing a date column and the 321 series listed in
scaler.json. The last 96 rows must be consecutive hourly readings. The
script writes 96 forecast rows in the original units. Use --variant dense
for the reference checkpoint or --device cpu for CPU inference.
The CLI loads Safetensors through the provided model factory.
python -m pip install huggingface_hub
hf download takumiecd/cst-itransformer-electricity --local-dir itr-ecl
python -m pip install -r itr-ecl/requirements.txt
python itr-ecl/inference.py itr-ecl electricity.csv prediction.csv --device cuda
The training data are the original THUML Electricity benchmark CSV. The published scaler comes from the first 70% of its rows. The upstream source revision, scaler, learning curves, and complete metrics are included.
Upstream architecture code and its license are included in upstream/.
Reproduce training
Use a full checkout of the linked upstream revision as upstream/ and put the
pinned CSV in upstream/dataset/electricity/. Install the upstream data
dependencies and the packages listed in requirements.txt. The upstream
trainer uses np.Inf. Use np.inf with NumPy 2.
From the directory containing the downloaded recipe and the full checkout, run:
bash recipe.sh dense
CST_ATOM_LR_MULTIPLIER=4 ITR_WORKERS=0 bash recipe.sh cst