Variational Quantum RNS Comparator: A Cluster-Inspired Quantum Machine Learning Architecture for Residue Number Systems
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Residue Number Systems (RNS) offer a highly parallel and carry-freerepresentation for arithmetic, yet the fundamental operation of magnitude compar-ison is notoriously non-trivial due to the loss of positional ordering across residues.In 2010, the first cluster-based method for RNS comparison was introduced, show-ing that global ordering can be recovered from algebraic partitions of the residuedomain. In this work we reformulate this principle in the quantum setting and pro-pose ClusterNet, a variational quantum architecture whose entanglement structuremirrors the cluster geometry of the RNS domain. ClusterNet embeds the residuesof two integers into a multi-register quantum state, uses intra- and inter-registerentanglement to encode relative structure, and extracts a comparator bit through aparameterized flag qubit. We show that ClusterNet can exactly represent the RNScomparator via a reversible quantum circuit and prove expressivity guarantees forthe ansatz family. Because large-scale variational training of quantum circuits remains challeng-ing, we validate the underlying inductive bias through a classical surrogate modelthat preserves ClusterNet’s residue decomposition. A two-hidden-layer neural net-work trained on the full RNS domain (3, 5, 7) successfully learns the magnituderelation X > Y with 95–97% accuracy and reveals geometric patterns correspond-ing to the same residue clusters that structure our quantum design. The learneddecision boundary exhibits a sharp diagonal and highly interpretable modular stri-ations, demonstrating that the cluster-based representation is both natural andlearnable. Taken together, our theoretical construction and empirical results show thatClusterNet provides a principled quantum representation of the RNS compari-son problem and captures the algebraic geometry underlying magnitude ordering.This establishes cluster-structured residue embeddings as a promising direction forquantum arithmetic, hybrid quantum-classical architectures, and future quantumaccelerators for modular computation.