Multipoint-BAX: A New Approach for Efficiently Tuning Particle Accelerator Emittance via Virtual Objectives

Although beam emittance is critical for the performance of high-brightness accelerators, optimization is often time limited as emittance calculations, commonly done via quadrupole scans, are typically slow. Such calculations are a type of $\textit{multipoint query}$, i.e. each query requires multiple secondary measurements. Traditional black-box optimizers such as Bayesian optimization are slow and inefficient when dealing with such objectives as they must acquire the full series of measurements, but return only the emittance, with each query. We propose a new information-theoretic algorithm, Multipoint-BAX, for black-box optimization on multipoint queries, which queries and models individual beam-size measurements using techniques from Bayesian Algorithm Execution (BAX). Our method avoids the slow multipoint query on the accelerator by acquiring points through a $\textit{virtual objective}$, i.e. calculating the emittance objective from a fast learned model rather than directly from the accelerator. We use Multipoint-BAX to minimize emittance at the Linac Coherent Light Source (LCLS) and the Facility for Advanced Accelerator Experimental Tests II (FACET-II). In simulation, our method is 20$\times$ faster and more robust to noise compared to existing methods. In live tests, it matched the hand-tuned emittance at FACET-II and achieved a 24% lower emittance than hand-tuning at LCLS. Our method represents a conceptual shift for optimizing multipoint queries, and we anticipate that it can be readily adapted to similar problems in particle accelerators and other scientific instruments.

For applications where the optimization objective is not a direct system observable, but rather is computed from a series of secondary measurements, even BO may be too inefficient.For example, a single query might require a scan of another control variable, a series of expensive computations, or an internal optimization process.We refer to this type of query as a multipoint query.Black-box optimization tasks with multipoint queries are encountered in a variety of fields, such as material science [20], nuclear astrophysics [21], aerospace engineering [22], bioinformatics [23], in addition to particle accelerators [24].When dealing with such tasks, traditional optimization methods, including BO, exhibit two types of inefficiencies.First, each query requires a set number of secondary measurement points to calculate the objective, even if a subset of those points already reveals the system settings to be suboptimal.Second, because the black-box function returns only the objective to the optimization algorithm, the full information acquired within the black-box function evaluation (e.g. the full series of secondary measurements) is not shared across different optimization steps, and this information loss leads to inefficient sampling.The result is that each multipoint query is both expensive and information-poor.When time is a limiting factor, optimizer inefficiency may reduce the number of control variables that can be optimized, curtail the ability to find a global optimum, or make the optimization task too costly to even attempt in practice.Optimizer inefficiency is particularly problematic for scientific instruments that are in high demand.
The motivating example for this paper is beam-emittance minimization in particle accelerators.The emittance of a charged particle beam, defined as the volume of particles in position-momentum phase space [25], is an important parameter for a variety of accelerator applications.For accelerator-based light sources, emittance determines the X-ray beam brightness, limiting the shortest wavelength available at X-ray free-electron lasers (XFELs) [26] and affecting the output X-ray power by orders of magnitude [27].Emittance is especially important for the next generation of undulator designs.For example, at the LCLS-II high-energy upgrade (LCLS-II-HE) [28], a modest emittance reduction from 0.6 mm•mrad to 0.4 mm•mrad is projected to increase the maximum photon energy that can reach saturation from 7.3 keV to 10.5 keV, enabling atomic resolution of biomolecules (see Appendix C for details).For colliders, small emittance is critical to maximize luminosity [29,30].Beams with high emittance ratios are needed for a variety of new light source and collider designs [31], and for injection into components of compact accelerators, such as dielectric wakefield accelerating cavities [32].
The accelerator settings need to be periodically re-optimized, or tuned, to achieve acceptable emittance values.Emittance depends on the initial beam conditions at the particle source (e.g. the photocathode and associated drive laser for electron accelerators), along with the combined effects of adjustable accelerator settings.The initial conditions can change as a result of both intended beam property adjustments (e.g.changes to the beam charge) and unintended drift over time (e.g.uncontrolled time-varying changes to the drive laser output).Given the importance of the beam emittance to accelerator performance, emittance optimization would ideally be a routine task for accelerator operations.
However, one of the most common methods for determining the transverse emittance involves scanning a focusing magnet's strength while observing the resulting change in beam size [25], i.e. the emittance is calculated from a multipoint query.Each step of the optimizer thus involves choosing a configuration in the control domain (the settings of the accelerator), then taking a set of measurements over a defined range in the secondary domain (in this case, beam-size measurements at different magnet settings), and finally fitting the measured points in the secondary domain to calculate an emittance value to the optimization algorithm.The inefficiency of measuring emittance severely limits the number of tuning opportunities at most accelerator facilities, despite the importance of achieving small emittance.For example, at the Linac Coherent Light Source (LCLS) [26], injector emittance is typically tuned only after returning from a machine shut-down or a substantial change to the target beam parameters (such as the charge), and it is done almost entirely manually by human experts.There is a clear need for more efficient algorithms for emittance optimization.
In this paper, we develop a new information-theoretic algorithm, Multipoint-BAX, as a sample-efficient method for optimization tasks with multipoint queries, using techniques adapted from Bayesian Algorithm Execution (BAX) [33].In contrast to BO, which directly models the objective function, Multipoint-BAX builds a system surrogate model in the joint control-measurement domain, defined by the Cartesian product of the optimization's control and secondary domain.Multipoint-BAX then guides the acquisition with a virtual objective, i.e. one that is calculated on the surrogate model rather than obtained directly from the machine.By modeling the joint control-measurement domain, as opposed to modeling only the objective of a multipoint query, our procedure maximizes the information gained from individual measurements.In addition, by employing a virtual objective, Multipoint-BAX can query individual points in the joint control-measurement domain, avoiding the need for multiple measurements at each step.We emphasize that querying and modeling direct observables (e.g.beam sizes using Multipoint-BAX), rather than the objective (e.g.emittance using BO) represents a significant conceptual shift in black-box optimization with multipoint queries.In summary, this paper introduces a new information-theoretic algorithm, Multipoint-BAX, for optimization tasks with multipoint queries.We present its application to the challenging and outstanding problem of emittance tuning in accelerators, with substantial improvement in sample-efficiency.First, we present the challenges of emittance optimization to motivate this work.Second, we describe how Multipoint-BAX can improve efficiency for general optimization tasks involving multipoint queries.Third, for the specific case of emittance optimization, we show our method to be sample-efficient compared to both BO and the Nelder-Mead simplex algorithm [34], using a simulation environment of the LCLS injector.Finally, we show experimental results for Multipoint-BAX in minimization of electron-beam emittance at both LCLS and the Facility for Advanced Accelerator Experimental Tests II (FACET-II) [35] at SLAC National Accelerator Laboratory (SLAC), with the former achieving 24% lower emittance than was found by manual tuning.We anticipate this approach to be widely adaptable to optimization problems involving multipoint queries on real-world instruments in science and engineering.

