Reinforced In-Context Black-Box Optimization

## Abstract

Abstract Black-Box Optimization (BBO) has found successful applications in many fields of science and engineering. Recently, there has been a growing interest in meta-learning particular components of BBO algorithms to speed up optimization and get rid of tedious hand-crafted heuristics. As an extension, learning the entire algorithm from data requires the least labor from experts and can provide the most flexibility. In this paper, we propose RIBBO, a method to reinforce-learn a BBO algorithm from offline data in an end-to-end fashion. RIBBO employs expressive sequence models to learn the optimization histories produced by multiple behavior algorithms and tasks, leveraging the in-context learning ability of large models to extract task information and make decisions accordingly. Central to our method is to augment the optimization histories with regret-to-go tokens, which are designed to represent the performance of an algorithm based on cumulative regret over the future part of the histories. The integration of regret-to-go tokens enables RIBBO to automatically generate sequences of query points that satisfy the user-desired regret, which is verified by its universally good empirical performance on diverse problems, including BBO benchmark functions, hyper-parameter optimization and robot control problems.

## 1 Introduction

Black-Box Optimization (BBO) Alarie et al. (); Audet & Hare () refers to optimizing objective functions where neither analytic expressions nor derivatives of the objective are available. To solve BBO problems, we can only access the results of objective evaluation, which usually also incurs a high computational cost. Many fundamental problems in science and engineering involve optimization of expensive BBO functions, such as drug discovery Negoescu et al. (); Terayama et al. (), material design Frazier & Wang (); Gómez-Bombarelli et al. (), robot control Calandra et al. (); Chatzilygeroudis et al. (), and optimal experimental design Greenhill et al. (); Nguyen et al. (), just to name a few.

To date, a lot of BBO algorithms have been developed, among which the most prominent ones are Bayesian Optimization (BO) Frazier (); Shahriari et al. () and Evolutionary Algorithms (EA) Back (); Zhou et al. (). Despite the advancements, these algorithms typically solve BBO problems from scratch and rely on expert-derived heuristics. Consequently, they are often hindered by slow convergence rates, and unable to leverage the inherent structures within the optimization problems Astudillo & Frazier (); Bai et al. ().

Recently, there has been a growing interest in meta-learning a particular component of the algorithms with previously collected data Arango et al. (); Feurer et al. (). Learning the component not only alleviates the need for the laborious design process of the domain experts, but also specifies the component with domain data to facilitate subsequent optimization. For example, some components in BO are proposed to be learned from data, including the surrogate model Müller et al. (); Perrone et al. (); Wang et al. (); Wistuba & Grabocka (), acquisition function Hsieh et al. (); Volpp et al. (), initialization strategy Feurer et al. (); Poloczek et al. (), and search space Li et al. (); Perrone & Shen (); some core evolutionary operations in EA have also been considered, e.g., learning the selection and mutation rate adaptation in genetic algorithm Lange et al. () or the update rules for evolution strategy Lange et al. (); the configuration of the algorithm can also be learned and dynamically adjusted throughout the optimization process Biedenkapp et al. (); Adriaensen et al. ().

There have also been some attempts to learn an entire algorithm in an End-to-End (E2E) fashion, which requires almost no expert knowledge at all and provides the most flexibility across a broad range of BBO problems.
However, existing practices require additional knowledge regarding the objective function during the training stage, e.g., the gradient information (often impractical for BBO) Chen et al. (); TV et al. () or online sampling from the objective function (often very expensive) Maraval et al. (). Chen et al. () proposed the OptFormer method to imitate the behavior algorithms separately during training, presenting a challenge for the user to manually specify which algorithm to execute during testing. Thus, these methods are less ideal for practical scenarios where offline datasets are often available beforehand and a suitable algorithm for the given task has to be identified automatically without the involvement of domain experts.

In this paper, we introduce Reinforced In-context BBO (RIBBO), which learns a reinforced BBO algorithm from offline datasets in an E2E fashion. RIBBO employs an expressive sequence model, i.e., causal transformer, to fit the optimization histories in the offline datasets generated by executing diverse behavior algorithms on multiple tasks. The sequence model is fed with previous query points and their function values, and trained to predict the distribution over the next query point. During testing, the sequence model itself serves as a BBO algorithm by generating the next query points auto-regressively. Apart from this, RIBBO augments the optimization histories with regret-to-go (RTG) tokens, which are calculated by summing up the regrets over the future part of the histories, representing the future performance of an algorithm. A novel Hindsight Regret Relabelling (HRR) strategy is proposed to update the RTG tokens during testing. By integrating the RTG tokens into the modeling, RIBBO can automatically identify different algorithms, and generate sequences of query points that satisfy the specified regret. Such modeling enables RIBBO to circumvent the impact of inferior data and further reinforce its performance on top of the behavior algorithms.

We perform experiments on BBOB synthetic functions, hyper-parameter optimization and robot control problems by using some representatives of heuristic search, EA, and BO as behavior algorithms to generate the offline datasets. The results show that RIBBO can automatically generate sequences of query points satisfying the user-desired regret across diverse problems, and achieve good performance universally. Note that the best behavior algorithm depends on the problem at hand, and RIBBO can perform even better on some problems. Compared to the most related method OptFormer Chen et al. (), RIBBO also has clear advantage. In addition, we perform a series of experiments to analyze the influence of important components of RIBBO.

## 2 Background

### 2.1 Black-Box Optimization

Let $f:\mathcal{X}\rightarrow\mathbb{R}$ be a black-box function, where $\mathcal{X}\subseteq\mathbb{R}^{d}$ is a $d$-dimensional search space. The goal of BBO is to find an optimal solution $\bm{x}^{*}\in\mathop{\arg\max}_{\bm{x}\in\mathcal{X}}f(\bm{x})$, with the only permission of querying the objective function value. Several classes of BBO algorithms have been proposed, e.g., BO Frazier (); Shahriari et al. () and EA Back (); Zhou et al. (). The basic framework of BO contains two critical components: a surrogate model, typically formalized as Gaussian Process (GP) Rasmussen & Williams (), and an acquisition function Wilson et al. (), which are used to model $f$ and decide the next query point, respectively. EA is a class of heuristic optimization algorithms inspired by natural evolution. It maintains a population of solutions and iterates through mutation, crossover, and selection operations to find better solutions.

To evaluate the performance of BBO algorithms, regrets are often used. The instantaneous regret $r_{t}=f(\bm{x}^{*})-f(\bm{x}_{t})$ measures the gap of function values between an optimal solution $\bm{x}^{*}$ and the currently selected point $\bm{x}_{t}$. The cumulative regret ${\rm Reg}_{T}=\sum_{i=1}^{T}r_{i}$ is the sum of instantaneous regrets in the first $T$ iterations.

### 2.2 Meta-Learning in Black-Box Optimization

Hand-crafted BBO algorithms usually require an expert to analyze the algorithms’ behavior across a wide range of problems, a process that is both tedious and time-consuming. One solution is meta-learning Vilalta & Drissi (); Hospedales et al. (), which aims to exploit knowledge to improve the performance of learning algorithms given data from a collection of tasks. By parameterizing a component of BBO algorithms or even an entire BBO algorithm that is traditionally manually designed, we can utilize historical data to incorporate the domain knowledge into the optimization, which may bring speedup.

Meta-learning particular components has been studied with different BBO algorithms. Meta-learning in BO can be divided into four main categories according to “what to transfer” Bai et al. (), including the design of the surrogate model, acquisition function, initialization strategy, and search space. For surrogate model design, Wang et al. () and Wistuba & Grabocka () parameterized the mean or kernel function of the GP model with Multi-Layer Perceptron (MLP), while Perrone et al. () and Müller et al. () substituted GP with Bayesian linear regression or neural process Garnelo et al. (); Müller et al. (). For acquisition function design, MetaBO Volpp et al. () uses Reinforcement Learning (RL) to meta-train an acquisition function on a set of related tasks, and FSAF Hsieh et al. () employs a Bayesian variant of deep Q-network as a surrogate differentiable acquisition function trained by model-agnostic meta-learning Finn et al. (). The remaining two categories focus on exploiting the previous good solutions to warm start the optimization Feurer et al. (); Poloczek et al. () or shrink the search space Perrone & Shen (); Li et al. (). Meta-learning in EA usually focuses on learning specific evolutionary operations. For example, Lang et al. substituted core genetic operators, i.e., selection and mutation rate adaptation, with dot-product attention modules Lange et al. (), and meta-learned a self-attention-based architecture to discover effective and order-invariant update rules Lange et al. (). ALDes Zhao et al. () introduces an auto-regressive learning-based approach to sequentially generate components of meta-heuristic algorithms. Beyond that, Dynamic Algorithm Configuration (DAC) Biedenkapp et al. (); Adriaensen et al. () concentrates on learning the configurations of algorithms, employing RL to dynamically adjust the configurations during the optimization process.

