Abstract
Predicting stock prices is a complex task due to the non-stationary nature of financial markets and the intricate interdependencies between different equities. Traditional models often fail to account for time-lagged correlations and the varying importance of features under different market conditions. This paper introduces MASTER (MArkert-Guided Stock TransformER), a novel forecasting architecture designed to capture both "momentary" and "cross-time" correlations. By integrating macro-market signals to dynamically weight input features and alternating between temporal and spatial aggregation, MASTER achieves a significant improvement in portfolio returns, outperforming state-of-the-art models by up to 47%.
Introduction
Financial markets are highly interconnected, yet most deep learning models for finance suffer from two primary limitations. First, they often exhibit Time-Aligned Bias, assuming that correlated stocks move in perfect synchrony. In reality, lead-lag effects are common; for instance, a supply chain disruption might affect a raw material provider days before impacting the end-consumer. Second, these models typically rely on Static Feature Importance, treating technical indicators with uniform weight regardless of whether the market is in a bull or bear phase.
MASTER addresses these gaps by creating a framework that understands the shifting relevance of features and the complex, time-lagged relationships between different stocks in a large-scale universe.
The MASTER Framework
The MASTER framework processes stock data through a specialized five-step pipeline designed to manage the high dimensionality and computational complexity of market data.
- Market-Guided Gating: The model first analyzes "Market Status" (index prices and volumes) to rescale input features. This acts as an automated feature selection mechanism that adapts to current volatility or trends.
- Intra-Stock Aggregation: A Transformer encoder analyzes the historical sequence of individual stocks to capture local temporal patterns like momentum.
- Inter-Stock Aggregation: This core innovation calculates correlations across the entire stock universe. By performing this after intra-stock analysis, information can flow across different time steps between stocks, capturing cross-time dependencies.
- Temporal Aggregation: An attention-based pooling layer summarizes the sequence of embeddings into a single vector per stock.
- Prediction: A final linear layer predicts the normalized return ratio.
By decoupling temporal and spatial analysis, MASTER reduces computational complexity from $O((T \times N)^2)$ to $O(N^2T)$, enabling the simultaneous processing of hundreds of stocks.
Experimental Results
The researchers evaluated MASTER on the CSI300 and CSI800 benchmarks, representing the largest and most liquid stocks in the Chinese market. Using the Alpha158 indicator set, the model was compared against baselines including XGBoost, LSTMs, and specialized models like GAT.
Predictive Accuracy and Profitability
MASTER achieved the highest Information Coefficient (IC) and RankIC, showing a ~13% improvement over the next best models. In backtesting a "Top 30" trading strategy, the model delivered an Annualized Return (AR) of 27% on the CSI300 and 28% on the CSI800. This represents a 47% improvement in portfolio-based metrics over previous state-of-the-art methods. Furthermore, the model led in Information Ratio (IR), indicating superior risk-adjusted returns.
Interpretability and Correlation Analysis
A key strength of MASTER is its ability to learn and visualize the "momentary" nature of stock correlations. Unlike static graph models that assume fixed relationships, MASTER identifies fleeting, sparse connections.
As shown in the attention map visualizations, the model successfully identifies lead-lag relationships without prior knowledge of industry sectors. It observes how signals propagate through the market, allowing it to "turn up" the importance of specific risk-related features during volatile periods while focusing on trend indicators during stable growth.
Conclusion and Future Work
MASTER demonstrates that incorporating market context and cross-time dependencies is vital for accurate stock forecasting. While the $O(N^2)$ complexity remains a challenge for scaling to massive markets like the US NYSE, the model provides a robust foundation for automated feature selection and relationship discovery. Future research will explore more granular data, such as limit order books, to further refine these learned correlations for risk management and portfolio optimization.
Summary updated