Manuscript Offprint
arXiv:2610.24426Margin-Based Generalization for Quantum Machine Learning with Classical Data Encoding
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 , where is the number of trainable encoding parameters and 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 parameters (Theorem 2). The bound separates into the same margin-normalized term as in the quantum-data case and an additive encoding-capacity term of order , 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 of Theorem 2 and of Corollary 1. Neither improves on the inverse margin. With 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.
Generalization in QML. Uniform generalization bounds for QML have been derived from parameter counts (Caro et al., 2022), effective dimension (Abbas et al., 2021), and quantum information-theoretic arguments (Banchi et al., 2021). Gil-Fuster et al. (2024) showed that QNNs overfit randomized labels, questioning the practical value of uniform bounds, in analogy with Zhang et al. (2021). Hur and Park (2025) established a margin-based bound for QNNs with quantum input data by covering the image of the data matrix under the unitary class, and demonstrated empirically that margin-based metrics dominate parameter-based ones. More recently, Rodriguez-Grasa et al. (2026) derived solution-dependent PAC-Bayesian bounds for layered quantum models. Our theory instead extends the quantum-data margin bound to classical inputs with trainable encodings, and our experiments evaluate margin-based predictors in that setting.
Data encoding. For classical data, the choice of quantum embedding determines the model's frequency content (Schuld et al., 2021) and its generalization behavior. Caro et al. (2021) derived generalization bounds for fixed encodings via fat-shattering dimensions of the induced function class. Data re-uploading (Pérez-Salinas et al., 2020) interleaves encoding and trainable layers. Trainable embeddings (Lloyd et al., 2020) and neural quantum embeddings (Hur et al., 2024; Liu et al., 2025; Kim et al., 2026; Choi et al., 2025) optimize the encoding to separate the classes in Hilbert space, which enlarges margins (Hur and Park, 2025). Our results cover both regimes: a margin-based bound that carries over to fixed encodings (Proposition 1), and a bound that quantifies the capacity cost of training the encoding (Theorem 2).
3 Preliminaries
Multiclass classification with QNNs. We consider -class classification of -qubit quantum states, writing . A QNN applies a unitary from an accessible class , followed by a positive operator-valued measurement (POVM) . For a pure input state , the model outputs the vector of class probabilities
and predicts . Given i.i.d. samples from an unknown distribution , the true risk is .
Margins. The margin operator measures the gap between the correct class probability and the strongest competitor. The sample margin of is . For a margin level , the ramp loss is defined by . The empirical margin loss is . Writing for the class of functions induced by the hypothesis class, the standard margin bound (Mohri et al., 2018) states that, for any , with probability at least , for all ,
where denotes the empirical Rademacher complexity of the loss class restricted to the sample.
Margin bound for quantum data. Two constants of the QNN control the Rademacher complexity in (1). The measurement constant is , where is the spectral norm. The unitary distance bound satisfies for all and some reference unitary , where is the sum of the Euclidean norms of the columns. Covering the image of the sample data matrix with matrix sparsification techniques (Zhang, 2002), Hur and Park (2025) obtained the following.
Theorem 1 (Hur and Park, 2025). Consider an n-qubit QNN with unitary class (distance bound ) and POVMs for -class classification of quantum states. For any and , with probability at least over an i.i.d. sample of size , every hypothesis satisfies
When the k POVM elements are nonzero projectors, , so the measurement factor is common across models with the same number of classes. The remaining factors b and n must still be accounted for when comparing different unitary classes or circuit widths.
4 Margin Bounds with Classical Data Encoding
Fixed encodings. A fixed encoding transports the data distribution onto the space of quantum states, so the classical-data problem is an instance of the quantum-data one and the quantum-data bound transfers directly.
Proposition 1 (Fixed encodings). For any fixed encoding of classical inputs into -qubit states, the bound of Theorem 1 holds for the hypothesis class of all with .
Proof. The encoded pairs are i.i.d. samples from the pushforward of under , and under this identification the risks, the margins, and the hypothesis class are exactly those of the quantum-data setting.
Trainable encodings. Modern encodings, however, are trained together with the classifier, and the reduction above then breaks down. The encoded data matrix is no longer fixed but moves with the encoding parameters. We model a trainable encoding as a parameterized circuit that prepares with
where the are fixed data-dependent unitaries (e.g., angle-embedding blocks), the are Hermitian generators, and contains the independent trainable encoding parameters. A circuit layer containing several trainable gates is decomposed into scalar-parameter factors of the form appearing in (2). The fixed unitary allows the case to represent an arbitrary fixed encoding. Data re-uploading circuits (Pérez-Salinas et al., 2020) with fixed input weights are obtained by repeating the same data-dependent block. Writing , define the hypothesis and induced loss classes
Theorem 2. Consider an n-qubit QNN with unitary class and distance bound , POVMs , and a trainable encoding of the form (2) with parameters. For any and , with probability at least over an i.i.d. sample of size , every hypothesis satisfies
The first term is the margin-normalized capacity of the post-encoding QNN unitary class, as in Theorem 1, while the second term accounts for the trainable encoder. Setting L = 0 recovers the fixed-encoding case. The notation suppresses logarithmic factors. Theorem 3 in Appendix A gives the explicit dependence.
Any variational classifier can be viewed as a trainable encoding followed by a fixed classifier, by absorbing all of its trainable gates into the encoding. This leads to the following corollary.
Corollary 1. In the setting of Theorem 2 with and , with probability at least over an i.i.d. sample of size , every hypothesis satisfies
with absolute constants, where . If every trainable gate is a Pauli rotation and the measurement is projective, the encoding term is .
The complexity term is a parameter count and the margin enters only through and the logarithm, as for a finite-dimensional Lipschitz class whose fat-shattering dimension at scale grows like (Anthony and Bartlett, 2009), in contrast to the polynomial of Theorem 2. It is a margin-loss analogue of the parameter-count bound of Caro et al. (2022). Explicit constants are given in Appendix A.8.
Proof sketch. The full proof is in Appendix A, and we outline the argument here. Write for the encoded data matrix, whose columns are normalized states, so for every . (1) Since is -Lipschitz uniformly in (Hur and Park, 2025), covering numbers of reduce to covering numbers of the set , which is no longer the image of a single data matrix. (2) The key step is a two-scale covering argument that restores the single-matrix structure.
Lemma 1 (Two-scale covering). For any radii ,
The proof uses unitary invariance of the Frobenius norm. If is close to a cover point , then is equally close to , and the image can be covered by the original argument. (3) The unitary factor is bounded exactly as in the quantum-data case, since every has Frobenius norm . (4) For the encoding factor, a telescoping argument shows the map is -Lipschitz, so an -net of the parameter cube (of log-cardinality at most ) induces a cover of . (5) Dudley's entropy integral over the combined covering bound, with the discretization scale chosen proportional to , yields the stated complexity. Combining with (1) completes the proof.
The product form (2) is sufficient but not necessary: the proof only requires the encoder family to be uniformly Lipschitz in its trainable parameters. Fully classical neural encoders require a separate covering bound and are not covered by Theorem 2. We next evaluate margin- and parameter-based statistics across QNNs with varying encoder capacity.
5 Experimental Setup
We follow the predictor-evaluation methodology developed for classical deep networks (Jiang et al., 2019; Dziugaite et al., 2020). We train a large family of models spanning many hyperparameter axes, compute candidate complexity measures for each trained model, and score each measure by how well it predicts the generalization gap across controlled hyperparameter changes. Each hyperparameter is denoted in a bold font in the following subsections.
5.1 Datasets and Preprocessing
We construct three binary image-classification tasks: MNIST (LeCun et al., 2010) classes 1 vs. 6, KMNIST (Clanuwat et al., 2018) classes 0 vs. 5, and Fashion-MNIST (Xiao et al., 2017) classes 4 vs. 9. The dataset itself is treated as a hyperparameter in the evaluation below. For each class, 5,000 training and 500 test samples are drawn at random. Images are standardized, reduced to two dimensions by principal component analysis, and standardized again so that the two features can be used directly as rotation angles of quantum gates. The two-dimensional feature vector is tiled to match the register width. For example, becomes on six qubits.