The Challenges of Emittance Optimization
This work is motivated by the challenges typically faced when optimizing the emittance in particle accelerators.Despite the importance of emittance to the lasing process, optimization is not a part of standard daily operations.Tuning time is limited by the need to minimize beam interruptions to users, which roughly translates into a limit on the number of queries to the system available for each tuning event.Emittance tuning is particularly slow because the exact response of the emittance to accelerator settings is unknown, and thus emittance is typically tuned as a black-box: iteratively adjusting the injector settings and observing the outcome.Using the most common method of emittance measurement, called the "quadrupole scan" method, a series of beam-size measurements is needed to calculate the emittance at each configuration of settings, making the query at each iteration particularly slow [25].As a result, emittance tuning is typically limited to recovery from scheduled down-times and when switching to non-standard beam setups.Note that while single-shot emittance measurements for accelerators do exist (e.g.multi-slit and pepper-pot masks [36][37][38][39]), they are generally not suitable for all types of beams and beamline layouts, including beams at the LCLS.With standard black-box emittance optimization using the quadrupole scan method, each step involves choosing a new control variable configuration (one or more accelerator injector magnet settings), running a subroutine that measures the beam size at multiple settings of a downstream quadrupole magnet, and calculating the emittance from the set of beam sizes observed.At LCLS, the subroutine is very time-consuming.When factoring in the need for robustness in automated tuning, we found that in practice we need to acquire an average of 18 beam-size measurements per emittance calculation, equivalent to at least 5 minutes of beam time per query using wire scanners.
Figure 1 (Left) highlights several problems encountered using BO-or other standard model-based optimizers-to tune emittance.As an illustration, we consider a typical emittance tuning task involving an eight-point calculation.First, BO must execute a full eight (or more) measurement scan at each query, even if the first beam size indicates the control setting is poor.Second, despite the wealth of information in the beam-size measurements, BO only uses the calculated emittance to build its model.As a result, different steps of the optimizer acquire nearly redundant beamsize measurements.Third, the measurement variable settings needed for an accurate emittance calculation depend on the control variables, which sometimes lead to scans that are unsuitable for fitting emittance.In BO, this valuable information obtained  during a failed scan would be discarded, despite being helpful for characterizing the beam-size response to the control variable.

