Paper · 2020-12-22 · cs.LG, cs.CL
Intrinsic Dimensionality Explains the Effectiveness of Language Model Fine-Tuning
Fine-tunes a pretrained language model by training only d coordinates of a fixed random projection (Fastfood); SAID adds per-layer scales. RoBERTa-Large reaches 90% of full MRPC fine-tuning with about 200 trainable parameters. Pre-training lowers this intrinsic dimension, and lower values track better generalization, with a compression-based bound (author-reported).
Parameter-efficient fine-tuningLow-rank adaptation (LoRA and variants)Language model pretrainingIntrinsic dimensionfine-tuningintrinsic-dimensionpretraininggeneralization
AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Fine-tuning a large language model usually means adjusting every one of its weights, even when the task has only a small labelled dataset. The authors ask why this works at all, and they suggest that the task needs far fewer adjustable "knobs" than the model has.
Their test is simple. The model's weights are frozen at their pretrained values. A small set of trainable numbers is multiplied by a fixed random matrix and added to those weights. Only the small set is trained. The smallest set that still reaches about 90% of the full fine-tuning score is the task's "intrinsic dimension". For some tasks and models it is tiny.
The paper also finds that better-pretrained models need fewer knobs, and that tasks needing fewer knobs tend to generalize better. This is offered as an explanation for why plain gradient descent works so well on small datasets.
TL;DR
Fine-tuning a pretrained model can be reparameterised into a random subspace of dimension d, so only d numbers are trained, with the projection held fixed §3 eq. 1 eq. 2. For RoBERTa-Large on MRPC, about 200 such numbers reach 90% of full fine-tuning §4.2 tab. 1. The minimum d is lower for models pretrained longer §5.1 fig. 2 and for larger models §5.2 fig. 3, and it tracks generalization §5.3 fig. 4 fig. 5. All numbers are author-reported.
Problem
Full fine-tuning updates every parameter of a pretrained model. The authors say the optimisation problem is largely unexplained in the low-data regime, where plain gradient descent without strong regularisation still generalises §1. They measure the dimension of the fine-tuning problem instead of its parameter count, and they treat it as a measure of task complexity §1 §5.
Their measurement is a heuristic upper bound. The exact intrinsic dimension is intractable, so the reported values depend on random projections and on the projection type used §3 §4.2.
Method
Subspace re-parameterisation §3 eq. 1. The model keeps all D weights \theta^{D}_0 frozen at their pretrained values. Training changes only \theta^{d}, a vector of d numbers, through a fixed linear map P from d to D dimensions:
\theta^{D} = \theta^{D}_0 + P(\theta^{d}) eq. 1
Projection. The authors use the Fastfood transform, which they call the primary choice §3. It has the form below, where H is a Hadamard matrix, G a diagonal matrix of independent standard normal entries, B a diagonal matrix of signs with equal probability, and \Pi a random permutation matrix. The product can be computed in \mathcal{O}(D \log d) with the Fast Walsh-Hadamard Transform §3. Everything except \theta^{d} is fixed, so the optimisation lives only in d dimensions §3.
\theta^{D} = \theta^{D}_0 + \theta^{d} M, \qquad M = H G \Pi H B eq. 2
Measuring intrinsic dimension §3 §4.1. Train \theta^{d} with standard SGD for several values of d. Starting from \theta^{d} = 0, which gives the pretrained model, pick the smallest d that reaches 90% of the score of standard full fine-tuning. The authors call this d_{90}.
# Measure d90 for one model and one dataset [§3] [§4.1] [§5.1]
# Input: full_score (standard full fine-tuning), search bounds low and high
# Output: smallest subspace size d that reaches 90% of full_score
def find_d90(full_score, train_and_eval, low, high):
# Target: 90% of the full fine-tuning score [§3]
target = 0.9 * full_score
# Binary search over d; §4.1 used a log-spaced sweep instead [§5.1]
while low < high:
mid = (low + high) // 2
# Best score over the learning-rate search for this d [§4.1]
score = train_and_eval(mid)
if score >= target:
high = mid
else:
low = mid + 1
return lowSubspace training step. Only \theta^{d} receives gradients; the rest is fixed §3 eq. 2.
# One subspace fine-tuning run [§3] [eq. 2]
# Input: theta_0 (D,) pretrained weights; d; seed; train_data
# Output: trained theta_d (d,)
def subspace_finetune(theta_0, d, seed, train_data):
# Fixed random factors, drawn once per seed and never trained [§3]
G = diagonal(random_normal(D, seed)) # standard normal
B = diagonal(random_sign(D, seed)) # +1 or -1, equal probability
Pi = random_permutation(D, seed)
# Start at zero, so the model starts at the pretrained weights [§4.1]
theta_d = zeros(d)
for batch in train_data:
# Map the d trainable values into the full D-dimensional space [eq. 2]
theta_D = theta_0 + fastfood(theta_d, G, Pi, B) # (D,)
loss = model_loss(theta_D, batch)
theta_d = sgd_step(theta_d, grad(loss, theta_d))
return theta_dStructure-aware variant (SAID) §3 eq. 3. The layers of an attention model are assumed to specialise, so SAID trades m trainable values from the subspace for one learned scale \lambda_i per layer, where m is the number of layers. The subspace then has d−m values for the projection plus m scales, and the scales are trained jointly §3.
\theta^{D}_i = \theta^{D}_{0, i} + \lambda_i \, P(\theta^{d-m})_i eq. 3
The layer-unaware version is called DID (direct intrinsic dimension) §3.
# SAID: one learned scale per layer [§3] [eq. 3]
# Input: theta_0 split into layers; num_layers = m; d
# Output: theta_D for the fine-tuned model
def said_weights(theta_0, lambdas, theta_low, layers, Pi_fastfood):
# theta_low holds d - m values; lambdas holds m values [§3]
projected = fastfood(theta_low, Pi_fastfood) # (D,)
# Scale each layer's projected part by its own lambda [eq. 3]
for layer_index, layer in enumerate(layers):
projected[layer] = lambdas[layer_index] * projected[layer]
return theta_0 + projectedPre-training and generalisation experiments §5.1 §5.2 §5.3. The authors measure d_{90} on six datasets while RoBERTa-Base is pretrained from scratch, saving checkpoints along the way §5.1 fig. 2. They also measure d_{90} on MRPC for many public pretrained models §5.2 fig. 3, and they relate d_{90} to evaluation accuracy and to a relative generalisation gap §5.3 fig. 4 fig. 5.
Generalisation bound §5.3.1 eq. 4 eq. 5. The margin loss is defined as below, with an optional margin \gamma §5.3.1.
\mathcal{L}_{\gamma}(f) = \mathbb{P}_{(x,y)\sim D}\left[f(x)[y] \le \gamma + \max_{i \ne y} f(x)[j]\right] eq. 4
With d trainable intrinsic parameters trained on m samples, the paper states the following asymptotic bound "with high probability" §5.3.1. It does not involve the full parameter count D §5.3.1.
\mathcal{L}_{0}(f) \leq \hat{\mathcal{L}}_{0}(f) + \mathcal{O}\left(\sqrt{\frac{d}{m}}\right) eq. 5
The proof, in the appendix, goes through a compressibility argument with a helper string consisting of the random seed and \theta^{D}_0 app. A.1 eq. 6. It yields an intermediate bound with \log r, where r is the number of discrete states of the stored \theta_d app. A.1 eq. 7. The final bound eq. 8 is the form given in eq. 5.
|f(x)[y] - g_{\theta,s}(x)[y]| \le \gamma eq. 6
\mathcal{L}_{0}(f) \leq \hat{\mathcal{L}}_{\gamma}(f) + O\left(\sqrt{\frac{d \log r}{m}}\right) eq. 7
\mathcal{L}_{0}(f) \leq \hat{\mathcal{L}}_{0}(f) + \mathcal{O}\left(\sqrt{\frac{d}{m}}\right) eq. 8
Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| Subspace dimension d (sentence tasks) | 10 to 10000, log scale | §4.1 | 100 subspace runs per dataset and model |
| Subspace dimension d (pre-training trajectory) | binary search, min 100, max 4 million | §5.1 | |
| Learning rate, sentence tasks | small search over four values | §4.1 | the four values are not stated in the text |
| Learning rate, pre-training trajectory | best values from §4 for d < 10000, one fixed value otherwise | §5.1 | the fixed value is not stated |
| Learning rate, parameter-count study | small search per model | §5.2 | range and values not stated |
| Optimiser | standard SGD | §3 | momentum, weight decay, batch size and epochs for the subspace runs not stated |
| Initial \theta^{d} | zero vector | §4.1 | starts at the pretrained model |
| Initial SAID scales \lambda | not stated | §3 | |
| Projection | Fastfood, M = HG\Pi HB | §3 eq. 2 | the normalisation constants of H, G and B are not stated |
| Random factors | G standard normal, B signs with equal probability, \Pi random permutation | §3 | how the d-vector is padded to the Hadamard size is not stated |
| Target for d_{90} | 90% of standard full fine-tuning score | §3 | the metric for each dataset is not stated, except the MRPC example, which uses accuracy |
| Pre-training steps (trajectory) | 200k (instead of RoBERTa's 500k) | §5.1 | RoBERTa-Base retrained from scratch, not the released checkpoints |
| Pre-training batch size (trajectory) | 1k, described as half of the RoBERTa setting | §5.1 | the original batch size is not restated in this paper |
| Pre-training setup otherwise | as in RoBERTa | §5.1 [ROBERTA] | |
| Classification head | randomly initialised and included in the subspace | §4.1 | |
| MRPC training samples | about 3700 | §4.1 | |
| QQP training samples | about 363k | §4.1 | |
| Implementation | HuggingFace Transformers | §4.1 §5.2 | |
| Models in §5.2 | BERT, RoBERTa, BART, Electra, Albert, XLNet, T5, XLM-R, at several public sizes | §5.2 | exact checkpoints not listed |
Results
Author-reported. Setup: sentence prediction on MRPC and QQP, using GLUE benchmark tasks, with BERT and RoBERTa at base and large sizes; hardware not stated; baseline is standard full fine-tuning §4.1 tab. 1.
Table 1 gives d_{90} for each model and dataset tab. 1:
| Model | SAID MRPC | SAID QQP | DID MRPC | DID QQP |
|---|---|---|---|---|
| BERT-Base | 1608 | 8030 | 1861 | 9295 |
| BERT-Large | 1037 | 1200 | 2493 | 1389 |
| RoBERTa-Base | 896 | 896 | 1000 | 1389 |
| RoBERTa-Large | 207 | 774 | 322 | 774 |
Summary of the headline results. Figures are described in words, as no image support is available fig. 1 fig. 2 fig. 3 fig. 4 fig. 5.
| Setting | Metric | Baseline | This paper | Source |
|---|---|---|---|---|
| RoBERTa-Large, MRPC, 90% of full fine-tuning | trainable parameters | full fine-tuning | 207 (SAID), 322 (DID) | tab. 1 |
| RoBERTa-Large, MRPC | trainable parameters | full fine-tuning | "roughly 200" (text) | §4.2 |
| RoBERTa-Large, QQP | trainable parameters | full fine-tuning | 774 (SAID and DID) | tab. 1 |
| Pre-training trajectory, RoBERTa-Base, six datasets | d_{90} over checkpoints | none (trend over checkpoints) | decreases monotonically with pre-training (qualitative) | §5.1 fig. 2 |
| Parameter count, MRPC, many public models | d_{90} | none (trend across models) | decreases as parameter count grows (qualitative) | §5.2 fig. 3 |
| Generalisation, six datasets | evaluation accuracy and relative gap | none (correlation) | lower d_{90} correlates with higher accuracy and smaller gap (qualitative) | §5.3 fig. 4 fig. 5 |
| Generalisation bound | \mathcal{L}_0 bound | none stated | O(\sqrt{d/m}) (asymptotic, constants not stated) | §5.3.1 eq. 5 |
Paper vs code
No official code.
The arXiv LaTeX source (v1) contains no code link [raw/src/2012.13255]. Searched: a GitHub repository search for the method name and title words, for "structure aware intrinsic dimension", and for the paper's terms within the facebookresearch organisation. No repository by the authors was found. The only match is a third-party reimplementation, which is not used here.
Pitfalls
- The 90% target depends on the metric. The text states the target as 90% of the full-training metric and gives an accuracy example §3. For QQP and the other datasets the metric is not stated, so reproduce it with the same metric as your full fine-tuning baseline.
- The projection's normalisation is not stated. Fastfood is given as HG\Pi HB eq. 2, but no scaling constants are provided §3. Scaling may change the effective learning rate, so calibrate on one task before comparing numbers.
- Padding is not stated. The paper does not say how a d-vector is embedded in the Hadamard size, or how D is handled when it is not a power of two §3.
- The learning rates are not reported. The four candidate rates §4.1, the fixed rate used for d \ge 10000 §5.1, and the rates used in the parameter-count study §5.2 are not given in the text. The paper's d_{90} values are therefore not reproducible from the text alone.
- The randomly initialised classification head is part of the subspace §4.1. If your implementation keeps the head outside the subspace, your d is not comparable with the paper's.
- The "d+1" storage claim needs a seed. Storing \theta_d and the seed is enough to rebuild the projection, and this is what the paper counts §5. The seed must be stored with the same random generator, or the stored vector means nothing.
- Table 1 and the text differ slightly. The text says "roughly 200" for MRPC and "800" for QQP §4.2; Table 1 gives 207 and 774 tab. 1.
- SAID does not beat DID in every cell. The text says SAID improves consistently §4.2. In Table 1, RoBERTa-Large on QQP is tied at 774 tab. 1.
- d_{90} is an upper bound, and the authors say so. Random projections and the Fastfood restriction make the estimate crude, so the true intrinsic dimension is probably lower §4.2.
- Dense projections are infeasible at scale. The authors estimate 1.42 TB to store a dense projection matrix for RoBERTa-Large at d=1000 §3. Use Fastfood or a sparse projection.
- The trajectory experiment retrained RoBERTa-Base. The checkpoints were trained from scratch with 200k steps and a batch size of 1k §5.1. They are not the public RoBERTa checkpoints, so curves will not match published models.
- Points with no d_{90} are omitted from the trajectory plots. These are checkpoints where the full checkpoint could not reach above majority-class accuracy, or where SAID training did not stabilise fig. 2.
- The bound's index is ambiguous. Eq. 4 writes \max_{i \ne y} f(x)[j], using i in the condition but j in the expression eq. 4. We read both as the same index.
- The bound has a gap in the proof. The appendix derives a bound in terms of \hat{\mathcal{L}}_{\gamma} with \log r eq. 7, and the final statement uses \hat{\mathcal{L}}_{0} and drops \log r eq. 8. The step between them is not written out, and the constants are not stated app. A.1.
- The bound only covers subspace-trained models. The authors state that it applies only to models trained in the intrinsic-dimension subspace, and that SGD is not proved to optimise in that subspace §5.3.1.
- d_{90} is sensitive to the search procedure. It is defined through the learning-rate search and the full-fine-tuning baseline §4.1 §5.1. The paper reports no run-to-run variance across seeds.
Lineage
- Builds on: arXiv:1804.08838, "Measuring the intrinsic dimension of objective landscapes" (Li et al.), which defines the subspace method and the DID projection §2 §3. The Fastfood transform is from Le et al. §3. The structure-aware variant SAID is the new contribution here §3.
- Uses the pretraining recipe of RoBERTa, arXiv:1907.11692, for the trajectory experiment §5.1.
- Compared against: DID within this paper, plus standard full fine-tuning as the reference. No external method is compared.
- Superseded by: not known from content already in this wiki.
Source and license
Adapted from “Intrinsic Dimensionality Explains the Effectiveness of Language Model Fine-Tuning” by Armen Aghajanyan, Luke Zettlemoyer, Sonal Gupta (arXiv:2012.13255), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.