Does Your Neural Network Extrapolate? Feature Engineering as Identifiability Bias for OOD Generalization

Leonel Aguilar, Jan Nagler, Christoph Hoelscher, Nino Antulov-Fantulin

TL;DR

Deep neural networks are phenomenal interpolators, yet they famously fall apart when asked to extrapolate beyond their training window. This paper proves that from a finite training window alone, the true underlying data-generating process is mathematically impossible to identify—meaning "feature engineering is dead" is only true inside your training distribution. To generalize out-of-distribution (OOD), someone—either you via feature maps or a foundation model's input format—must explicitly supply the right structural assumptions.

What Problem Does This Paper Address?

Imagine looking at a curve on the interval $[-\pi, \pi]$. Is it $\sin(x)$, or is it a degree-9 Taylor polynomial? Within that window, the two are practically indistinguishable—their maximum deviation is tiny, easily swallowed by a whisper of noise. Yet step just outside that window into $[\pi, 3\pi]$, and the polynomial rockets off to infinity while the sine wave calmly oscillates on.

Figure 1: Left: sin(x) (green) and its degree-9 Taylor polynomial (black) can be observationally equivalent on the training window (depending on noise and amount of samples) and diverge on [π, 3π]. Models (MLP, SINDy, TabPFN, TimesFM) trained/evaluated on the Original (raw) space without noise are shown. “raw” corresponds to “None” feature map in the tables (untransformed inputs). “On sin” and “on Taylor-9” identify the source of the training or forecasting-context data. Right: in Fourier coordinates φ(x) = (sin x, cos x), both (ID, OOD) map to the same circle S1, turning OOD extrapolation into interpolation.

This is the fundamental trap of out-of-distribution (OOD) extrapolation. Statistical learning theory guarantees that neural networks generalize well in-distribution (ID), where test data looks like training data. However, on any finite training window, infinitely many data-generating processes (DGPs) agree within noise tolerance while diverging wildly outside it. Standard empirical risk minimization (ERM) and cross-validation are completely blind to this choice. The authors ask: when can neural networks actually extrapolate, and what breaks the tie between equally plausible realities?

Methods

The authors formalize observational equivalence on a finite window and introduce the DGP commitment: a joint triplet $(\varphi, \psi, \mathcal{M})$ consisting of an input feature map ($\varphi$), an invertible label map ($\psi$), and a model class ($\mathcal{M}$). Rather than treating feature engineering and architecture as separate knobs, they show these three act as a single structural commitment that locks in an assumed continuation beyond the training data. For instance, mapping $x \mapsto (\sin x, \cos x)$ wraps both training and OOD points onto the same unit circle, turning dangerous extrapolation into safe interpolation.

Beyond theory, the authors deliver three practical tools for engineers:

  1. Near-boundary validation: Holding out a narrow strip of data just past the training boundary (rather than random internal folds) to catch diverging hypotheses early.
  2. The SINDy $\delta_{\text{OOD}}$ diagnostic: Using sparse identification of nonlinear dynamics (SINDy) residuals to flag whether candidate feature coordinates admit clean, sparse governing equations.
  3. CE/PE reframing: Treating Content Embeddings (CE) and Positional Embeddings (PE) in sequence models (Transformers, Mamba, S4D) as explicit feature-engineering channels.

Datasets