Meta-learning entire algorithms has also been explored to obtain more flexible models. Early works Chen et al. (); TV et al. () use Recurrent Neural Network (RNN) to meta-learn a BBO algorithm by optimizing the summed objective functions of some iterations. RNN uses its memory state to store information about history and outputs the next query point. This work assumes access to gradient information during the training phase, which is, however, usually impractical in BBO problems.
OptFormer Chen et al. () uses a text-based transformer framework to learn an algorithm, providing a universal E2E interface for BBO problems. It is trained to imitate different BBO algorithms across a broad range of problems, which, however, presents a challenge for the user to manually specify an algorithm for inference. Neural Acquisition Processes (NAP) Maraval et al. () uses transformer to meta-learn the surrogate model and acquisition function of BO jointly. Due to the lack of labeled acquisition data, NAP uses an online RL algorithm with a supervised auxiliary loss for training, which requires online sampling from the expensive objective function and lacks efficiency. Black-box Optimization NETworks (BONET) Krishnamoorthy et al. () employ a transformer model to fit regret-augmented trajectories in an offline BBO scenario, where the training and testing data are from the same objective function, and a prefix sequence is required to warm up the optimization before testing. Compared to the above state-of-the-art E2E methods, we consider the meta-BBO setting, where the training datasets consist of diverse algorithms across different functions. Our approach offers the advantage of automatically identifying with RTG tokens and deploying the best-performing algorithm without requiring the user to pre-specify which algorithm to use or to provide a prefix sequence during the testing phase. It utilizes a supervised learning loss for training on a fixed offline dataset without the need for further interaction with the objective function.

### 2.3 Decision Transformer

Transformer has emerged as a powerful architecture for sequence modeling tasks Khan et al. (); Wen et al. (); Wolf et al. (). A basic building block behind transformer is the self-attention mechanism Vaswani et al. (), which captures the correlation between tokens of any pair of timesteps. As the scale of data and model increases, transformer has demonstrated the in-context learning ability Brown et al. (), which refers to the capability of the model to infer the tasks at hand based on the input contexts. Decision Transformer (DT) Chen et al. () abstracts RL as a sequence modeling problem, and introduces return-to-go tokens, representing the cumulative rewards over future interactions. Conditioning on return-to-go tokens enables DT to correlate the trajectories with their corresponding returns and generate future actions to achieve a user-specified return. Inspired by DT, we will treat BBO tasks as a sequence modeling problem naturally, use a causal transformer for modeling, and train it by conditioning on future regrets. Such design is expected to enable the learned model to distinguish algorithms with different performance and achieve good performance with a user-specified low regret.

Figure: Figure 1: Illustration of RIBBO. Left: Data Generation. $K$ existing BBO algorithms $\{\mathcal{A}_{j}\}_{j=1}^{K}$ and $N$ BBO tasks $\{f_{i}\}_{i=1}^{N}$ are used to serve as the behavior algorithms and the training tasks, respectively. The offline datasets $\{\mathcal{D}_{i,j}\}$ consist of the optimization histories $\bm{h}_{T}=\{(\bm{x}_{t},y_{t})\}_{t=1}^{T}$ collected by executing each behavior algorithm $\mathcal{A}_{j}$ on each task $f_{i}$ for $T$ evaluation steps, which are then augmented with the regret-to-go tokens $R_{t}$ (calculated as the cumulative regret $\sum^{T}_{t^{\prime}=t+1}(y^{*}-y_{t^{\prime}})$ over the future optimization history) to generate the final dataset $\{\widehat{\mathcal{D}}_{i,j}\}$ for training. Right: Training and Inference. Our model takes in triplets of $(\bm{x}_{t},y_{t},R_{t})$, embeds them into one token, and outputs the distribution over the next query point $\bm{x}_{t+1}$. During training, the ground-truth next query point is used to minimize the loss in Eq. (4). During inference, the next query point $\bm{x}_{t+1}$ is generated auto-regressively based on the current history $\hat{\bm{h}}_{t}$.
Refer to caption: x1.png

## 3 Method

This section presents Reinforced In-context Black-Box Optimization (RIBBO), which learns an enhanced BBO algorithm in an E2E fashion, as illustrated in Figure 1. We follow the task-distribution assumption, which is commonly adopted in meta-learning settings Finn et al. (); Hospedales et al. (); Zhou et al. (). Our goal is to learn a generalizable model $\mathcal{M}$ capable of solving a wide range of BBO tasks, each associated with a BBO objective function $f$ sampled from the task distribution $P(\mathcal{F})$, where $\mathcal{F}$ denotes the function space.

Let $[N]$ denote the integer set $\{1,2,\ldots,N\}$. During training, we usually access $N$ source tasks and each task corresponds to an objective function $f_{i}\sim P(\mathcal{F})$, where $i\in[N]$. Hereafter, we use $f_{i}$ to denote the task $i$ if the context is clear. We assume that the information is available via offline datasets $\mathcal{D}_{i,j}$, which are produced by executing a behavior algorithm $\mathcal{A}_{j}$ on task $f_{i}$, where $j\in[K]$ and $i\in[N]$. Each dataset $\mathcal{D}_{i,j}=\{\bm{h}^{i,j,m}_{T}\}_{m=1}^{M}$ consists of $M$ optimization histories $\bm{h}^{i,j,m}_{T}=\{(\bm{x}_{t},y_{t})\}_{t=1}^{T}$, where $\bm{x}_{t}$ is the query point selected by $\mathcal{A}_{j}$ at iteration $t$, and $y_{t}=f_{i}(\bm{x}_{t})$ is its objective value. If the context is clear, we will omit $i,j,m$ and simply use $\bm{h}_{T}$ to denote a history with length $T$. The initial history $\bm{h}_{0}$ is defined as $\emptyset$. We impose no additional assumptions about the behavior algorithms, allowing for a range of BBO algorithms, even random search.

With the datasets, we seek to learn a model $\mathcal{M}_{\bm{\theta}}(\bm{x}_{t}|\bm{h}_{t-1})$, which is parameterized by $\bm{\theta}$ and generates the next query point $\bm{x}_{t}$ by conditioning on the previous history $\bm{h}_{t-1}$. As introduced in Section 2.1, with a given budget $T$ and the history $\bm{h}_{T}$ produced by an algorithm $\mathcal{A}$, we use the cumulative regret

$$ ${\rm Reg}_{T}=\sum_{t=1}\nolimits^{T}(y^{*}-y_{t})$ (1) $$

as the evaluation metric, where $y^{*}$ is the optimum value and $\{y_{t}\}^{T}_{t=1}$ are the function values in $\bm{h}_{T}$.

### 3.1 Method Outline

Given the current history $\bm{h}_{t-1}$ at iteration $t$, a BBO algorithm selects the next query point $\bm{x}_{t}$, observes the function value $y_{t}=f_{i}(\bm{x}_{t})$, and updates the history $\bm{h}_{t}=\bm{h}_{t-1}\cup\{(\bm{x}_{t},y_{t})\}$. Similar to the previous work Chen et al. (), we take this framework as a starting point and treat the learning of a universal BBO algorithm as learning a model $\mathcal{M}_{\bm{\theta}}$, which takes the preceding history $\bm{h}_{t-1}$ as input and outputs a distribution of the next query point $\bm{x}_{t}$. The optimization histories in offline datasets provide a natural supervision for the learning process.

Suppose we have a set of histories $\{\bm{h}_{T}\}$, generated by a single behavior algorithm $\mathcal{A}$ on a single task $f$. By employing a causal transformer model $\mathcal{M}_{\bm{\theta}}$, we expect $\mathcal{M}_{\bm{\theta}}$ to imitate $\mathcal{A}$ and produce similar optimization history on $f$. In practice, we usually have datasets containing histories from multiple behavior algorithms $\{\mathcal{A}_{j}\}_{j=1}^{K}$ on multiple tasks $\{f_{i}\}_{i=1}^{N}$. To fit $\mathcal{M}_{\bm{\theta}}$, we use the negative log-likelihood loss

$$ $\mathcal{L}_{\rm BC}(\bm{\theta})=-\mathbb{E}_{\bm{h}_{T}\sim\mathcal{D}_{i,j} }\left[\sum\nolimits_{t=1}^{T}\log\mathcal{M}_{\bm{\theta}}(\bm{x}_{t}|\bm{h}_ {t-1})\right].$ (2) $$

To effectively minimize the loss, $\mathcal{M}_{\bm{\theta}}$ needs to recognize both the task and the behavior algorithm in-context, and then imitate the optimization behavior of the corresponding behavior algorithm.

Nevertheless, naively imitating the offline datasets hinders the model since some inferior behavior algorithms may severely degenerate the model’s performance. Inspired by DT Chen et al. (), we propose to augment the optimization history with Regret-To-Go (RTG) tokens $R_{t}$, defined as the sum of instantaneous regrets over the future history:

