---
title: 'SimQFL: Quantum Federated Learning Simulator'
url: https://www.emergentmind.com/topics/simqfl
type: topic
---

# SimQFL: Quantum Federated Learning Simulator

SimQFL is a software platform specifically designed for simulating, analyzing, and visualizing quantum federated learning (QFL) protocols in a classical computing environment. Unlike general-purpose quantum circuit simulators and classical federated learning (FL) toolkits, SimQFL provides integrated support for all core phases of distributed quantum neural network (QNN) training—including parameterized circuit modeling, input encoding, gradient-based optimization, noise modeling, and client–server communication—while also supplying real-time, user-friendly visualization of learning metrics at each epoch. SimQFL enables customizable experimentation and reduces the barrier to entry for QFL research by giving researchers granular control over quantum and classical hyperparameters and an interactive GUI for monitoring, tuning, and exporting models and results [2508.12477].

## 1. System Architecture and Core Components

SimQFL adopts a federated server–client architecture. The system consists of a single ClassicalServer that orchestrates $R$ rounds of communication among $N$ QuantumClient nodes. Each QuantumClient $n$ possesses a private dataset $D_n$, encodes its minibatch inputs into a $Q_n$-qubit quantum state, applies a parameterized quantum circuit (PQC), and returns updated parameters to the server. The orchestration, communication, and aggregation all occur on classical hardware, using state-vector emulation for quantum operations.

Major software modules are organized as follows:

- **QuantumEncoder:** Transforms a classical vector $w \in \mathbb{R}^d$ into a normalized quantum state using amplitude encoding:
  $$
  |\psi_{\text{enc}}(w)\rangle = \sum_{i=0}^{2^Q-1} \frac{w_i}{\|w\|} |i\rangle.
  $$
  Deployed as a reusable Python class.

- **QuantumModel (Circuit Builder):** Specifies the PQC ansatz $U(\theta)$ over $Q$ qubits and $L$ layers. Each layer contains parameterized single-qubit rotations ($R_x$, $R_y$, $R_z$) and fixed CNOT gates. Internally, 
  $$
  U(\theta) = \prod_{d=1}^D \exp(-i \theta_d G_d / 2)
  $$
  with $G_d$ as Pauli generators.

- **FederatedTrainingManager:** Handles local training on clients ($K$ local epochs), gradient estimation via the parameter-shift rule, communication, and global aggregation following quantum-aware federated averaging.

- **Aggregator:** On the server, collects all $\{\theta_n^{(r)}\}$, computes a weighted average, and broadcasts updated global parameters.

- **CommunicationLayer:** Simulates synchronous communication between server and clients.

- **VisualizationEngine:** Real-time display implemented with Flask and JavaScript, updating charts for global/test accuracy, per-client losses, and fidelity after every epoch [2508.12477].

## 2. Quantum Federated Learning Algorithms Implemented

SimQFL implements a quantum extension of Federated Averaging (“FedAvgQ”). Each QuantumClient executes $K$ steps of local optimization on circuit parameters, then synchronously shares the optimized weights with the server. The server aggregates parameters and iterates.

- **Parameterized PQC Form:** For $\theta \in \mathbb{R}^D$:
  $$
  U(\theta) = \prod_{\ell=1}^L \left[\mathrm{ENT}_\ell \cdot \bigotimes_{j=1}^Q R_\alpha(\theta_{\ell,j})\right]
  $$
  or equivalently as a product of unitary rotations as above.

- **Local Loss and Gradient:** For a client $i$ with batch $B_i$,
  $$
  L_i(\theta) = \frac{1}{|B_i|} \sum_{(w,y) \in B_i} \ell\Big[y, f(w; \theta)\Big], \quad f(w;\theta) = \langle \psi_{\text{out}}(w; \theta)| O | \psi_{\text{out}}(w; \theta) \rangle,
  $$
  with $\ket{\psi_{\text{out}}} = U(\theta) |\psi_{\text{enc}}(w)\rangle$ and $\ell$ e.g. cross-entropy. Gradients are computed by parameter-shift:
  $$
  \frac{\partial L_i}{\partial \theta_d} = \frac{1}{2} \left[ L_i(\theta + \frac{\pi}{2} e_d) - L_i(\theta - \frac{\pi}{2} e_d) \right].
  $$

