Source-linked AI summary

Quantum Machine Learning with SQUID

Alessandro Roggero, Jakub Filipek, Shih-Chieh Hsu, Nathan Wiebe

arXiv:2105.00098v3quant-ph

TL;DR

Quantum machine learning needs practical, comparable ways to train hybrid models under near-term resource constraints. SQUID provides a PyTorch-based framework with standardized quantum-model interfaces and back-propagation, and its MNIST example reports classical-network accuracy above 99%. The framework’s flexibility supports exploring quantum and classical components together, while custom backend interfaces and the simplified current approach remain scope boundaries.

  • Problem

    Near-term quantum devices constrain data loading and introduce encoding, preprocessing, and comparison challenges for quantum machine-learning experiments.

    Source: §1 · p. 1
  • Method

    SQUID embeds quantum models within PyTorch-based hybrid architectures with standardized model design, explicit back-propagation, and interchangeable classical and quantum components.

    Source: §1 · p. 1, §2.1 · p. 2, §2.2 · p. 3
  • Results

    Classical networks in the MNIST example achieved classification accuracies above 99%, with more input-model hidden units showing no statistically significant final-accuracy improvement.

    Source: §3 · p. 6
  • Takeaways & Limitations

    SQUID provides a flexible framework for efficiently exploring possible quantum advantages in machine-learning classification through globally trained classical–quantum architectures.

    Source: §5 · p. 9

    Using SQUID with a specific quantum backend requires custom QuantumModel subclasses interfacing with that backend’s API.

    Source: §4.2 · p. 8

Abstract

from arXiv · show

In this work we present the Scaled QUantum IDentifier (SQUID), an open-source framework for exploring hybrid Quantum-Classical algorithms for classification problems. The classical infrastructure is based on PyTorch and we provide a standardized design to implement a variety of quantum models with the capability of back-propagation for efficient training. We present the structure of our framework and provide examples of using SQUID in a standard binary classification problem from the popular MNIST dataset. In particular, we highlight the implications for scalability for gradient-based optimization of quantum models on the choice of output for variational quantum models.

1 Introduction

Near-term quantum devices constrain data loading and make fair comparison with classical machine learning difficult. SQUID addresses these issues with a standardized, PyTorch-based hybrid framework that supports quantum models and back-propagation while reducing preprocessing and implementation overhead.

1 Introduction

  • Quantum-enhanced machine learning seeks potential quantum speed-ups [5] [7] [8] and recognition of statistical patterns difficult for purely classical schemes [10].Recent work also addresses trainability [11] and quantum-model generalization error [16].Source: §1 · p. 1
  • Near-term quantum devices cannot efficiently load datasets such as MNIST into quantum memory, while encoding and decoding add classical–quantum overhead.These resource constraints motivate alternatives to direct quantum data loading.Source: §1 · p. 1
  • Small synthetic datasets make benchmarks artificial, whereas classical preprocessing complicates performance attribution and cross-study comparison.Different preprocessing choices also create overhead for comparing quantum approaches or conducting meta-analysis.Source: §1 · p. 1
  • SQUID standardizes hybrid quantum–classical model design on top of PyTorch, requiring user-defined forward- and back-propagation functions for quantum models.The framework is intended to improve reproducibility and support extensible quantum model implementations.Source: §1 · p. 1
  • Standard preprocessing across applications and approaches makes experiments more directly comparable and reduces the coding burden for new researchers.The framework also connects classical and quantum components in a way resembling quantum-inspired algorithms [1].Source: §1 · p. 1

2 The squid framework

SQUID is a PyTorch-based framework for jointly training classical and quantum components in hybrid classification models. It standardizes model interfaces, gradient propagation, quantum-circuit construction, and output selection while supporting extensible implementations.

2 The squid framework

  • SQUID jointly trains classical networks with a quantum network to learn encoders and decoders for hybrid classification models.This architecture can learn feature maps for representing large datasets on near-term devices and incorporate classical information known a priori.Source: §2 · p. 2
  • The framework assumes training examples contain classical vectors vclass and quantum states |vquant⟩, using classical bit-encoding and quantum amplitude encoding.The amplitude-encoding choice also subsumes quantum training vectors represented as distinct computational-basis bit strings.Source: §2 · p. 2

2.1 Framework Design

  • MainModel composes a classical encoder, a middle quantum or classical model, and a classical decoder, reducing to PyTorch nn.Sequential when all three are classical.Figure 1 represents model nodes as classical neurons or quantum state vectors and edges as transformations.Source: §2.1 · p. 2, Figure 1 · p. 2

2.2 Propagating through the Main Model

  • When the middle model is quantum, SQUID stops PyTorch autograd at the tensor-to-array boundary and uses the quantum model’s backward function to return gradients.A fake loss formed from the encoder output and supplied gradient lets PyTorch propagate gradients through the remaining parameters.Source: §2.2 · p. 3