(a)
(b)
(c)
Figure 1: Four-qubit embedding circuits with input . (a) angle embedding. (b) angle embedding. (c) One IQP embedding layer. One- and two-layer variants are used.

(a)

(b)
Figure 2: Four-qubit variational circuits with trainable parameters . (a) Basic entangler layer with rotations. The variant substitutes gates, and strongly entangling layers substitute general U3 rotations in place of rotations. (b) Simplified two-design layer.
5.2 Model Family
Each QNN is specified by four architectural hyperparameters.
Embedding circuit . Four fixed embeddings are used: angle embedding, angle embedding, and IQP embeddings with one or two layers (Havlíček et al., 2019) (see Figure 1).
Variational circuit . Four ansätze are used: basic entangler layers with or rotations, strongly entangling layers (Schuld et al., 2020), and simplified two-design layers (Cerezo et al., 2021) (see Figure 2).
Re-uploading depth and circuit width. We evaluate re-uploading depths and circuit widths . The full circuit alternates embedding and variational blocks. The model prepares and outputs the measurement distribution of qubit 0. If the outermost variational block is viewed as the post-encoding QNN unitary, the preceding trainable rotations play the role of the encoding parameters in (2). The binary measurement on qubit 0 is projective, so for every model.
5.3 Training
Three optimization hyperparameters are varied, namely the batch size , the learning rate , and the random seed . Models are trained using Adam (Kingma and Ba, 2015) until the following convergence criterion is met. Let and denote the mean and standard deviation of the most recent 500 mini-batch losses, respectively, and let denote the mean of the preceding 500 mini-batch losses. Training stops when . In total, the grid comprises architectures, optimization settings, 3 datasets, and 5 seeds, i.e., 19,440 training runs.
5.4 Complexity Measures
We compare five baseline complexity measures and two theorem-derived ones, all oriented so that larger values should indicate a larger generalization gap. Of the baselines, three contain margin information , and , while two are parameter-based and . Here is the median training margin, is the number of qubits, and is the total number of trainable parameters in the model. The factor mirrors the explicit dependence in Theorem 2. The baselines isolate the ingredients of the bounds (margin, circuit width, and the parameter count that controls the encoding-capacity term), combining them only through simple products, so that comparisons among them attribute predictive power to the margin or to the parameter count. The median is used rather than the lower quartile to avoid infinite inverse margins for inexpressive models (Hur and Park, 2025). Results with lower-quantile margins are given in Appendix E.
The two theorem-derived measures combine the same ingredients in the functional forms that the bounds prescribe, and Section 6.2 compares them with the best baseline. The composite measure matches the explicit dependence on , and in Theorem 2, with the margin and the encoding capacity as separate additive terms. The ratio stands in for the unknown unitary radius and is chosen to maximize the generalization property prediction accuracy of the measure. The measure follows the Pauli-rotation form of Corollary 1 with and at the margin scale , so that the margin enters only through a logarithm.
5.5 Evaluation Criteria
Conditional independence test. The conditional independence test of Jiang et al. (2019) measures the effect of a complexity measure on the generalization gap while controlling for confounding by the hyperparameters. For a pair of hyperparameter settings , define the sign random variables and , and let be uniformly distributed over the values of a subset of hyperparameter types. The criterion is the worst-case normalized conditional mutual information over small conditioning sets,
where and denote conditional mutual information and conditional entropy, estimated from the empirical distribution over runs. Larger means carries more information about the generalization gap even after conditioning on the most adversarial pair of hyperparameters.
Sign-error distribution. Following Dziugaite et al. (2020), the sign-error quantifies how often the ordering of two models by disagrees with their ordering by generalization gap, across pairs of settings that differ in exactly one hyperparameter (random seeds excluded):
Each pair is weighted by , the normalization of . The factor lower-bounds the probability that the sign of the gap difference, estimated from a test set of size , agrees with its sign under the true distribution (Dziugaite et al., 2020). Thus, only hyperparameter-setting pairs with sign-consistency probability at least 0.5 are retained. Some environments may consequently contain too few reliable comparisons, so a sign-error is calculated only when the effective sample size is at least 12. Some complexity measures have a large fraction of environments where the change in a hyperparameter does not result in a change of complexity measure, thus the sign-error is evaluated as 0.5. These measures may have an unfair advantage due to the large number of environments having relatively low sign-error. To resolve such issues, we remove all environments where the complexity measure remains constant.
| Complexity measure | All 90% | Mean | Common 90% | Mean | |
|---|---|---|---|---|---|
| 4.565 | 0.7124 | 0.4799 | 0.7225 | 0.4783 | |
| 3.543 | 0.7144 | 0.4801 | 0.7274 | 0.4787 | |
| 0.1932 | 0.7724 | 0.5038 | 0.7724 | 0.5038 | |
| 0.4683 | 0.7256 | 0.4879 | 0.7531 | 0.4962 | |
| 0.1564 | 0.7724 | 0.5038 | 0.7724 | 0.5038 |
Table 1: Five baseline complexity measures: conditional independence test score (5) (higher is better) and 90th-percentile and mean sign-error (6) (lower is better) across all environments and across the Common environments in which the changed hyperparameter affects every measure (ansatz, number of re-uploadings, number of qubits). The maximum sign-error is 1 for every measure.
Computing within each experimental environment (each fixed configuration of the remaining hyperparameters) yields a distribution of sign-errors per measure, whose upper tail reveals worst-case behavior. We report empirical cumulative distribution functions (ECDFs) and 90th-percentiles. 90th-percentiles indicate how well the complexity measure predicts the generalization gap for a large fraction of environments, thus indicating robustness as well as accuracy (Dziugaite et al. (2020)).
6 Results
Training diagnostics and the distribution of empirical generalization gaps over all runs are reported in Appendix B.
6.1 Baseline measures
Table 1 reports both evaluation criteria for the five baseline complexity measures. In the conditional independence test, the pure margin measure attains the highest score. It exceeds the score of the qubit-normalized margin measure and every parameter-based measure. The mixed measure underperforms compared to both inverse-margin measures, suggesting that multiplying margin information by a parameter count degrades rather than improves the signal.
The sign-error columns of Table 1 point the same way. No measure is completely robust (every measure exhibits environments with the maximal sign-error of 1), mirroring the classical findings of Dziugaite et al. (2020). At the 90th-percentile, however, the margin-based measures achieve markedly lower sign-error than the parameter-based measures.
Figure 3 decomposes the 90th-percentile sign-errors by the hyperparameter that is varied within each pair. Two observations stand out. First, the parameter-based measures and are constant under changes of embedding, batch size, learning rate, and dataset, so those environments are excluded for them (Appendix C; dashes in Figure 3) and their scores rest on the three architecture axes, where the deficit is concentrated on the ansatz axis (0.878 versus 0.768 for ). Second, the margin-based measures show lower 90th-percentile values for optimization hyperparameters (batch size and learning rate) compared to other hyperparameters, which is desirable: a good complexity measure should respond to whatever affects generalization, whichever hyperparameter caused it (Dziugaite et al., 2020).
The overall advantage of margin-based measures could, in principle, stem solely from the axes on which parameter counts are constant. The Common columns of Table 1 therefore restrict the comparison to the hyperparameters that change every measure, namely the ansatz, the number of re-uploadings, and the number of qubits. The differences shrink, but the margin-based measures still dominate at the 90th-percentile and mean. Full empirical cumulative distributions of sign-errors are further detailed in Appendix H (Figure 6).
| Embedding | 0.75 | 0.75 | 0.75 | — | — |
|---|---|---|---|---|---|
| Ansatz | 0.77 | 0.77 | 0.82 | 0.88 | 0.88 |
| Number of ReUps | 0.71 | 0.71 | 0.71 | 0.71 | 0.71 |
| Number of Qubits | 0.70 | 0.68 | 0.71 | 0.71 | 0.71 |
| Batch Size | 0.68 | 0.68 | 0.68 | — | — |
| Learning Rate | 0.68 | 0.68 | 0.68 | — | — |
| Dataset | 0.74 | 0.74 | 0.74 | — | — |
Figure 3: 90th-percentile values of the sign-error empirical distribution, decomposed by the hyperparameter varied within each pair. Lower is better.
| Complexity measure | 90% | ||
|---|---|---|---|
| All | Common | ||
| 4.565 | 0.7124 | 0.7225 | |
| 3.316 | 0.7117 | 0.7212 | |
| 0.3657 | 0.7321 | 0.7699 | |
Table 2: Best baseline versus the two theorem-derived measures of Section 5.4: conditional independence score (5) (higher is better) and 90th-percentile sign-error over all and over the Common environments (lower is better); . Confidence intervals are given in Appendix G.
6.2 Theorem-derived measures
Table 2 compares the best baseline, , with the two theorem-derived measures of Section 5.4, which combine the margin and the parameter count in the functional forms prescribed by the bounds. On the axes that leave and unchanged (embedding, batch size, learning rate, dataset) both order models exactly as , so all differences arise on the architecture (Common) axes.
A composite complexity measure of the form that incorporates the number of qubits, number of parameters, and the margin following Theorem 2 is optimized in-sample through grid search to minimize the 90th-percentile sign-error. The minimum 90th-percentile sign-error of 0.7117 was achieved at , an improvement of 0.0007 over whose paired bootstrap interval includes zero (; Appendix G; held-out check in Appendix D). When applied to the conditional independence test, the optimized composite complexity measure scored , which improves upon the parameter-based measures but not the pure margin. In fact, decreases monotonically in over the whole scanned range, from at to at (Table 3), so the composite never improves on its base in this test. The conditional independence test is designed to expose this. It scores the information a measure carries about the gap once the hyperparameters are fixed, and since is determined by three architecture hyperparameters, conditioning removes everything a term in could contribute. What remains is a pull of the model-pair ordering toward that of , one of the weakest measures in Table 1.
Since depends on the unitary radius , it should depend on the ansatz type and qubit number. Optimizing one weight per (ansatz, ) pair lowers the 90th-percentile sign-error to 0.6988 on the five axes that leave fixed (where scores 0.7052), but only to 0.7108 (versus 0.7124, within the bootstrap uncertainty) over all seven axes, with , again below the pure margin measure (Appendix D).
Corollary 1 places the parameter count outside and the margin inside a logarithm. The measure is markedly worse than on both criteria (Table 2), because its ordering is dominated by the parameter count: ranges from 2.77 to 5.26 across the grid, whereas has median 0.74, so the term exceeds the margin-dependent term in every run. Consequently orders 97.7% of the pairs of runs with different exactly as does (Kendall with , -0.06 with ) and inherits the conditional independence score of the parameter count.
Finally, we score the empirical margin loss , i.e., the fraction of training points with margin at most . At each of it outperforms on both criteria, with up to and a 90th-percentile sign-error down to 0.706, a gain whose paired bootstrap interval excludes zero (Appendix F). The lower tail of the margin distribution thus carries more information about the gap than its median. Unlike , however, does not depend on a margin level, which makes it the simpler summary of the margin distribution.
7 Conclusion
We extended margin-based generalization theory for quantum neural networks from quantum to classical data. For a fixed data encoding, the quantum-data margin bound of Hur and Park (2025) transfers without modification (Proposition 1). For trainable encodings, such as data re-uploading circuits, we proved a bound in which the margin-normalized term of the quantum-data case is accompanied by an additive encoding-capacity term of order (Theorem 2), using a two-scale covering argument that treats the encoding parameters and the post-encoding unitary separately. When all trainable parameters lie in the encoding circuit, the complexity term reduces to a parameter count and the margin enters only logarithmically (Corollary 1).
Empirically, across 19,440 QNNs trained on binary tasks from MNIST, KMNIST, and Fashion-MNIST, the inverse margin is the strongest of the measures compared in predicting the generalization gap, under both the conditional independence test and the sign-error analysis. It outperforms the parameter-count baselines as well as the measures derived from Theorem 2 and Corollary 1, which combine the margin with the parameter count. The composite measure improves on the sign-error of the inverse margin only when its weight is tuned in-sample, and then by less than the bootstrap uncertainty. Since the parameter count is determined by the architecture hyperparameters on which the test conditions, it adds little information about the generalization gap beyond what the margin already carries. These findings extend the quantum-data observations of Hur and Park (2025) to classical data.
A natural follow-up question is how hardware noise affects these findings, as noise such as depolarizing noise contracts the measurement probabilities toward uniform and thereby shrinks the margin. On the theoretical side, Theorem 2 assumes that trainable gates and data-dependent gates are separate, as in Equation (2). Extending the analysis to encodings that process data and trainable parameters jointly, such as classical neural encoders (Hur et al., 2024) or rotation gates with trainable frequencies (Jaderberg et al., 2024), would bring a broader class of QNNs within the scope of the theory.
Code Availability
The code can be found in the following repository: https://github.com/jyryu98/margin-gen-qml-classical-encoding.
Acknowledgments
This work was supported by the Institute of Information & Communications Technology Planning & Evaluation (IITP) ITRC (Information Technology Research Center) funded by the Ministry of Science and ICT (MSIT), Korea (IITP-2026-RS-2026-25519864), by the IITP grant (No. 2019-0-00003, Research and Development of Core Technologies for Programming, Running, Implementing and Validating of Fault-Tolerant Quantum Computing System), by the National Research Foundation of Korea (RS-2025-02309510), by Korean ARPA-H Project through the Korea Health Industry Development Institute (KHIDI), funded by the
Ministry of Health & Welfare, Korea (RS-2025-25456722), and National Institute of Health (NIH) research project (2026-ER0901-00).
References
Abbas, A., Sutter, D., Zoufal, C., Lucchi, A., Figalli, A., and Woerner, S. (2021). The power of quantum neural networks. Nature Computational Science, 1(6):403–409.
Anthony, M. and Bartlett, P. L. (2009). Neural network learning: Theoretical foundations. cambridge university press.
Banchi, L., Pereira, J., and Pirandola, S. (2021). Generalization in quantum machine learning: A quantum information standpoint. PRX Quantum, 2(4):040321.
Bartlett, P. L., Foster, D. J., and Telgarsky, M. J. (2017). Spectrally-normalized margin bounds for neural networks. Advances in Neural Information Processing Systems, 30.
Caro, M. C., Gil-Fuster, E., Meyer, J. J., Eisert, J., and Sweke, R. (2021). Encoding-dependent generalization bounds for parametrized quantum circuits. Quantum, 5:582.
Caro, M. C., Huang, H.-Y., Cerezo, M., Sharma, K., Sornborger, A., Cincio, L., and Coles, P. J. (2022). Generalization in quantum machine learning from few training data. Nature Communications, 13(1):4919.
Cerezo, M., Sone, A., Volkoff, T., Cincio, L., and Coles, P. J. (2021). Cost function dependent barren plateaus in shallow parametrized quantum circuits. Nature Communications, 12(1):1791.
Choi, J., Hur, T., Jeong, S., Jung, K. L., Park, J. B., Lee, J., Jung, J. U., and Park, D. K. (2025). Optimizing quantum data embeddings for ligand-based virtual screening. arXiv preprint arXiv:2512.16177.
Clanuwat, T., Bober-Irizar, M., Kitamoto, A., Lamb, A., Yamamoto, K., and Ha, D. (2018). Deep learning for classical Japanese literature. arXiv preprint arXiv:1812.01718.
Cortes, C. and Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3):273–297.
Dziugaite, G. K., Drouin, A., Neal, B., Rajkumar, N., Caballero, E., Wang, L., Mitliagkas, I., and Roy, D. M. (2020). In search of robust measures of generalization. Advances in Neural Information Processing Systems, 33:11723–11733.
Gil-Fuster, E., Eisert, J., and Bravo-Prieto, C. (2024). Understanding quantum machine learning also requires rethinking generalization. Nature Communications, 15(1):2277.
Havlíček, V., Córcoles, A. D., Temme, K., Harrow, A. W., Kandala, A., Chow, J. M., and Gambetta, J. M. (2019). Supervised learning with quantum-enhanced feature spaces. Nature, 567(7747):209–212.
Hur, T., Araujo, I. F., and Park, D. K. (2024). Neural quantum embedding: Pushing the limits of quantum supervised learning. Physical Review A, 110(2):022411.
Hur, T. and Park, D. K. (2025). Understanding generalization in quantum machine learning with margins. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research. PMLR.
Jaderberg, B., Gentile, A. A., Berrada, Y. A., Shishenina, E., and Elfving, V. E. (2024). Let quantum neural networks choose their own frequencies. Physical Review A, 109(4):042421.
Jiang, Y., Neyshabur, B., Mobahi, H., Krishnan, D., and Bengio, S. (2019). Fantastic generalization measures and where to find them. arXiv preprint arXiv:1912.02178.
Kim, Y., Im, C., Kim, T., Hur, T., and Park, D. K. (2026). Multi-channel convolutional neural quantum embedding. Advanced Quantum Technologies, 9(1):e00575.
Kingma, D. P. and Ba, J. (2015). Adam: A method for stochastic optimization. In International Conference on Learning Representations.
LeCun, Y., Cortes, C., and Burges, C. J. (2010). MNIST handwritten digit database. http://yann.lecun.com/exdb/mnist.
Liu, H., Hur, T., Zhang, S., Che, L., Long, X., Wang, X., Huang, K., Fan, Y.-a., Zheng, Y., Feng, Y., et al. (2025). Neural quantum embedding via deterministic quantum computation with one qubit. Physical Review Letters, 135(8):080603.
Lloyd, S., Schuld, M., Ijaz, A., Izaac, J., and Killoran, N. (2020). Quantum embeddings for machine learning. arXiv preprint arXiv:2001.03622.
Mohri, M., Rostamizadeh, A., and Talwalkar, A. (2018). Foundations of Machine Learning. MIT Press, 2nd edition.
Neyshabur, B., Bhojanapalli, S., and Srebro, N. (2018). A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations.
Pérez-Salinas, A., Cervera-Lierta, A., Gil-Fuster, E., and Latorre, J. I. (2020). Data re-uploading for a universal quantum classifier. Quantum, 4:226.
Rodriguez-Grasa, P., Caro, M. C., Eisert, J., Gil-Fuster, E., Schreiber, F. J., and Bravo-Prieto, C. (2026). A pac-bayesian approach to generalization for quantum models. arXiv preprint arXiv:2603.22964.
Schuld, M., Bocharov, A., Svore, K. M., and Wiebe, N. (2020). Circuit-centric quantum classifiers. Physical Review A, 101(3):032308.
Schuld, M., Sweke, R., and Meyer, J. J. (2021). Effect of data encoding on the expressive power of variational quantum-machine-learning models. Physical Review A, 103(3):032430.
Xiao, H., Rasul, K., and Vollgraf, R. (2017). Fashion-MNIST: A novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747.
Zhang, C., Bengio, S., Hardt, M., Recht, B., and Vinyals, O. (2021). Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107–115.
Zhang, T. (2002). Covering number bounds of certain regularized linear function classes. Journal of Machine Learning Research, 2:527–550.
A Proof of Theorem 2
Throughout, is the number of qubits, , the sample size, and the number of classes. Here and satisfies for all . We write for the encoded sample matrix. Since its columns are normalized quantum states, for every , where on matrices denotes the Frobenius norm. For a matrix , we write for its image under the unitary class.
The argument first establishes the following explicit-logarithmic version of Theorem 2 under two side conditions. Appendix A.7 then removes those conditions, which only exclude regimes where Theorem 2 holds for elementary reasons.
Theorem 3 (Explicit-logarithmic version of Theorem 2). In the setting of Theorem 2, assume and . Then the empirical Rademacher complexity in (1) obeys
A.1 Reduction to Matrix Covering
The quantum-data analysis of Hur and Park (2025) rests on two facts. First, for any label , the map is -Lipschitz in on normalized states, since is -Lipschitz, is 2-Lipschitz in , and each measurement function is -Lipschitz. Second, the image of a fixed data matrix admits the covering bound (their Equation (9), obtained from Maurey sparsification (Zhang, 2002) applied to complex matrices)
for any matrix X with and any .
For the class (3), the Lipschitz property gives, for any ,
but the right-hand side is no longer the image of a single matrix. The data matrix moves with .
A.2 Two-Scale Covering
Lemma 2 (Lemma 1, restated). For any ,
Here the first covering number is over covers by points of itself (internal covers): the grid of Lemma 4 is one, and an internal covering number is at most the external one at half the radius.
Proof. Take such that is an -cover of . The grid construction of Lemma 4 below produces the cover from points inside the cube, so every cover point is itself an admissible data matrix. For each , let be an -cover of the image . Given any , choose with . By unitary invariance of the Frobenius norm, . Then choose with . Hence is an -cover of cardinality at most the claimed product.
Splitting the radius in (8) as and applying the lemma,
Since every satisfies , the second term follows from (7) at radius :
A.3 Lipschitz Property of the Encoding
Lemma 3. For all ,
with , and consequently .
Proof. For unitaries and , a telescoping argument gives , since all remaining factors have unit spectral norm. The fixed interleaved unitaries cancel in each telescoping step. For a single layer,
Combining the two facts and applying the Cauchy–Schwarz inequality,
The matrix statement follows because each of the columns changes by at most in Euclidean norm.
More general parameterized layers. The subsequent argument uses only the uniform Lipschitz property in Lemma 3. It therefore also applies to encoders satisfying uniformly in and , with replaced by . This includes data-parameter coupled rotations such as when the data are bounded. Encoders implemented by a separate classical neural network require a covering bound for that network and are outside Theorem 2.
A.4 Covering the Parameter Cube
Lemma 4. For any r > 0,
Proof. An axis-aligned grid of spacing inside matches each coordinate to within and is therefore an -cover in , with points per axis, giving .
We state the bound in the form, standard for covering numbers of bounded sets (compare for the radius-R ball). The covering number of a nonempty set is at least one, so a valid upper bound on must remain nonnegative for every . An expression of the form fails this for , while needs no side condition. In the regime relevant inside Dudley's integral, the two forms agree up to constants.
By Lemma 3, an -cover of the cube induces an -cover of , so
where .
A.5 Covering Bound for the Hypothesis Class
Under the assumption of Theorem 3, for all one has , so (valid for ) absorbs the ceiling in (10). Radii are irrelevant since has diameter at most . Combining (9), (10), and (11) gives, for all ,
with .
A.6 Dudley's Entropy Integral
Dudley's entropy integral (Bartlett et al., 2017, Lemma A.5) gives
The lemma is stated for sets containing the origin, and applying it to increases each covering number by at most one element, affecting only absolute constants. Using on (12), the two contributions are
where . The second bound follows by extending the integral down to 0, which is allowed because its integrand is nonnegative and integrable at 0: substituting and using for together with , exactly as in Appendix A.8. The cutoff is thus needed only for the unitary term. Choose
which is admissible ( ) precisely when , the sample-size condition of Theorem 3. Then
with
Since and for ,
This establishes Theorem 3, and substituting into the margin bound (1) yields Theorem 2 whenever and .
A.7 Removing the Side Conditions
It remains to prove Theorem 2 when either side condition of Theorem 3 fails.
Small samples. Suppose . Then , and since for , the first term of Theorem 2 satisfies . Once the constant hidden in the is at least 20, the right-hand side of the bound exceeds one, and the bound holds trivially because .
Weak unitary classes. Suppose and . The ceiling in (10) can then no longer be absorbed multiplicatively, so we keep it via , and (12) acquires the additive term . This term is active only at small radii. Since , every matrix in the image satisfies , so the single point covers at radius . The unitary factor in (9) is therefore zero at all radii , that is for all . The additive term hence contributes to Dudley's entropy integral at most
which is absorbed into the first term of Theorem 2. The remainder of the proof proceeds unchanged, completing the proof for every . When , the post-encoding unitary class is a singleton; applying Dudley's integral directly to the encoder cover (11) gives the simpler encoder-only scaling .
A.8 Proof of Corollary 1
With , the reduction (8) reads , with no unitary factor. By Lemma 3 an -cover of the cube with induces an -cover of , so Lemma 4 gives
Since is integrable at 0, Dudley's integral may be taken with lower limit , which removes the term. Applying it to and substituting , with and the elementary bound for ,
using . Substituting into the margin bound (1) gives, with probability at least ,
When the logarithm is at least , so the bracket is at most a constant multiple of and for ; this yields Corollary 1 with absolute constants. If every trainable gate is a Pauli rotation , then , , and . If, in addition, the measurement is projective with outcomes, each is an orthogonal projector, so , , and . We may take , since margins never exceed 1 and otherwise; then for , and with ( for binary classification). The same lower bound absorbs the additive constant 0.89 in (14), giving the stated form, with a constant depending only on .
B Training Diagnostics
Figure 4 summarizes the training results in all runs. Most runs achieve high training and test accuracy, with a population of poorly performing outliers concentrated among the smallest architectures. For two of the three datasets, the empirical generalization gap (training minus test accuracy) is distributed approximately symmetrically around zero rather than being predominantly positive. The gaps in this regime are small, so fluctuations from the finite test set can be comparable to the gaps themselves. The -weighting in Equation (6) discounts comparisons for which the ordering is not reliably determined.

