Modern accelerators are among the most complicated and delicate computer-controlled systems. An accelerator such as the Linac Coherent Light Source (LCLS) can consist of tens of thousands of components, each of which needs to be thoroughly controlled and monitored in order for the machine to properly work. Realizing the maximum machine performance and maintaining high availability for such a machine pose a tremendous challenge.
Machine learning (ML) may hold the key to addressing this challenge. As a broad field of study, ML offers algorithms and methods for modeling, optimizing, and automatic controlling of systems of all scales, which could be ideal for many accelerator applications.
At SLAC, we are developing ML methods for accelerators.
- Automated tuning and control: Using advanced online optimization algorithms to efficiently search the parameter space, discover the optimal operation setting, and maintain the high performance.
- Beam diagnostics and data analysis: Analyzing beam diagnostics data with ML methods to extract accurate and detailed beam conditions and providing live beam information to users.
- Fault detection and prediction: Identifying root causes of machine faults by analyzing recent data of a vast number of process variables, predicting future machine faults based on models trained with archived history data.
- Accelerator modeling and simulation: Building comprehensive models for the accelerators with both physics simulation and deep learning, applying the models to accelerator diagnostics and control.
Tuning SPEAR3 dynamic aperture with the RCDS method. X. Huang, J. Safranek, Phys. Rev. ST Accel. Beams, 18, 084001 (2015)
SLAC accelerator physicists have been pioneers in developing and promoting online optimization algorithms. The robust conjugate direction search (RCDS) method was designed for the optimization of noisy functions with a complex terrain in the parameter space . It has found applications in ~30 laboratories worldwide, including work that resulted in substantial improvement in the storage ring nonlinear beam dynamics at SPEAR3, ESRF, MAX-IV, and NSLS-II and in FEL power at LCLS .
Application of Bayesian optimization to online tuning has been extensively studied on the LCLS . The Gaussian process (GP) optimizer was developed in a collaboration with the CS department of Stanford University. The application of the GP optimizer to the tuning of optics matching quadrupoles in LCLS has led to a significant reduction of FEL tuning time.
 X. Huang et al, Nucl. Instrum. Meth. A, 726, 77-83 (2013); X. Huang, NAPAC’16, p. 1287 (2016).
 X. Huang, et al, Phys. Rev. ST Accel. Beams, 18, 084001 (2015); S. Liuzzo, et al, IPAC’16, p. 3420 (2016); D. K. Olsson, IPAC’18, p. 2281 (2018); X. Yang, et al, IPAC’19 (2019); J. Wu, et al, FEL’17 (2017)
 M. McIntire, et al, IPAC’16, p. 2972 (2016); J. Duris, et al, presentation at HB2018
Prediction of longitudinal phase space with a Neural Network based surrogate model. C. Emma, A. Edelen, et al, PRAB 21,112802 (2018)
Beam Diagnostics with ML at FACET
FACET-II expects to produce particle beams of unprecedented quality that are challenging to measure using traditional diagnostics. The FACET-II facility is leveraging Machine Learning (ML) techniques to provide shot-to-shot non-destructive measurements of the electron beam distribution for use in machine set-up and user analysis of experimental data. This effort focuses on studying and deploying ML based virtual diagnostics and new diagnostics boosted by ML that directly, but non-destructively, measure electron beam parameters.
At FACET-II ML based virtual diagnostics are used to predict the electron beam distribution along the accelerator using only existing non-destructive measurements of the electron beam and the accelerator settings as inputs to the ML models. The virtual diagnostics will also be used in combination with conventional optimizers to aid in machine tuning for user experiments which require different electron beam distributions. This work is being conducted in close collaboration with LCLS/LCLS-II and has been prototyped recently in proof-of-principle experiments [1,2].
The other focus of FACET-II is development of new diagnostics that are ideal for computer control and optimization of accelerators. Diagnostics which are ideal for computer control are both fast (single shot) and non-destructive. Fast diagnostics take advantage of the speed available by modern computers and machine learning algorithms. Non-destructive diagnostics allow continuous monitoring and tuning of the beam without disrupting delivery to users. FACET-II is developing a diagnostic based on edge radiation  that uses convolutional neural networks to perform image analysis and return beam parameters and dynamics in milliseconds in lieu of simulation optimization techniques that take hours.
 C. Emma and A. Edelen, et. al., PRAB 21 112802 (2018)
 A. Scheinker, A. Edelen, et. al., PRL 121 044801 (2018)
 Chubar, O.V., Particle Accelerator Conference 1995, vol. 4, pp. 2402-2404 vol.4, 1995.
Illustration of the ghost imaging experimental setup. Figure author: Thomas J. Lane. Figure under CC4.0 license.
Ghost Imaging with ML
Ghost imaging (see e.g. ) is an experimental technique that extracts higher-dimensional information from a single-pixel camera (or a “bucket” detector). The experimental setup typically consists of a beam splitter that splits the incident light into two paths: one going through the sample and the bucket detector, the other reaching a pixelated detector to measure the spatial profile of the incident light. By correlating the bucket detector reading and the spatial measurement of the incident light, one can reconstruct the spatial structure of the sample, without ever directly measuring the sample. Similarly, one can apply the principles of ghost imaging in the time and frequency domain to probe the temporal and spectral features of the sample. The shot-to-shot variation in the measurement of the incident light is critical for the reconstruction of the sample. Whereas traditional imaging methods fight to reduce noise, ghost imaging exploits shot-to-shot jitter to extract new information from our experiments. Machine learning algorithms are a critical part of ghost imaging reconstruction. As opposed to traditional correlation analysis, machine learning algorithms exploit prior knowledge of the sample to improve convergence of the reconstruction and reduce the acquisition time and sample damage.
Ghost imaging can provide a range of benefits for accelerators and photon science, including improving the signal-to-noise ratio (Felgett's advantage), reducing the number of measurements required (compressive sensing), and replacing challenging beam manipulation with comparatively easy measurements. Examples include manipulating the electron beam in the accelerator  and measuring sample dynamics at time-scales shorter than the x-ray bunch .
 Miles J. Padgett and Robert W. Boyd. "An introduction to ghost imaging: quantum and classical" Phil. Trans. R. Soc. A 375 (2016)
 Li, S., et al. "Electron ghost imaging." Physical review letters121.11 (2018): 114801.
 Ratner, D., et al. "Pump-probe ghost imaging with SASE FELs." Physical Review X 9.1 (2019): 011045.
 T.J. Lane and D. Ratner, "What are the advantages of ghost imaging? Multiplexing for x-ray and electron imaging" arXiv:1907.12178 (2019)