Skip to content

Implementation and study of a quantum machine learning (QML) algorithm using neutral atoms with Pulser.

Notifications You must be signed in to change notification settings

morf1102/pulser-rydberg-qml

Repository files navigation

🧠 Rydberg Quantum Kernel Project

Author: Félix Moras

Course: BSQ501 — Specialty Projects in Quantum Sciences

University: Université de Sherbrooke, Fall 2025

🎯 Project Objective

This project aims to implement and study a Quantum Kernel Learning algorithm on a Rydberg neutral atom platform, using the Pulser library.

The goal is to define a feasible experimental protocol by comparing two approaches:

  1. The quantum echo protocol (Forward-Backward): Based on a time-reversal of the evolution, which is difficult to achieve experimentally.

  2. The revival protocol (Forward-Forward): Leverages the natural revival of the $|Z_2\rangle$ state to bypass the need for an echo.

This work is a continuation of the article:

🧩 Project Structure

.
├── helpers.py
│   ├── Utility functions: pulse creation, registers, ideal states, etc.
│
├── rydkernel.py
│   ├── Construction of the quantum kernel based on Rydberg dynamics.
│   ├── Implements the Forward-Backward and Forward-Forward protocols.
│   └── Contains the main logic for calculating fidelities and kernel matrices.
│
├── qml_pxp.py
│   ├── Main script to launch simulations.
│   ├── Defines scan parameters (λ, number of qubits, time, etc.)
│   └── Saves results to the 'results/' directory.
│
├── pulser_testing_ground.ipynb
│   └── Experimentation notebook for validating Pulser sequences.
├── revivals.ipynb
│   └── Experimentation notebook for validating revival dynamics.
│
└── results/
    ├── plot_results.ipynb
    │   └── Jupyter Notebook for plotting and analyzing simulation data.
    └── *.json
        └── Output files from simulations (e.g., z0_forward_backward.json, etc.)

⚙️ Dependencies

This project uses the following libraries:

  • pulser and pulser_simulation — For defining and emulating neutral-atom sequences.

  • qutip — For handling quantum vectors and operators.

  • torch and numpy — For numerical computation and tensor manipulation.

  • itertools, json, logging, scipy — For organizing, managing, and analyzing simulations.

Recommended installation:

pip install -r requirements.txt

🚀 Execution

To run a complete kernel simulation:

python qml_pxp.py

This will generate a file named:

kernel_simulation_results.json

This file contains the kernel matrices, simulation parameters, and summary statistics.

⚠️ Warning: Depending on the system size (n_qubits) and the backend used, the execution can be long (from minutes to hours).

🔬 Scientific & Implementation Details

This project implements a quantum kernel based on the analog dynamics of a Rydberg atom array. The core idea is to encode data into the system's Hamiltonian and use the resulting quantum state's fidelity as a similarity measure.

The Rydberg Hamiltonian

The evolution of the $N$-atom system is described by the Rydberg Hamiltonian:

$$ H(t)=\sum_{i=1}^{N}\left[\frac{\Omega(t)}{2}\sigma_{i}^{x}-\delta(t)\hat{n}_{i}\right]+\sum_{i<j}V_{ij}\hat{n}_{i}\hat{n}_{j} $$

Where:

  • $\Omega(t)$: The Rabi frequency, controlling the laser coupling between the ground $|g\rangle$ and Rydberg $|r\rangle$ states.
  • $\delta(t)$: The detuning of the laser from the atomic transition frequency.
  • $V_{ij} = C_6/r_{ij}^6$: The strong van der Waals interaction between atoms. This term gives rise to the Rydberg blockade, a key phenomenon where the excitation of one atom prevents the excitation of its neighbors within a "blockade radius."

To encode the classical data vector $x$, we set the detuning to be proportional to the data, $\delta(t) \rightarrow \frac{\Omega}{2}\lambda x$. This yields the specific Hamiltonian for this project:

$$ H(\lambda x)=\frac{\Omega}{2}\sum_{i=1}^{N}[\sigma_{i}^{x}-\lambda x\hat{n}_{i}]+\sum_{i<j}V_{ij}\hat{n}_{i}\hat{n}_{j} $$