$$ $\hat{\bm{h}}_{T}=\{(\bm{x}_{t},y_{t},R_{t})\}_{t=0}^{T},\;R_{t}=\sum\nolimits_ {t^{\prime}=t+1}^{T}(y^{*}-y_{t^{\prime}}),$ (3) $$

where $\bm{x}_{0}$ and $y_{0}$ are placeholders for padding, denoted as [PAD] in Figure 1(b), and $R_{T}=0$. The augmented histories compose the augmented dataset $\widehat{\mathcal{D}}_{i,j}$, and the training objective of $\mathcal{M}_{\bm{\theta}}$ becomes

$$ $\mathcal{L}_{\rm{RIBBO}}(\bm{\theta})=-\mathbb{E}_{\hat{\bm{h}}_{T}\sim \widehat{\mathcal{D}}_{i,j}}\left[\sum\nolimits_{t=1}^{T}\log\mathcal{M}_{\bm{ \theta}}(\bm{x}_{t}|\hat{\bm{h}}_{t-1})\right].$ (4) $$

The integration of RTG tokens in the context brings identifiability of behavior algorithms, and the model $\mathcal{M}_{\bm{\theta}}$ can effectively utilize them to make appropriate decisions. Furthermore, RTG tokens have a direct correlation with the metric of interest, i.e., cumulative regret $\mathrm{Reg}_{T}$ in Eq. (1). Conditioning on a lower RTG token provides a guidance to our model and reinforces $\mathcal{M}_{\bm{\theta}}$ to exhibit superior performance. These advantages will be clearly shown by experiments in Section 4.4.

The resulting method RIBBO has implicitly utilized the in-context learning capacity of transformer to guide the optimization with previous histories and the desired future regret as context. The in-context learning capacity of inferring the tasks at hand based on the input contexts has been observed as the scale of data and model increases Kaplan et al. (). It has been explored to infer general functional relationships as supervised learning or RL algorithms. For example, the model is expected to predict accurately on the query input $\bm{x}_{t}$ by feeding the training dataset $\{(\bm{x}_{i},y_{i})\}_{i=1}^{t-1}$ as the context Guo et al. (); Hollmann et al. (); Li et al. (); Laskin et al. () learned RL algorithms using causal transformers. Here, we use it for BBO.

### 3.2 Practical Implementation

Next, we detail the model architecture, training, and inference of RIBBO.

Model Architecture.
For the formalization of the model $\mathcal{M}_{\bm{\theta}}$, we adopt the commonly used GPT architecture Radford et al. (), which comprises a stack of causal attention blocks. Each block is composed of an attention mechanism and a feed-forward network. We aggregate each triplet $(\bm{x}_{i},y_{i},R_{i})$ using a two-layer MLP network. The output of $\mathcal{M}_{\bm{\theta}}$ is a diagonal Gaussian distribution of the next query point. Note that previous works that adopt the sequence model as surrogate models Müller et al. (; ); Nguyen & Grover () typically remove the positional encoding because the surrogate model should be invariant to the history order. On the contrary, our implementation preserves the positional encoding, naturally following the behavior of certain algorithms (e.g., BO or EA) and making it easier to learn from algorithms. Additionally, the positional encoding can help maintain the monotonically decreasing order of RTG tokens. More details about the architecture can be found in Appendix A.

Model Training.
RTG tokens are calculated as outlined in Eq. (3) for the offline datasets before training. Since the calculation of regret requires the optimum value of task $i$, we use the best-observed value $y_{\rm max}^{i}$ as a proxy for the optimum. Let $\{\widehat{\mathcal{D}}_{i,j}\}_{i\in[N],j\in[K]}$ denote the RTG augmented datasets with $N$ tasks and $K$ algorithms. During training, we sample a minibatch of consecutive subsequences of length $\tau<T$ uniformly from the augmented datasets. The training objective is to minimize the RIBBO loss in Eq. (4).

Figure: Algorithm 1 Model Inference with HRR

Model Inference. The model $\mathcal{M}_{\bm{\theta}}$ generates the query points $\bm{x}_{t}$ auto-regressively during inference, which involves iteratively selecting a new query point $\bm{x}_{t}$ based on the current augmented history $\hat{\bm{h}}_{t-1}$, evaluating the query as $y_{t}=f(\bm{x}_{t})$, and updating the history by $\hat{\bm{h}}_{t}=\hat{\bm{h}}_{t-1}\cup\{(\bm{x}_{t},y_{t},R_{t})\}$. A critical aspect of this process is how to specify the value of RTG (i.e., $R_{t}$) at every iteration $t$. Inspired by DT, a naive approach is to specify a desired performance as the initial RTG $R_{0}$, and decrease it as $R_{t}=R_{t-1}-(y^{*}-y_{t})$. However, this strategy has the risk of producing out-of-distribution RTGs, since the values can fall below 0 0 due to an improperly selected $R_{0}$.

Given the fact that RTGs are lower bounded by 0 0 and a value of 0 0 implies a good BBO algorithm with low regret, we propose to set the immediate RTG as 0 0. Furthermore, we introduce a strategy called Hindsight Regret Relabelling (HRR) to update previous RTGs based on the current sample evaluations. The inference procedure with HRR is detailed in Algorithm 1. In line 1, the history $\hat{\bm{h}}_{0}$ is initialized with padding placeholders $\bm{x}_{0},y_{0}$ and RTG $R_{0}=0$. At iteration $t$ (i.e., lines 3–7), the model $\mathcal{M}_{\bm{\theta}}$ is fed with the augmented history $\hat{\bm{h}}_{t-1}$ to generate the next query point $\bm{x}_{t}$ in line 3, followed by the evaluation procedure to obtain $y_{t}$ in line 4. Then, the immediate RTG $R_{t}$ is set to 0 0, and we employ HRR to update previous RTG tokens in $\hat{\bm{h}}_{t-1}$, i.e., calculate the instantaneous regret $r=y^{*}-y_{t}$ (line 5) and add $r$ to every RTG token within $\hat{\bm{h}}_{t-1}$ (line 6):

$$ $\displaystyle\forall 0\leq i<t,R_{i}\leftarrow R_{i}+(y^{*}-y_{t}).$ (5) $$

Note that this relabelling process guarantees that $\forall 0\leq i<t$, the RTG token $R_{i}=\sum_{t^{\prime}=i+1}^{t}(y^{*}-y_{t^{\prime}})$, which can also be written as $\sum_{t^{\prime}=i+1}^{T}(y^{*}-y_{t^{\prime}})$, consistent with the definition in Eq. (3), because the immediate RTG $R_{t}=\sum_{t^{\prime}=t+1}^{T}(y^{*}-y_{t^{\prime}})$ is set to 0. In line 7, the history $\hat{\bm{h}}_{t}$ is updated by expanding $\hat{\bm{h}}_{t-1}$ with $\{(\bm{x}_{t},y_{t},0)\}$, i.e., the current sampling and its immediate RTG $R_{t}=0$. The above process is repeated until reaching the budget $T$. Thus, we can find that HRR not only exploits the full potential of $\mathcal{M}_{\bm{\theta}}$ through using 0 0 as the immediate RTG and thereby demands the model to generate the most advantageous decisions, but also preserves the calculation of RTG tokens following the same way as the training data, i.e., representing the cumulative regret over future optimization history.

### 3.3 Data Generation

Finally, we give some guidelines about data generation for using the proposed RIBBO method.

Data Collection. Given a set of tasks $\{f_{i}\}_{i=1}^{N}$ sampled from the task distribution $P(\mathcal{F})$, we can employ a diverse set of behavior algorithms for data collection. For example, we can select some representatives from different types of BBO algorithms, e.g., BO and EA. Datasets $\mathcal{D}_{i,j}$ are obtained by using each behavior algorithm to optimize each task with different random seeds. Each optimization history $\bm{h}_{T}=\{(\bm{x}_{t},y_{t})\}_{t=1}^{T}$ in $\mathcal{D}_{i,j}$ is then augmented with RTG tokens $R_{t}$, which is computed as in Eq. (3). The resulting histories $\hat{\bm{h}}_{T}=\{(\bm{x}_{t},y_{t},R_{t})\}_{t=0}^{T}$ compose the final datasets $\widehat{\mathcal{D}}_{i,j}$ for model training.