- **Server Aggregation:**
  $$
  \theta^{(r+1)} = \sum_{i=1}^N \frac{|D_i|}{\sum_j |D_j|} \cdot \theta_i^{(r)}.
  $$

Users may substitute aggregation or optimization routines (e.g., robust FL) as required [2508.12477].

## 3. Simulation Environment and Configuration Parameters

SimQFL provides extensive configurability of both quantum and classical FL hyperparameters:

- **Quantum Hyperparameters:** 
  - Qubits per client ($Q_n$, range 1–10)
  - Circuit depth ($L$)
  - Allowed gates: $R_x$, $R_y$, $R_z$, CNOT
  - Measurement: expectation vs. sample-based

- **Classical Hyperparameters:** 
  - Number of global rounds ($R$), local epochs ($K$), batch size, learning rate ($\eta$)
  - Number of clients ($N$, up to 100)
  - Optimizer (Adam, SGD, RMSProp, etc.)

- **Noise and Decoherence:** Optional NoiseModel submodule:
  - *Depolarizing channel:* $\mathcal{D}_p(\rho) = (1-p)\rho + p I/2^Q$
  - *Amplitude damping:* $A_p(\rho) = E_0\rho E_0^\dagger + E_1\rho E_1^\dagger$, with $E_0$ and $E_1$ as specified Kraus operators
  - Tunable $p$ or $\gamma$ for noise rates

Custom datasets can be uploaded in CSV; drag-and-drop support for images is included [2508.12477].

## 4. Real-Time Visualization and User Interface Features

SimQFL includes a browser-based dashboard for epoch-wise monitoring:

- **Live updates** per global round: global accuracy/loss, per-client loss curves, and quantum fidelity ($\langle\psi_\text{out} | \psi_\text{target}\rangle^2$ if enabled).
- **Interface elements**: 
  - Training vs. test charts (accuracy/loss by round)
  - Per-client loss heatmap
  - Fidelity visualizations
  - Hyperparameter summary and adjustment widgets
  - Dataset upload and image loader panels
  - Export buttons for model weights, logs, figures

A WebSocket/HTTP polling mechanism provides immediate feedback, supporting interactive debugging, rapid convergence analysis, and dynamic simulation configuration [2508.12477].

## 5. Benchmarking, Evaluation Metrics, and Comparative Analysis

SimQFL's default benchmarking suite includes MNIST, Fashion-MNIST, and CIFAR-100. Performance metrics are as follows:

- **Final accuracy** (e.g., MNIST QFL $\sim 97.1\%$ vs. classical FL $\sim 86.6\%$)
- **Convergence speed** (number of rounds to reach target; e.g., QFL converges in $\sim 20$ rounds vs. classical in $\sim 30$)
- **Communication overhead** (number of floating-point parameters times rounds)
  
Compared to existing tools such as QuNetSim (focused solely on quantum network simulation) and OpenFL/PeerFL (classical FL only), SimQFL is distinctive in its combined support for PQC modeling, complete QNN training, and federated protocols. QFL models trained with SimQFL have demonstrated up to $\sim 10.5\%$ accuracy improvements over classical MLPs on image classification tasks, with only modest communication cost per client and round [2508.12477].

## 6. Practical Use Cases and Extensibility

SimQFL is intended as a research and development platform for distributed QNN design and quantum networking studies. Typical workflows involve:

1. Launching the simulation via app.py and browser dashboard
2. Configuring quantum/classical parameters, uploading datasets or selecting from built-in tasks
3. Executing QFL runs while monitoring real-time charts
4. Interactively adjusting hyperparameters or noise models during or between rounds
5. Exporting trained weights and logs for post-processing or further analysis with tools such as Qiskit or Pennylane

The platform is extensible: users may augment the QuantumEncoder class (for new encodings), add deeper circuit layers (noting “barren plateau” effects), implement novel aggregation rules (e.g., sparse FL, FedProx), or target hardware-specific noise by tuning the NoiseModel [2508.12477].

---

SimQFL establishes an end-to-end, fully configurable environment for QFL simulation and analysis, uniquely bridging the gap between quantum neural network design, distributed ML experimentation, and user-centric visualization. It serves as a practical resource for rapid algorithmic prototyping, comparative experimentation with classical vs. quantum federated paradigms, and foundational exploration of privacy-preserving distributed quantum ML architectures prior to the widespread availability of large-scale quantum network hardware [2508.12477].

Source: https://www.emergentmind.com/topics/simqfl