Particle Swarm Optimization Trains Variational Quantum Circuits, Selecting from Four Gate Types

Variational Quantum Circuits (VQCs) hold promise for machine learning, but training these circuits often proves difficult due to challenges like the barren plateaus problem, where gradients vanish, hindering optimisation. Marco Mordacci and Michele Amoretti, both from the University of Parma, alongside their colleagues, address this issue by applying Particle Swarm Optimisation (PSO), a technique inspired by the collective movement of bird flocks, to train VQCs. Their innovative approach allows the algorithm to independently select the quantum gates, target qubits, and rotation angles, effectively designing the circuit itself. Testing PSO on biomedical image datasets from MedMNIST demonstrates that it achieves classification accuracy comparable to, and sometimes exceeding, that of traditional gradient descent methods, all while utilising fewer quantum gates, representing a significant step towards more efficient quantum machine learning.

This work demonstrates that PSO can effectively determine both the structure of a VQC, selecting which quantum gates to apply and to which qubits, and the optimal rotation angles for those gates. The PSO algorithm was implemented with configurable parameters and applied to datasets from the MedMNIST collection, focusing on binary classification tasks.

Performance comparisons with classical stochastic gradient descent reveal that PSO can achieve comparable, or even better, classification accuracy across multiple datasets, despite using fewer quantum gates. Quantum Machine Learning (QML) leverages quantum systems to tackle complex tasks, with VQCs serving as quantum counterparts of neural networks. However, training VQCs can be difficult due to issues like barren plateaus, where the optimization landscape hinders learning. Designing optimal VQC architecture is therefore crucial for achieving better results. Particle Swarm Optimization is a stochastic optimization technique that simulates the movement of a swarm of birds, characterized by a set of particles and iterations representing movements in the solution space. Each particle is defined by its position, velocity, its best position found, and the best position found by the swarm. Three hyperparameters, c1, c2 and w, control the swarm’s behaviour. Initially, c1 is set high and c2 low, encouraging exploration by focusing on each particle’s own best solution.

As iterations progress, c1 decreases while c2 increases, shifting the behaviour toward exploitation of the swarm’s global best. The inertia weight w also starts high to support broad exploration and is gradually reduced to slow particle movement, aiding convergence to an optimal or suboptimal solution. The algorithm uses 50 particles and was tested with both 40 and 80 dimensions, representing trainable parameters. The parameters of each particle are grouped in sets of 4 and define the applied gate (Rx, Ry, Rz, and CNOT), the target qubit, the control qubit if a CNOT is selected, and the rotation angle if a rotation is used.

Thus, with 40 parameters, the VQC can have at most 10 gates. Since the parameters are random numbers in the range [0, 1], this range is discretized, mapping it to the number of gates. Similarly, for qubit selection, the range [0, 1] is mapped to the number of qubits. For rotation angles, the range [0, 1] is scaled to [0, 2π]. The PSO process was executed for 100 iterations and tested on MNIST (digits 0 and 1) and several MedMNIST datasets.

Only binary tasks were considered by selecting the first two classes: CNV and DME for oct, Bladder and Left Femur for organA, organC, and organS. Other considered datasets were already binary. PSO was compared to the Adam optimizer (learning rate of 0. 01, batch size 32, for 100 epochs). A VQC with 8 qubits was used, consisting of two layers of Ry rotations and CNOT gates arranged in a circular topology (32 gates and 16 parameters).

Principal component analysis was applied to reduce the input to the 8 most significant features for angle encoding. Results show that PSO can achieve similar or better accuracy, except for pneumonia and organS. Similar behaviour is observed in the test results. Furthermore, in the oct dataset, PSO 80 outperforms Adam, suggesting a slightly better generalization by the PSO-trained circuit. Results on the breast dataset demonstrate that while Adam achieved similar test accuracy, it predicts only a single class, indicating a failure to learn meaningful patterns.

In contrast, the VQCs optimized with PSO began to learn both classes. An example of a VQC achieved by PSO shows that it achieved similar or even better performance than Adam, while using a lower number of gates. Moreover, several gates do not contribute to the classification task, meaning the circuit can attain the same results with an even smaller number of effective gates. Results obtained on Rigetti Ankaa-3 and IQM Garnet devices using 1024 shots and a subset of 100 samples from the organA test set show that the presence of noise does not impact the performance of the VQC optimized by PSO, which achieves results comparable to those in the ideal scenario. This work used PSO to train the structure of VQCs on MedMNIST datasets, evaluating it on binary classification tasks, showing better performance than classical gradient descent with fewer gates. This work demonstrates that PSO can effectively determine both the structure of a VQC, selecting which quantum gates to apply and to which qubits, and the optimal rotation angles for those gates. The PSO algorithm was implemented with 50 particles, tested with both 40 and 80 dimensions representing trainable parameters, and applied to datasets from the MedMNIST collection, focusing on binary classification tasks. Experiments revealed that PSO achieves comparable, and in some cases superior, classification accuracy compared to the Adam optimizer, a standard classical approach, across multiple datasets including breast cancer, chest x-rays, and various organ imaging studies. Notably, PSO consistently achieved high accuracy on the organA dataset, with the 80-dimensional PSO configuration outperforming Adam in test results, suggesting improved generalization capabilities. The team measured accuracy on validation and test sets, demonstrating that PSO-trained VQCs can achieve results ranging from 52% to 92% depending on the dataset.

👉 More information
🗞 Training Variational Quantum Circuits Using Particle Swarm Optimization
🧠 ArXiv: https://arxiv.org/abs/2509.15726

Rohail T.

Rohail T.

As a quantum scientist exploring the frontiers of physics and technology. My work focuses on uncovering how quantum mechanics, computing, and emerging technologies are transforming our understanding of reality. I share research-driven insights that make complex ideas in quantum science clear, engaging, and relevant to the modern world.

Latest Posts by Rohail T.:

Pathology Foundation Models Encode Disease Progression Using Diffusion Pseudotime Analysis

Pathology Foundation Models Encode Disease Progression Using Diffusion Pseudotime Analysis

February 3, 2026
Deep Researcher Achieves PhD-Level Reports Via Sequential Plan Reflection and Crossover

Deep Researcher Achieves PhD-Level Reports Via Sequential Plan Reflection and Crossover

February 3, 2026
Molecular Bond Breaking Achieves Coherent Vibrations in Methyl Radical Umbrella Mode

Molecular Bond Breaking Achieves Coherent Vibrations in Methyl Radical Umbrella Mode

February 3, 2026