Multipoint-BAX for Efficient Emittance Optimization
To overcome the challenges described above and improve the efficiency of optimization with multipoint queries, we propose to model the joint control-measurement domain, i.e. to learn a model of the beam size as a function of both the control and measurement variables.Figure 1 (Right) presents an illustration of how joint optimization samples individual beam-size measurements to maximize the information gained with each measurement.We highlight that joint optimization requires minimization of a computed function (e.g.emittance) operating on a learned model of a direct observable (e.g.beam size).However, existing standard model-based optimization methods such as BO are typically restricted to modeling and optimizing the same quantity.In the case of emittance tuning, standard BO can only model and optimize the computed emittance from a full quadrupole scan at each query point in the control domain.Here we introduce a novel method which solves all three of the above mentioned problems, sampling individual points from the joint domain, modeling all acquired information, and separating the modeling space from the optimization objective.
Input Domain We develop an information-based method, Multipoint-BAX, that allows us to model a direct observable that is different than the objective.In the case of emittance tuning, we query a single point in the joint control-measurement domain, thereby observing a single beam size, rather than performing a full scan of beam size measurements to calculate the emittance objective.Multipoint-BAX then builds a model of the physical observable (beam size) with respect to both the control variables and the measurement variable.However, as we do not wish to optimize the beam size, we introduce a virtual emittance objective calculated on our learned model of beam sizes.This virtual objective is obtained by executing the full emittance calculation on function samples drawn from the learned model's posterior distribution; i.e. the emittance is calculated on the virtual beam size model, not on direct measurements.The next acquisition point is then chosen using an information-based strategy, which involves maximizing the mutual information between the model's posterior predictive distribution and the minimizer of the virtual objective.
In the LCLS emittance application, Multipoint-BAX models the beam size with respect to several injector magnet settings.The three primary emittance-tuning variables at LCLS are the solenoid magnet (SOL1) and two corrector quadrupoles (CQ1 and SQ1) [40]. Figure 3 shows a simplified layout of the LCLS injector and emittance calculation setup.To run an emittance calculation for an injector configuration, a "quadrupole scan" [25] changes a quadrupole at location s 0 (denoted Q5), while measuring the beam size on a wire at location s 1 .We reconstruct the beam matrix elements by solving the system of equations where R k is the total transfer matrix (which describes the change in beam shape from s 0 to s 1 ) for the kth quadrupole setting, Σ 0 is the beam matrix at location s 0 , and Σ 1 k is the beam matrix at location s 1 for the kth quadrupole setting.Each 2×2 beam matrix Σ defines the beam phase space through four elements: σ 11 , σ 12 = σ 21 , and σ 22 .Each measurement at quadrupole setting k returns the σ 11 element of Σ 1 k ; with sufficient measurements, we can use Eq (1) to solve for all three unknown elements of Σ 0 .We then obtain the single plane emittance from the Σ 0 matrix using the relationship Equation ( 2) is computed for both transverse planes, X and Y , and the normalized geometric mean gives the final emittance.For more details, see [41].By applying this procedure to predictions from a beam-size model (rather than beam-size measurements), Equation ( 2) produces a virtual emittance objective.The full Multipoint-BAX emittance optimization procedure is illustrated in Figure 4.The procedure is initialized with randomly sampled points from the joint control-measurement domain.Then, at each iteration, the algorithm queries the beam size at a single value of the Q5, SOL1, CQ1 and SQ1 variables, constructing a model of the beam size as a function of both control (Q5) and measurement variables (SOL1, CQ1, and SQ1).This internal model represents the prior distribution on the function describing the beam-size response to the quadrupole strength, and is implemented in this work by a Gaussian process (GP) model; we parameterize the GP with a radial basis function kernel (for all input dimensions) with a fixed likelihood noise scale estimated  offline from prior beam size measurements, where we fit kernel hyperparameters (lengthscales and output scale) by maximizing the marginal log likelihood [42,43].
During the internal step (Figure 4b), Multipoint-BAX executes the emittance calculation on a predefined number of quadrupole scans drawn from the model's posterior distribution, with each virtual scan producing a virtual objective.Finally, the information-based acquisition function selects a new beam-size measurement to query on the accelerator at the injector configuration that maximizes the mutual information between the accelerator settings and the virtual objective.Note that the query that maximizes the information gain is not necessarily the configuration with the lowest emittance based on the posterior samples.After measuring a new beam size, the algorithm updates the GP model and begins a new iteration.We emphasize that in a Multipoint-BAX emittance optimization, emittance calculations are only executed virtually on function samples drawn from the posterior distribution of the learned GP model, and never on the machine itself.
In general, any automated emittance tuning approach requires a robust emittance calculation procedure.While Multipoint-BAX never executes a full beam-size scan for an emittance calculation on the real machine, an equivalent method executes on the model posterior.In this paper we used the newly-developed pyemittance package [41] that provides an adaptive emittance procedure.More details regarding the emittance calculation are described in Appendix B.
In Algorithm 1, we provide pseudocode for our Multipoint-BAX procedure for emittance tuning.Here, we use X to denote the space of control variables (i.e., SOL1, CQ1, and SQ1), and X to denote the product space of control and measurement variables (i.e., SOL1, CQ1, SQ1, and Q5).Additionally we use T to denote the number of total queries that we make in the joint control-measurement domain, and K to denote the number of posterior function samples drawn from our GP model.We also use D t to denote the dataset of queries that have been made by iteration t.In line 8, we introduce an expected information gain (EIG) acquisition function, defined as where x * denotes the control variable that minimizes the emittance, i.e., x * = argmin x∈ X Emittance f (x), and {x k t } K k=1 denotes a set of posterior samples of emittance minimizers, generated by running an emittance minimization procedure on posterior function samples, as detailed in Algorithm 1 (lines 5-6).Further, H[ • ] denotes the (Shannon) entropy, and E p(x * |Dt) [ • ] denotes the expectation taken with respect to the posterior density p(x * |D t ).Our acquisition function can be viewed as a version of Bayesian algorithm execution (BAX) [33], which aims to greedily gain information about a computed function property via running an algorithm on posterior samples; here, the associated algorithm is an emittance optimization procedure, and the associated function property (computed by the algorithm) is the emittance minimizer over the control variables, x * ∈ X .Our acquisition function is discussed in more detail in Appendix D. Timing results for this algorithm are given in Appendix E.  # variable with lowest emittance, as given by this sample # Optimize the acquisition function 8: # Query black-box function f at x t 10: # Update dataset with new observation 12: We note that the multipoint query optimization setting we consider in this paperand the information-based acquisition function that we develop for this setting-are distinct from the settings (and corresponding methods) of several recent developments in BO, including standard optimization with entropy search methods [44][45][46], multiobjective optimization [43,47], and multi-fidelity optimization [48,49].In particular, multi-fidelity Bayesian optimization (MFBO) settings are related in that they also involve an auxiliary input space (i.e., a fidelity space).However, in MFBO, the goal is to optimize the black-box function at the highest fidelity value in the auxiliary space, while in multipoint optimization the goal is to optimize an objective calculated across multiple points in the auxiliary space (for example, via a potentially complex emittance calculation); as a consequence, the goals in the two settings are dissimilar, and methods derived for MFBO do not directly apply to our setting.

