arXiv:2610.20138cs.LGOct 2026

Manuscript Offprint

arXiv:2610.20138

In-Context Batch Black-box Optimization via Flow Matching

Quoc-Anh Hoang Nguyen, Xinyu Zhang, Daolang Huang, Julien Martinelli, Samuel Kaski

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Batch black-box optimization is important for expensive systems where many candidates can be evaluated in parallel, yet only a few rounds of evaluation are affordable. In this regime, effective batch construction must identify multiple promising regions while avoiding redundant evaluations, and conventional Bayesian optimization can require increasingly difficult batch-selection procedures as the batch size grows. We introduce Flow Matching for Thompson-Sampling Refinement (FMTR), an amortized approach that learns offline a continuous, history-conditioned proposal distribution from which variable-size batches can be sampled. FMTR is trained offline by conditional flow matching on Thompson-sampling argmaxes refined toward high-value regions via a horizon-dependent Langevin pushforward map, adapting the exploration-exploitation tradeoff over the optimization horizon. At test time, the model parameters remain fixed and batch generation requires neither task-specific surrogate refitting nor numerical acquisition optimization. FMTR achieves strong performance against batch BO and in-context baselines on synthetic and real-world benchmarks, while substantially reducing the computational cost of batch selection.

1 INTRODUCTION

Many scientific and engineering design problems require optimizing an objective that can only be queried through costly experiments or simulations. Modern experimental and computational platforms increasingly support parallel evaluation, from high-throughput laboratories to compute clusters, motivating batch black-box optimization in applications such as enzyme engineering, regulatory RNA design, and materials design (Canty et al., 2025; Torres et al., 2026; Kelvin et al., 2026; Hastings et al., 2025). This changes the nature of the optimization decision: in the batch setting, the utility of each candidate depends on the rest of the batch, which should cover several plausible high-value regions and underexplored parts of the search space while avoiding redundant evaluations. Moreover, the evaluation of each batch can incur substantial experimental or computational costs, making the number of optimization rounds an important practical constraint. Consequently, it is desirable to develop batch selection methods that make effective use of each round and achieve high-quality solutions with as few evaluation rounds as possible.

Bayesian optimization (BO; Garnett 2023) is a standard approach for constructing such batches under limited evaluation budgets. It models the objective with a probabilistic surrogate, commonly a Gaussian process (GP, Rasmussen & Williams 2006), and selects evaluations through an acquisition function that balances promising predicted values against posterior uncertainty. However, when selecting q candidates at once, the acquisition must account for interactions among the proposed points, making its maximization a joint problem over qd variables. Joint acquisitions become difficult to optimize as q grows, while common alternatives construct the batch through q sequential or independent optimization problems (Wilson et al., 2018; Kandasamy et al., 2018; Balandat et al., 2020; Teufel et al., 2024). Each round thus requires updating a task-specific surrogate and solving a difficult, time-consuming batch-selection problem before the evaluations can be run in parallel.

In-context learning offers a complementary route by moving recurring computation to offline pre-training over a distribution of optimization tasks. At deployment, a pretrained model adapts to a new objective through the observations supplied in context, without updating its parameters. Existing methods introduce in-context learning at different stages of the BO loop. Surrogate-based approaches perform posterior inference in context but retain a conventional acquisition function and an online search over the design space (Müller et al., 2023; Chang et al., 2025; Yu et al., 2026). Acquisition-level approaches instead learn to predict acquisition values, replacing their potentially expensive computation while still searching for the maximizing candidate (Hung et al., 2025; Rakotoarison et al., 2026). End-to-end in-context optimizers go further by learning the query policy itself, commonly from trajectory-level rewards, and map the observed history and a supplied candidate set directly to the next query (Maraval et al., 2023; Zhang et al., 2025; 2026; Huang et al., 2025). These policies remove task-specific surrogate fitting and numerical acquisition optimization, but are typically formulated as single-query policies over a finite candidate set. They therefore do not directly provide an in-context sampler over continuous query locations from which a batch can be drawn.

Generative models offer a natural way forward. By learning a proposal distribution over continuous designs, they turn batch construction into sampling: the proposal places mass on several promising regions, generating a batch of the desired size without optimizing a joint acquisition. Recent generative BO methods either adapt a diffusion sampler using a task-specific surrogate or fit the proposal directly from observed utilities (Yun et al., 2025; Oliveira et al., 2026). In both cases, the proposal is fitted or updated on the current objective as optimization proceeds, rather than produced in context by a model pretrained across tasks. This leaves open how to combine in-context adaptation with a reusable continuous proposal and how to specify its target distribution for each observed history.

Figure

MethodIn-context amortizationBatch selectionLearned query distribution
Batch BO (Kandasamy et al., 2018; Teufel et al., 2024)✕✓✕
ICL-based BO (Rakotoarison et al., 2026; Yu et al., 2026)Surrogate or acqf only✕✕
End-to-end ICL optimization (Maraval et al., 2023; Zhang et al., 2026)✓✕✕
Generative BO (Yun et al., 2025; Oliveira et al., 2026)✕✓✓
FMTR (ours)✓✓✓

Figure 1: Overview of FMTR and its positioning relative to related methods. FMTR directly models a query distribution for end-to-end batch selection. (Top) Pretraining and deployment with closed-loop rollouts for data generation.

Contributions. We address this gap with Flow Matching for Thompson-Sampling Refinement (FMTR), which combines in-context adaptation with sample-based generation for large-batch-few-round black-box optimization tasks. Figure 1 provides an overview of our method and positions it against concurrent baselines. Our contributions can be summarized as follows:

• We introduce a conditional flow-matching model that represents a proposal distribution over continuous query locations, conditioned on the observed history and remaining evaluation budget. FMTR generates a batch of the requested size by sampling from this proposal with fixed model parameters, without task-specific surrogate fitting or acquisition-function optimization.

• We construct supervised training targets by refining Thompson-sampling argmaxes toward high-value regions according to the remaining optimization horizon. This provides a simple alternative to trajectory-level reinforcement learning while retaining more exploration early and increasing exploitation toward the end of optimization.

• Across synthetic and real-world benchmarks, FMTR achieves strong optimization performance at substantially lower batch-selection cost. Ablations further show that target refinement and value weighting both improve over directly amortizing parallel Thompson sampling.