Abstract
The Adaptive Long-Short Pattern Transformer (ALSP-TF) is a specialized deep learning architecture designed to rank stocks by their expected returns. By enhancing the standard Transformer with a "fine-grained pattern distiller" and a "time-adaptive modulator," the model captures complex volatility patterns and inter-stock dependencies without requiring manual domain knowledge or fixed graph structures. Evaluated on NASDAQ, NYSE, and TSE, ALSP-TF demonstrates significant improvements in risk-adjusted returns and profitability over state-of-the-art baselines.
Introduction
Predicting stock market movements is notoriously difficult due to "non-stationary dynamics"—the rules of the game change over time—and the fact that stocks are highly interrelated. Traditional Recurrent Neural Networks (RNNs) struggle to capture fine-grained, interactive volatility patterns over long sequences. Furthermore, vanilla Transformers are often context-agnostic (comparing individual data points rather than multi-day patterns) and position-agnostic in the financial domain. Most models also rely on rigid, static graphs to model stock relationships, which fail to capture evolving market synergies.
Methodology
ALSP-TF introduces a three-part pipeline to turn raw price data into actionable rankings:
- Graph-based Initialization: Instead of manual industry lists, the model uses Dynamic Time Warping (DTW) to calculate similarity between stock pairs based on historical price movements. A gated graph smoothing operation then reduces noise and enriches initial embeddings.
- Fine-grained Pattern Distiller (Lit Layer): This layer employs dilated causal convolutions to group contiguous days into "patterns." This allows the model to compare the shape of a price wave rather than just comparing two single-day prices.
- Time-adaptive Modulator: Standard position embeddings are replaced with a learnable sigmoid function that adjusts attention weights based on the actual time interval between patterns, enabling the model to prioritize short-term or long-term relevance dynamically.
The model is trained using a combination of Rank Loss (for ordering) and Graph Proximity Loss (a self-supervised signal ensuring representations respect DTW-discovered relationships).
Key Insights
A core innovation of ALSP-TF is the focus on patterns over points. In finance, a single day's price is often noise. By forcing the Transformer to look at "compound patterns" (sub-sequences) through the Lit layer, the model becomes much more resilient to market volatility. Furthermore, the time-adaptive modulator recognizes that the distance between events matters differently depending on the context. Lower layers of the Transformer focus on local, high-frequency interactions, while higher layers gravitate toward long-term trends.
Experimental Evaluation
The model was evaluated on three major exchange markets: NASDAQ (1,026 stocks), NYSE (1,737 stocks), and TSE (95 stocks), using data from 2013 to 2020 with a 16-day lookback window.
ALSP-TF significantly outperformed state-of-the-art baselines across all markets. On the NASDAQ dataset, it achieved a Sharpe Ratio (SR) of 1.55 and an Internal Rate of Return (IRR) of 0.53, compared to the previous best of 1.42 and 0.44. The model showed an average relative performance gain of 8.57% in risk-adjusted returns (SR) and 18.54% in cumulative profits (IRR) over the best-performing baselines.
Conclusion
ALSP-TF effectively navigates complex inter-stock relationships and non-stationary dynamics. While the computational cost of DTW for massive universes and the reliance on purely price-volume data are current limitations, the model's ability to discover automated synergies and handle temporal elasticity marks a significant advancement in stock investment selection.
Summary updated