LLMs are Bayesian, In Expectation, Not in Realization
This paper argues that while transformers violate strict exchangeability due to order-dependent predictions, they remain effectively Bayesian in expectation, as their prequential regret decomposes into a cumulative predictive KL divergence that stays competitive with Bayesian posteriors and significantly outperforms frequentist plug-in baselines.
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 Big Question: Are AI Models "Bayesian" or Not?
Imagine you are trying to guess the next word in a story. A Bayesian approach is like a super-smart detective who has a perfect mental rulebook. If you give the detective a set of clues (examples), they should arrive at the exact same conclusion about the next word, no matter in what order you hand them the clues. If you swap Clue A and Clue B, the answer shouldn't change.
For a long time, people hoped Large Language Models (LLMs) were these perfect detectives. But recent tests showed they aren't. If you shuffle the order of the examples in the prompt, the AI sometimes gives a different answer. This seemed to prove that AI models are not following the perfect Bayesian rules.
This paper argues that this "failure" is a misunderstanding. The authors say: "Stop looking at whether the AI is perfect in every single instance. Instead, look at how much 'penalty' the AI pays for being imperfect."
The Core Analogy: The Grocery Store Receipt
Think of the AI's performance like a grocery store receipt.
- The "Bayesian Ideal" is the theoretical lowest price you could pay if you had perfect knowledge.
- The "AI's Price" is what the AI actually charges you.
The paper says that even if the AI makes a mistake in the order of items (shuffling the receipt), it doesn't mean the AI is broken. It just means the AI is paying a tiny "convenience fee" (extra cost) for having to process the list in a specific order.
The authors prove mathematically that:
- The Fee is Tiny: The extra cost the AI pays for shuffling the order is so small (measured in fractions of a "bit," which is a tiny unit of information) that the AI is still almost as good as the perfect Bayesian detective.
- It's About the Average: If you averaged out all the possible ways to shuffle the clues, the AI's average performance would be nearly perfect. The fact that one specific shuffle is slightly off doesn't matter much in the grand scheme.
Key Findings Explained Simply
1. The "Ordering Fee" (The Cost of Shuffling)
The paper introduces a concept called Order-Averaging Gain.
- Imagine: You have a deck of cards representing examples. A perfect system gives the same answer whether you deal the cards left-to-right or right-to-left.
- The Reality: The AI deals them left-to-right. Sometimes, this specific order makes it slightly less confident than if it had dealt them differently.
- The Result: The authors measured this "loss of confidence." They found it is incredibly small. It's like paying an extra $0.01 on a $100 purchase. You aren't getting ripped off; you're just paying a tiny fee for the convenience of a specific order.
2. The "Safe Code" (Handling the Unknown)
AI models sometimes get scared when they see a word or number they haven't seen before in the examples. A "perfect" Bayesian model handles this gracefully.
- The Test: The authors tested the AI on simple math and logic puzzles (like guessing the next number in a sequence).
- The Result: The AI's predictions were almost identical to the perfect Bayesian predictions. Even when the AI had to guess on a new number, it didn't panic. It stayed very close to the "ideal" math, especially when it had seen a few examples.
- Comparison: They compared the AI to a "Frequentist" (a simpler, rigid statistician who only trusts what they've seen). The AI was much closer to the "perfect Bayesian" than to the rigid statistician, especially when there were very few examples.
3. The "Position" Problem (Why Order Matters)
Why does the AI care about order at all?
- The Experiment: The authors messed with the AI's "positioning system" (the part of the brain that knows which word comes first, second, third).
- The Discovery: When they removed the position clues, the AI became perfectly indifferent to order (it became a perfect Bayesian). When they added position clues back, the AI started caring about order again.
- The Takeaway: The AI's "order sensitivity" isn't a bug in its logic; it's a feature of how it reads the sequence. It's like a person reading a book: they read left-to-right. If you give them the pages out of order, they get confused. But if you average out all the ways they could have read the pages, they understand the story just fine.
4. The "Activation" Check (Is the AI actually thinking?)
The authors wanted to know if the AI was actually "doing the math" or just guessing.
- The Test: They used a technique called "activation patching" (like swapping a specific gear in a clock). They took the "counting" information from a clean example and pasted it into a messy example.
- The Result: The AI's answer changed exactly as the math predicted. This proves the AI isn't just memorizing; it is actually calculating the statistics (counts and positions) internally and using them to make predictions.
The Bottom Line
The paper resolves a paradox:
- Old View: "The AI changes its mind when you shuffle the examples, so it's not a true Bayesian."
- New View: "The AI changes its mind slightly, but the cost of that change is so small that, for all practical purposes, it acts like a Bayesian."
The Analogy:
Imagine a chef who is trying to bake a cake using a perfect recipe.
- The Perfect Chef (Bayesian): Would bake the exact same cake regardless of whether they added the flour before the sugar or vice versa.
- The AI Chef: Adds flour before sugar. If you ask them to add sugar first, the cake is slightly different (maybe 1% less fluffy).
- The Paper's Conclusion: The AI isn't a "bad" chef. It's just that the order of ingredients matters slightly to them. But if you look at the average cake they bake over many tries, it's indistinguishable from the perfect cake. The "fluffiness loss" is negligible.
In short: Transformers (the AI architecture) don't need to be perfect, order-agnostic machines to be incredibly good at predicting the future. They just need to be "Bayesian enough" that the penalty for their order-sensitivity is tiny. And the math shows that penalty is indeed tiny.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.