Manuscript Offprint

arXiv:2610.24426

Margin-Based Generalization for Quantum Machine Learning with Classical Data Encoding

Ju-Young Ryu, Tak Hur, Daniel K. Park

Abstract

Understanding generalization is essential for assessing the practical viability of quantum machine learning. In many applications, quantum models operate on classical data that must first be encoded into quantum states, making the encoding part of the effective hypothesis class. We develop a margin-based generalization framework for this setting, covering both fixed and trainable quantum data encodings. For fixed encodings, the existing margin bound transfers unchanged. For trainable encodings, we derive a bound using a two-scale covering argument that combines the original margin-dependent term with an additive encoding-capacity term of order O~(L/m)\widetilde{O}(\sqrt{L/m}), where LL is the number of trainable encoding parameters and mm is the training-sample size. Across 19,440 simulated training runs spanning various image datasets, circuit architectures, and optimization settings, the inverse margin performs best among five baseline and two bound-derived complexity measures under conditional-independence and 90th-percentile sign-error criteria, within bootstrap uncertainty. These results provide a unified margin-based view of generalization in quantum machine learning with classical data.

1 Introduction

Quantum neural networks (QNNs) use parameterized quantum circuits as trainable models for learning tasks. As in classical machine learning, their practical utility depends on generalization: the ability to make accurate predictions on unseen data from a finite training sample. Generalization in QML has been studied through parameter counts (Caro et al., 2022), effective dimension (Abbas et al., 2021), and quantum information-theoretic quantities (Banchi et al., 2021).

Most of these analyses produce uniform bounds that hold simultaneously for every hypothesis in the model class. Uniform bounds have faced sustained criticism in classical deep learning. Zhang et al. (2021) showed that deep networks easily fit random labels, so any bound that applies equally to all hypotheses in the class cannot distinguish models that generalize from models that memorize. The same failure occurs in QML. Gil-Fuster et al. (2024) demonstrated that even few-qubit QNNs can perfectly fit randomized labels on a benchmark quantum dataset, rendering uniform bounds equally uninformative in the quantum setting.

Classical learning theory responded to this critique with margin-based analyses (Cortes and Vapnik, 1995; Bartlett et al., 2017; Neyshabur et al., 2018). These analyses replace the worst case over the hypothesis class with a data-dependent quantity that measures how confidently the trained model separates the training sample. Large-scale empirical studies subsequently confirmed that margin-based complexity measures are among the most reliable predictors of generalization in deep networks (Jiang et al., 2019; Dziugaite et al., 2020). Hur and Park (2025) recently extended this line of work to QML. They established a margin-based generalization bound for QNNs classifying quantum data and showed empirically, on quantum phase recognition tasks, that margin-based metrics predict generalization better than parameter-based metrics.

Near-term applications of QML, however, predominantly involve classical data, which must be loaded into a quantum computer by a data-encoding circuit. The encoding is known to shape the expressivity of

∗^{*}These authors contributed equally to this work.

the resulting model (Schuld et al., 2021; Pérez-Salinas et al., 2020) and its generalization behavior (Caro et al., 2021). When the encoding is fixed, each classical input is mapped to a quantum state once and for all. The classical-data problem then reduces exactly to the quantum-data one, and the margin theory of Hur and Park (2025) transfers unchanged (Proposition 1). Modern QNN architectures, however, often make the encoding itself trainable, either by interleaving parameterized layers with data re-uploading blocks (Pérez-Salinas et al., 2020; Lloyd et al., 2020) or by learning the embedding with a classical neural network (Hur et al., 2024). In this case, the encoded sample matrix depends on learned parameters, so the fixed-matrix covering argument of Hur and Park (2025) no longer applies directly.

This paper makes the following theoretical and empirical contributions.

  • We show that for any fixed data encoding the quantum-data margin bound holds without modification (Proposition 1). We then prove a margin-based generalization bound for QNNs whose inputs are produced by a trainable encoding with LL parameters (Theorem 2). The bound separates into the same margin-normalized term (bE/γ)n/m(bE/\gamma)\sqrt{n/m} as in the quantum-data case and an additive encoding-capacity term of order L/m\sqrt{L/m}, up to logarithmic factors. The proof introduces a two-scale covering argument that covers the encoding parameter space and the QNN unitary class at separate scales. A corollary for QNNs whose trainable parameters all lie in the encoding circuit (Corollary 1) shows that the margin then enters the bound only logarithmically.

• Following the predictor-evaluation methodology of Jiang et al. (2019) and Dziugaite et al. (2020), we conduct a systematic empirical study of 19,440 QNN models trained on binary classification tasks derived from MNIST, KMNIST, and Fashion-MNIST. The study sweeps four embedding circuits, four variational ansätze, three re-uploading depths, three qubit counts, and a grid of optimization hyperparameters. Five baseline complexity measures are evaluated with a conditional independence test and a sign-error analysis. Margin-based measures consistently outperform parameter-count measures on both criteria.

