When we evaluate a machine learning model using $K$-fold cross-validation, we are looking for two things: an estimate of the model's expected error and a measure of how much that estimate might fluctuate—its variance. While cross-validation is excellent at providing an unbiased estimate of the mean error, calculating the "error bars" around that mean is a fundamentally harder problem.
Research by Yoshua Bengio and Yves Grandvalet in No Unbiased Estimator of the Variance of K-Fold Cross-Validation proves a sobering "no-go" theorem: there is no universal, unbiased way to estimate the variance of a cross-validation result.
The Problem of Inseparable Correlation
The core reason variance estimation fails is that the "folds" in cross-validation are not independent. In a standard $K$-fold setup, each training set overlaps significantly with the others. If you have 5 folds, any two training sets share 75% of the same data.
Because the training sets are so similar, the errors the model makes on each test fold are correlated. If the model performs poorly on Fold 1 because of a specific subset of training data, it is likely to perform similarly on Fold 2 because that same data was likely used to train the second model as well.
To calculate an unbiased variance, an estimator would need to perfectly account for these correlations. However, Bengio and Grandvalet demonstrated that these dependencies are "inseparable." They showed that any general variance estimator can be represented as a system of linear equations. For the estimator to be unbiased across all possible data distributions, these equations must be satisfied simultaneously. Their proof shows that these constraints are mutually exclusive—solving for one type of correlation inevitably biases the estimate of another.
Why We Can't Just "Look" at the Folds
It is tempting to think we can estimate the variance by simply looking at the spread of the $K$ different error scores. But these $K$ scores do not contain enough information to disentangle the three sources of variance:
- The inherent noise in the data.
- The variance due to the specific choice of training samples.
- The variance due to the specific choice of test samples.
Because the training sets overlap, the "internal" variance of the cross-validation process is baked into the results in a way that cannot be reversed without knowing the underlying data distribution—which, in a learning problem, is exactly what we don't know.
Generalizing to Multiple Sources
This problem becomes even more acute when data is not "identically distributed," such as when data is collected from different hospitals, users, or time periods. In Multiple-source cross-validation, Charles Sutton and Krzysztof J. Geras extend this logic to real-world settings where we care about how a model generalizes to a new source of data.
In these "multiple-source" scenarios, the variance is arguably more important than the mean error because it tells us about the stability of the model across different contexts. However, they reiterate the fundamental challenge identified by Bengio: without making highly restrictive (and often unrealistic) assumptions about the data, we cannot derive a variance estimate that we can truly trust.
Practical Implications
The takeaway for researchers is not that cross-validation is broken, but that its "error bars" are inherently deceptive. When you see a confidence interval reported for a cross-validation score, that interval is likely biased—usually underestimating the true uncertainty because it fails to account for the complex correlations between folds. We use cross-validation to see how well our model works, but we must accept that we cannot precisely know how much that performance estimate will vary on a new draw of data.