← Latest papers
📊 statistics

Total Variation Distance Estimation in Autoregressive Models

This paper presents efficient algorithms for estimating the total variation distance between two length-nn autoregressive distributions under sample, logit, and noisy logit access models, offering significant improvements over prior methods and demonstrating practical utility in quantifying distributional differences between modern LLM inference engines.

Original authors: Eric Price, Kevin Tian, Zhiyang Xun, Yusong Zhu

Published 2026-07-23
📖 7 min read🧠 Deep dive

Original authors: Eric Price, Kevin Tian, Zhiyang Xun, Yusong Zhu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Invisible Differences Between AI Twins

Imagine you have two identical twins. They were raised in the exact same house, eat the same food, and have the same DNA. If you ask them a question, you expect them to give the exact same answer, word for word. In the world of Artificial Intelligence, specifically Large Language Models (LLMs), the "DNA" is the model's weights—the mathematical brainpower stored in a file. But in the real world, things aren't that simple. Just like twins might react differently depending on whether they are tired, hungry, or talking to a friend, AI models can produce different results depending on the computer hardware they run on, how many questions they are answering at once, or even tiny, invisible glitches in the software code.

To measure how different two things are, scientists often use a tool called "Total Variation Distance" (TV). Think of this as a "mismatch meter." If you have two bags of marbles, and you pull one out of each, the TV distance tells you the maximum chance that the two marbles will be different colors. It's a perfect score for "how likely are these two things to disagree?" This is different from other tools that try to measure "how surprised" a model is, which can break down completely if the models disagree on even a single word. The big question researchers are asking is: If two companies claim to be running the exact same AI model, are they actually giving you the same experience, or are there hidden differences lurking in the code?

The Paper's Mission: Catching the Ghosts in the Machine

This paper, titled "Total Variation Distance Estimation in Autoregressive Models," is a detective story about finding those hidden differences. The authors, a team from the University of Texas at Austin, realized that while two AI engines might look identical on paper, the way they actually generate text can drift apart due to things like "batching" (answering many questions at once) or "quantization" (simplifying numbers to save space). They wanted to build a reliable way to measure the Total Variation Distance between two AI engines to see just how much they disagree.

The authors discovered that measuring this distance is tricky because AI models don't just spit out answers; they build them one word at a time, like a chain reaction. If you only get to see the final answer (like a sample), it's like trying to guess the plot of a movie by watching only the last scene. To solve this, they developed three different "superpowers" or ways to peek under the hood, and they found that the more you can see, the easier the job becomes.

1. The "Sample" Superpower (The Blindfolded Guess)
The most basic way to check an AI is to ask it a question and see what it says. This is called "sample access." The authors found that if you only have this view, you need to ask the AI a lot of questions to get a good measurement. Specifically, the number of questions you need grows with the square of the story length (n2n^2) and the size of the vocabulary's "active" list (KK). It's like trying to map a huge forest by walking a single path; you have to walk it many, many times to be sure you haven't missed a hidden clearing. Their method improves on previous attempts, making it faster, but it still requires a massive number of queries.

2. The "Logit" Superpower (The X-Ray Vision)
Many AI systems also show their "logits," which are the raw numbers the model uses to decide what word comes next, before it turns them into a final choice. This is like seeing the AI's internal thought process. The authors showed that if you have access to these numbers, the job becomes incredibly easy. You only need a number of queries that grows linearly with the story length (nn). It's a huge leap forward—like switching from walking through the forest to flying over it in a helicopter. They proved that this is the absolute fastest way to do it; you can't do it any quicker than this.

3. The "Noisy Logit" Superpower (The Foggy Window)
Here is where it gets really interesting. In the real world, those "logit" numbers aren't always perfect. Sometimes the computer is busy, or the software is slightly buggy, and the numbers come back a little fuzzy or "noisy." The authors realized that if you treat this noise as a known quantity (like knowing how foggy your window is), you can still get a great measurement. They created a method that smoothly blends the "blindfolded" and "X-ray" approaches. If the noise is low, you act like you have X-ray vision. If the noise is high, you act more like you are blindfolded. This is the most practical tool because it works even when the AI isn't behaving perfectly.

Putting It to the Test: The Real-World Showdown

To prove their methods work, the authors didn't just stay in the lab. They set up a real-world experiment comparing two popular AI engines, vllm and sglang, running the exact same model (Qwen3-0.6B). They wanted to see if these two engines, which are supposed to be identical, actually produced the same text.

They found that the engines did disagree. The Total Variation Distance between them was about 0.586 for a 500-word story. This number represents the maximum difference in probability between the two engines for any possible outcome. In practical terms, it means that if you were to run a specific test to tell the two engines apart, the best possible test would succeed roughly 59% of the time. It is a measure of how distinguishable the two engines are, rather than a direct probability that any single random sentence generated by one will be different from the other.

The study also revealed why they disagreed. Sometimes, one engine would pick a word that the other engine considered impossible (a "support mismatch"), causing the distance to spike. Other times, they picked the same words but assigned them slightly different probabilities. The authors also noticed that the "noise" in the system changed depending on how the engines were configured. For example, if you asked the engines to answer 256 questions at once, the noise increased, making the measurements fuzzier. But their new "multilevel" method was smart enough to handle this. By asking the same question many times and averaging the results, they could filter out the noise and find the true distance.

The Takeaway

The paper concludes that we can now reliably measure how different two AI engines are, even when they are running on different hardware or using different software tricks. They proved that while it's hard to do this if you only see the final answers, it becomes much easier if you can peek at the internal numbers. Most importantly, they showed that even when those numbers are a bit noisy, we can still get an accurate picture by using their new statistical tricks.

This matters because as AI becomes more common, companies need to know if their "cheap" version of a model is actually the same as the "expensive" one, or if a new, faster software update is secretly changing how the AI behaves. The authors have provided the ruler to measure these invisible differences, ensuring that when we say two AIs are the same, they really are. Their code is now available for anyone to use, turning this complex math into a practical tool for the future of AI.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →