All models

MASTER

Stock forecasting Transformer that alternates within-stock and cross-stock attention after a market-guided gate.

Time series · 103 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (13 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
775K
Operations
103
Framework
PyTorch
Recurrent
No
Published
AAAI 2024
Cited by
105 (as of 30 October 2026)
Authors
Tong Li, Zhaoyang Liu, Yanyan Shen and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m18037
Graph hash
66b8eda522d7b23e4375bfdb614b1b75e99409387e9a7ef6abf5d97dec52aa8a
Skeleton hash
ca1b7a45731923960b6b55fb99da2453a294264bcc029424f41fc8be69f03140
Architecture hash
b60872ea46ad150abc198c34fd1d86d80a5b5a5e0494236c0c5e7c73b123b1ce
Diagram SHA-256
f3182d1649bc92eeb50735022806af6a68e1689cc340599e83eb67a0c717cd5c
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

MASTER, the Market-Guided Stock Transformer, forecasts stock prices for many stocks jointly, modeling how the stocks relate to one another and using market information to select input features. What it predicts is each stock's future return ratio after daily Z-score normalization, which encodes how the stocks rank against each other.

The paper argues that correlations between stocks occur momentarily and across different time steps, which earlier time-aligned designs miss. MASTER breaks the problem up: attention within each stock's own sequence, followed by attention across stocks at each time step. A temporal attention layer then summarizes each stock's sequence of embeddings into one embedding for prediction. Before all of this, a gate rescales the input features using a vector that represents the current market status.

The experiments use the CSI300 and CSI800 stock sets with a lookback window of 8 and a prediction interval of 5. The paper reports average improvements of 13% on ranking metrics and 47% on portfolio-based metrics over the second-best results. The repository publishes processed data and core code, because the original experiments ran in a business codebase built on Qlib.

Key idea. MASTER alternates attention within each stock's history and across stocks at each time step, and uses market information to select features automatically.

  • MASTER
  • Market-Guided Stock Transformer
  • stock price forecasting
  • stock correlation
  • stock transformer
  • market-guided gating
  • feature selection
  • CSI300
  • CSI800

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{li2023mastermarketguidedstocktransformer,
      title={MASTER: Market-Guided Stock Transformer for Stock Price Forecasting}, 
      author={Tong Li and Zhaoyang Liu and Yanyan Shen and Xue Wang and Haokun Chen and Sen Huang},
      year={2023},
      eprint={2312.15235},
      archivePrefix={arXiv},
      primaryClass={cs.CE},
      url={https://arxiv.org/abs/2312.15235}, 
}