Data Normalization.
To provide a unified interface and balance the statistic scales across tasks, it is important to apply normalization to the inputs to our model. We normalize the point $\bm{x}$ by $(\bm{x}-\bm{x}_{\rm min})/(\bm{x}_{\rm max}-\bm{x}_{\rm min})$, with $\bm{x}_{\rm max}$ and $\bm{x}_{\rm min}$ being the upper and lower bounds of the search space, respectively. For the function value $y$, we apply random scaling akin to previous works Wistuba & Grabocka (); Chen et al. (). That is, when sampling a history $\bm{h}_{\tau}$ from the datasets $\mathcal{D}_{i,j}$, we randomly sample the lower bound $l\sim\mathcal{U}(y^{i}_{\rm min}-\frac{s}{2},y^{i}_{\rm min}+\frac{s}{2})$ and the upper bound $u\sim\mathcal{U}(y^{i}_{\rm max}-\frac{s}{2},y^{i}_{\rm max}+\frac{s}{2})$, where $\mathcal{U}$ stands for uniform distribution, $y^{i}_{\rm min},y^{i}_{\rm max}$ denote the observed minimum and maximum values for $f_{i}$, and $s=y^{i}_{\rm max}-y^{i}_{\rm min}$; the values $y_{t}$ in $\bm{h}_{\tau}$ are then normalized by $(y_{t}-l)/(u-l)$ for training. The RTG tokens are calculated accordingly with the normalized values. The random normalization can make a model exhibit invariance across various scales of $y$. For inference, the average values of the best-observed and worst-observed values across the training tasks are used to normalize $y$.

## 4 Experiments

