Next-token functional estimation

Milind Nakul, Vidya Muthukumar, Ashwin PananjadyarXiv 2026

TL;DR

Classical leave-one-out (LOO) validation techniques fail when applied to sequential data because temporal dependencies violate the assumption of data independence. This paper introduces a generalized "leave-a-window-out" estimation framework that systematically removes a local window of future tokens to break these correlations. The authors prove that this simple modification achieves minimax-optimal, parametric error rates across a diverse class of mixing stochastic processes.

What Problem Does This Paper Address?

In machine learning and statistics, we frequently need to estimate properties of an unobserved future data point (the "next token") based on a sequence of past observations. Common examples include estimating the surprise probability (the chance that the next token is something we haven't seen yet) or predicting the test error of a sequence-trained classifier.

Classically, these properties are estimated using the leave-one-out (LOO) principle, such as the famous Good–Turing estimator for surprise probability. LOO works beautifully when data points are independent and identically distributed (i.i.d.) because the sample is symmetric. However, real-world sequential data—like text, genomic sequences, or financial time series—is full of temporal dependencies. If you delete just a single point, its immediate neighbors remain in the dataset, highly correlated with the omitted point. This correlation breaks the LOO logic, causing standard estimators to suffer from severe, non-vanishing bias.

Methods

To fix this flaw, the authors propose a leave-a-window-out estimator. Instead of treating a single omitted point $X_i$ as a proxy for the unseen future point, the algorithm drops a contiguous window of length $\tau$ immediately after index $i$ before computing the empirical measure.

Formally, for each index $i$, the data is partitioned into a deletion window $D_i = \{k \in [i, (i + \tau - 1) \wedge n]\}$ and a retained set $\mathcal{I}_i = [n] \setminus D_i$. The estimator then evaluates the target function using $X_i$ against the empirical measure of the cleaned subset $\mathcal{I}_i$, averaging these proxies across the entire trajectory. When $\tau = 1$, this framework seamlessly reduces back to the classical LOO estimator.

To prove that this method works theoretically, the authors establish a general upper bound on the Mean Squared Error (MSE). They decouple the error into bias and variance:

  1. Bias is controlled by ensuring the stochastic process is sufficiently $\beta$-mixing (meaning far-apart segments become nearly independent).
  2. Variance is controlled using a McDiarmid-style concentration inequality adapted for dependent data via Marton couplings, which quantify how a perturbation at one time step propagates into the future.

Datasets

Because this is a theoretical paper establishing fundamental estimation rates, the authors evaluate their framework using synthetically generated stochastic processes where parameters like mixing times ($T_{\text{mix}}$) and dependence lengths ($\ell$) can be precisely controlled:

  • Repeated-block chains: Processes where i.i.d. base labels are repeated for random block lengths.
  • Sticky Markov chains: Markov chains with a high probability of remaining in the current state.
  • Moving Average (MA) processes: Linear time series where covariates are sliding window sums of white noise.
  • Autoregressive (AR) processes: Time series where each point depends geometrically on the previous point.

Key Insights and Ideas

  • Asymmetric Deletion Suffices: Crucially, the estimator only drops data points in the future of the proxy point ($\tau$ steps ahead), leaving the past intact. This directional deletion is perfectly tailored to next-token prediction tasks.
  • Robustness to Over-estimation: In practice, choosing the exact window size $\tau$ can be tricky. However, the experiments reveal that overestimating $\tau$ does not degrade performance, whereas underestimating it causes the estimator to fail catastrophically by reverting to standard LOO behavior.
  • A Unified View of Stability: The paper unifies seemingly disparate problems—ecology's missing mass problem, nearest-neighbor search tail probabilities, and algorithmic generalization bounds—under the single mathematical umbrella of "next-token functional estimation."

Key Results

The paper demonstrates both theoretically and empirically that the leave-a-window-out approach successfully recovers the optimal parametric error decay rate of $O(1/n)$ (adjusted by the process's mixing time to $O(T_{\text{mix}}/n)$), where classical methods completely stall.

Figure 1. Failure of leave-one-out estimation under temporal dependence. (a) The Good–Turing estimator, which is the leave-one-out estimator for surprise probability, used on a sticky Markov chain with Tmix = 4. The MSE remains constant as n grows. (b) The leave-one-out test error estimator with the k-nearest neighbor rule for classification. The dependent covariates are generated using the moving average (MA(1)) and autoregressive (AR(1)) process. The labels are obtained using the sign of the first coordinate of the covariates. The MSE decreases at a very slow rate with n. The black dotted line plots the parametric n−1 rate. See Section 5 for more details.

As shown in Figure 1(a), when estimating surprise probability on a sticky Markov chain, the standard Good–Turing (LOO) estimator's MSE remains completely flat as the sample size $n$ increases. Similarly, in Figure 1(b), using LOO to estimate the test error of a $k$-nearest neighbor classifier rule on dependent data results in an incredibly slow error decay. In contrast, the proposed windowed estimator successfully achieves the optimal parametric rate (the black dotted line).

Additionally, the authors prove a matching minimax lower bound of $\Omega(T_{\text{mix}}/n)$ for surprise probability estimation on Markov chains, confirming that their leave-a-window-out principle is information-theoretically optimal.

Limitations and Future Work

  • Uniform Stability Requirements: The theoretical guarantees for classification test error rely on the training algorithm being uniformly stable (meaning the model doesn't change much if you alter one training point). While regularized logistic regression satisfies this, popular algorithms like $k$-NN do not—even though empirical results show the windowed estimator still works well for $k$-NN. Relaxing this assumption is a key open direction.
  • High-Dimensional Scaling: The analysis for nearest-neighbor tail probabilities is currently restricted to real-valued state spaces ($\mathcal{X} \subset \mathbb{R}$). Extending this framework to high-dimensional spaces remains an unexplored challenge.

Summary updated

BibTeX
@misc{nakul2026next,
  author = {Milind Nakul and Vidya Muthukumar and Ashwin Pananjady},
  title = {{Next-token functional estimation}},
  year = {2026},
  eprint = {2609.19529},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.19529},
}
Figure