Stock price forecasting remains an extremely challenging problem due to the non-stationary nature of financial markets. Recent deep learning approaches model complex stock correlations by learning temporal patterns from individual stock series and then aggregating cross-stock information. However, existing methods select which alpha factors to trust using static projections of market features, ignoring how market regimes evolveover the lookback window—a “recovering from a crash” regime and a “new bull market” produce similar instantaneous statistics but require different factor selections. Moreover, standard MSE training objectives weight all stocks equally, wasting gradient signal on mid-ranked stocks that never enter a long–short portfolio. To address these issues, we introduce StockMamba, a State-Space Gated Stock Transformer with Rank-Aware Optimization. StockMamba replaces static market gating with a Mamba-2 state-space model that scans market regime dynamics in linear time and produces time-varying factor gates via temperature-controlled softmax. For training, StockMamba pairs cross-stock attention and temporal distillation with a U-shaped Rank-Position Loss that concentrates gradients on the head and tail stocks where portfolio P&L is determined. Experiments on CSI-300 and CSI-800 with the Qlib pipeline show that StockMamba achieves 12.1% higher IC and 15.0% higher Rank IC over the MASTER baseline on CSI-300 (13.5% and 14.8% on CSI-800), with ablation studies confirming the contribution of each proposed module. A cross-market evaluation on S&P 500 further confirms that the gains generalize to a structurally different market (9.5% higher IC over MASTER), and a Kolmogorov–Smirnov test on the learned factor gates provides statistical evidence that the gating mechanism is genuinely regime-dependent.
Peng Zhang (Wed,) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: