In-Sample Moments "Generalize" under Overfitting
As a hitchhiker in learning theory, I constantly bump into a weird kind of problems, where an overfitted hypothesis still predicts certain population quantities accurately. One specific instance is about the 2nd moment of prediction which will be today’s topic.1 After being haunted by the issue for years,2 I finally figured out a way to nicely characterize the phenomenon.
Problem Setup
Consider a standard least-square regression problem where we have i.i.d. sample . Let be ERM from function class , i.e.,
where denotes empirical expectation. Let’s assume realizability, i.e., where is the Bayes-optimal predictor. All and are bounded in . The quantity of interest is
The goal is to show that is bounded by something not large. (As we will see, this something may not be fixed!)
Standard Approach
The standard approach is to show that since with enough data. To ensure this, we need to pay , the complexity of the function class (e.g., for finite classes, or dimensionality for linear): with high probability,
Define , then , and
The second term is controlled by . For the first term, we can use standard concentration to relate to and this term does not involve since it’s w.r.t. a fixed function . As increases, the upper bound converges to .
The Overfitting Regime
The problem with the above bound is that when is extremely expressive, the bound can grow indefinitely with all the way to infinity. However, if we completely overfit, then we’d have , and
which clearly concentrates towards in a -free manner! Believe or not, I have run into a number of scenarios like this, where an upper bound close to is totally acceptable.3 (NB: this is a different target compared to the previous analysis where the upper bound is close to .) What I’d really love to have is a single bound that covers both cases: in the good-fit regime ( small), the bound should be close to ); in the over-fit regime ( large), the bound is close to ). Better still, perhaps the bound can even provide characterization for the continuous spectrum in between.
Unified Analysis through Empirical Pythagoreans
I gave this weird problem some thought every time I ran into it, but always gave up due to its messiness and lack of urgency. Thanks to LLMs, I was able to dig into it deeply recently and figured out a solution. The key is the empirical Pythagoreans that4
which holds as long as is closed under scaling, i.e., for constant scalar . To see why this is true, note that the identity will generally be violated by a cross-term
On the other hand, given is ERM, we can consider the derivative of the empirical loss along the direction of , which should be at :
which establishes the empirical Pythagoreans. Then
For the first term, concentrates to and this clearly does not involve ; in fact, we need to pay this anyway even in the perfect overfitting case (). The second term is the empirical loss of , ; let be the population loss. Therefore, to obtain an upper bound on , we need a lower bound on . One trivial (but later useful) lower bound is . Another comes from bounding
as the first term is bounded by concentration + union bound, and the second can be similarly bounded by introducing . Therefore, the second lower bound of is
Put together into Eq.(1), we have
This perfectly captures both the good-fit and over-fit regimes: when is very large, the is active inside and we have an upper bound close to ; when is small, becomes active; when combined with , this recovers
As conclusion, the “” is not as elegant as I hoped, but given the numerous failures I am pretty satisfied with the current form. Also it does provide characterization for the intermediate regime where gradually decreases below . Finally, I believe the analysis also holds in the misspecified case where we replace with the population best fit (which may not be unique), as long as we have closure under rescaling and . This enables the population version of Pythagoreans for which is the only property we need.
Footnote Remarks
-
A simpler example is when we predict , which is always accurate provided that is closed under offset, as that implies . ↩
-
Some years ago when Alekh, Sham, and I discussed RL at MSR (that was before we started working on the book), Sham once made a point along the lines of: if you fit TD from on-policy trajectories, and you totally overfit, then it just recovers Monte-Carlo? which is very much along the spirit of this post. And guess what, we are working on something related (and very exciting!) and that’s what got me into this rabbit hole again… ↩
-
An example is Proposition 3 here. Generally this result might be useful when you care about the loss rather than the minimizer (i.e., min vs. argmin). ↩
-
In fact we could stop here, as it shows that . We can just combine this with the previous -based bound and take the minimum over the two. I think technically this is not much different from what I am doing in the main text, but retrospectively this alternative approach feels conceptually more straightforward…? ↩