# Machine learning for the anomaly detection and characterization of the 24 GeV/c proton beam at CERN IRRAD Facility

Jaroslaw Szumega, Lamine Bougueroua, Blerina Gkotse, Pierre Jouvelot, Federico Ravotti

► To cite this version:

Jaroslaw Szumega, Lamine Bougueroua, Blerina Gkotse, Pierre Jouvelot, Federico Ravotti. Machine learning for the anomaly detection and characterization of the 24 GeV/c proton beam at CERN IRRAD Facility. 16th International Particle Accelerator Conference, Jun 2025, Taipei (TW), Taiwan. pp.2917-2920, 10.18429/JACoW-IPAC2025-THPM110. hal-05322700

HAL Id: hal-05322700

https://hal.science/hal-05322700v1

Submitted on 20 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# MACHINE LEARNING FOR THE ANOMALY DETECTION AND CHARACTERIZATION OF THE 24 GeV/c PROTON BEAM AT CERN IRRAD FACILITY

Jaroslaw Szumega¹,²*, Lamine Bougueroua³, Blerina Gkotse¹,²,⁴, Pierre Jouvelot², Federico Ravotti¹

¹Experimental Physics Department, CERN, Geneva, Switzerland

²Mines Paris, PSL University, Paris, France

³Efrei Research Lab, Université Paris-Panthéon-Assas, Paris, France

⁴ University of Wisconsin-Madison, Madison, USA

## Abstract

The accurate assessment of beam quality is one of the most important aspects in the operation of irradiation facilities such as IRRAD at CERN. The Beam Profile Monitor (BPM) sensor system developed there for the high-intensity Proton Synchrotron beam features minimal particle interaction, radiation hardness and good sensitivity. It provides a wealth of high-quality beam-profile data not available in other facilities, enabling the development of data processing more advanced than before. To further exploit these BPM system's features, we investigate whether innovative Machine Learning (ML) techniques can be adapted to such an infrastructure and improve upon existing data analysis techniques.

This paper details the application study of (1) autoencoder architectures to perform the automatic pattern recognition and anomaly detection of proton beam profiles, and (2) deep learning techniques to predict relevant beam parameters. We applied this ML-based approach to a new dataset of BPM data taken during a recent run of IRRAD, and our preliminary results demonstrate acceptable performance in comparison to existing methods. This work is a first step towards a data-driven irradiation-experiment facility.

## INTRODUCTION

The IRRAD facility is located on the T8 beamline of the experimental East Area at CERN. For its operation, the facility exploits a 24 GeV/c proton beam extracted from the Proton Synchrotron (PS) ring. This beam requires constant quality monitoring; therefore, along the beamline, four Beam Profile Monitor (BPM) sensors are placed. This setup enables constant and real-time monitoring of the transverse beam profile, which is, nominally, Gaussian with a size of 12 × 12 mm² FWHM (Full Width at Half Maximum) [1]. This monitoring information, available on dedicated webpages, is used by the beam-operation team to properly steer the irradiation beam, as well as by the IRRAD users, to analyze the data of their irradiation experiments.

The BPM sensors, developed at IRRAD and based on the Secondary Electron Emission effect [2], feature partial grids of 39 pixelated metal pads of about 4×4 mm² area (Fig. 1). They are connected to a dedicated 40-channel electronic Data Acquisition (DAQ) system. This unique setup provides

an average stored data bandwidth of about 10 Mb/day per BPM.

Since each BPM is structured as a pixelized pattern of pads, each single profile measurement may be easily pre-processed so as to be treated as an image. With such an approach, a rather large image dataset can be prepared from BPM measurements, thus opening up the possibility of developing Artificial Intelligence (AI)-based analyses of the IRRAD beam profiles and the definition of new metrics for beam characterization. In particular, one can envision training Machine Learning (ML) models towards automatic classification or anomaly detection of beam profiles.

<figure><img src="image_2.png" /><figcaption>Figure 1: Graphical model of a BPM-sensor printed circuit board (PCB) (left-hand side), confronted with an example of measurement data seen as an image (right-hand side).</figcaption></figure>