2.3 Complexity of Gradient Evaluation

  • The quantum-gradient procedure estimates Q1 output probabilities and M-dimensional parameter gradients using parameter-shift circuits, with sampling error controlled probabilistically.On future fault-tolerant devices, the analysis states that quadratic speedups in both ϵ and M may be possible at the cost of longer circuit depth.Source: §2.3 · pp. 3–4

2.4 Available classical models

  • SQUID provides extensible classical models and constructs quantum models from nearest-neighbor one- and two-qubit unitary layers.Quantum outputs are computational-basis probabilities, but only a small subset is typically selected because the number of outcomes grows exponentially with register size.Source: §2.4 · p. 4, §2.5 · pp. 4–5

2.5 Available quantum models

  • SQUID replaces a fixed encoding–variational split with a global unitary whose parameters come from the classical encoder, while retaining the ability to reproduce a factorized form when useful.The encoder output dimension must remain below the generic unitary parameter bound M < (4^N − 1), although efficiently decomposable circuits can require only polynomially many parameters.Source: §2.5 · p. 5

3 Example applications

SQUID evaluates hybrid classical–quantum classifiers on binary MNIST, comparing classical, separable quantum, and entangling quantum models with different output sizes. Across both quantum families, richer outputs are important for optimization and accuracy, while quantum models do not surpass the classical baseline.

3 Example applications

  • The MNIST experiment classifies digits 3 and 7 using an encoder, a classifier or quantum subroutine, and a decoder, with quantum outputs ranging from one to 2^N probabilities.The study uses 48 independent optimization runs and compares the maximum output dimension M1 = 2^N with a minimum setting M1 = 2.Source: §3 · pp. 5–6, Figure 2 · p. 6
  • Classical networks exceed 99% MNIST accuracy, with larger hidden layers improving training fit but not producing a statistically significant improvement in final accuracy.The validation-accuracy distribution remains largely stable as parameter count increases, while training accuracy can reach 100% after more than 80 epochs.Source: §3 · p. 6, Figure 3 · p. 6

3.1 Separable Quantum Models

  • Full-output separable quantum models show a mild accuracy increase with model size but remain below smaller classical networks, whereas single-output models deteriorate as size increases.For six-qubit models, more than half of full-output runs exceed 99% accuracy, while restricting the output prevents most runs from reaching that threshold.Source: §3.1 · p. 7, Figure 5 · p. 7

3.2 Quantum models with entanglement

  • Quantum models with entanglement never exceed classical accuracy, and restricted-output models lose training accuracy as they grow larger.The optimizer struggles to find good parameters for large restricted-output models, indicating optimization difficulty rather than simple overfitting.Source: §3.2 · p. 7, Figure 6 · p. 8

4 SQUID Extensions and Future Work

SQUID is extended through a configuration-driven Helpers package and planned backend and task support. These extensions target reproducible, lower-overhead experimentation while preserving the framework’s modularity.

4.1 SQUID Helpers Package

  • SQUID Helpers uses YAML configuration files to simplify bootstrapping multiple runs, test cases, and result aggregation.Source: §4.1 · p. 8
  • Deterministic seed changes during bootstrap runs make each result exactly reproducible, while configurations and aggregated outputs are saved together.Source: §4.1 · p. 8
  • The Helpers workflow performs an early dimension-checking forward pass, then runs standard training with the Main Model backward call.Source: §4.1 · p. 8

4.2 Future Work

  • SQUID can abstract communication with specific quantum backends, but each backend requires a custom QuantumModel subclass implementing its API.Source: §4.2 · p. 8
  • Current SQUID support is limited to classification and regression, while more advanced scenarios would require changes to SQUID and especially SQUID Helpers.Source: §4.2 · p. 8
  • Future extensions include additional quantum-computing frameworks and backend-agnostic operation across multiple quantum devices.Source: §4.2 · p. 8

5 Conclusions

The paper presents SQUID as a PyTorch-based hybrid framework for training classical and quantum components together. Its architecture supports dimensionality reduction and tunable quantum-state measurement, while future validation must address sample complexity and device effects.

  • SQUID embeds quantum algorithms within multi-layer classical–quantum architectures and uses PyTorch automatic differentiation for efficient optimization.Source: §5 · p. 9
  • The framework’s decoder tunes measurement settings to balance limited probability measurements against the exponential repetition cost of full computational-basis sampling.Source: §5 · p. 9
  • SQUID supports flexible interchange of classical and quantum components and could be adapted to classically efficient entangled representations such as tensor-network states [37].Source: §5 · p. 9
  • Assessing practical viability requires sample-complexity analysis, including finite-statistics and decoherence effects for target devices.Source: §5 · p. 9

A Gradient evaluation for variational quantum models

The appendix derives gradient evaluation for variational quantum models by differentiating parameterized unitaries and estimating output probabilities with Hadamard tests. The measurement strategy scales with the number of requested outputs and model parameters.

B Additional information on the MNIST benchmark

The MNIST benchmark reports classical and quantum-model results across parameterizations, output sizes, and training behavior. The appendix organizes the underlying tables and figures, including confidence intervals, percentile thresholds, and output-size comparisons.

Loading 2105.00098v3…