Demonstration 1 of 1
PCA on an embedding before a second stage: the 90% variance rule against cross-validation
If the label signal sits low in the embedding's variance ranking, what does a PCA that keeps 90% of the variance leave for the second stage?
Each principal component is ranked by the variance it explains, which is a property of the embedding alone and never sees the label. When the signal sits among the top directions a few components keep it. When it sits lower, the components that explain 90% of the variance leave it out and the second stage falls back to the soft label. Keeping every component avoids the loss, and cross-validating the choice finds that without needing to know where the signal is.
Scroll sideways for the whole equation
lambda_j is the variance of embedding direction j (largest first), k the number of principal components kept and EV(k) the fraction of total variance they explain.
Predict first. With the signal starting at variance rank 20, how well does a second stage on a PCA that keeps 90% of the variance do, compared with the soft label alone?
Choose an example
Scroll sideways for the whole figure
Constructed example: twenty-four seeded synthetic embeddings with a planted signal, PCA and logistic regression, measured by the chapter activity.
Calculated values
- Soft label alone
- 0.707
- Raw embedding
- 0.823
- 90% variance rule
- 0.695
- Cross-validated choice
- 0.826
- Components in the 90% rule
- 16
With the signal starting at variance rank 20, the 90% rule keeps about 16 components (91% of the variance) and scores 0.695, against 0.707 for the soft label alone and 0.823 for the raw embedding: 0.695 - 0.707 = -0.012, so the reduced embedding has lost the signal. Choosing by cross-validation scores 0.826, and 0.826 - 0.695 = 0.131 is its margin over the rule.
Worked steps
- Soft label alone: 0.707. Raw embedding plus soft label: 0.823.
- 90% variance rule: 0.695 with about 16 components.
- Variance rule against soft label alone: 0.695 - 0.707 = -0.012.
- Cross-validated choice: 0.826; it picked the soft label alone in 0.00 of datasets.
Use the idea
Treat the reduction as a candidate: compare no reduction, the soft outputs alone and a few component counts inside the development folds, fit the projection on training rows only, and assess the frozen choice on untouched rows.
Where the conclusion applies
Constructed data with a linear, equal-strength signal in five directions, a logistic regression stand-in for the chapter's LightGBM second stage, and an independent soft label. Real embeddings do not place their signal on convenient axes, and this activity does not show that this mechanism caused the PCA loss in the Autopilot comparison, which the chapter says was not isolated.
Check your understanding: The 90% rule keeps the same fraction of variance wherever the signal sits. Why does its accuracy change so much?
Chapter 22 source: section "When VLMs Beat Traditional CV Pipelines".