Results of Optimization in Noisy LCLS Simulation Setting
We study the performance of Multipoint-BAX in emittance optimization using a surrogate model of the LCLS copper injector trained on IMPACT-T simulation data.Details of this model are presented in Appendix F. At each iteration, we query the beam size from the LCLS surrogate model given a configuration of virtual injector control variables for SOL1, CQ1, and SQ1, as well as a single value for the Q5 strength.For each run, the algorithm was initialized with 10 points that were uniformly sampled from the joint control-measurement domain defined by the bounds set on each variable domain: SOL1: (0.46, 0.485) (kG•m), CQ1 and SQ1: (-0.02 0.02) (kG).All tests ran for 200 iterations, corresponding to 200 total beam size queries from the simulation.Each algorithm execution on the posterior (i.e.virtual objective) involves a scan of 10 initial points, followed by 10 final points in both X and Y after adjusting the scan range based on the minimum of the parabola (see Appendix B).To assess the performance of Multipoint-BAX, we repeat the optimization with black-box methods operating directly on the multipoint query.We chose BO and Nelder-Mead simplex [34] as baselines, as both have seen extensive use in accelerator operations [15-19, 50, 51].Details of the BAX, BO, and simplex algorithm implementations are given in Appendix D and Appendix G.
For each algorithm, we ran 40 tests, each with different initial samples.For all simulated measurements, Gaussian noise of the form N (0, σ n ) was added to the beam size for each function query, with σ n = 10% as a conservative estimate of typical experimental noise levels at LCLS (see Appendix A). Figure 5 shows the mean and standard error of the simulated Multipoint-BAX optimization runs (blue), Bayesian optimization with a GP model (orange), and simplex optimization runs (green).The emittance value shown is the ground truth (noiseless) emittance corresponding to the best control variables found at each iteration, and we display the best emittance up to that point as a function of the total number of beam-size measurements.are normalized by the ground truth optimal emittance.In the lower plot of Figure 5, we show a magnified view of the Multipoint-BAX optimization.A drawback from using a virtual objective is that the algorithm never runs full emittance calculations on the true function during optimization, so in practice an operator would not have access to the blue line.However, we can observe the quality of the internal beam-size model, which can serve as a proxy for convergence; if the GP models the beam-size response correctly, it should also identify the configuration with the optimal emittance.For this reason, we also show the error on its beam-size prediction compared to the true (observed) beam size in the LCLS surrogate model on the right-hand axis (purple).
We can further check that the Multipoint-BAX GP model learns the correct behavior of the beam size during scans over the secondary domain.Figure 6 shows samples of the GP posterior during iterations 40 and 100, with the control variables set to the optimal configuration that the algorithm estimates at that given iteration.By We plot posterior samples of the beam-size scan for these control variables (gray), the posterior mean of the GP at the same control variables (red), and the ground truth beam sizes for this scan (blue).
iteration 100, Multipoint-BAX models the beam-size response to a quadrupole scan with high accuracy.
Multipoint-BAX significantly surpasses BO and simplex in finding an optimal emittance.While each BO and simplex iteration corresponds to an average of 18 beam-size measurements, each algorithm iteration is a single measurement.In this noisy environment, Multipoint-BAX finds the optimal emittance after about 160 measurements on average, while the mean of the BO runs takes over 3000.With each beam-size measurement taking 18 seconds on a wire scanner at LCLS, BAX would require 48 minutes of invasive measurements compared to 15 hours with BO.
We hypothesize that Multipoint-BAX should exhibit increased robustness to noise because its GP models the beam size rather than the calculated emittance.Because the emittance fit is sensitive to errors in the beam size, the emittance is more difficult to model than the beam size.To test this robustness, we repeated the previous experiment with both a noisier (σ n = 30%) and a less noisy (σ n = 5%) beam-size function.The results are shown in Figure 7: the increased noise leaves our method's performance largely unchanged (blue), while degrading BO's performance significantly (orange).