To perform beam-profile tracking and characterization, representing BPM data as images leads to considering using computer-vision-based processing techniques such as Convolutional Neural Networks (CNN), which happen to be already well known for their versatile and efficient applications in the field of High-Energy Physics ( [3], [4], [5]). Moreover, ML methods have been used already in a variety of contexts related to accelerator tuning [6] and beam prognostics for particle-accelerator modeling [7]. Other complex systems dealing with high-energy beams, such as high-power laser systems, also benefit from the use of deep-learning methods [8], in particular when using Autoencoder (AE)-based architectures.

In production irradiation facilities, beams are (hopefully) most of the time properly calibrated, and thus most of the images we collected within the IRRAD BPM dataset represent “good”, i.e., well-centered cases. Distinguishing those from the rather less frequent “bad” cases can be seen as an instance of the One-Class Classification problem. For such cases, AE solutions have been shown to be well-suited [9], since they

<footnote>* jaroslaw.szumega@cern.ch</footnote>
encode the structure of the good data, thus yielding lower reconstruction errors for them than for bad ones.

In this paper, using IRRAD unique BPM data, we investigate experimentally how AE-based techniques compare to traditional statistics-based methods when (1) characterizing nominal beam profiles and (2) performing anomaly detection during beam-profile monitoring, both in terms of accuracy and performance. These two tasks must be properly managed when operating an irradiation facility; thus, this is the main focus of this work.

## RESOURCES

We describe below (1) the original BPM dataset we gathered and (2) the AE architecture we developed to perform anomaly detection.

### Beam-Profiles Dataset

Our work relies on a new 2-part dataset composed of images representing centered- and off-centered beam profiles (see Fig. 2). Each image is represented by a matrix of 7×9 grayscale values, each linearly normalized to the range (0.0, 0.1); the 24 peripheral pixels that do not correspond to actual pads are set to 0.0. The colored representation is used solely for visual purposes (“plasma” colormap was used).

<figure><img src="image_3.png" /><figcaption>Figure 2: Two examples of BPM recorded data (the top row represents a well-centered beam profile, while the bottom row, an off-centered one), visualized as low-resolution images, where each pad is represented as a square pixel (the greyscale brightness corresponds to the measured value (left-hand side), while, to provide better visualization, a colormap has been assigned to the data in the right-hand side).</figcaption></figure>

The first part of this dataset includes the beam-monitoring data taken during Week 20 of the IRRAD run in Year 2024. Currently, this sub-dataset consists of $N_1 = 40,543$ samples, with 22,206 images of good-quality beam profiles and 18,337 examples of off-centered ones. This was a very particular week in 2024 when the well-centered and off-centered samples were observed with a ratio 0.55:0.45.

The second part of the dataset, used only for model training, consists of the rest of the full year 2024 of well-centered profiles. In 2024, we recorded almost $N_2 = 1,400,000$ samples. Among them, the ratio of centered and off-centered beams was 0.85:0.15. This set of samples is clearly imbalanced, due to the nature of operational beam quality, which stays within an acceptable range most of the time. To maintain the training-verification integrity, the special data of

Week 20 will be excluded as a separate subset for final verification.

<figure><img src="image_4.png" /><figcaption>Figure 3: Horizontal and vertical Gaussian fits (left-hand side) and center-pad longitudinal spline interpolation (right-hand side) of a typical IRRAD beam profile (2025, May 19).</figcaption></figure>

To determine whether a beam profile denotes a well-centered beam, its corresponding image is numerically analyzed in order to construct the best horizontal and vertical 1D-Gaussian fits (see Fig. 3). Based on the values of the fit properties, in particular the beam-center coordinates, the specific class for each beam profile is determined analytically: an image is considered “good” if its Gaussian-fit intensity peak is distanced ± 2 mm, both in the x and y directions, from the central-pad BPM location, considered to be at position (0, 0). This procedure is currently used at IRRAD to assess the beam quality during irradiation experiments.

### Convolutional Autoencoder

Considering the characteristics of the available data and our classification-oriented goals, we decided to assess, in this experiment, whether a Convolutional Autoencoder (CAE) [10] would constitute an appropriate model. A CAE is a specific type of autoencoder that is capable of learning patterns and specific features that are present in a given set of images. For the learned features, image reconstruction is possible, as well. However, an accurate result will be obtained only for the specific classes of images that were available in the training dataset.

