Thompson Sampling via Fine-Tuning of LLMs
Nicolas Menet, Aleksandar Terzic, Michael Hersche, Andreas Krause, Abbas Rahimi
Abstract
Bayesian optimization in large unstructured discrete spaces is often hindered by the computational cost of maximizing acquisition functions due to the absence of gradients. We propose a scalable alternative based on Thompson sampling that eliminates the need for acquisition function maximization by directly parameterizing the probability that a candidate yields the maximum reward. Our approach, Thompson Sampling via Fine-Tuning (TOSFIT), leverages the prior knowledge embedded in prompt-conditioned large language models, and incrementally adapts them toward the posterior. Theoretically, we derive a novel regret bound for a variational formulation of Thompson Sampling that matches the strong guarantees of its standard counterpart. Our analysis reveals the critical role of careful adaptation to the posterior probability of maximality-a principle that underpins our TOSFIT algorithm. Empirically, we validate our method on three diverse tasks: FAQ response refinement, thermally stable protein search, and quantum circuit design. Within a collection of methods covering in-context Bayesian optimization, reinforcement learning, and evolutionary search, TOSFIT exhibits both state-of-the-art sample efficiency and computational efficiency. 1
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
Lineage
Builds on7
- More Than a Toy: Random Matrix Models Predict How Real-World Neural Representations GeneralizeAlexander Wei, Wei Hu, Jacob SteinhardtICML 2022 · 90 citations
- Improving black-box optimization in VAE latent space using decoder uncertaintyPascal Notin, José Miguel Hernández-Lobato, Yarin GalNeurIPS 2021 · 76 citations
- Back to Basics: Revisiting REINFORCE-Style Optimization for Learning from Human Feedback in LLMsArash Ahmadian, Chris Cremer, Matthias Gallé, Marzieh Fadaee et al.ACL 2024 · 20 citations
- Probabilistic Inference in Reinforcement Learning Done RightJean Tarbouriech, Tor Lattimore, Brendan O'DonoghueNeurIPS 2023 · 15 citations
- Variational Bayesian Optimistic SamplingBrendan O'Donoghue, Tor LattimoreNeurIPS 2021 · 8 citations
Related papers
- FunBO: Discovering Acquisition Functions for Bayesian Optimization with FunSearchVirginia Aglietti, Ira Ktena, Jessica Schrouff, Eleni Sgouritsa et al.ICML 2025
- A Sober Look at LLMs for Material Discovery: Are They Actually Good for Bayesian Optimization Over Molecules?Agustinus Kristiadi, Felix Strieth-Kalthoff, Marta Skreta, Pascal Poupart et al.ICML 2024 · 55 citations
- Multi-armed bandits for resource efficient, online optimization of language model pre-training: the use case of dynamic maskingIñigo Urteaga, Moulay-Zaïdane Draïdia, Tomer Lancewicki, Shahram KhadiviACL Findings 2023 · 1 citation
- Steering Generative Models with Experimental Data for Protein Fitness OptimizationJason Yang, Wenda Chu, Daniel Khalil, Raul Astudillo et al.NeurIPS 2025 · 13 citations
- BOTS: A Unified Framework for Bayesian Online Task Selection in LLM Reinforcement FinetuningQianli Shen, Daoyuan Chen, Yilun Huang, Zhenqing Ling et al.ICLR 2026 · 15 citations
