{'fraction_non_alphanumeric': 0.03948992184286302, 'fraction_numerical': 0.009278303395950455, 'mean_word_length': 4.298341203535537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Reformulation of the No-Free-Lunch Theorem for Entangled Data Sets

The no-free-lunch (NFL) theorem is a celebrated result in learning theory that limits one's ability to learn a function with a training data set. With the recent rise of quantum machine learning, it is natural to ask whether there is a quantum analog of the NFL theorem, which would restrict a quantum computer's ability to learn a unitary process (the quantum analog of a function) with quantum training data. However, in the quantum setting, the training data can possess entanglement, a strong correlation with no classical analog. In this work, we show that entangled data sets lead to an apparent violation of the (classical) NFL theorem. This motivates a reformulation that accounts for the degree of entanglement in the training set. As our main result, we prove a quantum NFL theorem whereby the fundamental limit on the learnability of a unitary is reduced by entanglement. We employ Rigetti's quantum computer to test both the classical and quantum NFL theorems. Our work establishes that entanglement is a commodity in quantum machine learning.

Introduction.-There are very few fields of science and technology that have not been impacted by machine learning. Yet progress in machine learning has been anything but steady, with periods of stagnation interleaved with periods of advancement [1]. This reflects the deep and non-trivial nature of learning theory. In order to advance the theory, fundamental results needed to be proven on the trainability, expressibility, and scalability of learning architectures such as neural networks [2].
One such fundamental result is the no-free-lunch (NFL) theorem [3][4][5][6][7]. At the conceptual level, the theorem states that different optimization procedures essentially perform the same when averaged over many problem instances and training data sets. At the mathematical level, the theorem has many alternative formulations, such as a statement that the average performance over all problem instances and training sets depends only on the size of the training data set and not on the optimization procedure. A consequence of this is that data must be considered the commodity or currency in machine learning that ultimately limits performance. Hence, this is why big data sets are viewed in such high regard.
A quantum version of the NFL theorem could play an important role in understanding the scalability of QNNs. Recently,Poland et al. [42] made progress along these lines. They proved a lower bound on the average risk that depends only on the number of quantum states t used for training. Here, the risk is the probability of incorrectly learning a unitary process, which is the natural quantum analog of the classical risk. Their bound tends to zero only as t approaches the Hilbert-space dimension, which is exponentially large. This suggests that an exponentially large training data set is needed to learn a unitary. One can view this result as a roadblock in the path towards scaling QNNs, due to the apparent exponential (i.e., inefficient) scaling.
In this Letter, we consider a more general scenario, depicted in Fig. 1. Here, the goal is to learn a unitary with training data consisting of quantum states; however, these quantum states can now be entangled to a reference system. Such entangled states can be easily prepared on a quantum computer, and hence this scenario has practical relevance. A special case of this scenario is when the training data states have no entanglement with the reference system, corresponding to the scenario in Ref. [42].
Our main result is a quantum NFL theorem that generalizes the result in Ref. [42] by allowing for an arbitrary amount of entanglement in the training data. An amazing feature of our theorem is that our lower bound on the average risk is reduced as the Schmidt rank r of the entanglement grows. Furthermore the bound goes to zero when r = d, where d is the Hilbert space dimension, regardless of the number of training data points t. Given that our bound is tight (i.e., it can be saturated), this implies that one does not need an exponentially large training data set in order to learn a unitary. Hence, our Letter establishes that both big data and big entanglement are valuable in quantum machine learning, and that the currency of entanglement can lead to scalability.
Our Letter adds to the remarkable literature on en-arXiv:2007.04900v2 [quant-ph] 28 Feb 2022 tanglement as a resource. In communication theory, preshared entanglement allows one to transmit two bits of information by sending a single qubit [43]. In fundamental physics, an observer that is entangled to a system can guess the outcome of complementary measurements on that system, and this led researchers to generalize Heisenberg's uncertainty principle to allow for uncertainty reduction due to entanglement [44][45][46]. Our Letter is analogous to these examples, albeit in a different context. We note that in Ref. [47], an important problem about learning an unknown unitary transformation from a finite number of examples was studied. In particular, Ref. [47] proved that whenever the unknown unitary is randomly drawn from a group the incoherent strategies achieve the ultimate performances for quantum learning. However, our results are different from Ref. [47] in the sense that we quantify the generalization error after training perfectly on the training set.
In what follows, we first discuss the classical NFL theorem. We then present our quantum NFL theorem, with the proof given in the Supplemental Material [48]. Finally, we perform numerical tests of both NFL theorems. This includes an implementation on Rigetti's quantum computer, which allows us to effectively violate the classical NFL theorem and also verify our quantum NFL theorem. We note that the Supplementary Material provides detailed proofs of all statements that follow.
Results.-In classical supervised machine learning, NNFL arises in the setting depicted in Fig. 1(a). Here the goal is to learn an unknown function f , where f maps a discrete input set X (of size d X ) to a discrete output set Y (of size d Y ). In this setting one generates from f a training set S in the form of t ordered input-output pairs as S = {(x j , y j ) : x j ∈ X , y j := f (x j ) ∈ Y} t j=1 . This data is employed to train a hypothesis function h S such that it matches perfectly the action of f on the training data. The hope is that h S also makes accurate predictions on unknown, unseen data. However, as we will see, the NFL theorem provides a constraint on this.
To quantify how well the hypothesis function performs in predicting f one defines the risk function R f (h S ) as Specifically, R f (h S ) is the probability that h S (x) and f (x) differ across X when x is sampled from the probability distribution π(x). While there are various mathematical versions of the NFL theorem [3-6], we follow the treatment in Ref. [6], which lower bounds the risk when averaged over training sets S and functions f : This is an information-theoretic bound (and hence is independent of the optimization method employed in training), implying that the average risk is limited by the Here we show input data in the form of bitstrings fed into a Neural Network (NN) to solve a binary classification problem. The NFL theorem indicates that it is the size of training data rather than the choice of optimization method that limits the average risk. Namely, small (large) t leads to big (small) generalization errors on average. (b) In quantum supervised learning, the goal is to learn a ddimensional unitary process with t quantum states serving as training data. For generality, we allow these states to possibly be entangled with a reference system, with the Schmidt rank r quantifying the degree of entanglement. Here we show these states training a Quantum Neural Network (QNN) to classify quantum data (Schrodinger's cat being dead or alive). Our Quantum NFL theorem indicates that r * t is the quantity that limits the average risk, and hence big entanglement (large r) leads to small generalization errors even when t is small.
size of the training set t, with the bound going to zero if t = d X . (Henceforth we drop the subscript when As the NFL theorem is an information-theoretic result, the bound depends on the prior knowledge that one has about the set of maps from which f is chosen. Given that we will ultimately be interested in unitary maps in the quantum setting, one can consider classical analogs of unitaries in the classical setting for a meaningful comparison. Hence, we reformulate the classical NFL theorem for both stochastic and bistochastic matrices, which are somewhat analogous to unitaries. In the Supplemental Material we show that the classical NFL theorem for stochastic and bistochastic matrices can be expressed as where F (d, t) is the expectation over f of the squared distance between f (x) the h S (x). In the stochastic case, we analytically find In the bistochastic case, we simplify the expression of F (d, t) such that it can be numerically computed. The case of f being a permutation matrix was considered in Ref. [42] and has a similar form as (3). All of these classical NFL results are conceptually similar, and dramatically different from the quantum case as we will see now.
Quantum NFL theorem.-Consider a quantum supervised learning task where the goal is to learn an unknown unitary U that maps a d-dimensional input Hilbert space H X to a d-dimensional output Hilbert space H Y . Moreover, we consider a reference system R, with H R denoting the associated Hilbert space, and we allow access to R during the training process. We suppose that all training data states have the same Schmidt rank r ∈ {1, 2, ..., d} across the cut H X ⊗ H R . The training set is given by t pairs of input-output states Here, the output states are given by |φ j = (U ⊗ 1 1 R )|ψ j , where 1 1 R is the identity over H R . During the training process, we allow for repeatable access to the states in S Q . Perfect training corresponds to the condition where the hypothesis unitary V S Q satisfies | φ j |φ j | = 1 for all j ∈ {1, ..., t}, where |φ j = (V S Q ⊗ 1 1 R )|ψ j .
Similar to the classical case, we quantify the accuracy of the hypothesis V S Q via the quantum risk function: defined as the average trace distance squared between the true output |y = U |x and the hypothesis output |ỹ = V S Q |x , where |x ∈ H X and |y , |ỹ ∈ H Y . Here, D T (ρ, σ) = 1 2 ||ρ − σ|| 1 , and the integral is over the uniform Haar measure dx on state space. Note that the risk is quantified on the smaller space H Y while the training is performed on the larger space H Y ⊗ H R .
Averaging the risk R U (V S Q ) over all unitaries U and training sets S Q leads to our main result: which is a NFL theorem for entanglement-assisted quantum supervised learning. The proof is presented in the Supplemental Material, where we also show that the bound in (5) can be stated more generally in that it holds for all choices of S Q , and hence the average over S Q is trivial and can be removed from (5). We show below in our numerical implementions that this bound is tight, and the inequality in (5) is saturated if the input states in S Q are linearly independent (see Supplementary Material for more details). Our proof for (5) relies on the assumption that the hypothesis unitary V S Q matches the target unitary U perfectly on the training set. This condition reduces the unitary U † V S Q to a simple block diagonal form. We then employ the Weingarten calculus to calculate the average over all target uniaries, which reduces to (5). We note that one does not need to perform tomography of states for evaluating the cost function. Rather, the overlap between the true output state and the output of the hypothesis unitary can be efficiently estimated, e.g., using the SWAP test.
Implications of results.-Let us discuss the implications of (5). First, consider the case of zero entanglement, r = 1. In this case we recover the main result of Ref. [42], which states that the average risk is non-zero when t < d and can only go to zero when t = d. Typically, d = 2 n will be exponentially large in the quantum setting, with n being the number of qubits, and hence this implies that an exponential amount of training data is needed to fully learn an unknown unitary.
At the other extreme, when there is maximal entanglement (r = d), one can see from (5) that only one training pair is sufficient for the lower bound on the average risk to reach zero. In the language of quantum information theory [49], this single training data point corresponds to the "Choi state" of the target unitary U . More generally, (5) indicates that the key quantity is r * t. When r * t is small (large), the bound on the average risk is high (low). Hence, even moderate amounts of entanglement can improve the performance of quantum machine learning, by reducing the training data requirements.
The standard goal of quantum algorithms is quantum speedup, which typically corresponds to complexity scaling polynomially in n, since classical algorithms often exhibit exponential scaling. Variational quantum algorithms, which train QNNs, are no exception, and any exponential scaling in such algorithms destroys quantum speedup. Consequently, the quantum NFL theorem of Ref. [42], which corresponds to r = 1 in our theorem, appeared to be a roadblock to quantum machine learning, since it suggested that an exponential amount of training data was required. Our Letter, on the other hand, appears to at least give some hope for quantum speedup with QNNs, provided that one has access to entangled training data. With that said, quantum speedup is a subtle issue, and we emphasize that (5) is derived under the assumption of perfect training. Hence one must analyze the complexity of training, and barren plateaus in training landscapes must be avoided in order to retain quantum speedup (see Discussion for elaboration).
In our implementations below, we compare the quantum and classical NFL theorems. We will argue that we observe an apparent violation of the classical NFL theorems. While these classical NFL theorems are of course Here we plot the average risk after learning 10 single-qubit unitaries on the Rigetti Aspen-4 quantum computer using 10 training sets consisting of t = 1, 2 unentangled r = 1 (blue squares) and entangled r = 2 (red circles) training states. The solid lines indicate the corresponding bounds imposed by our quantum NFL theorem, (5). Note, that while the optimizations were performed on the quantum computer, the final risk RU (VS Q ) and optimal cost CU (VS Q ) (plotted in the inset and defined in the Supplemental Material) were calculated classically to allow an accurate (i.e., noiseless) evaluation of the success of the optimizations. In black we plot the classical deterministic (dotted) and stochastic (dashed) NFL theorems.
valid under the setting of their formulation, this setting nevertheless does not allow for entangled data. Hence the apparent violation is due to the fact that the physical laws of nature allow for a more general setting than the assumed setting of these theorems. We also remark that one could allow for a reference system R in the classical setting (like we do in the quantum setting). However, access to such a system would not change the bounds in the classical NFL theorems. This is because, in the classical setting, no correlation between R and X would be possible under the standard assumption that the joint state is a pure state. (Training with mixed states is not allowed since that would correspond to training with multiple pure states and, arguably, would be cheating.) Hence, allowing for R in the classical setting is trivial.
Implementations.-The availability of cloud-based quantum computers offers the possibility of testing the validity of NFL theorems with truly entangled data sets.
In what follows, we present numerical results for quantum supervised learning, with the task of learning randomly generated unitaries, using entangled training states of increasing Schmidt rank. The details of our implementations are presented in the Supplemental Material.
We first employ Rigetti's Aspen-4 quantum device [9] to learn 2 × 2 unitaries. This involves a hybrid quantumclassical optimization loop where the quantum computer evaluates a cost function that quantifies the quality of the training on S Q , and then the parameters of the hypothesis unitary are adjusted classically to reduce the cost. Figure 2 shows the average risk versus t, after running this optimization loop, for training sets consisting Large-Scale Test of NFL Theorems. We plot the average risk versus t after learning 10 six-qubit unitaries on a simulator for 100 training sets. Each training set consisted of t = 1, ..., 64 training pairs of rank r = 2 0 , ..., 2 6 . The markers indicate the optimization results, whereas the solid lines indicate the bounds imposed by our quantum NFL theorem, (5). The simulation error bars are O(10 −3 ) and therefore smaller than the size of the markers. In black, we plot the classical NFL bounds for deterministic (solid), stochastic (dashed), permutation (dot-dashed), and bistochastic maps.
of t = 1, 2 unentangled (r = 1) and entangled (r = 2) states. To compare the performance to the fundamental limits imposed by the NFL theorems, we also plot the classical bounds for deterministic (2) and stochastic (3) maps as well as our quantum bound in (5). Good agreement is observed for our quantum bound with the small discrepancies attributable to imperfect learning (due to the presence of quantum noise it was not possible to completely minimize the cost function as shown in the inset) and finite-size averaging when computing the average risk. The average risk using a single entangled training pair (t = 1, r = 2) is substantially lower than both the average risk using a single unentangled training pair (t = 1, r = 1) and that allowed by the deterministic and stochastic classical NFL theorems, suggesting an apparent violation of these classical bounds.
While noise and other constraints limit the size of our quantum-hardware implementations, we can nevertheless explore larger systems on a simulator. Figure 3 plots the average risk when learning 64-dimensional unitaries on a simulator for t = 1, ..., 64 training states of Schmidt rank r = 2 0 , ..., 2 6 . Near-perfect agreement between the simulation data and the bound in (5) is observed in all cases. Furthermore, for r > 1 it is possible to reduce the average risk below that allowed by four different classical NFL bounds (which have very similar behavior). We remark that 2-dimensional permutation and bistochastic matrices can be learned with a single training pair and hence it was not possible to violate the permutation and bistochastic classical bounds for the previous 2-dimensional implementation; whereas our 64-dimensional implementation easily violates these bounds.
Discussion.-Quantum machine learning is a relatively new field that has already seen one major shift, from algorithms for the fault-tolerant era to variational methods for training Quantum Neural Networks (QNNs) in the near-term era. While several intriguing QNN architectures and training strategies have been proposed, rigorous results are urgently needed, in particular, to understand whether QNNs will offer a quantum speedup. In this Letter, we have contributed a rigorous theorem with implications for QNN scalability. While it previously appeared that an exponentially large training set would be required to train a QNN, our quantum No-Free-Lunch (NFL) theorem shows that entanglement in the training data can compensate for and remove this exponential overhead. This suggests that entanglement should be considered as a valuable resource in reducing the generalization error in quantum machine learning. While our Letter provides a glimmer of hope that quantum machine learning could yield a quantum speedup (i.e., polynomial scaling), there are still several issues and open questions that we now discuss.
One potential issue is the complexity of obtaining the entangled training data in the first place. This complexity will depend on the mode of access to the data. We note that for the setting where a user has physical access to the target unitary, then it is advantageous to input a state entangled with a reference system to the unitary so that the user can generate input-output training data with entanglement [40]. This procedure can overall decrease the average risk more efficiently in comparison to the input with no entanglement.
Another potential issue is the complexity of training. While our quantum NFL theorem assumes perfect training, it is possible that exponential scaling could be hid-den in the training difficulty, especially in light of recent results on barren plateaus (exponentially vanishing gradients) in QNN cost function landscapes [21][22][23]. While several promising strategies have been proposed to avoid barren plateaus in QNNs [24][25][26][27], this remains an active area of research. We speculate that for cases when one needs only a polynomial number of shots for training (i.e., no barren plateau issues), learning a unitary using an entangled training set is more advantageous than training sets with no entanglement. Deriving a no-freelunch (NFL) theorem that accounts for finite accuracy in training is an interesting open question that we leave for future work.
This highlights an important direction for future work. Naturally, it would be useful to extend the quantum NFL theorem to the case where one does not achieve perfect training on the training set. Such imperfect training could either be the result of shot noise or hardware noise, or could simply be due to local minima in the landscape. In this case, the lower bound in (5) would not be saturated, and hence it would be of interest to tighten the bound to account for imperfect training.

Supplemental Material for Reformulation of the No-Free-Lunch Theorem for Entangled Data Sets
We here present additional information and detailed proofs for the main results in the manuscript Reformulation of the No-Free-Lunch Theorem for Entangled Data Sets. First, in Section A we provide a proof for the quantum No-Free-Lunch (NFL) theorem with entangled data sets. Then, in Section C we derive the classical NFL theorem bounds for the case when one is learning a deterministic process, and when one is learning probabilistic processes (stochastic, and bistochastic). Finally, in Section D we discuss what are the quantum resources needed to violate classical NFL theorems.

A. Quantum No-Free-Lunch Theorem
Let us first recall the notation required to derive the entanglement-assisted quantum NFL. Let U denote the target unitary. Let H X R := H X ⊗ H R and H YR := H Y ⊗ H R denote input and output Hilbert spaces, respectively, such that dim(H X ) = dim(H Y ) = d. Let S Q denote the training set of size |S Q | = t, such that where Moreover, we consider that all training data states have the same Schmidt rank r ∈ {1, 2, ..., d} across the cut H X ⊗H R . Having perfectly trained a hypothesis unitary V S Q on the training data states, we will have that Then to quantify the accuracy of the hypothesis V S Q , we define the risk function R U (V S Q ) as where |x ∈ H X , and where the integral is over the uniform (Haar) measure dx on state space, such that dx = 1. Thus the risk function is proportional to average fidelity, which can also be expressed in terms of the Hilbert-Schmidt distance between U and V S Q as follows [50]: Let W := U † V S Q . Then from the Schmidt decomposition of a pure state, each |ψ j can be represented as which implies that where r k=1 c j,k = 1. Then from (A3), it follows that where we defined β j,k = ξ j,k |W |ξ j,k .
We then have to consider three cases: (1) the states in S Q are orthogonal, (2) the states in S Q are non-orthogonal but linearly independent, and (3) the states in S Q are linear dependent. As we now show, all three cases lead to the same NFL bound. If the input states in the set S Q are orthonormal then β j,k do not have to be the same for different values of j. Later we argue that if the set S Q is non-orthonormal (but still linear independent), then θ j = θ l , ∀j, l ∈ {1, . . . , t}. We now evaluate an average of the risk function R U (V S Q ) in (A6) over both S Q and U when S Q is an orthonormal set. Note that the W is a unitary matrix that can be represented in the following form: which follows from (A13), (A14), and from the fact that j |W ij | 2 = i |W ij | 2 = 1. Here, Y is a unitary matrix acting on a (d − rt) dimensional Hilbert space, which is orthogonal to the space spanned by input states in S Q , and there are r copies of each of the e iθj terms on the diagonal. The order of the averages over the target unitaries U and training sets S Q can be freely chosen given Fubini's theorem and so for convenience we first perform the averaging over U . Then the Haar average of term |Tr[U † V S Q ]| 2 in (A6) over U is given by The first equality follows from the assumption that Y is sufficiently random. We invoke the triangle inequality for the absolute value in (A17). The first integral in (A17) can be calculated as follows: where we used the fact that Haar integral over any unitary V ∈ U (d), with U (d) being the unitary group of degree d, satisfies the following property [51,52] : where v ij are the matrix elements of V . Moreover, the second integral in (A17) is which follows from the fact that the Haar measure is left-and right-invariant under the action of the unitary group of degree d (in particular, under −I).
Since (A18) is independent of the set S Q , the average of the risk function R U (V S Q ) over both S Q and U reduces to We now briefly argue that θ j = θ l , ∀j, l ∈ {1, . . . , t} in (A14) if the input states in S Q are not orthonormal (but still linearly independent). Let |ψ 1 , |ψ 2 ∈ S Q be two non-orthogonal vectors. Then, without loss of generality |ψ 2 can always be represented as follows: where i |c i | 2 = 1 and |c 1 | 2 = 0. Then, from (A9), we find that Since |e iθ2 | = 1, i |c i | 2 = 1 and |c 1 | 2 = 0, the aforementioned equation is satisfied if and only if which implies that θ 1 = θ 2 . This procedure can then be recursively applied to the rest of the states in the training set, which leads to θ j = θ k , ∀j, k ∈ {1, . . . , t}. Therefore, and hence, assuming the input states in S Q are linearly independent but non-orthogonal, the bound in (A22) is saturated.
Finally, we note that if S Q contains input states that are linearly dependent, then t in (A22) gets replaced by t, where t denotes the effective number of linearly-independent states in the set S Q .
Bringing all three of these cases together, we obtain our quantum NFL theorem in (A22). Moreover, since the bound in (A22) holds for all choices of S Q , the average over S Q is trivial and can be removed from (A22).

Fluctuations in the quantum risk
In this section we derive an expression for the variance in the risk function R U (V S Q ) as in (A6) over all unitaries and training sets, i.e.
For simplicity, and to align with our numerical implementations, we consider the case when the training set is composed of states which are linearly independent but non-orthonormal. In this case, as discussed in Section A, it is possible to perfectly learn the target unitary U on the subspace spanned by the training set, up to a global phase e iθ . Therefore, Note that for r * t = d we know that W = e iθ 1 1, which implies that σ 2 R = 0. However, for r * t < d, the risk R U (V S Q ), following (A27), evaluates to Then, from Section A, the average of R U (V S Q ) over all unitaries and training sets is given by Substituting (A29) and (A30) into (A28), we find that where we have simplified the expression using (A19) and (A21). Let V ∈ U (d). Then by invoking the following formula for symbolic integration with respect to the Haar measure on a unitary group [51,52] the first integral in (A31) reduces to The second integral in (A31) can be evaluated as follows: where we used (A19) to show that and from the left-and right-invariance of the Haar measure under the unitary −i1 1, it follows that Similarly, the third integral in (A31) vanishes due to the left-and right-invariance of the Haar measure under the unitary −1 1. Thus the standard deviation in the risk is given by As shown in Fig. 4, this expression matches well with the data obtained from the 6 qubit implementation on a numerical simulator. Moreover, in the limit of large dimensions the standard deviation in the risk scales as ≈ (r * t)/d 2 for 1 r * t < d, which implies that for high values of d the fluctuations in the risk are exponentially suppressed.

B. Details on Implementations
Here we elaborate on the methods used in our numerical implementations. For both implementations we first generated a Haar random unitary U and a random training set S Q consisting of t pairs of training states of rank r. To learn U we found the optimal hypothesis unitary V S Q by minimizing the cost function Here we show the circuits used to evaluate the cost function in (B1). Panels (a) and (b) correspond to the cases when the system X is unentangled or entangled, respectively, with the reference R. Here Aj denotes a circuit that efficiently prepares the state |ψj from the all-zero state |0 , i.e. |ψj = Aj|0 . The upper and lower wires respectively denote the system and reference qubits in X and in R. We remark that the probability of measuring the all-zero state is equal to the state overlap | φj|(V ⊗ I)|ψj | 2 . For the implementation on Rigetti's quantum computer the cost was evaluated from 1000 shots.
This cost function quantifies the overlap between an input training state evolved under the hypothesis unitary, (V ⊗ I)|ψ j , and the output training state, |φ j , averaged over the t training pairs. The circuits used to measure the state overlap are shown in Fig. 5, with the unentangled and entangled cases shown in panels (a) and (b) respectively.
Having obtained the optimal hypothesis V S Q , we calculated the risk R U (V S Q ) defined in (A6). The average was calculated over 10 random unitaries and 10 random training sets for the 2-dimensional implementation on the Rigetti quantum computer, and over 10 random unitaries and 100 random training sets in the case of the 64-dimensional implementation on the simulator. C. Classical No-Free-Lunch Theorems

Classical No-Free-Lunch Theorem For Deterministic Functions
In this section we provide a simple proof for the classical NFL theorem, where we follow the treatment [6]. Later we provide an alternate proof. We begin by recalling the notation used throughout the proof. Let X and Y denote discrete input and output sets of sizes d X and d Y , respectively. Let f : X → Y be an unknown function from X to Y, and let S denote a training set in the form of ordered input-output pairs The goal is to train a hypothesis function h S from the training set S to guess the function f . That is, we employ a learning algorithm to model the data so that Moreover, to quantify the performance of a hypothesis h S , we define the risk function as where x is sampled from X with respect to a distribution π(x). Assuming that π(x) is the uniform distribution, and The first inequality follows from the assumption that h S (x) = f (x) when x ∈ S. However, if x ∈ S, then h(x) is completely random. In other words, h(x) can take, with equal probability, any value in Y. Therefore, if one were to simply guess at random, then the error probability is (1 − 1/d). Moreover, the coefficient (d − t) in the second equality arises from the fact that there are (d − t) data points that are not in S. Note that the above derivation of the classical NFL theorem defines the risk as the probability that the hypothesis function outputs an incorrect bitstring. However to derive a quantum NFL we define the risk in terms of the trace distance squared between the outputs of the hypothesis and the and target functions. The latter will be helpful to put the classical and quantum bounds on an equal footing. As we now show, the classically NFL theorem can also be derived by defining the risk in terms of a squared 1-norm distance.
Specifically, consider the risk function defined as the average trace distance squared between the output of the hypothesis h S and target f functions on a random input x, sampled with respect to π(x). That is, let Here, 1 2 a − b 1 denotes the 1-norm distance between two vectors a and b. Then, let us assume again that π(x) is the uniform distribution. Without loss of generality, we can also assume that both X and Y are sets (of equal size d) consisting of d-dimensional bitstrings with Hamming weight one. Then, consider the following chain of inequalities: The first inequality follows from the fact that if we assume perfect training, then h S (x) guesses correctly f (x) for all x ∈ S. The second equality follows from the fact that the average distance f (x) − h S (x) 2 1 should be same for all x ∈ S. The second inequality holds by definition, as h opt S is the optimal hypothesis which minimizes the trace-distance square in (C10). In this case, the deterministic optimal hypothesis corresponds to randomly guessing (with equal probability) a d-dimensional bit string of Hamming weight one. Since there are d possible guesses, then we will have that (d − 1) times the distance will be 1 2 f (x) − h opt S (x) 1 = 1. While (C4), or equivalently (C9), is valid for general functions f , we recall that the No-Free-Lunch Theorem is an information theoretic result, meaning that the right-hand-side of (C7) can change when specializing f to a specific set of maps. It was shown in [42], that if f is known to be an invertible function the risk is bounded as Let us here remark that, as expected, for finite t and in the d → ∞ limit, the average risks in Eqs. (C13) and (C14) goes to one.

Classical NFL theorems for probabilistic maps
The standard classical no-free-lunch theorem in (C7) corresponds to the task of learning a deterministic matrix, where every element is either one or zero and each column sums to one. Such matrices, as the name suggests, represent deterministic processes where a bit string of Hamming weight one is mapped to another bit string of Hamming weight one. Similarly, the NFL for invertible deterministic processes, (C14), corresponds to the task of learning a permutation matrix, a deterministic matrix in which not only the columns but also the rows sum to one.
However, since in the quantum case one wishes to learn a unitary matrices (which can quantify probabilistic processes) in this section we derive NFL theorems for more general classes of matrices, which will allow for a fairer comparison between the quantum and classical NFL theorems. Namely, we consider here stochastic and doublystochastic matrices, which can be used to model classical probabilistic processes. Stochastic matrices are matrices in which each element is real and positive and every column sums to one. Doubly-stochastic matrices are the subset of stochastic matrices, such that every row (as well as every column) sums to one.
As indicated in Fig. 6(a), stochastic, deterministic, bistochastic, and permutation matrices form a partial order where permutation matrices are more constrained than bistochastic and deterministic matrices, which in turn are more constrained than stochastic matrices. From an information theoretic perspective, the more prior knowledge we have about the matrix (or maps) to be learnt, the less resources we should need to learn it. We therefore expect more resources to be required to learn stochastic matrices than permutation matrices, with the resources required to learn bistochastic and deterministic matrices sitting between the two extremes.

a. Classical NFL theorem for stochastic matrices
In this section, we derive a No-Free-Lunch theorem for learning stochastic matrices. A stochastic matrix is a square matrix, such that each entry is non-negative and the sum of the entries of each column is equal to one. We formulate the task of learning a stochastic matrix in terms of learning its columns. Hence, let us assume that M S is a d × d Permutation matrices along with an example of each sort. Stochastic matrices are matrices for which each element is real and positive and every column sums to one. Deterministic matrices are stochastic matrices where every element is either 1 or 0 and bistochastic matrices are stochastic matrices where every row sums to one. Permutation matrices are matrices which are both deterministic and bistochastic. Hence, stochastic, deterministic, bistochastic and permutation matrices form a partial order with permutation matrices more constrained that bistochastic and deterministic matrices which in turn are more constrained than stochastic matrices. We therefore expect more resources to be required to learn stochastic matrices than permutation matrices, with the resources required to learn bistochastic and deterministic matrices sitting between the two. This is indeed confirmed in (b) where we plot the rank r of training states required to violate the stochastic, deterministic, bistochastic and permutation NFL theorems as a function of the number of training pairs t when learning a 8 × 8 dimensional matrix. The number of pairs t required to violate the permutation bound is greater than the rank required to violate the stochastic bound, with the rank required to violate the deterministic and bistochastic bounds sitting between the two. stochastic matrix. Let X and Y denote sets of d-dimensional bitstrings of Hamming weight one, and let |X | = |Y| = d. Let f : X → C(Y) be a map corresponding to the unknown stochastic matrix M S , taking bitstrings from X to a convex combination of bitstrings in Y. Here we can define the training set S as Moreover, similar to previous sections, the goal is to train a hypothesis map h S from the training set S to estimate the target map f , such that To assess the performance of the learning task, we define the risk function as follows: where 1 2 a − b 1 denotes the 1-norm distance between two vectors a and b. Moreover, we recall that we define the risk such that in the limit d → ∞, the average risk should be one.
The first equality holds from the definition of the 1-norm distance and from (C25). The second equality follows from the representation of the Haar integral over pure states in terms of real parameters [53], where Γ(d) = (d − 1)!. The first integral in the third equality is symmetric in r l , and therefore, there are d terms which have the same value, and which result in the first integral in (C29). Similarly, the second integral in the third equality is symmetric with respect to any values of k and l, and therefore, there are d(d − 1) equal terms which leads to the second integral in (C29). The two integrals in (C29) can be derived by using properties of Dirac-delta and the Heavyside-theta functions. The first integral in (C29) simplifies as follows: where Θ(x) is the Heavyside-theta function.
Similarly the second integral in (C29) can be simplified as follows: Intuitively we expect that it is impossible to learn an infinite dimensional map with a finite training set. Thus we require taht for finite t and in the limit d → ∞ that the average risk is maximal, E S [E f [R f (h S )]] = 1. This is ensured by renormalizing the above expression for F (d), to obtain the final bound where F (d) is given by (C24). We now provide a brief proof for the optimality of the hypothesis in (C25). Since we have no information about f (x) for x / ∈ S in (C20), we assume that h S (x) is a fixed hypothesis for each target function f in the average. Let h S (x) = (β 1 , . . . , β d ) T , such that β j 0 and d j=1 β j = 1. Then, from arguments similar to (C27), we get that 2 + β l (d + 1)(β l d − 2) d(d + 1) + 1 d(d 2 − 1)(d − 2) k =l 1 + 4(1 − β k − β l ) d+1 + (d + 1)(dβ k β l − (β k + β l )) + 2(1 − β k ) d (−1 + β k + β l + dβ l ) + 2(1 − β l ) d (−1 + β l + β k + dβ k ) , where we used arguments similar to those used in deriving (C31) and (C34). Finally, by setting the derivative of (C39) with respect to β l equal to zero, we find that β l = 1/d for all l ∈ {1, . . . , d}. Moreover, the double derivative of (C39) with respect to β l is positive at β l = 1/d, which proves the optimality of the hypothesis in (C25).

b. Classical NFL theorem for bistochastic matrices
In this section, we derive a NFL theorem for learning bistochastic matrices. A bistochastic matrix is a square matrix such that each entry is non-negative, and each row and column sum to one. Similar to Section C 2 a, we formulate the task of learning a bistochastic matrix in terms of learning its columns. Let us assume that M BS is d × d bistochastic matrix. Let X and Y denote sets of d-dimensional bitstrings, and let |X | = |Y| = d. Let f : X → C(Y) be a map corresponding to the unknown bistochastic matrix M BS , taking bitstrings from X to a convex combination of bitstrings in Y. Then (C15)-(C17) also hold for the unknown bistochasic map f and the hypothesis map h S . Similarly, from the arguments used in deriving (C18)-(C21), we find that We now argue that the optimal hypothesis is given by where v = (1, . . . 1) T . First note that the action of the bistochastic map f is unknown on x / ∈ S. However, as each row in a bistochastic matrix sums to one, some partial information about f (x) can be obtained from each x i ∈ S. Moreover, since each row of a bistochastic matrix sums to one, the hypothesis matrix should be designed such that sum of its each row should also sum to one. Therefore, we get that where in the second equation we used (C16), and in the third equation we used the fact that the hypothesis map should be the same for all x l / ∈ S as for those cases f (x l ) is equally unknown. Here, we remark that (C44) is valid for any x / ∈ S.
To perform the averaging over all bistochastic maps, we first assume that a random bistochastic matrix is generated by sampling a d × d unitary matrix U with respect to the Haar measure, followed by replacing each matrix element u ij of U with |u ij | 2 . This construction leads to a bistochastic matrix as for any unitary matrix U , the following holds: which implies that Similarly, one can show that to violate the classical bound for d dimensional deterministic matrices the t training pairs must be at least of rank Finally, to violate the classical bound for d dimensional stochastic or bistochastic matrices we require where F (d, t) = F (d) is defined in (C24) for stochastic matrices and F (d, t) for bistochastic matrices is determined numerically. In Fig. 6(b), we plot these bounds for the case of learning an 8×8 dimensional permutation, deterministic, bistochastic and stochastic matrices respectively. For any number of training pairs the rank (i.e. amount of entanglement) required to violate the permutation bound is greater than the rank required to violate the stochastic bound, with the rank required to violate the deterministic and bistochastic bounds sitting between these two extremes. This makes sense from an information theoretic perspective. As remarked at the start of this section, permutation matrices are more constrained than bistochastic and deterministic matrices, which in turn are more constrained than stochastic matrices. As such, permutation matrices are easier to learn classically than stochastic matrices making the classical bound more resource intensive to violate.