FactorVAE: A Probabilistic Dynamic Factor Model Based on Variational Autoencoder for Predicting Cross-Sectional Stock Returns

Yitong Duan, Lei Wang, Qizhong Zhang, Jian LiAAAI 2022 · DOI

Introduction

In quantitative finance, factor models are fundamental for asset pricing, assuming that a small set of underlying factors—such as market volatility or firm size—drive the returns of a vast array of stocks. While traditional models rely on manually engineered factors, modern machine learning approaches aim to learn these representations automatically. However, financial data is characterized by a low signal-to-noise ratio, where predictive signals are often obscured by market noise. Deterministic models frequently overfit this noise and fail to provide risk estimates, which are essential for effective portfolio management.

The FactorVAE Framework

To address these challenges, the authors introduce FactorVAE, a probabilistic model that integrates Dynamic Factor Models (DFM) with Variational Autoencoders (VAE). FactorVAE treats factors as latent random variables, allowing for both return prediction and uncertainty estimation.

The overall architecture of FactorVAE, highlighting the interaction between the Factor Encoder (Oracle), Factor Predictor, and Factor Decoder.

The architecture is composed of three primary modules:

  1. Factor Encoder (The Oracle): Used only during training, this component utilizes future returns to extract "optimal" posterior factors.
  2. Factor Predictor: The operational core of the model during inference. It processes historical data through a multi-head global attention mechanism to predict the factors identified by the Oracle.
  3. Factor Decoder: This module maps the latent factors back to individual stock returns. It decomposes returns into "Alpha" (idiosyncratic components) and "Beta" (factor exposures).
Detailed internal structure of the Factor Encoder and Factor Decoder, showing the portfolio-based encoding and the alpha/beta decomposition layers.

The "prior-posterior" learning strategy is central to FactorVAE. By minimizing the KL Divergence between the Predictor’s estimate (prior) and the Oracle’s optimal factors (posterior), the model learns to filter out transient noise and focus on robust predictive signals.

Data and Experimental Setup

The model was evaluated using China A-shares market data and the Alpha158 dataset from the Qlib platform. The dataset included nearly 4,000 stocks. The training period spanned 2010–2017, with 2018 for validation and 2019–2020 for out-of-sample testing.

Key Insights

  • Oracle-Guided Learning: Leveraging future data during training provides a clear target for what constitutes a "good" factor, guiding the historical predictor to ignore non-predictive noise.
  • Probabilistic Risk Estimation: By outputting a distribution (mean and variance), FactorVAE naturally quantifies uncertainty. Utilizing this variance for risk-adjusted returns (the TDrisk strategy) significantly enhances portfolio stability.
  • Portfolio-Based Encoding: To accommodate the fluctuating number of stocks in the market (e.g., due to IPOs), the encoder constructs a fixed number of latent portfolios rather than analyzing stocks individually, ensuring architectural robustness.

Performance Results

FactorVAE was benchmarked against standard RNNs (GRU, ALSTM), Graph Attention Networks (GAT), and the Conditional Autoencoder (CA).

  • Predictive Accuracy: FactorVAE achieved a Rank IC of 0.055, outperforming the state-of-the-art CA model (0.039).
  • Investment Returns: In backtesting, a FactorVAE-based portfolio yielded an Annualized Return (AR) of 15.32% with a Sharpe Ratio of 1.92. The risk-adjusted TDrisk strategy further improved the AR to 16.32% and the Sharpe Ratio to 2.09.
  • Generalization: The model demonstrated strong performance on stocks not seen during training, confirming its ability to generalize across the cross-section of returns.

Conclusion and Future Directions

FactorVAE successfully bridges traditional finance theory and deep learning, offering a robust solution for noisy financial time-series. While highly effective using technical price-volume data, future iterations could incorporate alternative data sources like news sentiment or knowledge graphs. Additionally, integrating FactorVAE’s probabilistic outputs with reinforcement learning-based trading agents could further optimize execution strategies.

Summary updated

BibTeX
@inproceedings{duan2022factorvae,
  author = {Yitong Duan and Lei Wang and Qizhong Zhang and Jian Li},
  title = {{FactorVAE: A Probabilistic Dynamic Factor Model Based on Variational Autoencoder for Predicting Cross-Sectional Stock Returns}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i4.20369},
}
Figure