Bayesian Optimization of a Laser-Plasma Accelerator

Generating high-quality laser-plasma accelerated electron beams requires carefully balancing a plethora of physical effects and is therefore challenging — both conceptually and in experiments. Here, we use Bayesian optimization of key laser and plasma parameters to flatten the longitudinal phase space of an ionization-injected electron bunch via optimal beam loading. We first study the concept with particle-in-cell simulations and then demonstrate it in experiments. Starting from an arbitrary set point, the plasma accelerator autonomously tunes the beam energy spread to the subpercent level at 254 MeV and 4 . 7 pC = MeV spectral density. Finally, we study a robust regime, which improves the stability of the laser-plasma accelerator and delivers sub-five-percent rms energy spread beams for 90% of all shots.

In a laser-plasma accelerator (LPA) [1,2], an intense laser pulse excites a trailing plasma wave that can trap and accelerate electrons from the plasma background. The plasma wave supports accelerating fields that surpass those of modern radio-frequency based machines by orders of magnitude, which has led to the demonstration of fewfemtosecond [3,4], GeV-level electron beams over only cm distances [5,6].
Despite rapid progress of the field, however, providing the high-quality electron beams demanded by applications [7][8][9] is still a major challenge. Generating high-brightness laser-plasma electron beams requires carefully balancing a multitude of physical effects that nonlinearly couple laser and plasma parameters. Furthermore, probing the mechanisms of a laser-plasma accelerator is typically associated with high cost. Particle-in-cell (PIC) [10] simulations, that adequately cover the physics involved, require high temporal and spatial resolution, and are computationally very expensive. Optimizing LPAs in experiments is further complicated by the limited repetition rates and stability of today's drive lasers that typically constrain the available knowledge of the system to a few noisy measurements.
Bayesian optimization (BO) is a method designed to find optima of a costly to evaluate black-box function f based on limited and noisy measurements [11] and therefore seems well suited to optimize the complex parameter space of particle accelerators. Only recently, this approach was successfully applied to maximize the pulse energy of the Linac coherent light source (LCLS) x-ray free-electron laser [12].
In this Letter, we experimentally demonstrate the use of Bayesian optimization to improve the beam quality and stability of a laser-plasma accelerator. Based on particle-in-cell simulations, we first demonstrate the method's capability to autonomously optimize the shape of the beam's longitudinal phase space by controlling only a few experimentally accessible laser and plasma parameters. We then use the same algorithm to tune those parameters in the experiment and, starting from noise, optimize the accelerator to deliver subpercent energy spread beams at 254 MeV and few-10 pC bunch charge. By slightly adapting the BO algorithm, we find a regime which drastically improves the stability of these beams.
Bayesian optimization is an optimization strategy that is relevant for problems where an objective function f, i.e., the quantity that one wants to improve, is expensive to probe or, as in most cases, takes a long time to evaluate. The idea of BO is to make use of a surrogate model, i.e., a mathematical model that approximates the real objective function and is much faster and/or cheaper to evaluate. Oftentimes, the surrogate model is generated through Gaussian process regression [13], a machine learning technique which returns a probability distribution of possible functions compatible with previous evaluations. Thus, the model can not only predict the most probable value of f at an unexplored location but it also provides an uncertainty for this prediction. Since the goal is to maximize the objective function with as few direct evaluations as possible, BO uses the surrogate model to determine the most promising points to evaluate. To do so, the model predictions and their uncertainties are combined into an acquisition function which describes the strategy to determine the next parameters to sample. One of the most commonly used acquisition functions is expected improvement [11], i.e., the expected value of the improvement of a new measurement over the current best sample. The parameters which maximize the acquisition function are selected as the input for the next direct evaluation. Other choices of acquisition functions include upper confidence bound [14], knowledge gradient [15], and entropy search [16]. After the evaluation, the model is refined with the newly gathered information. This process is repeated iteratively to find the input parameters that maximize the objective function.
Here, we apply Bayesian optimization to a laser-plasma accelerator, which uses localized ionization injection in combination with optimal beam loading to generate highquality electron beams [17]. To separate the injection from the acceleration of the electron bunch, we use a plasma profile as shown in Figs. 1(d)-1(f). In a short region of nitrogen-doped hydrogen, inner shell electrons are first injected via ionization injection [18][19][20] and then subsequently accelerated in a plasma density plateau (n 0 ) formed from pure hydrogen. The final electron energy spread is determined by the initially injected phase space, the accumulation of correlated energy spread induced by the strong accelerating gradient, and an effect known as beam loading [21][22][23][24][25], which is driven by the current profile of the injected bunch and modifies the longitudinal accelerating field. When balancing those effects, the combined wakefield and beam loading field effectively result in a constant accelerating field over the entire bunch length [17]. In turn, every variation of the system that has an effect on the bunch charge, current profile, or the amplitude of the wakefield, will directly influence the energy spread of the accelerated electron bunch.
The influence of the dominant parameters deviating from the optimum setting can be summarized as follows. Higher laser energies drive a stronger wakefield, but also increase the injected charge due to higher intensity in the N 2 -doped region, which overloads the wakefield and results in a positively chirped bunch. The focus position determines the laser intensity in the injection region and thus the bunch charge. Shifting the focus toward the end of the plasma can therefore compensate higher laser energies and overloading the wake. The charge of the beam can also be controlled by the N 2 concentration as it determines the density of electrons available for injection. However, since the outer shells of nitrogen release five electrons to the plasma background, the N 2 concentration also scales the plasma density peak at the beginning of the target and the negative density gradient between doped and pure hydrogen. The change of the plasma wavelength in this transition roughly determines the length of the injected bunch. Finally, the plasma density in the plateau sets the plasma wavelength and wakefield amplitude, which limits the bunch length and its final energy. Although the main influence of each of these parameters is conceptually known, their complex interplay, as well as dynamic effects like the evolution of the drive laser and the wake make it difficult to study the system beyond such simple considerations. Particle-in-cell simulations that capture the full physics are required.
In the following, we combine the Bayesian approach with the spectral, quasicylindrical PIC code FBPIC [26,27] to identify the optimum working point in the complex parameter space that generates high-quality electron beams.
To optimize the spectral density of the electron bunch, we maximized the objective function Here, E is the median energy and ΔE is the median absolute deviation (mad) of the energy, which was found to be the most robust measure for the beam energy spread. Reducing the energy spread at the same time as maximizing the beam charge is for example of interest to drive a future freeelectron-laser [7] which puts limitations on the allowed spectral width of the electron beam while the radiation output scales strongly with the beam charge and current. The objective function uses a scaled bunch charge, ffiffiffiffi Q p , so as to promote beams with smaller energy spread over higher charge beams. We varied parameters that are easily accessible in the experiment: the N 2 concentration, the overall gas (plasma) density, the laser energy and focus position. Figures 1(a)-1(c) show the electron phase spaces after exiting the plasma for selected steps of the optimization which was seeded by running five simulations with random input parameters. Initially, panels (a),(d), the electron phase space has a positively correlated energy spread which is a sign that the wakefield is overloaded. This happens because the laser diffracts so that in the second half of the profile the wakefield is too weak to support the charge of the beam. The optimization algorithm compensates this by shifting the laser focus toward the end of the density profile and by increasing the laser energy, panels (b),(e). The wakefield is now strong enough to support the full charge throughout the entire plasma so that the phase space of the beam flattens. By further shifting the focus downstream and reducing the laser energy, panels (c),(f), the intensity in the injection region is decreased. This constrains the injection process and therefore the initial energy spread of the beam so that its slice energy spread is reduced. Additionally, an increase of the N 2 concentration increases the charge of the beam and its length due to the plasma density ramp that is now at the transition between the mixed and pure gas region. Because the front of the electron beam is now closer to the drive laser it experiences a weaker accelerating field and consequently its energy is lower. Finally, the optimized beam has a charge of 52 pC and an energy of 258 MeV with an energy spread of 0.7% (mad). This value is close to the slice energy spread of 0.4% at the center of the beam and limited only by the bunch tail, which contains ∼10% of the charge. The normalized transverse beam emittances are 1.5 and 0.3 mm mrad in x and y, respectively, where x is the laser polarization plane (the evolution of the transverse beam properties is shown in [28]).
After confirming that low energy spread beams are theoretically possible in a carefully optimized setup, we realized this scenario in an experiment using the LUX plasma accelerator [32,33]. Figure 2 shows the experimental setup. The Ti:sapphire drive laser ANGUS delivered pulses with up to 2.6 J (∼1% rms stability) energy and 39 fs FWHM (∼2.5% rms stability) pulse length that were focused by a 2 m focal length off-axis parabola to a FWHM spot size of 25 μm with 1 Hz repetition rate. The laser energy was controlled with an attenuator consisting of a thin-film polarizer in combination with a motorized wave plate. The pulse energy was measured with a pyroelectric sensor using the leakage through a transport mirror. The focus position of the laser was fine-tuned by shifting the motorized lens of a beam expander behind the last amplifier stage so that the beam reached the focusing parabola with slight initial defocus. The defocus was measured with a wave front sensor behind the parabola to infer the focus position. To compensate drifts of the system, the attenuator and the lens were controlled and stabilized in closed loop with the energy and wave front measurements.
The target consisted of a microstructured sapphire plate [17]. A 5-mm long square channel (500 μm edge length) was continuously filled from two inlets of which the first was supplied with a mixture of N 2 and H 2 and the second with pure H 2 . The N 2 concentration and gas pressure were controlled via three independent mass-flow controllers. These five parameters resembled the same degrees of freedom that we used in the simulations presented above. In addition, they provided control over the differential pressure between the front and the back of the target, which determines the transition between the mixed and pure gas regions. After the target an electromagnetic quadrupole doublet captured the accelerated beams and focused them onto the scintillating screen of an electromagnet dipole spectrometer. At the imaged energy, the spectrometer had a resolution of 0.1%. In a range of AE20 MeV around the focused energy, the resolution was better than 1%. The beam charge was measured with a cavity-based darkcurrent monitor.
Again, we used f ¼ ffiffiffiffi Q pẼ =ΔE as a measure for the spectral density. Using the online measured laser energy and defocus, the actual machine inputs were mapped to a measured objective function. Thereby, the surrogate model could attribute fluctuations of the objective function to variations of the recorded laser parameters and the model could be trained with consistent single shot data. To account for remaining noise, caused by measurement errors and variations of hidden laser parameters, we extended the surrogate model with a white noise kernel. We set the quadrupole doublet to image 270 MeV electron beams onto the spectrometer. Beams with an energy far off this set point were ignored by the optimization, due to the reduced energy resolution of the spectrometer and the apparently larger energy spread.
To start the optimization, we acquired data at ten random input settings. For each iteration, the optimization gathered six shots and fed these individually to the surrogate model, FIG. 2. Setup of the LUX accelerator. The laser energy and focus position in the plasma source with variable gas flows are controlled with a movable lens and an attenuator. Circular inset: plasma density (blue and green) and the laser envelope from a particle-incell simulation. The laser drives a spherical plasma cavity in the back of which an electron beam is injected and accelerated. maximized the acquisition function on the updated model, and then determined a new set point. Changes to the gas system took a few seconds to have an effect. Therefore, the machine was not tuned after every shot but by measuring six shots at each machine setting the jitter of the laser parameters could be used to locally explore the objective function. Figure 3 shows the evolution of the system during the optimization process. The initial beam, panel (a), has a spectrum with a small peak and a pedestal toward higher energies, which indicates that the beam still has a correlated energy spread from un-matched beam loading. After a few iterations, panel (b), a well-defined peaked spectrum is measured. Slight adjustments increase the energy of the beams to ∼260 MeV, panel (c). The decrease of the relative energy spread that comes at the cost of beam charge results in the improvement of the objective function. By balancing the relevant laser and plasma parameters the algorithm was able to find a setting with subpercent energy spread starting from initially random conditions after a runtime of 45 min. The fluctuations of the objective function around (c) can be attributed to jitters of the laser parameters [17].
To characterize the accelerator performance at this set point, we adopted the focusing to image a beam energy of 250 MeV for best spectral resolution. Figure 4 shows the average spectrum of the 100 best of 2500 recorded events, which we consider representative for operation at the optimized settings. On average, these beams had 31 pC and an energy of 254 MeV with 0.88% rms (0.68% mad) energy spread.
By building the surrogate model on the basis of all individual events, the algorithm aimed at settings where the best possible beam could be generated, regardless of how frequently these would occur. The drive laser parameters, in particular the laser energy and focus position, still vary slightly from shot to shot and were the main source of electron beams deviating from the optimum. By including the actual measurements of those parameters, the model could interpret fluctuations of the objective function to a large degree. However, variations of other hidden laser parameters, that could not be recorded online, still were substantial and reduced the precision of the model.
To improve the stability of the plasma accelerator, we modified the optimization algorithm: instead of feeding the surrogate model with individual shots, we collected 20 shots at each setting. We then determined the most frequent objective value [28] to train the model together with the averaged input parameters. Thereby, the algorithm favored settings, where the majority of the beams had a high quality, and thus balanced beam quality and stability. Figure 5 shows a comparison between a reference machine setting and a setting obtained with this modified approach. The reference setting is manually tuned and produces slightly higher energy spread than the beams from Fig. 4. The stability of the electron energy spectrum under the presence of shot-to-shot fluctuations of the drive laser is significantly improved: 90% of the accelerated beams have an energy spread smaller than 5%, compared to 60% of the beams in our reference case. The relative charge stability is similar with 45% in the optimized and 38% in the reference case. Both settings share similar laser conditions, but the stability-optimized setting has a lower N 2 concentration (3.6% compared to 10%), and ∼70% plasma density in the plateau.
The reason for the improved stability becomes evident when comparing the correlations between the bunch charge and the laser focus position-a main characteristic of localized ionization-injection schemes [17]. For the stability-optimized setting, the correlation of beam charge with focus position is significantly reduced. In both cases the relative energy spread has a clear optimum for the same  4. Energy spectrum at optimized settings: averaged spectrum (black) and standard deviation (gray area) over the best 100 of 2500 measured shots with a Gaussian fit (σ E;fit , blue) and corresponding statistics. The energy spectra are normalized to their respective median energy, to eliminate the effects of shotto-shot energy variations (1.5% rms) from the statistics. focus position. However, deviations from the optimum increase the energy spread less in the optimized case. To further elucidate the differences between both regimes, we have modeled them using PIC simulations: as a result of the lower N 2 concentration and plasma density plateau, the injected beams are significantly shorter in the high-stability regime. As a variation in focus position mainly changes the charge density of the injected bunch, the total charge fluctuation is smaller for shorter beams. A comparison of the longitudinal phase spaces for both settings [ Fig. 5(e)] shows that even though both cases develop roughly the same energy chirp for the same variation of the focus position, the shorter bunch length results in a smaller projected energy spread. Consequently, tuning the bunch length we can trade bunch charge and spectral density for robustness against intensity fluctuations. The set points found with the optimization method were still used after several weeks and gave comparable performance.
In conclusion, we have studied a localized ionization injection target, which generates high spectral density and low energy spread electron beams through optimization of beam loading. Providing electron beams for applications requires finding the optimal working point of laser and plasma parameters for high-quality beams within a complex parameter space and then operating consistently at this setting. We have introduced Bayesian optimization as a tool to identify an optimized working point and, by proper choice of the objective function, a new regime of high stability. After finding a new regime, it is however crucial to elucidate the underlying physics using correlations and high-statistic measurements supported by simulations. To demonstrate this concept we have traced stability improvements back to a shortened bunch length, which reduces the influence of energy chirp on the projected beam energy spread. We could generate high-quality low energy spread electron beams just by tuning readily accessible experimental parameters.
Furthermore, BO is a very promising tool to optimize the charge, divergence, and betatron photon yield in a laserplasma accelerator in real time [34]. Further optimizing the spatiotemporal properties of the drive laser, additional improvements might be achieved [35][36][37] and the use of physics-informed surrogate models [12] could speed up the optimization.
Combining together Bayesian optimization, PIC simulations, and access to real-time measurements and control settings in one system provides a powerful tool for the design and operation of laser-plasma accelerators leading to the demonstrated stable, high-quality beams. It can guide our understanding of the complex interplay between the experiment parameters and will thus become an important method for the development and operation of future laserplasma accelerators.
We appreciate the support by workshops and technical groups of University of Hamburg and DESY. We thank W. P. Leemans and M. Thevenet for discussions. This work was supported by BMBF Grants No. 05K19GUA, No. 05K19GUD, and computing time granted on the supercomputer JUWELS (Project No. CHHH20) at Jülich Supercomputing Centre.