Autoencoder Factor Models for Risk
Using an autoencoder's bottleneck layer as a data-driven substitute for hand-picked risk factors — letting a neural network discover a compressed representation of return co-movement instead of assuming it's value, size, and momentum.
Prerequisites: Autoencoders, Estimating the Factor Covariance Matrix
A classic factor risk model explains stock returns using a handful of hand-chosen factors — market, value, size, momentum — each defined by a human analyst's idea of what should matter. That works well when the analyst's guesses are right, but it means the model can only ever explain co-movement through the lens someone already thought of. An autoencoder factor model flips the order: instead of specifying factors up front, it asks a neural network to find whatever small set of compressed numbers best reconstructs the full panel of returns, and calls those numbers the factors — whatever they turn out to represent.
An analogy: describing a face in ten numbers
Imagine trying to describe any human face using only ten numbers, chosen so that from those ten numbers alone you could redraw a recognisable version of the original face. You wouldn't be told in advance what the ten numbers mean — you'd just search for whichever ten compress and reconstruct faces best, and only afterward might you notice that one of them tracks something like "face width" or "eye spacing." An autoencoder factor model does the same thing to a panel of stock returns: it searches for a small number of compressed numbers (the bottleneck) that best reconstruct the full set of returns, without being told upfront that they should represent "market" or "value."
The architecture, one piece at a time
An autoencoder has two halves. The encoder takes each day's full vector of stock returns (or characteristics) and squeezes it down to a much smaller vector — this is the bottleneck, and its dimension is the number of latent factors you're asking for. The decoder takes and tries to reconstruct the original return vector, . Training minimises the reconstruction error:
In plain English: adjust the encoder and decoder so that squeezing a day's returns down to just a few numbers and expanding them back out loses as little information as possible, averaged across every day in the training sample. Whatever the bottleneck ends up representing is the model's set of latent risk factors — exposures are read off the decoder's weights, and factor realisations are read off itself.
Worked example: a 3-factor bottleneck on 50 stocks
Train an autoencoder on daily returns for 50 stocks with a bottleneck of size 3. The decoder's weights show latent factor 1 loads positively on almost all 50 stocks with similar magnitude — the market factor, rediscovered without being told to look for it. Latent factor 2 loads positively on financials and negatively on utilities, something like a rate-sensitivity factor. Latent factor 3 loads heavily on five stocks with recent large idiosyncratic moves and weakly on everything else — likely a shared event rather than a persistent risk factor, a reminder that not every discovered dimension is a "real" economic factor worth trusting going forward. Reconstruction error at bottleneck sizes 2, 3, and 5 drops sharply from 2 to 3 and only marginally from 3 to 5, evidence that three factors capture most of the recoverable structure here.
What this means in practice
Autoencoder factor models are used where the risk driving a universe is suspected to be more complex than the standard hand-built factors capture — large, heterogeneous equity or crypto universes, or alternative-data-heavy portfolios — and where enough history exists to train a network reliably. They trade interpretability for flexibility: a hand-built value factor tells you immediately what it means, while a bottleneck dimension often needs to be reverse-engineered by inspecting which stocks load on it, and sometimes turns out not to mean anything stable at all.
An autoencoder factor model replaces hand-picked risk factors with whatever compressed representation, learned from data, best reconstructs the full panel of returns. The bottleneck dimension sets how many factors you're asking for; comparing reconstruction error across bottleneck sizes is how you check whether you've chosen enough.
Not every latent dimension an autoencoder discovers is a real, persistent risk factor — some capture a one-off event or a handful of correlated stocks that happened to move together in the training window. Always inspect what a latent factor loads on and check whether that loading pattern is stable out of sample before trusting it in a live risk model.
Related concepts
Practice in interviews
Further reading
- Gu, Kelly & Xiu, 'Autoencoder Asset Pricing Models', Journal of Econometrics (2021)
- de Prado, Machine Learning for Asset Managers, ch. 3