In this section, we examine the performance of RIBBO on a wide range of tasks, including synthetic functions, Hyper-Parameter Optimization (HPO) and robot control problems. The model architecture and hyper-parameters are maintained consistently across these problems. We train our model using five distinct random seeds, ranging from 0 0 to $4$, and each trained model is run five times independently during the execution phase. We will report the average performance and standard deviation. Details of the model hyper-parameters are given in Appendix A. Our code is available at [https://github.com/songlei00/RIBBO](https://github.com/songlei00/RIBBO).

### 4.1 Experimental Setup

Benchmarks. We use BBO Benchmarks BBOB Elhara et al. (), HPO-B Arango et al. (), and rover trajectory planning task Wang et al. (). The BBOB suite, a comprehensive and widely used benchmark in the continuous domain, consists of $24$ synthetic functions. For each function, a series of linear and non-linear transformations are implemented on the search space to obtain a distribution of functions with similar properties. According to the properties of these functions, they can be divided into $5$ categories, and we select one from each category due to resource constraints, including Greiwank Rosenbrock, Lunacek, Rastrigin, Rosenbrock, and Sharp Ridge. HPO-B is a commonly used HPO benchmark and consists of a series of HPO problems. Each problem is to optimize a machine learning model across various datasets, and an XGBoost model is provided as the objective function for evaluation in a continuous space. We conduct experiments on two widely used models, SVM and XGBoost, in the continue domain. For robot control optimization, we perform experiments on rover trajectory planning task, which is a trajectory optimization problem to emulate rover navigation. Similar to Elhara et al. (); Volpp et al. (), we implement random translations and scalings to the search space to construct a distribution of functions. For BBOB and rover problems, we sample a set of functions from the task distribution as training and test tasks, while for HPO-B, we use the meta-training/test task splits provided by the authors. Detailed explanations of the benchmarks can be found in Appendix B.1.

Data. Similar to OptFormer Chen et al. (), we employ $7$ behavior algorithms, i.e., Random Search, Shuffled Grid Search, Hill Climbing, Regularized Evolution Real et al. (), Eagle Strategy Yang & Deb (), CMA-ES Hansen (), and GP-EI Balandat et al. (), which are representatives of heuristic search, EA, and BO, respectively. Datasets are generated by employing each behavior algorithm to optimize various training functions sampled from the task distribution, using different random seeds. For inference, new test functions are sampled from the same task distribution to serve as the test set. Specifically, for the HPO-B problem, the meta-training/test splits have been predefined by the authors and we adhere to this standard setup. Additional information about the behavior algorithms and datasets can be found in Appendix B.2 and B.3.

### 4.2 Baselines

As RIBBO is an in-context E2E model, the most related baselines are those also training an E2E model with offline datasets, including Behavior Cloning (BC) Bain & Sammut () and OptFormer Chen et al. (). Their hyper-parameters are set as same as that of our model for fairness. Note that the seven behavior algorithms used to generate datasets are also important baselines, and included for comparison as well.

BC uses the same transformer architecture as RIBBO. The only difference is that we do not feed RTG tokens into the model of BC and train to minimize the BC loss in Eq. (2). When the solutions are generated auto-regressively, BC tends to imitate the average behavior of various behavior algorithms. Consequently, the inclusion of underperforming algorithms, e.g., Random Search and Shuffled Grid Search, may significantly degrade the performance. To mitigate this issue, we have also trained the model by excluding these underperforming algorithms, denoted as BC Filter.

OptFormer employs a transformer to imitate the behaviors of a set of algorithms and an algorithm identifier usually needs to be specified manually during inference for superior performance. Its original implementation is built upon a text-based transformer with a large training scale. In this paper, we re-implement a simplified version of OptFormer where we only retain the algorithm identifier within the metadata. The initial states, denoted as $\bm{x}_{0}$ and $y_{0}$, are used to distinguish between algorithms. They are obtained by indexing the algorithm type through an embedding layer, thereby aligning the initial states with the specific imitated algorithm. This enables the identification of distinct behavior algorithms within the simplified OptFormer. Further details about the re-implementation can be found in Appendix C.

### 4.3 Main Results

The results are shown in Figure 2. For the sake of clarity in visualization, we have omitted the inclusion of Random Search and Shuffled Grid Search due to their poor performance from start to finish. We can observe that RIBBO achieves superior or at least equivalent efficacy in comparison to the best behavior algorithm on each problem except SVM and rover. This demonstrates the versatility of RIBBO, while the most effective behavior algorithm depends upon the specific problem at hand, e.g., the best behavior algorithms on Lunacek, Rastrigin and XGBoost are GP-EI, Eagle Strategy and CMA-ES, respectively. Note that the good performance of RIBBO does not owe to the memorization of optimal solutions, as the search space is transformed randomly, resulting in variations in optimal solutions across different functions from the same distribution. It is because RIBBO is capable of using RTG tokens to identify algorithms and reinforce the performance on top of the behavior algorithms, which will be clearly shown later. We can also observe that RIBBO performs extremely well in the early stage, which draws the advantage from the HRR strategy, i.e., employing 0 0 as the immediate RTG to generate the optimal potential solutions.

Figure: Figure 2: Performance comparison among RIBBO, BC, BC Filter, OptFormer, and behavior algorithms on synthetic functions, HPO, and robot control problems. The $y$-axis is the normalized average objective value, and the length of vertical bars represents the standard deviation.
Refer to caption: x2.png

RIBBO does not perform well on the SVM problem, which may be due to the problem’s low-dimensional nature (only three parameters) and its relative simplicity for optimization. Behavior algorithms can achieve good performance easily, while the complexity of RIBBO’s training and inference processes could instead result in the performance degradation. For the rover problem where GP-EI performs the best, we collect less data from GP-EI than other behavior algorithms due to the high time cost. This may limit RIBBO’s capacity to leverage the high-quality data from GP-EI, given its small proportion relative to the data collected from other behavior algorithms. Despite this, RIBBO is still the runner-up, significantly surpassing the other behavior algorithms.

Compared with BC and BC Filter, RIBBO performs consistently better except on the SVM problem. BC tends to imitate the average behavior of various algorithms, and its poor performance is due to the aggregation of behavior algorithms with inferior performance. BC Filter is generally better than BC, because the data from the two underperforming behavior algorithms, i.e., Random Search and Shuffled Grid Search, are manually excluded for the training of BC Filter. As introduced before, OptFormer requires to manually specify which algorithm to execute. We have specified the behavior algorithm Eagle Strategy in Figure 2, which obtains good overall performance on these problems. It can be observed that OptFormer displays a close performance to Eagle Strategy, while RIBBO performs better. More results about the imitation capacity of OptFormer can be found in Appendix C.

Why Does RIBBO Behave Well? To better understand RIBBO, we train the model using only two behavior algorithms, Eagle Strategy and Random Search, which represent a good algorithm and an underperforming one, respectively. Figure 3(a) visualizes the contour lines of the $2$D Branin function and the sampling points of RIBBO, Eagle Strategy, and Random Search, represented by red, orange, and gray points, respectively. The arrows are used to represent the optimization trajectory of RIBBO. Note that the two parameters of Branin have been scaled to $[-1,1]$ for better visualization. It can be observed that RIBBO makes a prediction preferring Eagle Strategy over Random Search, indicating its capability to automatically identify the quality of training data. Additionally, RIBBO achieves the exploration and exploitation trade-off capability using its knowledge about the task obtained during training, thus generating superior solutions over the ones in the training dataset.

Generalization. We also conduct experiments to examine the generalization capabilities of RIBBO. For this purpose, we train the model on all $24$ BBOB synthetic functions simultaneously with the results shown in Figure 3(b). To aggregate results across functions with different output scaling, we normalize all the functions adhering to previous literature Turner et al. (); Arango et al. (); Chen et al. (). The results suggest that RIBBO demonstrates strong generalizing to a variety of functions with different properties. Further experiments are conducted to examine the cross-distribution generalization to unseen function distributions. The model is trained on $4$ of the $5$ chosen synthetic functions and tested with the remaining one. Note that each function (i.e., Greiwank Rosenbrock, Lunacek, Rastrigin, Rosenbrock, and Sharp Ridge) here actually represents a distribution of functions with similar properties, and a set of functions is sampled from each distribution as introduced before. The results suggest that RIBBO has a strong generalizing ability to unseen function distributions. Due to the space limitation, the results and more details on cross-distribution generalization are deferred to Appendix D. The good generalization of RIBBO can be attributed to the paradigm of learning the entire algorithm, which can acquire general knowledge, such as exploration and exploitation trade-off from data, as observed in Chen et al. (). In contrast, such generalization may be limited if we learn surrogate models from data, because the function landscape inherent to surrogate models will contain only the knowledge of similar functions.

Figure: (a) Visualization
Refer to caption: x12.png

### 4.4 Ablation Studies

RIBBO augments the histories with RTG tokens, facilitating distinguishing algorithms and automatically generating algorithms with user-specified performance. Next, we will verify the effectiveness of RTG conditioning and HRR strategy.

Influence of Initial RTG Token $R_{0}$. By incorporating RTG tokens, RIBBO is able to attend to RTGs and generate optimization trajectories based on the specified initial RTG token $R_{0}$. To validate this, we examine the performance of RIBBO with different values of $R_{0}$, and the results are presented in Figure 3(c). Here, the RTG values, instead of normalized objective values, are used as the $y$-axis. We can observe that the cumulative regrets of the generated query sequence do correlate with the specified RTG, indicating that RIBBO establishes the connection between regret and generation. We also conduct experiments to explore the effect of varying the immediate RTG $R_{t}$, and it is observed that setting to a value larger than 0 0 will decrease the performance and converge to a worse value. Please see Appendix E.

Effectiveness of HRR. A key point of the inference procedure is how to update the value of RTG tokens at each iteration. To assess the effectiveness of the proposed strategy HRR outlined in Eq. (5), we compare it with the naive strategy, that sets an initial RTG token $R_{0}$ and decreases it by the one-step regret after each iteration. The results are shown in Figure 3(d). The naive strategy displays distinct behaviors depending on the initial setting of $R_{0}$. Specifically, when $R_{0}=0$, i.e., the lower bound of regret, the model performs well initially. However, as the optimization progresses, the RTG tokens gradually decrease to negative values, leading to poor performance since negative RTGs are out-of-distribution values. Using $R_{0}=5$ compromises the initial performance, as the model may not select the most aggressive solutions with a high $R_{0}$. However, a higher initial $R_{0}$ yields better convergence value since it prevents out-of-distribution RTGs in later stage. The proposed HRR strategy consistently outperforms across the whole optimization stage, because setting the immediate RTG to 0 0 encourages the model to make the most advantageous decisions at every iteration, while hindsight relabeling of previous RTG tokens, as specified in Eq. (5), ensures that these values remain meaningful and feasible.

Further Studies. We also study the effects of the method to aggregate $(\bm{x}_{i},y_{i},R_{i})$ tokens, the normalization method for $y$, the model size, and the sampled subsequence length $\tau$. Please see Appendix F. More visualizations illustrating the effects of random transformations on the search space are detailed in Appendix G.

## 5 Conclusion

This paper proposes RIBBO, which employs a transformer architecture to learn a reinforced BBO algorithm from offline datasets in an E2E fashion. By incorporating RTG tokens into the optimization histories, RIBBO can automatically generate optimization trajectories satisfying the user-desired regret. Comprehensive experiments on BBOB synthetic functions, HPO and robot control problems show the versatility of RIBBO. This work is a preliminary attempt towards universal BBO, and we hope it can encourage more explorations in this direction. For example, we only consider the model training over continuous search space with the same dimensionality, and it would be interesting to explore heteroscedastic search space with different types of variables. A mathematical theoretical analysis of the in-context learning capabilities based on RTG tokens is also of interest.

## Appendix A Model Details

We employ the commonly used GPT architecture Radford et al. () and the hyper-parameters are maintained consistently across the problems. Details can be found in Table 1. For BC, BC Filter and OptFormer, the hyper-parameters are set as same as those of our model. The training takes about $20$ hours on $1$ GPU (Nvidia RTX $4090$).

**Table 1: List of hyper-parameter settings in RIBBO.**
| RIBBO |  |
| --- | --- |
| Embedding dimension | 256 |
| Number of self-attention layers | 12 |
| Number of self-attention heads | 8 |
| Point-wise feed-forward dimension | 1024 |
| Dropout rate | 0.1 |
| Batch size | 64 |
| Learning rate | 0.0002 |
| Learning rate decay | 0.01 |
| Optimizer | Adam |
| Optimizer scheduler | Linear warm up and cosine annealing |
| Number of training steps | 500,000 |
| Length of subsequence $\tau$ | 50 |

## Appendix B Details of Experimental Setup

### B.1 Benchmarks

- •
BBOB Elhara et al. () is a widely used synthetic BBO benchmark, consisting of $24$ synthetic functions in the continuous domain. This benchmark makes a series of transformations in the search space, such as linear transformations (e.g., translation, rotation, scaling) and non-linear transformations (e.g., Tosz, Tasy), to create a distribution of functions while retaining similar properties. According to the properties of functions, these synthetic functions can be divided into $5$ categories, i.e., (1) separable functions, (2) moderately conditioned functions, (3) ill-conditioned and unimodal functions, (4) multi-modal functions with adequate global structure, and (5) multi-modal functions with weak global structures. We select one function from each category to evaluate our algorithm, Rastrigin from (1), Rosenbrock Rotated from (2), Sharp Ridge from (3), Greiwank Rosenbrock from (4), and Lunacek from (5). We use the BBOB benchmark implementation in Open Source Vizier(^1^11[https://github.com/google/vizier](https://github.com/google/vizier)), and the dimension is set to $10$ for all functions.
- •
SVM and XGBoost. HPO-B Arango et al. () is the most commonly used HPO benchmark and is grouped by search space id. Each search space id corresponds to a machine learning model, e.g., SVM or XGBoost. Each such search space has multiple associated dataset id, which is a particular HPO problem, i.e., optimizing the performance of the corresponding model on a dataset. For the continuous domain, it fits an XGBoost model as the objective function for each HPO problem. These datasets for each search space id are divided into training and test datasets. We examine our method on two selected search space id, i.e., $5527$ and $6767$, which are two representative HPO problems tuning SVM and XGBoost, respectively. SVM has $3$ parameters, while XGBoost has $18$ parameters, which is the most in HPO-B. We use the official implementations(^2^22[https://github.com/releaunifreiburg/HPO-B](https://github.com/releaunifreiburg/HPO-B)).
- •
Rover Trajectory Planning Eriksson et al. (); Wang et al. () is a trajectory optimization task designed to emulate a rover navigation task. The trajectory is determined by fitting a B-spline to $30$ points in a $2$D plane, resulting in a total of $60$ parameters to optimize. Given $\bm{x}\in[0,1]^{60}$, the objective function is $f(\bm{x})=c(\bm{x})+\lambda(\|\bm{x}_{0,1}-\bm{s}\|_{1}+\|\bm{x}_{58,59}-\bm{g
}\|_{1})+b$, where $c(\bm{x})$ is the cost of the given trajectory, $\bm{x}_{0,1}$ denotes the first and second dimensions of $\bm{x}$ (similarly for $\bm{x}_{58,59}$), $\bm{s}$ and $\bm{g}$ are $2$D points that specify the starting and goal positions in the plane, $\lambda$ and $b$ are parameters to define the problem. This problem is non-smooth, discontinuous, and concave over the first two and last two dimensions. To construct the distribution of functions, we applied translations in $[-0.1,0.1]^{d}$ and scalings in $[0.9,1.1]$, similar to previous works Elhara et al. (); Volpp et al. (). The training and test tasks are randomly sampled from the distribution. We use the standard implementation for the rover problem(^3^33[https://github.com/uber-research/TuRBO](https://github.com/uber-research/TuRBO)).

### B.2 Bahavior Algorithms

The datasets are generated with several representatives of heuristic search, EA, and BO as behavior algorithms. We use the implementation in Open Source Vizier Song et al. () for Random Search, Shuffled Grid Search, Eagle Strategy, CMA-ES. For Hill Climbing and Regularized Evolution, we provide a simple re-implementation. We use the implementation in BoTorch Balandat et al. () for GP-EI. The details of these behavior algorithms are summarized as follows.

- •
Random Search selects a point uniformly at random from the domain at each iteration.
- •
Shuffled Grid Search discretizes the ranges of real parameters into $100$ equidistant points and selects a random point from the grid without replacement at each iteration.
- •
Hill Climbing. At each iteration $t$, the current best solution $x_{best}$ is mutated (using the same mutation operation as Regularized Evolution) to generate $x_{next}$, which is then evaluated. If $f(x_{next})>f(x_{best})$, $x_{best}$ is updated to $x_{next}$.
- •
Regularized Evolution Real et al. () is an evolutionary algorithm with tournament selection and age-based replacement. We use a population size of $25$ and a tournament size of $5$. At each iteration, a tournament subset is randomly selected from the current population, and the solution with the maximum value is mutated. The mutation operation uniformly selects one of the parameters and mutates it to a random value within the domain.
- •
Eagle Strategy Yang & Deb () without the Levy random walk, aka Firefly Algorithm, maintains a population of fireflies. Each firefly emits light whose intensity corresponds to the objective value. At each iteration, for each firefly, a weight is calculated to chase after a brighter firefly and actively move away from darker ones in its vicinity. The position is updated based on the calculated weight.
- •
CMA-ES Hansen () is a popular evolutionary algorithm. At each iteration, candidate solutions are sampled from a multivariate normal distribution and evaluated, then the mean and covariance matrix are updated.
- •
GP-EI employs GP as the surrogate model and EI Jones et al. () as the acquisition function for BO.

RIBBO is trained exclusively from offline datasets derived from various source tasks, which are sampled from the task distribution. Each dataset consists of several optimization histories, generated by running a behavior algorithm on a task. No additional assumptions are imposed to the data collection process or the behavior algorithms, thereby permitting the use of any behavior algorithm.

Nevertheless, we can choose appropriate behavior algorithms to help the training. The model is trained on the datasets collected by the behavior algorithms, and the characteristics of these datasets can influence the model’s efficacy. It is advisable to employ well-performing and diverse behavior algorithms to create these datasets. If the datasets are from suboptimal behavior algorithms predominantly, there might be a decline in performance, even with the incorporation of RTG tokens. If the datasets are predominantly produced by behavior algorithms with homogeneous properties, the model may only be adept at addressing specific problems characterized by those properties. Conversely, if the behavior algorithms are diverse, the model can learn the strengths from various algorithms.

### B.3 Data

For BBOB and rover problem, a set of tasks is sampled from the task distribution and the above behavior algorithms are used to collect data. Specifically, for the BBOB suite, a total of $200$ functions are sampled, and each behavior algorithm is executed $500$ times, except for GP-EI, which is limited to $100$ function samples due to its high time cost. For the rover problem, $300$ functions are sampled with each being run $500$ times, whereas for GP-EI, a smaller number of $50$ functions is selected, each being run $500$ times. For testing, we randomly sample $10$ functions for each problem and run each algorithm multiple times to report the average performance and standard deviation.

For HPO-B, we use the “v3” meta-training/test splits provided by the authors, which consist of $51$ training and $6$ test tasks for SVM, and similarly, $52$ training and $6$ test tasks for XGBoost. All behavior algorithms employ $500$ random seeds to collect the training datasets.

## Appendix C Re-Implementation of OptFormer

OptFormer Chen et al. () is a general optimization framework based on transformer Vaswani et al. () and provides an interface to learn policy or function prediction. When provided with textual representations of historical data, OptFormer can determine the next query point $\bm{x}_{t}$, acting as a policy. Additionally, if the context incorporate a possible query point $\bm{x}_{t}$, the framework is capable of predicting the corresponding $y_{t}$, thus serving as a prediction model. We focus on the aspect of policy learning, due to its greater relevance to our work.

The original implementation is built upon a text-based transformer and uses private datasets for training. In this paper, we have re-implemented a simplified version of OptFormer, where we omit the textual tokenization process and only retain the algorithm type within the metadata. Numerical inputs are fed into the model and we use different initial states $\bm{x}_{0}$ and $y_{0}$ to distinguish among algorithms. The initial states are derived by indexing the algorithm type in an embedding layer, thereby enabling the identification of distinct behavior algorithms within OptFormer. The hyper-parameters are set as same as our method.

To examine the algorithm imitation capability, we compare our re-implementation with the corresponding behavior algorithms. The results are shown in Figure 4. For clarity in the visual representation, we only plot a subset of the behavior algorithms, including Shuffled Grid Search, Hill Climbing, Regularized Evolution and Eagle Strategy. These behavior algorithms are plotted by solid lines, while their OptFormer counterparts are shown by dashed lines with the same color. Note that the figure uses the immediate function values as the $y$-axis to facilitate a comprehensive observation of the optimization process.

Figure: Figure 4: Comparison of the behavior algorithms with the OptFormer re-implementation.
Refer to caption: x16.png

## Appendix D Generalization

We conduct a series of experiments to examine the generalization of our method in this section. We train the model on $4$ of $5$ chosen synthetic functions and test on the remaining one. The results in Figure 5 have shown that RIBBO has a strong generalization ability to unseen function distributions.

Figure: Figure 5: Cross-distribution generalization by training on $4$ of $5$ chosen synthetic functions and testing on the remaining one.
Refer to caption: x22.png

We also train the model across all training datasets from BBOB synthetic functions simultaneously, and normalize all the test functions to aggregate results across functions with different output scaling. The results are shown in Figure 6(a), and RIBBO has the best performance.

Figure: (a) Aggregation on the entire BBOB
Refer to caption: x29.png

## Appendix E Further Discussions about RTG Tokens

We conduct more discussion about the setting of RTG tokens in this section. The immediate RTG tokens are designed to represent the performance based on cumulative regret over the future trajectories (i.e., $R_{i}=\sum_{t^{\prime}=i+1}^{t}(y^{*}-y_{t^{\prime}})$), rather than focusing solely on instantaneous regret $y^{*}-y_{t+1}$. Thus, setting the immediate RTG to 0 0 inherently accounts for future regret, thereby enabling the algorithm to autonomously trade-off the exploration and exploitation. We conduct experiments to examine the performance of RIBBO with different values of $R_{t}$. The results are shown in Figure 6(b). Setting to a value larger than 0 0 will decrease the performance and converge to a worse value, validating the effectiveness of setting the immediate RTG as 0 0.

Sampling the next query point $\bm{x}_{t}$ is influenced by all the model inputs, including the immediate RTG token $\bm{x}_{t}$ and the previous history $(\bm{x}_{i},y_{i},R_{i})^{t-1}_{i=0}$. The immediate RTG token represents the goal that is intended to be achieved, while the historical data contains information about the problem. These elements are integrated to construct the inputs, influencing the resulting sampled point. Even if the RTG token is set to 0 0, implying a desire to sample the optimum, the short length of the history suggests limited knowledge about the problem, prompting the model to retain explorative behavior. As the history extends, suggesting a sufficient knowledge of the problem, the preference encoded by the RTG token shifts towards more greedy action. We conduct an experiment about the std of the output Gaussian head of $x$ of RIBBO using GriewankRosenbrock function and the results are shown in Table 2. It is clear that the std is very large in the early stage and becomes small later, which demonstrates the ability to trade-off the exploration and exploitation.

**Table 2: Std of the output Gaussian head of $x$.**
| Number of evaluations | 1 | 30 | 60 | 90 | 120 | 150 |
| --- | --- | --- | --- | --- | --- | --- |
| std of $\bm{x}$ | 0.37 | 0.17 | 0.14 | 0.11 | 0.03 | 0.01 |

## Appendix F Ablation Studies

We provide further ablation studies to examine the influence of the key components and hyper-parameters in RIBBO, including the method to aggregate $(\bm{x}_{i},y_{i},R_{i})$ tokens, the normalization method for the function value $y$, the model size, and the sampled subsequence length $\tau$ during training.

Token Aggregation aims to aggregate the information from $(\bm{x}_{i},y_{i},R_{i})$ tokens and establish associations between them. RIBBO employs the Concatenation method (Concat), i.e., concatenating to aggregate $\bm{x}_{i}$, $y_{i}$ and $R_{i}$ to form a single token. This method is compared with two alternative token aggregation methods, i.e., Addition (Add) and Interleaving (Interleave). The addition method integrates the values of each token into one, while the interleaving method addresses tokens sequentially. The results are shown in Figure 6(c). The concatenation method surpasses both the addition and interleaving methods, with the addition method showing the least efficacy. The concatenation method employs a relatively straightforward approach to aggregate tokens, while the interleaving method adopts a more complex process to learn the interrelations among tokens. The inferior performance of the addition method can be due to the summation operator, which potentially eliminates critical details from the original tokens. These details are essential for generating the subsequent query $\bm{x}_{t}$.

Normalization Method is to balance the scales of the function value $y$ across tasks. We compare the employed random normalization with the dataset normalization and the absence of any normalization. Dataset normalization adjusts the value of $y$ by $(y-y_{\rm min}^{i})/(y_{\rm max}^{i}-y_{\rm min}^{i})$ for each task $i$, where $y_{\rm min}^{i}$ and $y_{\rm max}^{i}$ denote the observed minimum and maximum values of $f_{i}$. No normalization uses the original function values directly. The results in Figure 6(d) indicate that random normalization and dataset normalization perform similarly, whereas the absence of normalization significantly hurts the performance. The choice of normalization method directly impacts the computation of RTG tokens and subsequently affects the generation of the desired regret. The lack of normalization leads to significant variations in the scale of $y$, which complicates the training process. Both random and dataset normalization scale the value of $y$ within a reasonable range, thus facilitating both training and inference. However, random normalization can bring additional benefits, such as invariance across various scales of $y$ as mentioned in Wistuba & Grabocka () and Chen et al. (). Therefore, we recommend using random normalization in practice.

Model Size has an effect on the in-context learning ability. We assess the effects of different model sizes by comparing the performance of the currently employed model size with both a smaller and a larger model. The smaller model consists of $8$ layers, $4$ attention heads, and $128$-dimensional embedding space, while the larger model has $16$ layers, $12$ attention heads, and $384$-dimensional embedding space. The results are shown in Figure 6(e), indicating that the model size has a minimal impact on overall performance. Specifically, the smaller model, due to its limited capacity, shows a reduced performance, while the larger one, potentially more powerful, requires more training data, which can lead to a slight decrease in performance due to overfitting or inefficiency in learning from a limited dataset. This analysis highlights the trade-offs involved in selecting the appropriate model size for optimal performance.

Subsequence Length $\tau$ controls the context length during both the training and inference phases. The process of subsequence sampling acts as a form of data augmentation, enhancing training efficiency. As shown in Figure 6(f), sampling subsequences rather than using the entire history as context, particularly when $\tau=T=150$, leads to improved performance. The computational complexity for causal transformer training and inference scales quadratically with the context length. Therefore, utilizing a shorter $\tau$ can significantly reduce computational demands. However, it is important to note that a shorter $\tau$ might not capture sufficient historical data, potentially degrading the performance due to the insufficient contextual information. This highlights the trade-offs between computational complexity and performance.

Figure: (c) Token aggregation
Refer to caption: x31.png

## Appendix G Visualization of Branin Function

In several of our experiments, such as BBOB, rover problems, and the visualization analysis of the Branin function, we implement a series of transformations to the search space. This is designed to generate a distribution of functions with similar properties. A set of functions is sampled serving as the training and test tasks from the distribution.

For the Branin function, random translations and scalings are applied to form the distribution. In this section, we present visualizations of the contour lines of the $2$D Branin functions, sampled from the distribution to demonstrate the effects of the applied transformations. To this end, $4$ distinct random seeds are used to draw samples from the distribution. The visualizations are shown in Figure 7. Note that the two parameters of the Branin function have been scaled to the range of $[-1,1]$ for the clarity of visual representations. Variations are observed in both the location of the optimum and the scales of the objective values. For instance, the optimum of the first subfigure locates more to the right compared to the second one, and the contour lines in the former are much more dispersed than those in the latter. The value scale for the first subfigure ranges from $-8$ to $1$, while in the second, it ranges from $-3.5$ to $1$. By applying these transformations, we can generate a function distribution that retains similar properties, enabling the sampling of training and test tasks for our model.

For other functions, such as BBOB suite, besides simple random translations and scalings, more complex transformations such as non-linear Tosz and Tasy transformations are applied, leading to a more intricate landscape. However, due to the high dimensionality of these functions, direct visualization is impractical, so we present only the visualization of the $2$D Branin function.

Figure: Figure 7: Contour line visualization for samples drawn from the $2$D Branin function distribution using $4$ distinct random seeds.
Refer to caption: x35.png

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 8
presentation: 4
questions: In practice, it is also possible to just run the algorithmic optimizer longer to get better solutions and it would be interesting if this is also true for this approach. 

Some algorithmic optimizers use local approximations of the objective functions to estimate higher order informations (e.g., gradients) would this be useful for this approach or does this already happen inside of the learned model?
soundness: 4
strengths: The paper is well-written and clear. The presentation is easy to follow and the claims and contributions are clearly stated. The method is novel and performs better than state-of-the-art approaches on the selected experiments.
summary: This paper is about learning a black-box optimization algorithm in an end-to-end fashion. In terms of meta learning, this approach falls in the category of "meta-learning the entire algorithm". The reason for doing this is that it is more flexible than learning something that replaces heuristics in an existing black-box optimization algorithm.  The approach proposed in this paper builds on a large sequence model (causal transformer). The goal is that this model can learn from the sequential behavior of many BBO algorithms on many tasks for making decisions. The supervision signal in this learning task is the regret-to-go which captures the performance of the optimization algorithm. The training regime is offline and the training sequences consist of query points and function values. During the test phase, the model is used in an autoregressive way to generate new query points. Experiments are performed on synthetic functions / data and robotic control problems. The proposed method is compared to state-of-the-art baselines.
weaknesses: The main weakness of this method is the fact that it has to transfer or generalize to new optimization problems, while algorithmic optimizers have to be tuned to new optimization problems. It is hard to judge how much training is needed for this method to perform well on any "similar" problem.

---

confidence: 3
contribution: 2
initial_rating: 3
presentation: 2
questions: * I would suggest that before Eq. (2) it is highlighted that this is the standard behavioral cloning baseline.

* Can't the proposed HRR also lead to OOD RTGs, in case the $R_t \gg 0$ when no similar data was seen before in the meta-training set? That is, if the tasks encountered are more difficult than the tasks in the meta-train set.

* What is the size of $M$ and $T$ in the experiments? Do the results look different with smaller meta training sets? What are the minimal values where RIBBO starts to outperform basic BBO algorithms (that do not use the meta training data)?

* In Figures 3b,3c,3d, why were the specific functions chosen / "cherry-picked" for this visualization? Can you add the visualizations with the other test-functions to the supplementary material?

* In multiple places (for example, line 534), the authors claim that RIBBO can be used to generate optimization trajectories satisfying a user-specified regret. This claim does not seem to be sufficiently supported by the experiments. The experiments do indicate that there is a correlation between the user-specified regret and the obtained regret, but even in Figure 3c, the mean regret when a user specified regret $10$ is significantly larger than $10$.
soundness: 2
strengths: The BBO problem is a very relevant problem. Given that BBO can be framed as a special case of RL (where the state is kept constant), applying a decision transformer (DT) (or something similar) to this problem seems like an interesting approach.
summary: The paper proposes a method to solve black-box optimization (BBO) problems end-to-end, using a "decision transformer"-like approach.
This involves learning a transformer that given a context of query-observation pairs and regret-to-go tokens, selects the next query. This appears to learn from offline meta-training, how to build a model and use this model to make sequential decisions.
weaknesses: I see some weaknesses both in the proposed method (and how it differs from DT), and the experimental evaluation.

Methodology:

* In my opinion, the manuscript would benefit from a more careful distinction from decision transformers, especially, since the BBO setting is a special case of the standard RL setting (where the state is constant). Why do the authors use regret-to-go tokens as opposed to returns-to-go in DT? In DT, no "observation tokens" are added to the sequence, and instead returns (i.e., function "observations") are subtracted from the RTG. Furthermore, I would like to see a comparison against DT as a baseline in the experiments. From the current paper, it does not become evident why RIBBO would be preferable over DT.

* The assumption that the "true" optimum value $y^*$ is known seems off to me. How would this value be known in practice, e.g., for a molecular design task? Other BBO algorithms such as UCB/EI/... do not require knowledge of $y^*$, and instead effectively balance exploration & exploitation. This seems like a fundamental assumption of the proposed approach, and to my understanding is why regret-to-go tokens might not be so practical (DT uses return-to-go tokens which do not have this problem).

* Setting $R_t = 0$ before choosing the next action suggests to me that the acquisition function is executed in the "exploitation regime". That is, in the meta-training set, I would assume that actions from algorithms that follow $R_t = 0$ are most likely from a stage where the optimum has already been almost perfectly determined, and the BBO algorithm purely exploits the model (i.e., does not focus on further exploration). Perhaps "knowing" the true $y^*$ a priori can compensate for this lack of exploration, but I would assume that this does not work in challenging exploration tasks where $y^*$ is unknown a priori. Can the authors elaborate why they expect setting $R_t = 0$ would lead to explorative behavior?

Experimental evaluation:

* It is not clear to me why "imitating" a BBO algorithm (like UCB, EI, ...) with a transformer is preferable over optimizing said algorithm directly. The "imitation" setting seems more applicable to cases where we want to imitate decisions of a "human expert" that cannot be expressed in closed-form, as is done in BC. This paper seems to claim that the main reason for learning a transformer is that this can leverage meta-training data to select the right BBO algorithm on the fly, however, in my view the experiments are insufficient to support this claim. This is because (1) the experiments do not compare against any other ad-hoc method of choosing BBO algorithms on the fly based on their performance on similar tasks in a meta-training set (this would not require re-learning the BBO algorithm, just learning when to apply which one), and (2) the experiments do not appear to compare against baselines that also use the meta-training set. In other words, I believe that the experiments are heavily skewed in RIBBO's favor since RIBBO uses a meta-training set while most BBO baselines have not seen this extra data. It might be that RIBBO exploits additional patterns in the meta-training set beyond just imitating one of the BBO algorithms. In my view, the experiments should compare against BBO algorithms that operate over meta-learned models which incorporate knowledge from the meta-training set. See, for example, [1]. In my opinion, convincing experiments would have to evaluate against such approaches that meta-learn individual components.

* It seems to me that the most important results are in Appendix D where the authors test RIBBO in scenarios where the same function family are not included in the offline meta training set. In the results from the main test, RIBBO might make extensive use of offline information that is not available to most of the tested baselines (for example, GP-EI). It seems that in Appendix D, RIBBO is frequently outperformed by GP-EI. Can the authors elaborate on why that could be? This seems concerning to me.


[1]: Rothfuss et al., Meta-Learning Reliable Priors in the Function Space.

---

confidence: 3
contribution: 3
initial_rating: 8
presentation: 3
questions: - What are the major limitations of this approach? 
- During inference, as a user, how can I select the initial RTG? Could you please provide examples where a low or a high initial RTG value is preferred? I believe I didn't get this part well.
soundness: 3
strengths: - The paper is well-written and clear.
- The literature is covered nicely in addition to motivating the proposed approach of learning the BBO algorithm in an E2E fashion. 
- The experiments and the baselines demonstrate the potential of the proposed approach.
- The discussion section and ablation studies are comprehensive to understand the impact of each component in the algorithm.
summary: Black-Box Optimization (BBO) is the process of optimizing an objective function where neither analytic expression nor derivatives of the objective function are available. Although Bayesian Optimization (BO) and Evolutionary Algorithms (EA) are the main BBO algorithms developed, they solve BBO problems from scratch while relying on expert-derived heuristics. Recently, the meta-learning paradigm has been adopted to learn some components of the algorithms from previously collected data, yet it requires a degree of expert knowledge. On the contrary, learning the entire BBO algorithm in an End-to-End (E2E) fashion from data requires no expert knowledge at all while providing flexibility among a wide range of BBO problems. However, learning such algorithms is challenging, and in practice, selecting the specific BBO algorithm is needed during inference (as in OptFormer [1]). In this work, an approach named Reinforced In-context BBO (RIBBO) is proposed to learn a general BBO algorithm from offline data collected using multiple BBO algorithms. Using a causal transformer, RIBBO can predict the next query point, given the optimization history. To alleviate the need for expert knowledge during inference when selecting the desired BBO algorithm, RIBBO augments the optimization history with regret-to-go RTG tokens representing the future performance of an algorithm. Consequently, RIBBO can automatically identify different algorithms and generate sequences of query points that satisfy the specified regret. So, it adds an interpretable component that is easy to manipulate during inference. To update the RTG tokens during testing, this work proposes a novel Hindsight Regret Relabelling (HRR) strategy by setting the immediate RTG as 0. Finally, the potential of this approach has been demonstrated in three problem domains: BBOB synthetic functions, hyperparameter optimization, and robot control problems while comparing to classical approaches (that generated the offline dataset) and related baselines like Behavior Cloning (BC) and OptFormer [1].

[1] Chen, Yutian, et al. "Towards learning universal hyperparameter optimizers with transformers." Advances in Neural Information Processing Systems 35 (2022): 32053-32068.
weaknesses: There are no significant weaknesses in this work, yet some important comments should be mentioned to improve this work.
- The limitation of this approach is not well highlighted.
- The quality of plots can be improved. I personally don't like the overlapping vertical lines that represent the standard deviation. A shaded region could be better.

---

confidence: 3
contribution: 1
initial_rating: 3
presentation: 2
questions: 1. BBOB Experiment Clarifications: 

In the BBOB experiments, what dimensions were selected, and what is the interpretation of the x-axis (number of evaluations)?

2. Hyperparameter Sensitivity: 

A primary motivation for RIBBO is to alleviate the challenge of manually tuning hyperparameters (lines 13–16 in the abstract). However, RIBBO itself requires hyperparameter tuning due to the nature of neural network training. Some of these parameters are listed in Table 1 (Appendix). How were these hyperparameters tuned, and could the authors provide sensitivity metrics to show their impact on performance?

3. Literature Review Addition: 

Opt-GAN [1] is another BBO method that aims to learn a global optimizer through a neural network, predicting the next candidate point based on previous points sampled in an off-policy fashion. It would be beneficial to include this work in the literature review.

References
1[] Lu, Minfang, et al. "OPT-GAN: a broad-spectrum global optimizer for black-box problems by learning distribution." Proceedings of the AAAI Conference on Artificial Intelligence, vol. 37, no. 10, 2023.
soundness: 2
strengths: 1. Data-Efficiency: 

RIBBO addresses a significant problem in BBO by learning from sequences of sub-optimal trials. This approach enables the algorithm to learn from incomplete or unsuccessful trials, potentially reducing computational costs.

2. Implementation and Training Simplicity: 

The method is relatively straightforward to implement and train, given the simplicity of the Transformer architecture and the offline training process.
summary: This paper presents a meta-learning algorithm designed for black-box optimization (BBO) problems, which are often derivative-free and lack a gradient signal. The proposed method uses an offline dataset collected from behavioral optimization algorithms, each of which generates sequences of optimization steps across various problems. The algorithm then trains a sequence-to-sequence model based on the Transformer architecture to replicate these sequences, aiming to generalize effectively and produce a high-quality optimization sequence when applied to new problems sampled from the training problem distribution.

In a typical optimization sequence, each step includes a pair of values, (x_i, y_i), where x and y represent the input and output of the BBO problem, respectively. The authors propose enhancing this dataset by adding a Regret-To-Go (RTG) scalar, represented as (x_i, y_i, r_i), where r_i is the sum of future regrets for t > i. This paper distinguishes between Behavioral Cloning (BC), which learns without RTG, and RIBBO, which incorporates RTG into the model training.

The authors test their algorithm across three datasets: (1) BBOB, a collection of synthetic optimization problems grouped by shared characteristics; (2) HPO-B, a set of machine learning hyperparameter optimization problems targeting base models such as XGBoost and SVM; and (3) Rover trajectory planning, where the goal is to optimize a sequence of 30 two-dimensional points that minimize a cost function. The algorithm is evaluated against other meta-learning BBO approaches, such as OptFormer and BC, as well as traditional BBO methods, including CMA-ES. RIBBO demonstrates strong performance, outperforming the alternatives in these experiments.
weaknesses: 1. Behavioral Policy Limitations: 

The potential of RIBBO to outperform the behavioral policies it learns from is uncertain. Unlike reinforcement learning (RL), RIBBO lacks a policy optimization component; it merely learns to output the next query, x_i, based on past inputs, outputs, and RTG. This approach is essentially behavioral cloning that might favor sequences with lower regret if the RTG functions as intended. However, without optimizing the output sequences (e.g., by approximating the target output value, y, and deriving a gradient signal [1]), RIBBO’s ability to surpass the behavioral policies remains unclear.

2. Justification for RTG Inclusion: 

The authors could strengthen their argument and visual representation of why RTG enhances solution quality. It is not evident why augmenting the input data with RTG would encourage the model to generate lower-regret sequences. Why is the network motivated to generate sequences of lower RTG?

3. Transferability Across BBO Problems: 

Domains like RL or few-shot learning provide clear justifications for what knowledge can transfer across tasks, such as environment dynamics or domain distribution, respectively. However, in black-box problems, a shared generative function across tasks is not always present. Even in cases where tasks are sampled from a common distribution, such as in the same group in the BBOB testbench or the rover trajectory planning problem, RIBBO lacks an adaptation mechanism like MAML[2], which would help in adjusting to different environments. Consequently, the paper should address whether and why RIBBO is truly adaptable to unseen tasks.


References:
1. Sarafian, E., Sinay, M., Louzoun, Y., Agmon, N., & Kraus, S. (2020, July). Explicit Gradient Learning for Black-Box Optimization. In ICML (pp. 8480-8490).
2. Finn, Chelsea, Pieter Abbeel, and Sergey Levine. "Model-agnostic meta-learning for fast adaptation of deep networks." International conference on machine learning. PMLR, 2017.

Meta-review: This paper proposed the RIBBO method to enhance Black-Box Optimization by utilizing offline data and incorporating regret-to-go tokens, with potentials to improve the efficiency of optimization processes. The paper does not adequately address the limitations and comparisons with existing methods. The AC agrees with the reviewers that the work would benefit from a more careful distinction from decision transformer family of algorithms. It has not meet the standards expected for publication.

Decision: Reject