• Guided by the derived bounds, we test two theorem-derived complexity measures, the composite nq/mm+cnp\sqrt{n_q}/m_m + c\sqrt{n_p} of Theorem 2 and npln⁡(np/mm)n_p \ln(n_p/m_m) of Corollary 1. Neither improves on the inverse margin. With cc tuned in-sample, the composite lowers the sign-error only slightly, within the boot-strap uncertainty. Both measures score below the inverse margin in the conditional independence test. We attribute this to the parameter count being fixed by the architecture hyperparameters, on which the test conditions.

Together, these results extend the margin-based analysis of Hur and Park (2025) to QNNs trained on classical data and quantify the additional capacity introduced by learning the encoding.

References (42)

  • The power of quantum neural networks
  • Neural network learning: Theoretical foundations
  • Generalization in quantum machine learning: A quantum information standpoint
  • Spectrally-normalized margin bounds for neural networks
  • Encoding-dependent generalization bounds for parametrized quantum circuits
  • Generalization in quantum machine learning from few training data
  • Cost function dependent barren plateaus in shallow parametrized quantum circuits
  • Optimizing quantum data embeddings for ligand-based virtual screening (opens arXiv in a new tab)
  • Deep learning for classical Japanese literature (opens arXiv in a new tab)
  • Support-vector networks
  • Understanding quantum machine learning also requires rethinking generalization
  • Supervised learning with quantum-enhanced feature spaces
  • Neural quantum embedding: Pushing the limits of quantum supervised learning
  • Understanding generalization in quantum machine learning with margins
  • Let quantum neural networks choose their own frequencies
  • Fantastic generalization measures and where to find them (opens arXiv in a new tab)
  • Multi-channel convolutional neural quantum embedding
  • Adam: A method for stochastic optimization
  • MNIST handwritten digit database
  • Neural quantum embedding via deterministic quantum computation with one qubit
  • Quantum embeddings for machine learning (opens arXiv in a new tab)
  • Foundations of Machine Learning
  • A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks
  • Data re-uploading for a universal quantum classifier
  • A pac-bayesian approach to generalization for quantum models (opens arXiv in a new tab)
  • Circuit-centric quantum classifiers
  • Effect of data encoding on the expressive power of variational quantum-machine-learning models
  • Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms
  • Understanding deep learning (still) requires rethinking generalization
  • Covering number bounds of certain regularized linear function classes
  • For any $r_{1}, r_{2} > 0$
  • Applying it to $(\mathcal{F}_\gamma)_S \cup \{0\}$ and substituting $\beta = \sqrt{m} u$, with $K_0' = K_0/\sqrt{m} = 4\pi EH\sqrt{L}/\gamma$ and the elementary bound $\ln(1 + K_0'/u) \leq \ln(1 + K_0') + \ln(1/u)$ for $0 < u \leq 1$
  • Substituting into the margin bound (1) gives, with probability at least $1 - \delta$
  • The training accuracy and test accuracies are represented as boxplots
  • Simulations were performed with the default.qubit statevector simulator in PennyLane 0.42.3
  • The sign-errors formed a U-shape across this sweep as shown in Figure 5(a), achieving a minimum 90th-percentile sign-error of 0.7117 at $c^* = 0.075$
  • $c = 0$ is $\sqrt{n_q} / m_m$; the column $c = \infty$ is the ordering of $\sqrt{n_p}$, i.e., of $n_p$; its sign-errors are over the 10,443 environments in which $n_p$ varies (finite $c$: all 24,909)
  • Each setting had its $c$ value grid-searched across [0, 0.2] with increments of 0.005
  • The p-th percentile is exactly zero—and the inverse margin infinite—whenever more than $p\%$ of the training points are misclassified: this occurs for 47.7% (9,279/19,440) of runs at the 10th percentile, 5.9% (1,149) at the lower quartile, and 0% at the median
  • Runs with $m_{m}=0$: 0 (p50), 1,149 (p25), 9,279 (p10)
  • Because negative sample margins are recorded as zero, the count $\#\{\mathcal{M}\leq \gamma\}$ is unchanged by that convention for every $\gamma>0$, so $\widehat{R}_{\gamma}$ is the exact empirical margin loss and is finite for every run
  • With only five seeds the intervals are coarse; the bootstrap medians preserve the ranking of the point estimates, the intervals cleanly separate the margin-based measures from the parameter-count measures, and place $\widehat{R}_{\gamma=0.1}$ above $1/m_{m}$