The Quantum Kernel Definition

The quantum kernel is defined as the squared overlap (fidelity) between two quantum states, each prepared using a different data vector $x_i$ and $x_j$:

$$ \kappa_{\text{Ryd}}(x_i, x_j) = |\langle \psi(x_i) | \psi(x_j) \rangle|^2 $$

The states $|\psi(x)\rangle$ are prepared by starting in the $|\mathbb{Z}_2\rangle$ initial state (an alternating pattern of ground and Rydberg atoms, $|grgr\dots\rangle$) and evolving for a time $T$ under the data-encoded Hamiltonian $H(x)$:

$$ |\psi(x)\rangle = \hat{U}_{\text{Ryd}}(x, T)|\mathbb{Z}_2\rangle \quad \text{where} \quad \hat{U}_{\text{Ryd}}(x, T) = e^{-iH(x)T} $$

This makes the full kernel calculation:

$$ \kappa_{\text{Ryd}}(x_i, x_j) = |\langle\mathbb{Z}_2|\hat{U}_{\text{Ryd}}^{\dagger}(x_i, T)\hat{U}_{\text{Ryd}}(x_j, T)|\mathbb{Z}_2\rangle|^2 $$

Initial State Preparation: The crucial $|\mathbb{Z}_2\rangle$ state is prepared not with a direct pulse, but via adiabatic passage. This is done by slowly sweeping the detuning $\delta$ from a large negative value to a large positive value while simultaneously shaping the Rabi frequency $\Omega$.

Implementation Protocols

A major experimental challenge is that the backward-in-time evolution $\hat{U}^\dagger$ is not physically implementable on neutral-atom hardware. This project compares two methods to overcome this:

1. method="forward-backward" (Approximate Echo)

This protocol, proposed in the original paper, uses an approximate quantum echo to simulate the inverse evolution:

$$ \hat{U}_{\text{Ryd}}^{\dagger}(x, T) \approx \hat{Z}\hat{U}_{\text{Ryd}}(-J(x), T)\hat{Z} $$

  • The sequence is: Forward evolution with $x_j$, apply a $\hat{Z}$ gate, "Backward" (inverted-data) evolution with $-J(x_i)$, and a final $\hat{Z}$ gate.
  • The $\hat{Z}$ gate is not a physical pulse but a virtual $\hat{Z}$ gate, implemented in Pulser by shifting the phase of all subsequent laser pulses by $\pi$.

2. method="forward-forward" (Revival-Based)

This is the simplified, more practical protocol this project seeks to validate. It avoids the echo entirely by leveraging a natural phenomenon of the system: quantum revival.

  • When starting from the $|\mathbb{Z}_2\rangle$ state, the system's fidelity $F(t) = |\langle\mathbb{Z}_2|\psi(t)\rangle|^2$ naturally "revives" (returns to a high value) at periodic intervals.
  • The hypothesis is that by running both evolutions forward ($U(x_i, T)$ and $U(x_j, T)$) and measuring at a revival time $T = T_{\text{rev}}$, the natural revival of the state is sufficient to compute a high-quality kernel, bypassing the need for a complex and approximate echo.

📊 Next Steps

This project is still under active development.

Planned improvements include:

  • Adding a module for automatic visualization and analysis of results.
  • Simulating on Pasqal's high-performance backends using clusters (Emu-SV, Emu-MPS).
  • Introducing coherent errors and state preparation noise.
  • Performing a comparison between the Forward-Backward and Forward-Forward protocols.
  • Performing a comparison between different initial states ($|Z_0\rangle$ vs $|Z_2\rangle$).
  • Validating scalability for $N > 15$ qubits.

🧪 References

  • Ayana Sarkar et al., Concentration-Free Quantum Kernel Learning in the Rydberg Blockade, 2025.
  • Henrique Silvério et al., Pulser: An open-source package for neutral-atom arrays, Quantum (2022).
  • Pulser Documentation: https://pulser.readthedocs.io
  • QuTiP Documentation: https://qutip.readthedocs.io/

About

Implementation and study of a quantum machine learning (QML) algorithm using neutral atoms with Pulser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published