# Total Variation Distance Estimation in Autoregressive Models

DevFeed: [Total Variation Distance Estimation in Autoregressive Models](<https://devfeed.tech/articles/total-variation-distance-estimation-in-autoregressive-models-128561.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2607.19510>)

Author: Eric Price, Kevin Tian, Zhiyang Xun, Yusong Zhu

Published: 2026-11-11T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [sglang](<https://devfeed.tech/topics/sglang.md>), [vllm](<https://devfeed.tech/topics/vllm.md>), [quantization](<https://devfeed.tech/topics/quantization.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [autoregressive](<https://devfeed.tech/tags/autoregressive.md>), [batching](<https://devfeed.tech/tags/batching.md>), [cs-ds](<https://devfeed.tech/tags/cs-ds.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [distribution](<https://devfeed.tech/tags/distribution.md>), [estimator](<https://devfeed.tech/tags/estimator.md>), [inference](<https://devfeed.tech/tags/inference.md>), [kl-divergence](<https://devfeed.tech/tags/kl-divergence.md>), [llm](<https://devfeed.tech/tags/llm.md>), [quantization](<https://devfeed.tech/tags/quantization.md>), [queries](<https://devfeed.tech/tags/queries.md>), [robustness](<https://devfeed.tech/tags/robustness.md>), [sample](<https://devfeed.tech/tags/sample.md>), [serving](<https://devfeed.tech/tags/serving.md>), [sglang](<https://devfeed.tech/tags/sglang.md>), [sigma](<https://devfeed.tech/tags/sigma.md>), [stat-me](<https://devfeed.tech/tags/stat-me.md>), [stat-ml](<https://devfeed.tech/tags/stat-ml.md>), [theoretical](<https://devfeed.tech/tags/theoretical.md>), [token](<https://devfeed.tech/tags/token.md>), [tv](<https://devfeed.tech/tags/tv.md>)

## AI overview

The paper estimates total variation distance between length-n autoregressive distributions, motivated by serving engines producing different distributions despite using identical model weights. It gives three query guarantees for additive error ε: sample access uses Õ(n²K/ε²), improving on the cited Õ(n³m/ε⁵) estimator; logit access uses O(n/ε²), which the authors say is tight; and probabilities known to relative error σ use Õ((n+n²σ²)/ε²). The authors also report experiments, including comparing SGLang and vLLM on identical weights, and say TV remains estimable in cases where KL divergence is infinite.

## Source excerpt

arXiv:2607.19510v2 Announce Type: replace Abstract: Modern LLM deployments use a number of implementation choices and inference optimizations (e.g., batching, custom kernels, and quantization) on top of fixed weights, so two engines serving "the same model" can produce meaningfully different distributions. We study the problem of estimating the total variation (TV) distance between two length-$n$ autoregressive distributions to additive error $\varepsilon$, under three access models. (1) Under sample access, we use $\widetilde{O}(n^2 K/\varepsilon^2)$ queries, where $K$ is the maximum support of the next-token distribution. This improves upon the $\widetilde{O}(n^3 m/\varepsilon^5)$-query estimator of Meel et al. (2025), where $m \geq K$ is the total size of the token alphabet. (2) Under logit access, we use $O(n/\varepsilon^2)$ queries, and this is tight. (3) Under noisy logit access, we smoothly interpolate between the above two guarantees: if probability values are given to relative error $\sigma$, we use $\widetilde{O}((n+n^2\sigma^2)/\varepsilon^2)$ queries. We complement our theoretical results with an empirical evaluation of our algorithms, for example measuring the distance between SGLang and vLLM serving identical weights. Our experiments highlight the robustness and practicality of estimating the total variation distance, which remains estimable where the KL divergence is infinite. Our code is available at https://github.com/XunZhiyang/llm-tv-estimation.