The paper evaluates its framework across both synthetic benchmarks and real-world scientific datasets:

  • Synthetic Benchmarks: Minimal DGP pairs ($\sin(x)$ vs. Taylor-9; power law vs. exponential), a 2-node synthetic mass-action kinetics (MAK) graph, a periodic sequence-annotation task, and a newly constructed periodic $d$-torus benchmark designed to stress-test sample coverage, dimensionality, interaction order, and noise.
  • Natural-Science Datasets:
  • Physics: NASA Exoplanet Archive (predicting orbital periods via Kepler's third law, training on $a < 0.5\text{ AU}$ and testing up to $20\text{ AU}$).
  • Biology: Cross-species coding-DNA (CDS) detection (training on S. cerevisiae yeast chromosomes and testing zero-shot across five organisms spanning 19%–65% GC content, like E. coli and M. tuberculosis).
  • Histopathology: Camelyon17-WILDS ($96\times96$ H&E-stained lymph-node patches across multiple hospitals with different staining protocols).
Figure 2: Concept figures for the four natural-science domains. (a) MAK: predicted (pink) and true (blue) streamlines for raw inputs (left) and bilinear features (right). (b) Kepler: iso-T contours, ID shaded blue and OOD red. Log-OLS (green) overlays the true levels everywhere, the raw MLP (pink dashed) departs from them for a ≥0.5 AU. (c) CDS: three genetic-code feature maps that transfer zero-shot across organisms. (d) Histopathology: training (c0, c3) and held-out (c2) patches before and after the stain map φ.

Key Insights and Ideas

  • Features alone aren't enough—they must match the model class: Giving a model the exact right log-transformed coordinates $(\log x, \log y)$ for a power-law problem yields 3.2% OOD error with linear regression (OLS), yet fails miserably (83.3% error) with an MLP head because the MLP doesn't commit to linearity in that space.
  • Frozen foundation models inherit commitments via input format: Without changing a single weight, feeding raw $x$ vs. Fourier columns into TabPFN or TimesFM swings OOD error from total collapse to near-perfect accuracy. Pretraining doesn't magically solve OOD identifiability; it just routes the commitment through how you format the prompt or context.
  • Positional encodings are feature maps, not backbone magic: Across Transformers, Mamba, and S4D, standard PEs (RoPE, sinusoidal, learned APE) fail OOD on periodic tasks (~98–99% error), whereas an exact-Fourier PE drops error near zero regardless of the sequence architecture.
  • Partly wrong commitments can hurt worse than none: On coupled multi-dimensional problems, applying the exact feature map to only some coupled coordinates actually degrades OOD error compared to using raw inputs—even while improving in-distribution training error!

Key Results

  • Toy Sine Extrapolation: Identical MLPs achieve 0.3% ID error on $\sin(x)$, but OOD error drops from 155.9% (raw input) to 0.3% (Fourier features)—a ~520$\times$ improvement. TabPFN drops from 226.2% to 0.1% OOD error with zero gradient steps.
  • Natural Sciences:
  • Chemistry (MAK): Bilinear features + OLS achieve 0.0% OOD error vs. 24.4% for raw MLP.
  • Physics (Kepler): Log-space SINDy/OLS hit 2.1% / 3.8% OOD error vs. 79.0% for a raw MLP.
  • Biology (DNA): Injecting genetic-code features lifts zero-shot cross-species AUROC to 0.750–0.960, whereas standard positional encodings collapse to 0.445–0.824 (falling below random chance on M. tuberculosis).
  • Histopathology: Physics-based Macenko stain normalization lifts held-out hospital AUC from 0.754 to 0.984 while shrinking seed variance ~60$\times$.
  • Practitioner Tools: Near-boundary validation selects the true periodic DGP 100% of the time vs. 81.3% for standard cross-validation. The SINDy $\delta_{\text{OOD}}$ diagnostic correlates strongly with wrong feature maps (Spearman $\rho = 0.82$, $p = 1.3 \times 10^{-9}$).

Limitations and Future Work

The authors are transparent about where their guarantees stop:

  • Noise vs. Signal Regimes: Their main theoretical blindness bound (Proposition 1) is mathematically tight only when noise dominates the in-window gap ($\varepsilon_W \sqrt{n} \ll \sigma$), though empirically cross-validation still gets fooled in low-noise regimes due to polynomial overfitting.
  • Necessary, Not Sufficient: Even with the exact right feature map, OOD generalization collapses if the model lacks capacity for high-order feature interactions or if sample coverage falls below $N \lesssim 4^d$ in $d$ dimensions.
  • Diagnostic Blind Spots: Near-boundary validation requires access to data slightly outside the training window, and the SINDy diagnostic cannot rank feature maps for non-polynomial dynamics (like $\tanh$).
  • Future Directions: Extending sparse-identifiability bounds to finite samples and using near-boundary data to automatically discover $\varphi$ rather than hand-crafting it.

Summary updated

Abstract

Deep neural networks can learn salient features from an in-distribution (ID) training window without identifying the data-generating structure needed for out-of-distribution (OOD) generalization. Understanding this limitation requires examining the identifiability of the data-generating process (DGP). From a single training window, the DGP that yields the correct OOD extrapolation is not identifiable: infinitely many DGPs are observationally equivalent within a fixed tolerance on that window yet diverge arbitrarily beyond it, and no ID criterion alone can reliably distinguish them. A structural commitment—the feature map, label map, and model class $(\varphi, \psi, \mathcal{M})$—specifies the assumed DGP and governs OOD generalization while leaving ID performance essentially unchanged. When architecture, pretraining, data augmentation, input formats, or domain knowledge implicitly supply the correct commitment, the model generalizes beyond the training window. When it cannot infer OOD-relevant structure from ID evidence, it fails to generalize. When the commitment is correct {\em and} identifiable, OOD error vanishes. We demonstrate this mechanism in models trained from scratch and in foundation models across four natural-science settings (chemistry, physics, biology, and histopathology), as well as in a positional-encoding study spanning Transformer, Mamba, and S4D architectures. Finally, a controlled study shows that correct features are necessary but not sufficient for OOD generalization.
BibTeX
@inproceedings{aguilar2026does,
  author = {Leonel Aguilar and Jan Nagler and Christoph Hoelscher and Nino Antulov-Fantulin},
  title = {{Does Your Neural Network Extrapolate? Feature Engineering as Identifiability Bias for OOD Generalization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=7Df6LrvRJh},
}
Figure