No Unbiased Estimator of the Variance of K-Fold Cross-Validation

Yoshua Bengio, Yves Grandvalet

K-fold cross-validation is the industry standard for estimating how well a machine learning model will perform on unseen data. However, a seminal mathematical proof reveals a sobering reality: there is no "magic formula"—no universal unbiased estimator—to tell us exactly how much that performance estimate might vary. Because cross-validation reuses the same data points across different folds, it creates a complex web of correlations that makes a perfect variance estimate mathematically impossible.

The Illusion of Independent Samples

When we train a model, we don't just want to know its error rate; we want to know how much we can trust that number. If a model has a 5% error rate, is that a solid 5%, or could it swing between 2% and 10% depending on the specific training data?

To answer this, we usually calculate the variance. In simple statistics, if you have independent samples, calculating variance is straightforward. But in K-fold cross-validation, the samples are not independent. Each "fold" shares a large portion of its training data with every other fold. This overlap creates correlations that standard variance formulas ignore, leading researchers to often overconfidently report "error bars" that are much smaller than they should be.

Deconstructing the Variance

Rather than relying solely on empirical testing, the authors approach this problem through rigorous mathematical proof. They begin by breaking down the total variance of the cross-validation estimate into three distinct components:

  1. $\sigma^2$ (Variance): The inherent variation of errors on "true" test examples.
  2. $\omega$ (Within-block covariance): The correlation between test errors in the same fold because they share the exact same training set.
  3. $\gamma$ (Between-block covariance): The correlation between errors in different folds because their training sets overlap significantly.

Most practitioners only consider $\sigma^2$. However, the paper demonstrates that $\gamma$ (the overlap between folds) is often the dominant factor, especially in small datasets.

Using a proof by contradiction, the authors define a general class of estimators (quadratic forms of the errors). They show that for an estimator to be unbiased across all possible data distributions, it would have to satisfy a set of linear equations that are mathematically impossible to solve simultaneously. Furthermore, an eigenanalysis of the covariance matrix reveals that one specific component of the variance (tied to an eigenvalue $\lambda_3$) is simply "hidden" when working with a single dataset.

Experimental Evidence and the "No-Go" Theorem

The primary theoretical result is a formal "No-Go" theorem: There exists no universal unbiased estimator of the variance of K-fold cross-validation.

To illustrate these theoretical findings, the authors use synthetic datasets, including Gaussian Mixture Models and outlier scenarios. By running 100,000 independent experiments, they could establish the "true" variance and compare it against what a single cross-validation run would predict.

Experimental results illustrating the gap between true variance and standard estimators.

The experimental results are striking: standard variance estimators, which ignore fold correlations, underestimate the true variance by a massive margin. This underestimation is particularly severe when the learning algorithm is "unstable"—meaning small changes in training data lead to significant changes in the resulting model.

Key Takeaways and the Path Forward

  • The Cost of Data Reuse: The very mechanism that makes cross-validation powerful—using every data point for both training and testing—is exactly what makes its variance unestimable. The dependencies are permanently baked into the process.
  • Two-Fold CV is Not a Loophole: It was previously thought that 2-fold cross-validation might bypass this issue because the training sets are independent. The authors debunk this myth: the test sets remain correlated because the training set for one fold is the test set for the other.
  • Impact of $K$: As the number of folds ($K$) increases, the contribution of the "between-block" correlation ($\gamma$) changes, but it never completely disappears.

Where do we go from here? The proof applies specifically to universal estimators—those designed to work regardless of the underlying data distribution. If researchers make specific assumptions about their data (e.g., assuming it is strictly Gaussian), it may be possible to find a biased but "good enough" estimator.

Ultimately, since a perfect unbiased estimator is impossible, the field must pivot toward developing better heuristics and intentionally biased estimators. These new tools must explicitly acknowledge the correlations inherent in cross-validation, rather than relying on the demonstrably false assumption that cross-validation folds are independent and identically distributed (i.i.d.).

Summary updated

BibTeX
@inproceedings{bengio2003no,
  author = {Yoshua Bengio and Yves Grandvalet},
  title = {{No Unbiased Estimator of the Variance of K-Fold Cross-Validation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2003},
}
Figure