Enhancing Expressivity of Quantum Neural Networks Based on the SWAP test

Sebastian Nagies, Emiliano Tolotti, Davide Pastorello, Enrico Blanzieri
6/20/2025
quant-phcs.ETcs.LG

No official code found. Best implementation: snagies/generalized-swap-test-qnn (1 star, AGPL-3.0, last commit 2025-07-02).

Abstract

Quantum neural networks (QNNs) based on parametrized quantum circuits are promising candidates for machine learning applications, yet many architectures lack clear connections to classical models, potentially limiting their ability to leverage established classical neural network techniques. We examine QNNs built from SWAP test circuits and discuss their equivalence to classical two-layer feedforward networks with quadratic activations under amplitude encoding. Evaluation on real-world and synthetic datasets shows that while this architecture learns many practical binary classification tasks, it has fundamental expressivity limitations: polynomial activation functions do not satisfy the universal approximation theorem, and we show analytically that the architecture cannot learn the parity check function beyond two dimensions, regardless of network size. To address this, we introduce generalized SWAP test circuits with multiple Fredkin gates sharing an ancilla, implementing product layers with polynomial activations of arbitrary even degree. This modification enables successful learning of parity check functions in arbitrary dimensions as well as binary n-spiral tasks, and we provide numerical evidence that the expressivity enhancement extends to alternative encoding schemes such as angle (Z) and ZZ feature maps. We validate the practical feasibility of our proposed architecture by implementing a classically pretrained instance on the IBM Torino quantum processor, achieving 84% classification accuracy on the three-dimensional parity check despite hardware noise. Our work establishes a framework for analyzing and enhancing QNN expressivity through correspondence with classical architectures, and demonstrates that SWAP test-based QNNs possess broad representational capacity relevant to both classical and potentially quantum learning tasks.

View on arXivView PDF

Code Implementations(1)

AGPL-3.0

Code used in the publication "Enhancing Expressivity of Quantum Neural Networks Based on the SWAP Test"

10PythonMar 20, 20241 years agoAGPL-3.0

Similar Papers

Cite this paper

@article{nagies2025enhancing,
  title  = {Enhancing Expressivity of Quantum Neural Networks Based on the SWAP test},
  author = {Sebastian Nagies and Emiliano Tolotti and Davide Pastorello and Enrico Blanzieri},
  year   = {2025},
  eprint = {2506.16938},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.16938v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.16938.svg)](https://codeofpaper.com/paper/2506.16938)

Discussion