TL;DR
Standard time-series pre-training methods fail in finance because stock prices are highly volatile, noisy, and non-stationary. This paper introduces three domain-specific pre-training tasks—stock code classification, stock sector classification, and moving average prediction—that allow a simple Transformer model to capture latent statistical signatures in market data. The resulting framework consistently outperforms both market benchmarks and state-of-the-art models in investment returns and risk-adjusted metrics.
What Problem Does This Paper Address?
Pre-training has revolutionized natural language processing and computer vision, but its application to financial time series remains fundamentally limited. Existing attempts simply copy-paste techniques like Masked Value Prediction (MVP) or contrastive learning directly onto stock data.
However, stock prices violate the core assumptions of these models: they are highly non-stationary (their statistical properties shift over time) and riddled with random noise. Forcing a model to predict a specific masked price value usually results in overfitting to random market noise rather than learning structural patterns. Furthermore, generic time-series models completely ignore crucial domain context, such as the unique business profiles of individual companies or the shared behaviors of stocks within the same industry sector.
Methods
The authors propose the Stock Specialized Pre-trained Transformer (SSPT), built on a lightweight two-layer Transformer architecture. Instead of generic self-supervised tasks, SSPT introduces three customized pre-training objectives designed to exploit the unique properties of financial data:
- Stock Code Classification (SCC): Slices of price series from different stocks are mixed together. The model is tasked with identifying which specific stock a given slice belongs to. This forces the model to extract unique, time-invariant statistical footprints for individual companies.
- Stock Sector Classification (SSC): Similar to SCC, but the model identifies the industry sector (e.g., technology, restaurants) of the price slice, capturing broader, macro-level market dynamics.
- Moving Average Prediction (MAP): To fix the flaws of traditional masked value prediction, the authors look to technical trading indicators. Instead of predicting a single masked raw price, the model must predict the moving average of a window containing masked values. This acts as a low-pass filter, smoothing out random noise and forcing the model to learn stable trend dynamics.
During downstream fine-tuning, the pre-training heads are replaced with a profit prediction head that optimizes both a regression loss (to predict absolute returns) and a ranking loss (to accurately order stocks from most to least profitable).
Datasets
The framework was evaluated across five distinct datasets spanning major global markets and varying time periods:
- NASDAQ (2013–2017): 1,026 stocks across 112 sectors.
- NYSE (2013–2017): 1,737 stocks across 129 sectors.
- FTSE-100 (2013–2017): UK market index featuring 87 stocks across 11 sectors.
- TOPIX-100 (2016–2020): Japan's major market index featuring 95 large-cap stocks.
- NASDAQ-recent (2018–2022): A highly volatile modern dataset specifically included to test robustness against major market disruptions like the COVID-19 pandemic.
Key Insights and Ideas
- Stocks Leave Learnable Footprints: Intuitively, one might think raw price slices look too similar to classify. However, SSPT achieved ~20% accuracy in identifying stock codes and sectors from anonymous price slices. While 20% sounds low, it vastly outperforms random guessing (<0.1%), proving that price series contain distinct, learnable statistical signatures.
- Smoothing Beats Exact Prediction: Controlled experiments showed that predicting the moving average (MAP) yields a significantly lower Mean Squared Error and better downstream performance than trying to predict exact masked values (MVP). Smoothing prevents the model from wasting capacity on unpredictable, high-frequency noise.
- Fine-Tuning Strategies are Task-Dependent: The authors discovered that pre-training tasks interact differently with the final objective. For SCC and MAP, it is optimal not to freeze any parameters during fine-tuning, treating pre-training purely as a superior weight initialization. For SSC, freezing the embedding layers yields the best results.
Key Results
The authors evaluated performance using the Cumulative Investment Return Ratio (IRR) and the Sharpe Ratio (SR), assuming a daily buy-hold-sell trading strategy of the top 5 predicted stocks.
- Outperforming SOTA: On the standard NASDAQ dataset, the combined pre-trained model (SSPT-comb) achieved a Sharpe Ratio of 2.25 and an IRR of 0.82. This significantly beats the market baseline (SR: 1.53, IRR: 0.15) and the previous state-of-the-art graph-based model, CI-STHPAN (SR: 2.01, IRR: 0.66).
- Cross-Market Consistency: SSPT consistently achieved the highest Sharpe Ratios across all tested markets, including NYSE (SR: 2.35) and TOPIX-100 (SR: 1.21).
- Weathering the Pandemic: On the challenging NASDAQ-recent (2018–2022) dataset, SSPT-comb achieved a Sharpe Ratio of 1.33 compared to the market's 0.97, proving that the learned representations hold up even during black swan economic events.
Limitations and Future Work
While combining the classification tasks (SCC + SSC) reliably improves performance, integrating the Moving Average Prediction (MAP) task into a single multi-task pre-training workflow proved difficult. MAP requires a lower learning rate ($10^{-4}$) compared to the classification tasks ($10^{-3}$), and its performance is highly sensitive to loss coefficient tuning ($\gamma$). If not carefully balanced, the objectives conflict, causing performance degradation.
The authors suggest that future work should explore more sophisticated multi-task optimization methods or continual learning strategies to combine these complementary insights more robustly.
Summary updated