Metrics such as Mean Square Error (MSE) or Mean Absolute Error (MAE) are typically used to assess the difference between target, y, and predicted, ŷ, values. Yet, there exist metrics more specifically adapted to image processing. In particular, the Structural Similarity Index Measure (SSIM) is a perception-based metric designed to capture the change in structural information, luminance, and contrast [11]. It compares the local patterns of pixel intensities; these features make it a good candidate metric for beam-quality assessment with the presented BPM data. The metric values are within the range (0.0, 1.0), with 0.0 indicating bad and 1.0 perfect reconstruction or quality. Thus, the custom loss function, Loss(ŷ, y), we use for ML modeling below is defined as Loss(ŷ, y) = 1 - SSIM(ŷ, y), also called Structural Dissimilarity (DSSIM).

### ML Architecture

The CAE-based ML architecture we developed (see Fig. 4) is specified by the following transformation layers (we use
TensorFlow names in the description) for the encoder and decoder parts:

* Encoder part:

Input(7,9) → Resizing(16,16) → Conv2D(64, (3,3))
→ MaxPooling2D((2,2)) → Conv2D(16,(3,3))
→ MaxPooling2D((2,2)) → Conv2D(8,(3,3)) →
MaxPooling2D((2,2))

* Decoder part:

Conv2D(8,(3,3)) → UpSampling2D((2,2)) →
Conv2D(16,(3,3)) → UpSampling2D((2,2)) →
Conv2D(64,(3,3)) → UpSampling2D((2,2)) →
Conv2D(1,(3,3)) → Resizing(7,9) → Output(7,9)

This dedicated CAE consists mostly of 2D convolutional and pooling layers in the encoder, and (de)convolutional and up-sampling layers in the decoder. Our experiments with other architectural parameters suggest that this specific CAE model can properly learn the high-level features of each BPM image and later use them to reconstruct the sample.

