Author: Yu-Chen Den*, Kuan-Yu Chen*, Kendro Vincent, Tien-Hao Chang (*Equal Contribution)
Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2 (KDD)
Official code implementation of KDD 2026 paper: Integrating Inductive Biases in Transformers via Distillation for Financial Time Series Forecasting (Will change the official repo directory soon)
Install uv for package management
pip install uv && uv syncThe data/, model/ and output/ directories are created automatically by the
scripts below.
bash scripts/prepare_data.shBoth stages are configured with Hydra. configs/teacher.yaml
and configs/student.yaml pull in configs/model_config.yaml under model_conf,
and any field can be overridden on the command line:
python -m src.teacher_main seeds=[0] markets=[csi300] device=cuda:0 wandb=falseTo inspect the composed config without training anything:
python -m src.student_main --cfg jobbash scripts/run_pipeline.shArguments are forwarded to both stages, so only pass keys that exist in both configs. For stage-specific keys, run the two scripts separately.
bash scripts/run_pipeline.sh seeds=[0] markets=[csi300] device=cuda:0bash scripts/train_teachers.sh # or: python -m src.teacher_mainThis trains one teacher per (attention bias, market, seed) and writes, for every
run, checkpoints to model/tips_teacher-{bias}_{market}/ and predictions to
output/tips_teacher-{bias}_{market}/. The train-split predictions
(pred_train_s{seed}.npy) are what stage 2 distills from, so stage 1 must be
finished for all biases before running stage 2.
bash scripts/distill_student.sh # or: python -m src.student_mainThe teacher predictions on the train split are averaged into a pseudo-label
(over teachers first, then over seeds) and used as the only training signal for
a single vanilla Transformer, optimized with a listwise ranking loss (ListNet)
and reported as a stochastic weight average of the tail epochs. Student
checkpoints land in model/tips_student_{market}/ and test predictions in
output/tips_student_{market}/.
Stage 2 must use the same seq_len, target_range and date splits as stage 1;
the pseudo-labels are checked against the student's feature shape and the run
fails fast if they disagree.
If you use this code, please cite the following:
@article{den2026integrating,
title={Integrating Inductive Biases in Transformers via Distillation for Financial Time Series Forecasting},
author={Den, Yu-Chen and Chen, Kuan-Yu and Vincent, Kendro and Chang, Darby Tien-Hao},
journal={Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2},
year={2026}
}