Quant Memo
Advanced

Neural Networks in Finance

Why deep learning, so dominant on images and language, struggles on financial data, the data is small, noisy, and non-stationary, exactly the conditions where flexible models overfit, and where it can still earn its keep.

Prerequisites: Overfitting, Feature Engineering for Finance

Neural networks are the technology behind image recognition and large language models, so it's tempting to point them at markets and expect magic. The temptation is worth resisting until you understand why deep learning wins where it wins, and why markets are close to the worst-case setting for it. Deep learning thrives on enormous, stable, cleanly-labeled datasets, millions of images that still look like cats next year. Financial data is the opposite: small, drowning in noise, and non-stationary. Point a flexible enough model at it and overfitting is the default outcome, not a risk you occasionally run.

A neural network is, mechanically, a stack of simple layers. Each layer takes its inputs, mixes them linearly, and passes the result through a nonlinear squashing function:

a=σ(Wx+b).a = \sigma(Wx + b).

Here xx is the input vector, WW is a matrix of learned weights, bb is a vector of biases, and σ\sigma is a nonlinear activation (like ReLU or a sigmoid) applied element by element. Stack several such layers and you get a universal approximator, in principle it can fit almost any function. That expressive power is precisely the problem on noisy data: it will happily fit the noise too.

inputs hidden layer output
A tiny feedforward network. Each edge is a learned weight; even this toy has 16 weights plus biases. Real networks have thousands to millions, which on a few thousand noisy market observations is a recipe for memorization.

Neural networks are universal approximators that shine on huge, stationary, cleanly-labeled data. Financial data is small, noisy, and non-stationary, the opposite, so on markets a network's flexibility mostly buys you overfitting unless you fight it hard.

Why markets are hard for deep nets

  • Too few effective samples. A daily strategy over 12 years has ~3,000 observations, and because labels overlap and returns are serially correlated, the number of independent samples is far smaller. Networks with tens of thousands of parameters have nothing like the data to pin them down.
  • Non-stationarity. A network learns features tuned to the training regime; when the regime shifts, those features encode a world that no longer exists. See Feature Engineering for Finance on structural breaks.
  • Near-zero signal. With a tiny true predictable component, a flexible model fits mostly noise, and drives training loss toward zero while learning nothing that generalizes.
  • Opacity. Networks are hard to interpret, which makes them hard to risk-manage and hard to trust when they place a large bet, a real cost on a trading desk.

Worked example

You want to predict the sign of tomorrow's return from 2020 features, with 3,0003{,}000 daily observations. Reaching for a "proper" deep model, you build an MLP with two hidden layers of 128128 units. Count the parameters: the first layer has 20×128+128=2,68820 \times 128 + 128 = 2{,}688, the second 128×128+128=16,512128 \times 128 + 128 = 16{,}512, the output 128+1=129128 + 1 = 129, roughly 19,00019{,}000 parameters to fit from 3,0003{,}000 heavily-overlapping samples. It memorizes: training accuracy soars, purged-CV accuracy sits at 50%\sim 50\%.

Shrink to a tiny network, one hidden layer of 88 units (20×8+8+917720 \times 8 + 8 + 9 \approx 177 parameters), add dropout of 0.50.5, weight decay, and early stopping. Now training accuracy is modest and purged-CV nudges up to 5253%\sim 52\text{–}53\%, small, but real and generalizing. Better still, recognize that this is the wrong place for a deep net at all: if you instead model intraday order-book dynamics, where you have millions of observations, a sequence model can genuinely earn its complexity. Match the model's appetite for data to the data you actually have.

When your parameter count dwarfs your number of independent observations, a network will memorize the training set and its glowing training score is meaningless. Count effective samples (not raw rows, labels overlap), keep the model small, regularize hard, and only ever trust a purged, embargoed out-of-sample score.

Where they do earn their keep

Neural nets pay off in finance where the data is actually abundant and structured: high-frequency and order-book data (millions of samples), sequence models (LSTMs, temporal convolutions, transformers) for order-flow and microstructure, autoencoders for denoising and feature extraction, and large cross-sections where thousands of assets multiply the sample count. The rule of thumb: use deep learning where you have depth of data, not where you have a short, noisy daily series a gradient-boosted model would handle more robustly.

Before building a network, do the arithmetic: parameters versus independent samples. If parameters win by a wide margin, either shrink the model drastically or pick a lower-variance model like gradient boosting. On small, noisy financial samples, boosted trees usually beat deep nets and are far easier to regularize and interpret.

In interviews

If asked "would you use a deep neural network for this trading signal?", the mature answer is usually "probably not, and here's why": deep learning needs large, stationary, well-labeled data, while a daily strategy offers a few thousand noisy, overlapping, non-stationary samples, so the network overfits. Note the parameter-versus-sample arithmetic, the regularizers that help (small architecture, dropout, weight decay, early stopping), and the settings where nets do win (high-frequency, order-book, large cross-sections). Bonus: mention that whatever the model, honest validation still requires Purged & Embargoed Cross-Validation.

Related concepts

Practice in interviews

Further reading

  • Goodfellow, Bengio & Courville, Deep Learning
  • López de Prado, Advances in Financial Machine Learning
  • Gu, Kelly & Xiu, Empirical Asset Pricing via Machine Learning
ShareTwitterLinkedIn