<figure><img src="image_5.png" /><figcaption>Figure 4: CAE-architecture for BPM-anomaly detection. Both the input (X) and reconstructed (X') images are used to compute the similarity metric. Then the discriminator outputs the decision, based on the SSIM metric, using a threshold that was experimentally set to 0.95.</figcaption></figure>

## EXPERIMENT

Using the TensorFlow fit function, we trained our CAE model via the second sub-dataset, using only the “good” images among the $N_2$ samples, with the usual train-test split of 0.7:0.3 ratio. The resulting loss, after training on 15 epochs, is $8.8 \times 10^{-4}$.

Week 20, the first sub-dataset, was used for validation. Based on Gaussian fits, this is a very specific week of somewhat balanced centered/off-centered beam representations, as the beam was centered along the x-axis 54.8% of the time, centered along the y-axis 93.2% of the time, and remained in the center of the xy-plane 54.8% of the time.

Taking into account the same “± 2 mm x- and y-centered” metrics, the CAE model found that 54.77 % of the beam profiles reconstructed within our chosen SSIM quality range met the criterion. We provide the confusion matrix for the CAE (Predicted) and statistical (True) estimations for well-centered and off-centered beam profiles in Table 1; the F1-score is 0.6.

## DISCUSSION

The final loss value, of $8.8 \times 10^{-4}$, post training, is rather low, which suggests that our image-based model is well-adapted to representing BPM data. Indeed, the accuracies are within 10% of one another when comparing the CAE

<figure><img src="image_6.png" /><figcaption>Table 1: Confusion Matrix for the Presented CAE Model</figcaption></figure>

and statistical techniques. Yet, the F1-score can only be considered as “average”, and using more BPM data for training (IRRAD has access to multi-year BPM data) or looking at other similarity metrics must be considered.

Moreover, another important factor needs to be taken into account: model complexity and execution time. Indeed, the total assessment of the $N_1$ samples of actual operation data took on average 690.9 s with the numerical solution based on Gaussian fitting (i.e., 58 sample/s) running on a CERN SWAN machine<fnref n="1" />; this time shrank to only 16.0 s for the CAE-based solution<fnref n="2" /> (i.e., 2,532 sample/s). Thus, the ML-based computations took about 43 times less time than the analytical solution to obtain comparable results.

## CONCLUSION AND FUTURE WORK

In this paper, we introduced a new, convolutional-autoencoder-based technique to perform efficient beam profiling in irradiation facilities<fnref n="3" />. Preliminary experimental results targeting anomaly detection and beam characterization suggest that this approach has a potential to replace traditional techniques. Moreover, the processing efficiency of the proposed model allows to consider its usage in the real-time regime. These are crucial factors for beam-monitoring systems in any irradiation facility.

Regarding future work, more sophisticated BPM-data-modeling approaches can be envisioned using novel neural architectures such as Transformer models with attention mechanisms [12]. Such developments could allow the processing of not only single profiles but also of time series of beam profiles, i.e., of the longitudinal (time) characteristics of beam “spills” (see Fig. 3).

## REFERENCES

[1] B. Gkotse, M. Moll, F. Ravotti, and M. Glaser, “IRRAD: the new 24 GeV/c proton irradiation facility at CERN”, CERN, Geneva, Switzerland, Rep. AIDA-2020-CONF-2016-006, 2015.

<footnote n="1">¹ Platform with a 4-core processor (Intel(R) Xeon(R) 4216 CPU @ 2.10 GHz), 32 GB RAM, available Nvidia T4 GPU.</footnote>

<footnote n="2">² The ML model was tested under GPU and CPU-only configurations. The inference times were comparable within 0.1-0.2 s in a Jupyter environment. This approach enabled a fair comparison with classical methods.</footnote>

<footnote n="3">³ This project has received funding from the European Union’s Horizon Europe Research and Innovation programme under Grant Agreement No 101057511 (EURO-LABS).</footnote>
[2] I. Mateu et al., "A Beam Profile Monitor for High Energy Proton Beams Using Microfabrication Techniques", in *Proc. IBIC'20*, Santos, Brazil, Sep. 2020, pp. 86-89.
doi:10.18429/JACoW-IBIC2020-TUPP37

[3] C. F. Madrazo, I. Heredia, L. Lloret, and J. M. de Lucas, "Application of a convolutional neural network for image classification for the analysis of collisions in high energy physics", in *Proc. CHEP'18*, Sofia, Bulgaria, Jul. 2018, p. 06017.
doi:10.1051/epjconf/201921406017

[4] Mł. Piekarski, J. Jaworek-Korjakowska, A. I. Wawrzyniak, and M. Gorgon, "Convolutional neural network architecture for beam instabilities identification in synchrotron radiation systems as an anomaly detection problem", *Measurement*, vol. 165, p. 108116, 2020.
doi:10.1016/j.measurement.2020.108116

[5] F. Tommasino et al., "Proton beam characterization in the experimental room of the Trento proton therapy facility", *Nucl. Instrum. Methods Phys. Res. A: Accel. Spectrom. Detect. Assoc. Equip.*, vol. 869, pp. 15-20, 2017.
doi:10.1016/j.nima.2017.06.017

[6] Y. Morita, T. Washio, and Y. Nakashima, "Accelerator tuning method using autoencoder and bayesian optimization", *Nucl. Instrum. Methods Phys. Res. A: Accel. Spectrom. Detect. Assoc. Equip.*, vol. 1057, p. 168730, 2023.
doi:10.1016/j.nima.2023.168730

[7] K. Rajput et al., "Robust errant beam prognostics with conditional modeling for particle accelerators", *Machine Learning: Science and Technology*, vol. 5, no. 1, p. 015044, 2024.
doi:10.1088/2632-2153/ad2e18

[8] V. Gaciu, I. Dăncuș, B. Diaconescu, D. Ghiță, E. Slușanschi, and C. Ticoș, "Classification of laser beam profiles using machine learning at the ELI-NP high power laser system", *AIP Adv.*, vol. 14, no. 4, p. 045114, 2024.
doi:10.1063/5.0195174

[9] P. Perera, P. Oza, and V. M. Patel, "One-class classification: a survey", *arXiv*, 2021.
doi:10.48550/arXiv.2101.03064

[10] J. Masci, U. Meier, D. Cireșan, and J. Schmidhuber, "Stacked convolutional auto-encoders for hierarchical feature extraction", in *Proc. ICANN'11*, Espoo, Finland, Jun. 2011, pp. 52-59.
doi:10.1007/978-3-642-21735-7_7

[11] P. Bergmann, S. Löwe, M. Fauser, D. Sattlegger, and C. Steger, "Improving unsupervised defect segmentation by applying structural similarity to autoencoders", *arXiv*, 2018.
doi:10.48550/arXiv.1807.02011

[12] A. Vaswani et al., "Attention is all you need", in *Proc. NIPS'17*, Long Beach, CA, USA, Dec. 2017. https:// papers.nips.cc/paper_files/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html