← Latest papers
📊 statistics

PFN-TS: Thompson Sampling for Contextual Bandits via Prior-Data Fitted Networks

The paper proposes PFN-TS, a Thompson sampling algorithm that leverages Prior-Data Fitted Networks to approximate Bayesian posteriors in a single forward pass by converting noisy predictive distributions into mean-reward samples via a subsampled central limit theorem, thereby achieving strong empirical performance and theoretical regret bounds across various contextual bandit benchmarks.

Original authors: Yan Shuo Tan, Kenyon Ng, Ruizhe Deng, Sumetha Loganathan, Qiong Zhang, Bibhas Chakraborty

Published 2026-05-12
📖 5 min read🧠 Deep dive

Original authors: Yan Shuo Tan, Kenyon Ng, Ruizhe Deng, Sumetha Loganathan, Qiong Zhang, Bibhas Chakraborty

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

Imagine you are the manager of a vending machine with many different buttons (actions). Every time a customer walks up, they have a specific mood or situation (context), and you need to guess which button will give them the best snack (reward). The catch? You don't know which button is best for which mood, and you only find out after you press it. Your goal is to make as many happy customers as possible over time while minimizing the number of times you guess wrong. This is the "Contextual Bandit" problem.

To solve this, you need a strategy that balances exploring (trying new buttons to learn) and exploiting (using what you already know works). A popular strategy is called Thompson Sampling. It's like having a crystal ball that gives you a "best guess" for every button, but with a twist: the crystal ball is a bit fuzzy. It gives you a range of possibilities. You pick the button that looks best in that fuzzy guess, which naturally encourages you to try buttons that might be great but you aren't sure about yet.

The Problem: The Crystal Ball is Too Noisy

For years, people have used simple models (like straight lines) to build these crystal balls. But human behavior isn't a straight line; it's messy, complex, and full of surprises. Newer, smarter models called Prior-Data Fitted Networks (PFNs) (like TabPFN) are amazing at this. They are like "super-trained chefs" who have tasted millions of recipes. When you show them a few ingredients (data), they instantly know what the dish will taste like, without needing to cook it again.

However, there's a snag. These super-chefs are great at predicting the final taste (the noisy reward), but Thompson Sampling needs to know the uncertainty about the recipe itself (the underlying mean reward). The chefs don't hand you the recipe's uncertainty directly; they just give you the final dish. Trying to figure out the recipe's uncertainty by asking the chef to cook the dish a million times is too slow for a real-time vending machine.

The Solution: PFN-TS (The Smart Shortcut)

The authors of this paper invented PFN-TS, a new way to use these super-chefs for the vending machine problem.

1. The "Subsampled" Shortcut (The Geometric Grid)
Instead of asking the chef to cook the dish for every single ingredient combination (which takes forever), PFN-TS uses a clever math trick called a Subsampled Central Limit Theorem.

  • The Analogy: Imagine you want to know how much a river's water level fluctuates. You could measure it every second for a year (too much work!). Instead, PFN-TS measures the water level at specific, spaced-out intervals: day 1, day 2, day 4, day 8, day 16, and so on.
  • By looking at these "geometric" snapshots, the algorithm can mathematically estimate the river's overall fluctuation (uncertainty) very accurately, but with a tiny fraction of the effort. This allows the system to get the "fuzzy crystal ball" it needs for Thompson Sampling without slowing down.

2. The "Memory" Trick (Caching)
The paper also uses a feature of the new "super-chef" models called KV-Caching.

  • The Analogy: If you ask a chef, "What happens if I add salt?" and then "What happens if I add salt and pepper?", a normal chef might forget the salt part and start over. But this specific chef remembers the "salt" part and only calculates the "pepper" part.
  • PFN-TS uses this memory to reuse previous calculations. When the vending machine checks multiple buttons, it doesn't re-calculate everything from scratch; it just updates the parts that changed. This makes the system incredibly fast.

3. The "Shape-Shifter" (Adaptive Encoding)
Sometimes, the buttons on the machine are totally different from each other (like a soda button vs. a snack button). Other times, they are very similar (like a "spicy" snack vs. a "mild" snack).

  • PFN-TS has a built-in "shape-shifter." It tries two different ways of organizing the data at the same time. It uses a scoring system (CRPS) to see which way is working better. If the buttons are similar, it merges them into one model. If they are different, it keeps them separate. It automatically picks the best strategy as it learns.

What Did They Find?

The authors tested this new system (PFN-TS) against many other methods using:

  • Fake data: Simulated scenarios with complex, non-linear rules (like the famous "Friedman" functions).
  • Real-world data: Eight different datasets from the OpenML library (like predicting adult income or mushroom types).
  • A real mobile health trial: The "Drink Less" app, which tried to figure out the best push-notification strategy to help people drink less alcohol.

The Results:

  • Non-linear tasks: PFN-TS was the clear winner. It outperformed all other methods when the rules were complex and messy.
  • Linear tasks: When the rules were simple (straight lines), it performed just as well as the standard linear methods.
  • Mobile Health: In the "Drink Less" trial, PFN-TS achieved the highest estimated value, meaning it would have been the most effective strategy for helping people reduce drinking.

In Summary

PFN-TS is a new tool that takes a powerful, pre-trained AI model (the "super-chef") and teaches it how to be a perfect decision-maker in uncertain situations. It does this by using a mathematical shortcut to estimate uncertainty quickly and a memory trick to run fast. It automatically adapts to whether the problem is simple or complex, making it a top performer for both synthetic tests and real-world mobile health applications.

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 →