Results of Live Experimental Optimization at LCLS and FACET-II
We applied Multipoint-BAX to the online optimization of the beam emittance in the LCLS injector with an identical setup to the simulated environment.The injector control variables were the solenoid SOL1, and the two quadrupoles CQ1 and SQ1.Emittance calculations scanned the Q5 quadrupole while measuring beam size with a downstream wire scanner.Details of the experimental setup are given in Appendix A. The bounds on the SOL1 device domain were identical to the simulation runs, (0.46, 0.485) (kG•m), while CQ1 and SQ1's domains were made smaller to (-0.015, 0.015) (kG) due to constraints on the region where beam-size measurements were valid and within range of the wire scanner.In future work, such constraints can be incorporated in the optimization to learn to avoid bad or invalid regions without having to place tight restrictions on the control domains [52].
Figure 8 shows the resulting emittance optimization as a function of the number of beam-size measurements, initialized with 10 random points.To assess the performance of Multipoint-BAX, full experimental emittance calculations were performed every 20 iterations at the optimal control variables found by the algorithm at that iteration (blue).The experimental emittance calculations are slow and are only needed to assess convergence for the study.Because an operator would not have access to such calculations in practice, it would not be possible to select an earlier setting with Emittance optimization in the LCLS injector.Results of the BAX emittance optimization showing the true (observed) emittance calculated from measurements at the optimal configuration identified by Multipoint-BAX every 20 iterations (blue), its upper bound, i.e. the worst emittance seen after that iteration (green), the error on its beam-size prediction compared to the true beam size (purple), and the best hand-tuned emittance on that day for reference (red).Note that the blue and green curves are equal after query 30.See the text in Section 5 for additional details on each curve shown.
better emittance as would be done with BO.Therefore we show an upper bound on emittance at each point (green), i.e. the worst emittance seen after that iteration.Even without experimental emittance calculations, an operator can monitor the improvement in the Multipoint-BAX beam-size prediction compared to the measured values (purple) or the settling of control variables to decide when the algorithm has converged.
Multipoint-BAX reaches a final emittance of 0.62 ± 0.02 mm•mrad, 24% lower than that achieved by accelerator operators via hand-tuning during normal operations with the same machine state (0.82 ± 0.02 mm•mrad, in red with the shading corresponding to its 2-sigma error).The matching parameter was 1.17 in the X-plane and 1.08 in the Y .We note that neither the matching quadrupoles nor the match were included in this optimization.
We can see that Multipoint-BAX converges to small beam-size errors and a low emittance value after approximately 60 iterations, corresponding to about 20 minutes of beam time.We note that, after only a handful of queries, the model posterior already begins to concentrate on the optimal region, and thus the algorithm has some chance of estimating a low emittance value, as we observe in the blue line in Figure 8.However, the model error is still large for at least 15 iterations, and yields an inconsistent estimate of the emittance (purple line, Figure 8).Only after approximately 60 iterations does the model converge to within the measurement error, yielding a final estimate of the emittance minimizer.
We can also confirm that by the end of the optimization, the GP has learned an accurate model of beam-size scans in the secondary domain, as seen in Figure 9.For iterations 10 and 90, we plot the posterior samples of the beam-size scan (gray) at the optimal configuration that Multipoint-BAX estimates at that iteration, the posterior mean of the GP (red), and the true beam-size measurements for this scan (blue).We can see that at iteration 10, the algorithm has not yet learned to model beam-size scan accurately, again confirming the low emittance in Figure 8 was selected by chance at that iteration.
The Multipoint-BAX behavior in this experimental setting is consistent with the simulation study on the injector surrogate model.Due to the inefficiency of traditional optimizers, their performance could not be compared to our method on the LCLS machine, as a single BO run was expected to take several hours based on previous experience, and beam time at LCLS is in high demand.Nonetheless, these results are a strong indication that Multipoint-BAX performance surpasses standard blackbox optimization methods in noisy experimental settings, just as we observed in the simulation environment.
In addition to the experimental test on LCLS, we applied the Multipoint-BAX procedure to the optimization of the electron-beam emittance on FACET-II.The FACET-II injector line has an identical setup to the LCLS beam line, and we again optimized SOL1, CQ1 and SQ1.However, FACET-II has a charge of 2 nC, compared to 250 pC in the LCLS run.The control domain bounds were (0.37, 0.41) (kG•m) for SOL1, and (-0.01 0.01) (kG) for CQ1 and SQ1.Here, optical transition radiation (OTR) screens were used instead of wire scanners for measuring the beam size downstream of Q5 (see Appendix A).
Multipoint-BAX was initialized with 10 random beam-size measurements, and full emittance evaluations were performed every 20 iterations using the current optimal the worst emittance seen after that iteration (green), the error on the model's beam-size prediction compared to the true beam size (purple), and the best hand-tuned emittance on that day for reference (red).Note that the blue and green curves overlap as they are are equal in this experiment.
control variables.Figure 10 shows the results of the FACET-II experimental run.Following the 10 initial random samples, Multipoint-BAX converges to an optimal configuration after 80 queries, recovering a similar emittance (4.49 ± 0.11 mm•mrad, with a match of 1.07 in X-plane and 1.06 in Y ) to the best hand-tuned value found during normal operations that day (4.48 ± 0.09 mm•mrad, with a match of 1.05 in X and 1.02 in Y ).Similar to previous figures, we also show the error on the algorithm's beam-size prediction compared to the true beam size measured on the machine at every iteration.

