Reinforcement Learning with Maskable Stock Representation for Portfolio Management in Customizable Stock Pools

Wentao Zhang, Yilei Zhao, Shuo Sun, Jie Ying, Yonggang Xie, Zitao Song, Xinrun Wang, Bo An

TL;DR

EarnMore is a novel reinforcement learning (RL) framework for portfolio management that allows investors to customize their stock pools without requiring model retraining. By utilizing a "maskable" stock representation and self-supervised learning, it achieves over 40% profit improvement over state-of-the-art baselines while offering the flexibility to dynamically add or remove stocks in real-time.

What Problem Does This Paper Address?

Portfolio management (PM) is the art of reallocating capital across different assets to maximize long-term returns. While RL has shown great promise in this field, most existing models are built for a fixed stock pool.

In the real world, this is a major limitation. Investors have diverse preferences (e.g., avoiding tobacco stocks or focusing on tech), and market conditions change (e.g., a stock gets delisted). Currently, if an investor wants to change their target stock pool, the RL agent usually needs to be retrained from scratch—a process that is computationally expensive, time-consuming, and often leads to unstable performance. The authors address this by introducing Customizable Stock Pools (CSPs) and a framework that handles them through "one-shot" training.

Methods

The core of the paper is the EarnMore framework, which consists of three innovative components:

  1. Maskable Stock Representation: Instead of training on a specific subset of stocks, the model is trained on a "Global Stock Pool" (GSP). When an investor selects a specific CSP, the stocks outside that pool are replaced with a learnable masked token [M]. This keeps the input dimensions consistent and allows the agent to "sense" which stocks are currently off-limits.
  2. Self-Supervised Pool-Level Embedding: To capture the complex relationships between stocks (e.g., how Apple's performance might correlate with Microsoft's), the authors use a Masked Autoencoder (MAE) approach. During training, the model learns to reconstruct the prices of masked stocks. This forces the encoder to learn deep, inter-stock dependencies rather than just looking at individual price trends.
  3. Re-weighting Mechanism: RL agents in continuous spaces often struggle with "dust" allocations—investing tiny, insignificant amounts in many stocks. EarnMore uses a Boltzmann-inspired re-weighting function with a temperature parameter to sparsify the portfolio, effectively zeroing out unfavorable stocks and concentrating capital on high-conviction picks.
Figure 2: The overall architecture of EarnMore. Module (a) is used to extract stock-level embeddings from GSP. Module (b) is the masking and reconstruction process to learn pool-level embeddings. Module (c) is an agent with masked token awareness.

Datasets

The authors evaluated EarnMore using daily data for over 3,000 US stocks with 95 technical indicators (like moving averages and volatility metrics). They focused on two major indices:

  • SP500: A global pool of 420 stocks.
  • DJ30: A global pool of 28 stocks.

From these, they constructed 8 diversified datasets, including 6 specific Customizable Stock Pools (CSPs) tailored to different industry preferences (Technology, Financials, and Services) to test the model's adaptability.

Key Insights and Ideas

  • One-Shot Training for Infinite Pools: The "aha moment" is that you don't need to retrain for every new pool if you treat the pool selection as a masking problem. This allows a single model to serve millions of investors with different preferences.
  • Masking as a Feature, Not a Bug: In many fields, masking is just a way to handle missing data. Here, it's used as a communication channel between the investor and the AI, allowing human intuition (e.g., "I think GE is going to underperform") to be directly injected into the agent's state.
  • Inter-stock Relationships Matter: By using a reconstruction task, the model learns that stocks don't move in isolation. This "pool-level" awareness makes the agent much more robust when the composition of the pool changes.

Key Results

EarnMore was tested against 14 state-of-the-art baselines, including traditional rule-based methods and advanced RL models like DeepTrader and SARL.

  • Superior Profitability: On the SP500, EarnMore achieved an Annual Rate of Return (ARR) of 97.17%, outperforming the best baseline by over 60%.
  • Market Resilience: During the high volatility of the COVID-19 pandemic, EarnMore showed a remarkable ability to recover quickly and identify stocks with high rebound potential, whereas many baselines suffered prolonged losses.
  • Efficiency: Because it requires only one-time training, EarnMore is orders of magnitude more efficient than "train-from-scratch" approaches as the number of customized pools grows.
Figure 3: Performance on GSP for SP500 and DJ30

Limitations and Future Work

While EarnMore is a powerhouse for profit, the authors note a few areas for improvement:

  • Risk Control: The model's primary goal was maximizing returns. In some scenarios, its risk metrics (like Maximum Drawdown) were slightly higher than more conservative baselines. Future work will focus on integrating explicit risk-penalty optimization.
  • Expanding the Global Pool: Currently, the model is limited to subsets of the global pool it was trained on. The authors aim to develop a more flexible "open" pool that allows for the easy addition of entirely new stocks without any retraining.

Summary updated

BibTeX
@inproceedings{zhang2023reinforcement,
  author = {Wentao Zhang and Yilei Zhao and Shuo Sun and Jie Ying and Yonggang Xie and Zitao Song and Xinrun Wang and Bo An},
  title = {{Reinforcement Learning with Maskable Stock Representation for Portfolio Management in Customizable Stock Pools}},
  booktitle = {The Web Conference},
  year = {2023},
  doi = {10.1145/3589334.3645615},
}
Figure