Figure 4: Accuracies and generalization gaps of all 19,440 runs. The training accuracy and test accuracies are represented as boxplots. The box extends from the first quartile to the third, with a line at the median. Error bars represent the inter-quartile range added to the box boundaries.
C Additional Experimental Details
Evaluation details. For the conditional independence test defined in Equation (5), the empirical joint distribution over runs is used to estimate the conditional mutual information and conditional entropy, following
Hur and Park (2025). For the sign-error defined in Equation (6), the function is the sign-consistency probability bound of Dziugaite et al. (2020) evaluated with the test-set size . Pairs are formed only between settings differing in exactly one hyperparameter, seeds are aggregated within each setting, and environments with effective sample size are discarded. Environments where the complexity measure is constant about the change in the hyperparameter are also discarded. In Equation (5), ranges over all eight hyperparameter types of Section 5, including the random seed, i.e. 36 conditioning sets (8 single types and 28 pairs); for every measure reported, the minimizing set does not involve the seed, so the 28 seed-free sets give the same . Of the 30,732 environments that contain at least one retained pair (), 24,909 satisfy (median among them, of at most 25). The margin-based measures are scored on these 24,909 environments (11,104 Common), whereas and are scored on 10,443 in both columns, because is also constant between the two basic-entangler ansätze, which removes 661 further environments. Both criteria depend only on how a measure orders pairs of models, so strictly increasing transformations of a measure, such as the square root in Corollary 1 or in , leave all scores unchanged.
Margin computation. Margins are computed on the training set after convergence as , where is the measurement distribution of qubit 0, and denotes the median of this distribution.
Software and hardware. Simulations were performed with the default.qubit statevector simulator in PennyLane 0.42.3. PyTorch 2.8.0 was the main machine learning framework used. Experiments were carried out on a desktop computer equipped with an AMD Ryzen 7 7800X3D 8-core processor and 32GBs of RAM.
D Composite Measure Optimization
We optimize to minimize the 90th-percentile sign-error by grid-searching over [0.01, 0.1] with increments of 0.005. 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 .
Table 3 reports both criteria along a wider sweep of : the 90th-percentile sign-error is U-shaped with its minimum at , whereas decreases monotonically over the whole sweep, from its value to at , below even the parameter-count ordering recovered as , so no choice of improves the conditional independence score.
| c | 0 | 0.01 | 0.025 | 0.05 | 0.075 | 0.1 | 0.15 | 0.2 | 0.3 | 0.5 | 1 | 2 | ∞ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3.546 | 3.518 | 3.485 | 3.407 | 3.316 | 3.269 | 3.139 | 3.006 | 2.731 | 2.284 | 1.130 | 0.066 | 0.194 | |
| 0.7144 | 0.7136 | 0.7134 | 0.7121 | 0.7117 | 0.7127 | 0.7129 | 0.7138 | 0.7154 | 0.7183 | 0.7233 | 0.7294 | 0.7724 | |
| 0.7274 | 0.7250 | 0.7247 | 0.7221 | 0.7212 | 0.7233 | 0.7237 | 0.7257 | 0.7310 | 0.7385 | 0.7486 | 0.7592 | 0.7724 |
Table 3: Composite measure along a sweep of : conditional independence score (higher is better) and 90th-percentile sign-error over all and over the Common environments (lower is better). is ; the column is the ordering of , i.e., of ; its sign-errors are over the 10,443 environments in which varies (finite : all 24,909). For reference, with sign-errors 0.7124 and 0.7225.
We also optimize , where each (qubit number, ansatz) pair has its own independent . Each setting had its value grid-searched across [0, 0.2] with increments of 0.005. The 90th-percentile sign-errors for each setting pair for this sweep is shown in Figure 5(b). Using the optimum values, the aggregate sign-error 90th-percentile is 0.6988. This aggregate runs over the environments in which is constant, i.e., those varying embedding, re-uploadings, batch size, learning rate, or dataset (17,199 environments), not over the seven axes of Tables 1 and 2; on the same five axes scores 0.7052 and the single- composite 0.7012, while over all seven axes scores 0.7108 versus 0.7124 for (paired bootstrap difference -0.0017, 95% interval [-0.0036, 0.0001]). The gain is confined to the re-uploading axis (0.680 versus 0.709) and is reversed on the qubit (0.705 versus 0.685) and ansatz (0.771 versus 0.768) axes, on which the weights are not fit.
Held-out evaluation of the fitted weights. The twelve weights are fit by minimizing the 90th-percentile sign-error on the same environments on which it is then reported, so the 0.6988 figure may be optimistic. A seed-level split (fit on seeds , evaluate on ) is not possible here, because the sign-error requires an effective sample size , which needs the full cross-product of random seeds within each environment; a two- or three-seed subset leaves no scored environments. We therefore split the environments in half (preserving all five seeds), fit on one half, and evaluate the aggregate 90th-percentile sign-error on the other, in both directions. The held-out values are 0.695 and 0.705 (versus 0.6988 in-sample); on the same halves scores 0.700 and 0.709 and the single-c composite 0.697 and 0.705, so the fitted weights keep an advantage of about 0.004–0.005 over on these five axes but essentially tie the single-c composite. The single global shows no comparable held-out advantage over (held-out composite 0.709 versus 0.710, and a tie to four decimals (0.7148 for both) in the reverse split).
(a) c Optimization
(b) Optimization