Conclusions and Outlook
In summary, we have proposed a new approach for highly-efficient optimization of systems involving multipoint queries, and have demonstrated the method experimentally for the high-impact case of emittance optimization in accelerators.Rather than optimizing on slow multipoint queries, Multipoint-BAX instead learns a model of the system on-the-fly from single measurements in the joint control-measurement domain.
The algorithm then guides the optimization by calculating a virtual objective on the fast-executing surrogate.The method avoids the need for the full, slow multipoint query while also maximizing the information gain of each measurement, increasing the overall efficiency of the optimization.We applied Multipoint-BAX to the specific task of electron-beam emittance optimization in the LCLS injector in both noisy simulation and experimental settings, and in the FACET-II injector in an experimental setting.In a simulation with typical LCLS noise levels, we saw a 20× increase in efficiency in reaching the optimum when using our method compared to BO.In experiments on the live machine, Multipoint-BAX was able to reach an emittance that was 24% lower than that achieved by handtuning at LCLS, and recovered a similar emittance to the best hand-tuned emittance in FACET-II.As shown in Figure B1, even a modest reduction of emittance at LCLS-II-HE [28] can have a dramatic impact on FEL performance.Future work will include expanding the Multipoint-BAX method presented here to higher dimensions to incorporate more quadrupoles and control variables along the accelerator, and targeting more complex objectives (e.g. the beam matching parameter along with the emittance).We expect performance can improve further with stronger priors, such as information on the physical correlations between the control and measurement variables [17].Using a non-zero prior mean function, e.g. a surrogate learned from simulations or previous measurements, may also improve tuning efficiency [53].This method could also be used in tandem with more comprehensive machine models, and highlights a new path toward replacing expensive indirect beam measurements with computation on easy-to-acquire samples from surrogate models.In addition to emittance minimization, a variety of other accelerator tasks require multipoint queries and could employ Multipoint-BAX, for example manipulating longitudinal phase space [24] or designing X-ray focusing optics.Beyond accelerators, we anticipate Multipoint-BAX will be broadly applicable to complex optimization problems in science and engineering.While we focus on multipoint queries, similar advantages exist for single-point queries that produce rich outputs, e.g. from simulations.Multipoint-BAX is particularly advantageous over traditional methods on tasks with high noise environments and high dimensional inputs, both common to real-world scientific instruments.
X-and Y -axes are defined as orthogonal and the Z-axis as parallel to the path of the beam).All mentions of emittance in this article refer to the geometric mean of the normalized transverse emittance, unless otherwise noted.
Common methods to measure electron-beam size in the transverse planes involve either scanning a wire through the beam or passing the beam through a yttrium aluminum garnet (YAG) or OTR screen [55].An emittance calculation is done using beam-size measurements with either multiple wires/screens at different positions in the accelerator, or, as we used in this work, a single wire/screen while changing an upstream quadrupole magnet [25,56].Here, each full emittance calculation was performed using the Q5 quadrupole with adaptive scanning methods as outlined in [41].For each full emittance calculation executed on the machine, four initial points are measured as a rough scan along the full quadrupole range to find the approximate waist location, which can change as the upstream injector configuration is varied.Once the waist is found, a finer scan of seven points is measured around the waist, with redundant points skipped during acquisition.During analysis, any data outside of the convex region are removed from the set based on the inflection points, and points are added as needed to recover a symmetric parabola.The process repeats in each of the X and Y dimensions, for a total of 18 beam-size measurements on average.
When accelerator operators tune the LCLS photoinjector by hand, emittance calculations typically involve a scan of at least four measurements over the domain of the scanning quadrupole upstream of the wire.However, in some configurations of the injector, the waist of the beam-a necessary feature to capture-in the transverse X-and Y -plane does not occur at the same quadrupole strength, thus requiring two quadrupole scans over two different ranges (or one large range).Moreover, to incorporate the calculation into automated tuning, the calculation must be robust, requiring additional measurements.To achieve robust and accurate measurements, the quadrupole scan range needs to be large enough to fully capture the waist of the beam along both axes, while still being narrow enough to accurately quantify the minimum of the parabolic curve.This range can vary for different machine settings and is typically adjusted by hand until a good scan is achieved.
Here, the number of measurements per scan executed on the machine (18 on average) was empirically chosen.Using fewer beam-size measurements per scan was insufficiently robust during optimization, leading to erroneous emittance calculations.Using additional measurements per scan resulted in a slightly smaller final emittance, but at the cost of even slower convergence.BAX uses 30 measurements to calculate the virtual objective on the internal model since acquisition time is many orders of magnitude faster than querying the machine.

