Quant Memo
Core

Transfer Learning and Fine-Tuning

Transfer learning takes a network already trained on a large, related task and adapts it to a new, smaller task, reusing what it already learned instead of starting from random weights and relearning everything from scratch.

Prerequisites: The Multilayer Perceptron, The Bias-Variance Decomposition

Training a large network from scratch needs a lot of data — millions of examples, in many domains. Most real financial problems don't have that: a specific earnings-call sentiment task might have a few thousand labeled examples, nowhere near enough to train a network's millions of parameters from random weights without overfitting badly. But there's a shortcut, when a related task with abundant data exists: don't start from random.

An experienced hire who already knows how to read financial statements, model cash flows, and communicate to a committee doesn't need to relearn those skills for a new firm — they just need a few weeks to pick up firm-specific systems and conventions. Most of what made them valuable transfers directly; only the last, specific layer of knowledge needs to be built fresh. Transfer learning does the analogous thing with a network's weights: take one trained on a large, related task (general language understanding, general chart-pattern recognition), and adapt it, rather than starting from a blank slate.

The mechanics, one symbol at a time

A network trained on a large source task has learned weights θpre\theta_{\text{pre}}. Rather than initializing a new network's weights randomly for the target task, initialize them at θpre\theta_{\text{pre}} (or reuse most of them and attach a fresh final layer), then continue training on the smaller target dataset:

θtarget=θpreηtarget dataθL(θ)\theta_{\text{target}} = \theta_{\text{pre}} - \eta \sum_{\text{target data}} \nabla_\theta \mathcal{L}(\theta)

In words: this is ordinary gradient descent — subtract the learning rate η\eta times the gradient of the loss, same as always — except the starting point θpre\theta_{\text{pre}} already encodes useful general structure instead of being random noise. Two practical variants control how much of θpre\theta_{\text{pre}} gets to change. In feature extraction, most of the pretrained network is frozen (its gradient is set to zero, so those weights never update) and only a small new final layer is trained from scratch on top. In fine-tuning, the pretrained weights are allowed to keep updating too, usually with a smaller learning rate than the fresh layer, since they're already close to a good solution and large updates risk destroying what they learned (a failure mode called catastrophic forgetting).

Worked example 1: how few labeled examples fine-tuning can work with

A network pretrained on years of general market data has learned, in its early layers, to detect broad concepts like "elevated volatility" and "trend persistence" — features useful across almost any downstream financial task. The target task is predicting whether a specific type of corporate action (say, a spin-off announcement) triggers unusual volume, and there are only 300 labeled historical examples of that specific event.

Training a full network from scratch on 300 examples would badly overfit — with millions of parameters and only 300 data points, the network could easily memorize the training set outright and generalize terribly. Freezing the pretrained layers and training only a small new output layer (say, 50 parameters) on those 300 examples is a far better-posed problem: 300 examples for 50 parameters is a reasonable ratio, even though it would be hopeless for millions.

Worked example 2: choosing a learning rate for the pretrained layers

A fine-tuning run uses a learning rate of ηnew=0.01\eta_{\text{new}} = 0.01 for the freshly attached output layer and ηpre=0.0001\eta_{\text{pre}} = 0.0001 for the pretrained layers — 100 times smaller.

For a pretrained weight currently at w=0.842w = 0.842 with a computed gradient of =0.5\nabla = 0.5: the update is w=0.8420.0001(0.5)=0.8420.00005=0.84195w' = 0.842 - 0.0001(0.5) = 0.842 - 0.00005 = 0.84195 — barely moves.

For a fresh output-layer weight at w=0.1w=0.1 with the same gradient =0.5\nabla=0.5: w=0.10.01(0.5)=0.10.005=0.095w' = 0.1 - 0.01(0.5) = 0.1 - 0.005 = 0.095 — a much larger relative step.

The pretrained weight nudges gently, preserving almost all of what it learned on the large source task; the new weight, which starts from random and knows nothing useful yet, is allowed to move fast. Use the same large learning rate for both and the pretrained weights can be dragged away from their useful starting point before the new layer has had a chance to learn anything sensible from them — a common way fine-tuning runs go wrong in practice.

Bias–variance explorer
model complexity →sweet spot
test error 1.54train error 0.92underfitting

The explorer above shows error against model complexity; transfer learning shifts where a small target dataset lands on that curve. The same network architecture that would sit deep in overfitting territory trained from scratch on 300 examples starts much closer to the sweet spot when it begins from pretrained weights instead of random ones.

pretrained layers (frozen or low LR) source task: large, general dataset new head (full LR) target task: small dataset
Most of a pretrained network's structure is reused unchanged or nearly unchanged; a small new component is trained fresh on the limited target data.

What this means in practice

Transfer learning is the default way to use large pretrained language models on financial text (earnings calls, news, filings) — fine-tune a general language model on a small labeled sentiment or event-classification dataset rather than training a language model from scratch, which would need far more labeled data and compute than most firms have. The choice between freeze-and-extract versus full fine-tuning depends on how similar the source and target tasks are and how much target data exists: more similar tasks and less target data favor freezing more of the network; more different tasks and more target data favor fine-tuning more of it. It's also worth checking, once fine-tuned, whether performance on the original source task has degraded — catastrophic forgetting can silently erase general capability while chasing the narrow target metric.

Transfer learning starts training from weights already learned on a large, related task instead of from random initialization, which lets a network reach good performance on a small target dataset that would be nowhere near enough data to train the same architecture from scratch.

The classic confusion: assuming a pretrained model transfers well to any related-sounding task without checking how related the source and target really are. A model pretrained on general equity news sentiment may transfer poorly to, say, central-bank statement interpretation — the vocabulary, tone, and what "positive" even means are different enough that the pretrained features can be a worse starting point than expected, and this has to be validated on held-out target data, not assumed from the task names sounding similar.

Related concepts

Practice in interviews

Further reading

  • Yosinski et al., How Transferable Are Features in Deep Neural Networks?
  • Goodfellow, Bengio & Courville, Deep Learning, ch. 15
ShareTwitterLinkedIn