Figure 5: 90th-percentile of the empirical sign-error distribution for composite complexity measures . (a) One c is used for all experiments. (b) Each (ansatz A, number of qubits ) pair has its own . BE: basic entangler; S2D: simplified two-design; SEL: strongly entangling layers. ((a) and (b) have different scales)
E Margin Statistic Ablation
Table 4 recomputes the two criteria for all measures using the 10th-percentile and lower-quartile (25th) training margin in place of . The p-th percentile is exactly zero—and the inverse margin infinite—whenever more than 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. The ranking is percentile-independent at both ends: the inverse margin has the highest conditional independence score at every statistic, no measure containing beats it, and the parameter counts sit at the floor. On the sign-error, (0.7071) and the composite (0.7079) fall just below (0.7082) at the 10th percentile, a spread of 0.0011. Lower quantiles give stronger scores for every margin-based measure—moving from the median to the lower quartile roughly doubles ( ) and lowers its 90th-percentile sign-error (0.7124 0.7017)—but the 10th-percentile columns rest on a degenerate footing (nearly half the runs at , a third of the sign-error environments lost), so the median is used in the main text.
| measure | p50 | p25 | p10 | p50 | p25 | p10 |
| composite () |
Table 4: Margin-statistic ablation: (higher is better) and over all environments (lower is better) with the margin taken at the 50th, 25th, and 10th percentile. Runs with : 0 (p50), 1,149 (p25), 9,279 (p10). The parameter-only measures , do not use the margin, so their scores are constant across statistics.
F Empirical Margin Loss
Table 5 evaluates the empirical margin loss as a complexity measure at three fixed margin levels, with for reference. Because negative sample margins are recorded as zero, the count is unchanged by that convention for every , so is the exact empirical margin loss and is finite for every run. It exceeds the inverse median margin on both criteria at all three levels (paired bootstrap of the 90th-percentile difference at : , interval ; Appendix G); brackets are bootstrap intervals over resampled environments (an independent bootstrap draw from that of Table 6, so the interval differs in the last digit).
| measure | 90% All [95% CI] | 90% Common | |
|---|---|---|---|
| [0.7059 [0.7011, 0.7100] | |||
| [0.7056 [0.7011, 0.7090] | |||
| [0.7082 [0.7042, 0.7122] | |||
| [0.7124 [0.7080, 0.7166] |
Table 5: Empirical margin loss as a predictor. Higher and lower are better.
G Bootstrap Confidence Intervals
Table 6 reports bootstrap intervals for the 90th-percentile sign-error, obtained by resampling the sign-error environments with replacement (2,000 resamples). The intervals separate the pure-margin measures , and the composite; upper limit ) from the parameter-count measures ; lower limit , with and falling in between, while the differences among the pure-margin measures—including the 0.0007 edge of the composite over —lie within the intervals. Because the measures are scored on the same environments, the sharper test is a paired bootstrap of the difference in 90th-percentile sign-error on the shared environments (24,909; 24,897 for ; 2,000 resamples): composite minus is with interval , and minus is on the Common environments). Resampling the (varied hyperparameter, base configuration) clusters instead of individual environments leaves these intervals essentially unchanged (composite , ). Confidence intervals for the conditional independence score , obtained by resampling the five random seeds with replacement, likewise separate the margin-based from the parameter-count measures (Table 7).
| measure | 90% All [95% CI] | 90% Common [95% CI] |
|---|---|---|
| 0.7124 [0.7082, 0.7169] | 0.7225 [0.7178, 0.7295] | |
| 0.7144 [0.7099, 0.7183] | 0.7274 [0.7216, 0.7342] | |
| 0.7256 [0.7209, 0.7300] | 0.7531 [0.7468, 0.7594] | |
| 0.7724 [0.7637, 0.7809] | 0.7724 [0.7637, 0.7809] | |
| 0.7724 [0.7638, 0.7810] | 0.7724 [0.7634, 0.7810] | |
| composite () | 0.7117 [0.7075, 0.7159] | 0.7212 [0.7156, 0.7275] |
| 0.7321 [0.7275, 0.7367] | 0.7699 [0.7609, 0.7778] |
Table 6: Bootstrap 95% confidence intervals for the 90th-percentile sign-error, resampling environments.
| measure | [95% CI over seeds] |
|---|---|
| [3.73, 5.18] | |
| [2.87, 4.33] | |
| [2.00, 7.96] | |
| [1.56, 5.36] | |
| [1.93, 5.25] | |
| composite () | [2.69, 4.24] |
| [1.17, 1.54] |
Table 7: Conditional independence score with 95% bootstrap confidence intervals, resampling the five random seeds with replacement (40 resamples). 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 above . For and no resample falls below the full-grid value of the bootstrap run, which therefore sits at the lower limit.
H Sign-Error Empirical Cumulative Distributions

Figure 6: Empirical cumulative distributions of sign-error for the different complexity measures considered in this study. The mean, 90th-percentile, and maximum values are indicated with horizontal lines.