Figure 1 .
Figure 1.Querying the joint control-measurement domain.Left: Illustration of multipoint queries when tuning emittance with a standard black-box optimizer.The background color denotes the measured quantity (beam size), while the point marker color denotes the objective value (emittance) of the resulting multipoint query.The dashed line shows the optimal setting of the control variable.Optimizing the beam size is not equivalent to optimizing the emittance objective.Right: Illustration of the same number of beam-size measurements when optimizing via queries in the joint domain to maximize information gain of each measurement.

Figure 2 .
Figure 2. Optimization in the joint control-measurement domain.(a) A query of objective function f (x) is made at control setting x in the control domain.(b) A multipoint query at a control setting x requires a vector of measurements at a set of points z in a second domain.(c) The multipoint scenario is converted to an adaptive sampling problem in joint control-measurement domain.

Figure 3 .
Figure 3. LCLS photoinjector layout.The solenoid (SOL1) and corrector quadrupole (CQ1 and SQ1) settings comprise the control variables in our emittance optimization setting, and the quadrupole (Q5) setting is the measurement variable.The wire is used for beam-size measurements.
CQ1, SQ1]Optimization of emittance on model posterior Iterate until optimal injector config (with lowest emittance)

Figure 4 .
Figure 4. Diagram of the Multipoint-BAX procedure for emittance optimization.(a) A GP models the beam-size function with respect to the three control (SOL1, CQ1, and SQ1) and one measurement (Q5) variable, based on experimental data.(b) The emittance value and uncertainty of different injector configurations are assessed using cheap queries of the GP posterior.(c) A new experimental data point to query is suggested.(d) The machine is queried for a beam size.The colors of the boxes in this diagram match the colors of the domains illustrated in Figure 2.

