Can pretrained Transformers deliver semiparametrically efficient inference?

Han Yan, Jin Zhu, Chengchun Shi, Tengyao WangarXiv 2026

TL;DR

Imagine skipping the most grueling math in statistics—deriving "Efficient Influence Functions"—and instead having a neural network give you the mathematically "perfect" answer in milliseconds. This paper proves that a single pretrained Transformer can perform highly accurate statistical inference across a variety of problems, from medicine to economics, without ever being taught the underlying formulas.

What Problem Does This Paper Address?

In the world of "semiparametric inference," researchers try to estimate a specific number (like the average effect of a new drug) while dealing with complex, unknown "nuisance" factors (like the messy, non-linear ways age and lifestyle affect health).

The gold standard for solving this is to use an Efficient Influence Function (EIF). Think of the EIF as a custom-built mathematical "correction" that ensures your estimate is as precise as possible. The catch? Deriving an EIF is hard work. It requires high-level calculus, and you have to start from scratch every time you change your question (e.g., moving from "What is the average effect?" to "What is the effect on the bottom 10%?"). Furthermore, you have to re-run expensive calculations for every new dataset you encounter.

The authors ask: Can we build a "foundation model" for statistics that learns to be efficient once, during pretraining, and then answers any query on any new dataset instantly?

Methods

The researchers developed a pipeline that treats statistical inference as a "translation" task.

  1. Synthetic Pretraining: They generated a massive amount of synthetic data where the "ground truth" (the true effect) is known. Crucially, they didn't tell the model the EIF; they just gave it the data and the true answer.
  2. The Query-Indexed Transformer: Unlike previous models that only answer one type of question, this Transformer takes two inputs: the dataset and a query (e.g., "Give me the 0.8 quantile treatment effect").
  3. Gaussian Score Loss: They trained the model using a specific loss function that forces it to output both an estimate ($\hat{\beta}$) and a covariance matrix ($\hat{V}$). This allows the model to provide not just an answer, but a "Wald-type" confidence interval—essentially telling you how sure it is.
Figure 1: Graphical illustration of the pretraining and amortised inference pipeline.

Datasets

The model was trained entirely on simulated data generated from a variety of "priors," including:

  • OpenML tables: Real-world tabular data structures used to create realistic simulations.
  • Graph-based generators: Creating complex causal relationships.
  • Neural network-based generators: Simulating highly non-linear data.

For evaluation, they tested the model on standard benchmarks for:

  • Average Treatment Effect (ATE)
  • Quantile Treatment Effect (QTE)
  • Partially Linear Regression (PLR)
  • Mean Survival Time (MST)
  • Real-world data: The Infant Health and Development Program (IHDP) dataset, a classic benchmark for causal inference.

Key Insights and Ideas

  • Implicit Efficiency: The most profound finding is theoretical. The authors proved that if you train a Transformer on a "locally flat" prior of sufficient complexity, the model implicitly learns the EIF. It discovers the "perfect" statistical shortcut on its own just by trying to predict the mean of the simulations.
  • Amortized Inference: The "hard work" is done once during pretraining. Once the model exists, it can handle new datasets in a "zero-shot" manner.
  • The "Fixed Population" Penalty: The authors discovered a fascinating theoretical hurdle. While the model is great at being efficient on average across many populations, proving it is efficient for one specific, fixed population (the way classical frequentists prefer) requires an exponential amount of pretraining data. This highlights a fundamental difference between Bayesian-style "average" success and frequentist "guaranteed" success.

Key Results

  • Superior Accuracy: In tests like ATE and PLR, the Transformer (labeled "Ours") consistently achieved lower error (RMSE) than established statistical methods like AIPW or Double Machine Learning.
  • Blazing Speed: The model performs inference in roughly 0.02 seconds per dataset. Traditional machine learning methods often take seconds or minutes because they need to "cross-fit" or retrain parts of the model for every new sample.
  • Valid Uncertainty: The confidence intervals produced by the model were "nearly nominal," meaning if the model says it's 95% sure, it actually captures the true value about 95% of the time.
Performance of ATE estimation (Subfigure A) and coefficient estimation in the partially linear projection (Subfigure B).

Limitations and Future Work

  • Prior Growth: The current theory assumes the pretraining prior "grows" in complexity as the evaluation sample size increases. In practice, we usually pretrain a model once and leave it. Exploring how static models perform as data grows is an open question.
  • Smoothness Assumptions: The theoretical guarantees rely on the data distributions being relatively "smooth." If the real world is significantly "rougher" than the simulations, the efficiency might degrade.
  • Scaling: While the model handles families of queries well, scaling this to even broader, more "general-purpose" statistical tasks remains a goal for the future.

Summary updated

Abstract

Semiparametric models provide a broad framework for statistical inference, yet efficient estimation typically relies on influence function correction tailored to each estimand and on nuisance estimation repeated for every sample. We show that a single pretrained Transformer can deliver efficient estimation and valid inference for a family of estimands in one forward pass, without deriving efficient influence functions or estimating nuisance functions. Pretrained on simulated data with the true parameter as the only label, the Transformer learns the posterior mean and covariance of the queried estimand and hence returns an estimate and a Wald-type confidence region. Theoretically, we prove that, for locally flat pretraining priors of slowly growing complexity, the posterior mean is efficient for every queried estimand. The Transformer inherits this efficiency with asymptotically exact coverage, in probability over evaluation populations and queries, even under distribution shift. We also reveal that the guarantee places much higher demands on pretraining when the data-generating distribution is fixed, as in classical frequentist inference. Experiments on causal inference, partial linear regression, and survival analysis show that the pretrained model generally achieves the lowest estimation error among competing methods, with nearly nominal coverage, at a computational cost of only about 0.02 seconds per dataset.
BibTeX
@misc{yan2026can,
  author = {Han Yan and Jin Zhu and Chengchun Shi and Tengyao Wang},
  title = {{Can pretrained Transformers deliver semiparametrically efficient inference?}},
  year = {2026},
  eprint = {2611.27666},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.27666},
}
Figure