Quantum Vision Transformers for Quark–Gluon Classification
Marçal Comajoan Cara, Gopal Ramesh Dahale, Zhongtian Dong, Roy T. Forestano, S. V. Gleyzer, Daniel Justice, Kyoungchul Kong, Tom Magorsch, Konstantin Tzvetanov Matchev, Katia Matcheva, Eyup B. Unlu
We introduce a hybrid quantum-classical vision transformer architecture, notable for its integration of variational quantum circuits within both the attention mechanism and the multi-layer perceptrons. The research addresses the critical challenge of computational efficiency and resource constraints in analyzing data from the upcoming High Luminosity Large Hadron Collider, presenting the architecture as a potential solution. In particular, we evaluate our method by applying the model to multi-detector jet images from CMS Open Data. The goal is to distinguish quark-initiated from gluon-initiated jets. We successfully train the quantum model and evaluate it via numerical simulations. Using this approach, we achieve classification performance almost on par with the one obtained with the completely classical architecture, considering a similar number of parameters.
We introduce a hybrid quantum-classical vision transformer architecture, notable for its integration of variational quantum circuits within both the attention mechanism and the multi-layer perceptrons. The research addresses the critical challenge of computational efficiency and resource constraints in analyzing data from the upcoming High Luminosity Large Hadron Collider, presenting the architecture as a potential solution. In particular, we evaluate our method by applying the model to multi-detector jet images from CMS Open Data. The goal is to distinguish quark-initiated from gluon-initiated jets. We successfully train the quantum model and evaluate it via numerical simulations. Using this approach, we achieve classification performance almost on par with the one obtained with the completely classical architecture, considering a similar number of parameters.
Models based on vision transformer architectures are considered state-of-the-art when it comes to image classification tasks. However, they require extensive computational resources both for training and deployment. The problem is exacerbated as the amount and complexity of the data increases. Quantum-based vision transformer models could potentially alleviate this issue by reducing the training and operating time while maintaining the same predictive power. Although current quantum computers are not yet able to perform high-dimensional tasks, they do offer one of the most efficient solutions for the future. In this work, we construct several variations of a quantum hybrid vision transformer for a classification problem in high-energy physics (distinguishing photons and electrons in the electromagnetic calorimeter). We test them against classical vision transformer architectures. Our findings indicate that the hybrid models can achieve comparable performance to their classical analogs with a similar number of parameters.
In this work, quantum transformers are designed and analysed in detail by extending the state-of-the-art classical transformer neural network architectures known to be very performant in natural language processing and image analysis. Building upon the previous work, which uses parametrised quantum circuits for data loading and orthogonal neural layers, we introduce three types of quantum transformers for training and inference, including a quantum transformer based on compound matrices, which guarantees a theoretical advantage of the quantum attention mechanism compared to their classical counterpart both in terms of asymptotic run time and the number of model parameters. These quantum architectures can be built using shallow quantum circuits and produce qualitatively different classification models. The three proposed quantum attention layers vary on the spectrum between closely following the classical transformers and exhibiting more quantum characteristics. As building blocks of the quantum transformer, we propose a novel method for loading a matrix as quantum states as well as two new trainable quantum orthogonal layers adaptable to different levels of connectivity and quality of quantum computers. We performed extensive simulations of the quantum transformers on standard medical image datasets that showed competitively, and at times better performance compared to the classical benchmarks, including the best-in-class classical vision transformers. The quantum transformers we trained on these small-scale datasets require fewer parameters compared to standard classical benchmarks. Finally, we implemented our quantum transformers on superconducting quantum computers and obtained encouraging results for up to six qubit experiments.
The emergence of deep vision models such as convolutional neural networks and vision transformers has revolutionized computer vision, enabling significant advancements in image classification, object detection, and segmentation. In parallel, the rapid development of quantum computing has spurred interest in quantum machine learning (QML), which integrates the strengths of quantum computation with the representational power of deep learning. In QML, parameterized quantum circuits offer the potential to capture complex image features, define complex decision boundaries, and provide other computational advantages. This paper investigates hybrid quantum-classical vision architectures, with a focus on hybrid quantum-classical convolutional neural networks and hybrid quantum-classical vision transformers. These hybrid models explore both quantum pre-processing and post-processing of data, respectively, where quantum circuits are strategically integrated into the data pipeline to enhance model performance. Our results suggest that these hybrid models can enhance accuracy and computational efficiency in vision-related tasks, even with the constraints of current noisy intermediate-scale quantum devices.
In mainstream machine learning, transformers are gaining widespread usage. As Vision Transformers rise in popularity in computer vision, they now aim to tackle a wide variety of machine learning applications. In particular, transformers for High Energy Physics (HEP) experiments continue to be investigated for tasks including jet tagging, particle reconstruction, and pile-up mitigation. An improved Quantum Vision Transformer (QViT) with a quantum-enhanced self-attention mechanism is introduced and discussed. A shallow circuit is proposed for each component of self-attention to leverage current Noisy Intermediate Scale Quantum (NISQ) devices. Variations of the hybrid architecture/model are explored and analyzed. The results demonstrate a successful proof of concept for the QViT, and establish a competitive performance benchmark for the proposed design and implementation. The findings also provide strong motivation to experiment with different architectures, hyperparameters, and datasets, setting the stage for implementation in HEP environments where transformers are increasingly used in state of the art machine learning solutions.
Quantum machine learning models generally lack principled design guidelines, often requiring full resource-intensive training across numerous choices of encodings, quantum circuit designs and initialization strategies to find effective configuration. To address this challenge, we develope the Quantum Bias-Expressivity Toolbox (QBET), a framework for evaluating quantum, classical, and hybrid transformer architectures. In this toolbox, we introduce lean metrics for Simplicity Bias (SB) and Expressivity (EXP), for comparing across various models, and extend the analysis of SB to generative and multiclass-classification tasks. We show that QBET enables efficient pre-screening of promising model variants obviating the need to execute complete training pipelines. In evaluations on transformer-based classification and generative tasks we employ a total of 18 qubits for embeddings (6 qubits each for query, key, and value). We identify scenarios in which quantum self-attention variants surpass their classical counterparts by ranking the respective models according to the SB metric and comparing their relative performance.
The characterization of brain tumors from magnetic resonance imaging (MRI) is crucial for diagnosis, treatment planning, and prognosis. But the analysis of brain tumors based on MRI is still difficult because of the significant intra-tumoral heterogeneity, ambiguous boundaries of lesions, high dimensionality of imaging features, and complicated nonlinear relationships between anatomical structures. While transformer-based deep learning (DL) models have greatly advanced automated tumor analysis, classical feature representations often fail to effectively capture complex feature interactions in pathological images, especially when distinguishing between subtle pathological variations and normal tissue needs to be done efficiently. Recent quantum machine learning (QML) developments indicate that quantum feature encoding can map complex data to exponentially larger Hilbert spaces, leading to a more expressive representation of nonlinear patterns and feature correlations that are challenging to model with conventional architectures. Encouraged by this potential, this study proposes a hybrid quantum-classical framework, named QFormer-Brain, which combines transformer-based segmentation with quantum representation learning for automated brain tumor segmentation and classification. To segment the tumor regions, a Shifted Window UNet Transformers (Swin-UNETR) architecture is first used to capture both local anatomical details and global contextual information through hierarchical self-attention. Then, the deep semantic features of the segmented lesions are mapped to the quantum feature mapping module with angle encoding and variational quantum circuits (VQCs), which can obtain richer nonlinear feature representation by quantum superposition and entanglement mechanisms. The obtained quantum embeddings are then combined with features obtained from the transformer and classified by a Quantum Transformer Classifier. The experiments were performed on the publicly available BraTS 2021 data set using an 8-qubit variational quantum circuit, with 1024 measurement shots and readout-error mitigation, via the IBM Qiskit Aer simulator. The proposed framework achieved a Dice Similarity Coefficient (DSC) of 97.1%, Intersection-over-Union (IoU) of 95.0%, classification accuracy of 98.5%, sensitivity of 98.1%, specificity of 99.0%, and F1-score of 98.3%, outperforming U-Net, nnU-Net, ResNet50, Vision Transformer (ViT), and conventional hybrid Convolutional Neural Network (CNN)-based models. These results show that quantum-inspired representation learning can be efficiently integrated into transformer-based models to boost the discriminative feature extraction from complex MRI data.