First Steps Toward Understanding the Extrapolation of Nonlinear Models to Unseen Domains

Kefan Dong, Tengyu Ma

Machine learning models often fail when moved from the controlled environment of a lab to the messy reality of the real world—a phenomenon known as domain shift. While linear models have well-understood rules for how they extrapolate to new data, nonlinear models (like neural networks) are notoriously unpredictable outside their training range.

This paper provides a theoretical framework for understanding how certain nonlinear models can generalize to data distributions they have never seen before, proving that extrapolation is guaranteed under specific structural conditions.

The Problem: Beyond Bounded Density

Standard machine learning theory usually relies on the "bounded density ratio" assumption. This essentially requires the test data to be a subset of the training data. However, this does not cover true extrapolation—predicting on novel combinations of features the model has never encountered.

For linear models, extrapolation is straightforward: if the training data "covers" all directions in space (i.e., has a well-conditioned covariance matrix), the model can reliably extrapolate. For nonlinear models, this mathematical guarantee breaks down. A two-layer neural network can fit training data perfectly, only to "hallucinate" wildly on a data point just slightly outside the training set.

The authors ask a fundamental question: Under what mathematical conditions can we guarantee that a nonlinear model will behave predictably on a completely new domain?

Methodology: Additive Models and Error Ratios

To tackle this, the authors focus on a specific, structured class of nonlinear models called additive models:

$$f(x) = \sum_{i=1}^d f_i(x_i)$$

In this setup, each $f_i$ can be any arbitrary, complex nonlinear function of a single feature (or a subset of features). While simpler than a full-blown Transformer, this class is significantly more expressive than standard linear models.

To measure extrapolation success, they introduce the $\mathcal{F}$-restricted error ratio ($\mathcal{F}$-RER). This metric calculates the "worst-case" ratio between the error on the test distribution ($Q$) and the error on the training distribution ($P$). A small ratio guarantees that the model will extrapolate well.

The paper utilizes two main mathematical lenses to bound this error:

  1. Spectral Analysis of Laplacians: For discrete data, the joint distribution is treated as a bipartite graph, using its connectivity (eigenvalues) to prove stability.
  2. Gaussian Kernel Theory: For continuous data, eigenfunctions of Gaussian distributions are used to show that if features are sufficiently "entangled" (correlated) during training, the model cannot fluctuate uncontrollably in the test domain.

Key Insights: Marginals and Connectivity

Rather than relying on standard image or text benchmarks, the authors use stylized synthetic distributions to prove their theorems. A core finding is that marginals matter more than joints. You do not need to see every possible combination of features during training. As long as the model has seen the full range of each feature individually (marginal coverage) and those features are correlated, it can learn the underlying components.

Comparison of training distributions showing conditions for successful extrapolation to a test distribution.

As illustrated above, extrapolation depends heavily on the structure of the training data:

  • No Marginal Coverage (a): The model fails because it hasn't seen the full range of individual features.
  • Clusterable (b): If the data can be split into isolated clusters that never interact, the model cannot learn the relationship between them, and extrapolation fails.
  • Marginal Coverage + Non-clusterable (c): Even if the training support is sparse (like an L-shape or checkerboard), the model can successfully fill in the gaps and extrapolate to the test distribution ($Q$) if the data is "connected" and marginals are covered.

The authors also prove a "lower bound" showing that without these structural assumptions, general two-layer ReLU networks can fail arbitrarily. This "impossibility" result justifies the necessity of focusing on additive models to achieve positive theoretical guarantees.

Formal Results

The paper formalizes these insights into several key theorems:

  • Discrete Case (Theorem 2): The error ratio is bounded by the second eigenvalue of a "signless Laplacian" matrix. If the bipartite graph of the data is well-connected, the model extrapolates.
  • Gaussian Case (Theorem 3): For continuous features, if the features are pairwise Gaussian and the covariance matrix is non-degenerate ($\lambda_{min} > 0$), the error ratio is bounded by $d / \lambda_{min}$.
  • Multi-dimensional Features (Theorem 4): This extends to cases where $x$ is split into blocks (e.g., $x_1$ is an image, $x_2$ is text). Nonlinear interactions within those blocks are permissible, provided the blocks themselves remain additive.

Limitations and Future Work

While a significant step forward, the framework has limitations. The results are strictly limited to additive models and do not yet cover models with complex, cross-variable interactions (like $x_1 \cdot x_2 \cdot x_3$) common in deep learning. Furthermore, the continuous results rely heavily on Gaussian marginals, which rarely perfectly align with real-world data, and the focus remains on $L_2$ regression rather than classification.

Ultimately, the authors suggest these "first steps" could pave the way for a more general theory for full neural networks, potentially by viewing complex networks as compositions of these simpler, structured additive models.

Summary updated

BibTeX
@inproceedings{dong2023first,
  author = {Kefan Dong and Tengyu Ma},
  title = {{First Steps Toward Understanding the Extrapolation of Nonlinear Models to Unseen Domains}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=7wrq3vHcMM},
}
Figure