Algorithm 1
Multipoint-BAX for Emittance Tuning Input: initial dataset D 1 , black-box function f , prior distribution p(f ).

Figure 5 .
Figure 5. Simulated LCLS emittance optimization.Top: Optimization of beam emittance on the LCLS injector surrogate model using Multipoint-BAX (blue), BO (orange), and Nelder-Mead simplex optimization (green).The mean and 2-sigma standard error of 40 individual runs with randomized starting conditions are shown for each algorithm.The best emittance seen at each iteration is plotted, and the values are normalized by the minimum of the ground truth emittance.Bottom: A magnified view of Multipoint-BAX optimization results (blue), with the error on the beam-size prediction compared to the true (observed) beam size in the LCLS surrogate model are shown on the right-hand axis (purple).

Figure 6 .
Figure 6.Posterior Samples in Multipoint-BAX.Samples of the GP posterior during iterations 40 and 100 during a Multipoint-BAX optimization run on the LCLS surrogate model, with the control variables set to the optimal configuration that the model estimates at the given iteration.We plot posterior samples of the beam-size scan for these control variables (gray), the posterior mean of the GP at the same control variables (red), and the ground truth beam sizes for this scan (blue).

Figure 7 .
Figure 7. Robustness to noise during optimization.Comparison of the optimization performance on the LCLS injector surrogate model with varying levels of noise added to the beam size for Multipoint-BAX (blue shades) and BO (orange shades).The best emittance up to that iteration is shown, normalized by the minimum of the ground truth emittance.The lower plot shows a magnified view of Multipoint-BAX optimization.
Figure 8.Emittance optimization in the LCLS injector.Results of the BAX emittance optimization showing the true (observed) emittance calculated from measurements at the optimal configuration identified by Multipoint-BAX every 20 iterations (blue), its upper bound, i.e. the worst emittance seen after that iteration (green), the error on its beam-size prediction compared to the true beam size (purple), and the best hand-tuned emittance on that day for reference (red).Note that the blue and green curves are equal after query 30.See the text in Section 5 for additional details on each curve shown.

Figure 9 .
Figure 9. Multipoint-BAX beam-size predictions in the LCLS injector.Comparison of the beam-size predictions in Multipoint-BAX given by the posterior samples of the beam-size scan (gray) and the posterior mean of the GP (red) at the estimated optimal configuration, and the true observed beam sizes (blue) for a beam-size scan after 10 iterations (left) and 90 iterations (right).

Figure 10 .
Figure 10.Emittance optimization in the FACET-II injector.Results of the Multipoint-BAX emittance optimization showing the true (observed) emittance calculated from measurements at the optimal configuration identified by the algorithm every 20 iterations (blue), its upper bound, i.e. the worst emittance seen after that iteration (green), the error on the model's beam-size prediction compared to the true beam size (purple), and the best hand-tuned emittance on that day for reference (red).Note that the blue and green curves overlap as they are are equal in this experiment.