Exact Learning with Tunable Quantum Neural Networks and a Quantum
  Example Oracle
In this paper, we study the tunable quantum neural network architecture in
the quantum exact learning framework with access to a uniform quantum example
oracle. We present an approach that uses amplitude amplification to correctly
tune the network to the target concept. We applied our approach to the class of
positive $k$-juntas and found that $O(n^22^k)$ quantum examples are sufficient
with experimental results seemingly showing that a tighter upper bound is
possible.
Viet Pham Ngoc, Herbert Wiklicky
# Exact Learning with Tunable Quantum Neural Networks and a Quantum Example Oracle

###### Abstract

In this paper, we study the tunable quantum neural network architecture in the quantum exact learning framework with access to a uniform quantum example oracle. We present an approach that uses amplitude amplification to correctly tune the network to the target concept. We applied our approach to the class of positive \(k\)-juntas and found that \(O(n^{2}2^{k})\) quantum examples are sufficient with experimental results seemingly showing that a tighter upper bound is possible.

## 1 Introduction

Introduced in [1], the model of exact learning is, together with QPAC learning, one of the main framework of learning theory. Initially, the learner is given access to two different oracles: the membership oracle and the equivalence oracle. Suppose that \(c\) is the target concept. Given \(x\), a call to the membership oracle will return \(c(x)\) and given the learner's current hypothesis \(h\), the equivalence oracle will output a randomly chosen \(x\in\mathbb{B}^{n}\) such that \(h(x)\neq c(x)\) should such \(x\) exists The goal is then to produce a hypothesis \(h^{*}\) such that it is always equal to \(c\). Given the impracticality of the equivalence oracle it has become common practice to only work with the membership oracle [2, 3] or forgo these two oracle altogether and use another kind, generally a random example oracle. In this case, the preferred flavor is the uniformly distributed examples [4, 5, 6]. These last two research directions naturally gave rise to quantum generalisations of these oracles.

In this work we will study the performances of the tunable quantum neural network as introduced in [7] in the quantum exact learning framework when the learner has access to the quantum version of the uniform example oracle. To do so we devised a training algorithm that leverages amplitude amplification and fine tuned it by learning generic Boolean functions. We show that in this case it performs better than a naive algorithm that does not use amplitude amplification. Finally we adapted this algorithm to learn the class of \(k\)-juntas and found that it requires less examples than what can be found in the literature.

## 2 Quantum Exact Learning

As said previously, quantum exact learning is the extension of the exact learning framework to quantum oracles. We define the quantum membership oracle [8, 9, 10] and the uniform quantum example oracle [11] and formalise the training target in the quantum exact learning framework.

**Definition 2.1**.: _Let \(n\in\mathbb{N}\) and suppose that the target concept is \(c\in\mathbb{B}^{\mathbb{B}^{n}}\). Then the quantum membership oracle \(\mathbf{MO}(c)\) will have the following action:_

\[\forall x\in\mathbb{B}^{n},\forall b\in\mathbb{B},\ \mathbf{MO}(c)\left|x,b \right\rangle=\left|x,b\oplus c(x)\right\rangle \tag{1}\]

On the other hand, the uniform quantum example oracle is defined as:
**Definition 2.2**.: _Let \(n\in\mathbb{N}\) and \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) be the target concept, then a query to the quantum example oracle \(\mathbf{EX}(c)\) will return the superposition \(\ket{\psi(c)}\) such that:_

\[\ket{\psi(c)}=\frac{1}{\sqrt{2^{n}}}\sum_{x\in\mathbb{B}^{n}}\ket{x,c(x)} \tag{2}\]

By using either one of these oracles, the goal of the learner in the exact learning framework is:

**Definition 2.3**.: _Let \(n\in\mathbb{N}\) and \(\mathcal{C}\subseteq\mathbb{B}^{\mathbb{B}^{n}}\) be a concept class. An algorithm is said to be an exact learner for \(\mathcal{C}\) if for every \(c\in\mathcal{C}\), it outputs a hypothesis \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) such that, with high probability:_

\[\forall x\in\mathbb{B}^{\mathbb{B}^{n}},h(x)=c(x) \tag{3}\]

_This notion of high probability is to be defined. While some authors use a threshold of 2/3 [8], we chose to use 0.95._

In this contribution, we aim at performing exact learning with a learner having access to the uniform quantum example oracle.

## 3 Learning Algorithm

### Preliminary Analysis

Let \(n\in\mathbb{N}\) and \(c\in\mathbb{B}^{\mathbb{B}^{n}}\). As stated previously, we have access to the oracle \(\mathbf{EX}(c)\), a query to which will produce the superposition \(\ket{\psi(c)}\) given in Equation 2.

Now suppose that, in its current state (denoted \(\mathbf{T}(h)\)), the network is expressing \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) then:

\[\mathbf{T}(h)\ket{\psi(c)}=\frac{1}{\sqrt{2^{n}}}\sum_{h(x)=c(x)}\ket{x}\ket{ 0}+\frac{1}{\sqrt{2^{n}}}\sum_{h(x)\neq c(x)}\ket{x}\ket{1} \tag{4}\]

So from Equation 4, it comes that the number of misclassified inputs and the probability of measuring the read-out qubit in state \(\ket{1}\) are directly proportional:

**Proposition 3.1**.: _Let \(E(h)=\{x\in\mathbb{B}^{n}\mid h(x)\neq c(x)\}\) be the set of misclassified inputs and \(P_{1}\), the probability of measuring the read-out qubit in state \(\ket{1}\), then:_

\[P_{1}=\frac{\left|E(h)\right|}{2^{n}} \tag{5}\]

_In particular, we have:_

\[\min_{P_{1}>0}P_{1}=\frac{1}{2^{n}} \tag{6}\]

The idea is thus to use amplitude amplification to boost this probability and hence measure as many misclassified inputs as possible before updating the network. In this setup, the diffusion operator is as follows:

**Definition 3.1**.: _Let \(n\in\mathbb{N}\) and \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) be the target concept. Suppose that the network is expressing the function \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) in its current state, denoted \(\mathbf{T}(h)\), we set:_

\[\mathcal{X}_{\alpha_{0}}(c)=\mathbf{I}-2\ket{\psi(c)}\bra{\psi(c)} \tag{7}\]

\[\mathbf{U}(h)=\mathbf{T}(h) \tag{8}\]

_And_

\[\mathcal{X}_{G}=\mathbf{I}^{\otimes n}\otimes\mathbf{Z} \tag{9}\]

_This allows us to define the diffusion operator:_

\[\mathbf{Q}(c,h)=-\mathbf{U}(h)\mathcal{X}_{\alpha_{0}}(c)\mathbf{U}^{\dagger} (h)\mathcal{X}_{G} \tag{10}\]

Because the minimum non-zero probability of measuring a misclassified input is known, we can also determine the maximum number of iterations of the diffusion operator needed to appropriately amplify the amplitudes of the inputs of interest:
**Definition 3.2**.: _Let \(n\in\mathbb{N}\), we define:_

\[\theta_{\min}=\arcsin\left(\frac{1}{\sqrt{2^{n}}}\right) \tag{11}\]

_And:_

\[m_{\max}=\arg\min_{k\in\mathbb{N}}\left|(2k+1)\theta_{\min}-\frac{\pi}{2}\right| \tag{12}\]

We now show the following property:

**Proposition 3.2**.: _Let \(P_{1}\) be a non-zero probability of measuring the read-out qubit in state \(\left|1\right>\) in this setup. Let us denote \(P_{1}^{(m)}\) this same probability but after \(m\) rounds of amplitude amplification. Then there exists \(m_{1/2}\leq m_{\max}\) such that:_

**Proof**:

\[P_{1}^{(m_{1/2})}\geq\frac{1}{2} \tag{13}\]

Let \(\theta=\arcsin\bigl{(}\sqrt{P_{1}}\bigr{)}\), then because \(P_{1}\) is non-zero, we have:

\[\frac{1}{2^{n}}\leq P_{1}\leq 1 \tag{14}\]

Thus:

\[\theta_{\min}\leq\theta\leq\frac{\pi}{2} \tag{15}\]

If \(\frac{\pi}{4}\leq\theta\leq\frac{\pi}{2}\), then we can take \(m_{1/2}=0\). Otherwise, there exist \(m>0\) such that:

\[\frac{\pi}{4(2m+1)}\leq\theta<\frac{\pi}{4(2m-1)} \tag{16}\]

So:

\[\frac{\pi}{4}\leq(2m+1)\theta<\frac{\pi}{4}+\frac{\pi}{2(2m-1)}\leq\frac{3\pi} {4} \tag{17}\]

Hence after \(m\) rounds of amplitude amplification, we have:

\[\frac{1}{2}\leq\sin^{2}((2m+1)\theta)=P_{1}^{(m)} \tag{18}\]

Let us denote this \(m\), \(m_{1/2}\), then because \(P_{1}\geq\frac{1}{2^{n}}\), we also have \(m_{1/2}\leq m_{\max}\)

The general idea for the algorithm is the following:

1. E is the set of misclassified inputs, initialised with the empty set
2. For \(m\in[0,m_{\max}]\), perform \(m\) rounds of AA: * Perform \(s\) measurements * If 1 is measured on the read-out qubit, add the measurement of the \(n\) first qubits to \(E\) the set of misclassified inputs
3. Update the TNN according to \(E\) and restart from 1.
4. The algorithm stops if \(E\) remains empty when 3. is reached

In order to ensure that the algorithm correctly terminates 95% of the time, we give a condition on the number of measurements \(s\).

**Definition 3.3**.: _Let \(m\in[0,m_{\max}]\) and \(s\in\mathbb{N}\), we define \(N_{m}\) the number of times the read-out qubit is measured in state \(\left|1\right>\) after \(m\) rounds of amplification and over \(s\) measurements. Then:_

\[N_{m}\sim\text{B}\left(s,P_{1}^{(m)}\right) \tag{19}\]

Using Definition 3.3, we can now estimate the probability for the algorithm to terminate incorrectly:

**Proposition 3.3**.: _The probability that the algorithm stops when there are still misclassified inputs is given by:_

\[P(N_{0}=0,\ldots,N_{m_{\max}}=0\mid P_{1}>0) \tag{20}\]

_If \(s\geq 5\), then_

\[P(N_{0}=0,\ldots,N_{m_{\max}}=0\mid P_{1}>0)\leq 0.05 \tag{21}\]
**Proof**:

We have:

\[P(N_{0}=0,\ldots,N_{m_{\text{max}}}=0\mid P_{1}>0)\leq P(N_{m_{1/2}}=0\mid P_{1}>0) \tag{22}\]

But

\[P(N_{m_{1/2}}=0\mid P_{1}>0)=(1-P_{1}^{(m_{1/2})})^{s}\leq\frac{1}{2^{s}} \tag{23}\]

So by taking \(s\geq 5\), we do have:

\[P(N_{0}=0,\ldots,N_{m_{\text{max}}}=0\mid P_{1}>0)\leq 0.05 \tag{24}\]

Given this condition on \(s\), we will now specify further the learning algorithm through the task of learning a generic Boolean function.

### Learning a Generic Boolean Function

Let \(n\in\mathbb{N}\), in this section, we aim at learning \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) without assuming any property or structure on \(c\), that is we take the concept class \(\mathcal{C}\) to be \(\mathbb{B}^{\mathbb{B}^{n}}\). This task allows us to specify the learning algorithm to train a TNN in the exact learning framework. To do so we compare it to a naive approach. Without assuming anything about the target concept \(c\), the naive way to correctly learn it, is to evaluate \(c(x)\) for all \(x\in\mathbb{B}^{\mathbb{B}^{n}}\). Given that we only have access to a uniform quantum example oracle and not a quantum membership oracle the expected number of queries to measure all the inputs is given by:

**Theorem 3.1**.: _Let \(K\) be a set with \(|K|=N\) and \(\{k_{i}\}\) be uniformly sampled elements from \(K\). Now let \(s\in\mathbb{N}\) such that:_

\[\{k_{i}\}_{1\leq i\leq s}=K \tag{25}\]

_This problem is known as the coupon collector's problem [12] and it can be shown that:_

\[E(s)=N\ln(N) \tag{26}\]

#### 3.2.1 Naive algorithm

Using Theorem 3.1 we propose the naive learning algorithm described in Algorithm 1. With this algorithm, during each update phase, \(\theta(n2^{n})\) queries to the oracle are done. Because after each update, we should have measured all of the misclassified inputs, the result from [7] can be applied and the total number of updates is in \(\Theta(n)\). The total number of queries to the example oracle can thus be evaluated to be in \(\Theta(n^{2}2^{n})\).

```
Data:\(|\psi(c)\rangle\) and \(\mathbf{T}\) the network with all gates initialised to \(\mathbf{I}\) Result: Tuned network \(\mathbf{T}\) expressing \(c\) \(E\leftarrow[0]\); \(s\leftarrow\lfloor 2^{n}\ln(2^{n})\rfloor\); while\(E\neq\varnothing\)do \(E\leftarrow[]\); for\(1\leq i\leq S\)do  Measure \(\mathbf{T}\left|\psi(c)\right\rangle\); if1 is measured on the ancillary qubitthen  Add the first \(n\) qubits to \(E\);  end if  end for for\(u\in E\)do  Update \(\mathbf{G}_{u}\) in \(\mathbf{T}\);  end for  end for
```

**Algorithm 1**Naive algorithm

One property of this algorithm is that it puts an emphasis on the misclassified inputs. However within these \(2^{n}\ln(2^{n})\) measurements, a mix of misclassified and correctly classified inputs will be measured. By using amplitude amplification, the results of the measurements can then be focused on the inputs of interest. The idea is thus to adapt the number of samples to the number of amplification rounds in order to measure just what is necessary.
#### 3.2.2 A first improvement

Let \(N_{err}\in[1,2^{n}]\) be the number of misclassified inputs and \(\theta_{err}\in\left]0,\frac{\pi}{2}\right]\) defined by:

\[\theta_{err}=\arcsin\left(\sqrt{\frac{N_{err}}{2^{n}}}\right)=\arcsin\left( \sqrt{P_{1}}\right) \tag{27}\]

Then there exists \(m_{err}\in\mathbb{N}\) such that:

\[\theta_{err}\in\left]\frac{\pi}{2(2m_{err}+3)},\frac{\pi}{2(2m_{err}+1)}\right] \tag{28}\]

This yields:

\[N_{err}\in\left]\sin^{2}\left(\frac{\pi}{2(2m_{err}+3)}\right)2^{n},\sin^{2} \left(\frac{\pi}{2(2m_{err}+1)}\right)2^{n}\right] \tag{29}\]

And after \(m_{err}\) rounds of amplification, the probability \(P_{1}^{(m_{err})}\) of measuring the readout qubit in state \(\left|1\right\rangle\) is now:

\[P_{1}^{(m_{err})}\in\left]\sin^{2}\left(\frac{\pi}{2}-\frac{\pi}{2m_{err}+3} \right),1\right] \tag{30}\]

For \(m\) sufficiently large enough, if \(N_{err}\in\left]\sin^{2}\left(\frac{\pi}{2(2m_{err}+3)}\right)2^{n},\sin^{2} \left(\frac{\pi}{2(2m_{err}+1)}\right)2^{n}\right]\), then after \(m\) rounds of amplification, the results of the measurements will mostly be misclassified inputs. Applying Theorem 3.1 and taking into account the condition on the number of samples from Property 3.3 we define the following:

**Definition 3.4**.: _Let \(n\in\mathbb{N}\) and \(m_{\max}\) as in Definition 3.2. Then for \(m\in[0\ldots m_{\max}]\), we denote:_

\[N_{m}=\sin^{2}\left(\frac{\pi}{2(2m+3)}\right)2^{n} \tag{31}\]

_And_

\[s_{m}=\max(5,N_{m}\ln(N_{m})) \tag{32}\]

The total number of samples during an update phase is thus: \(\sum_{m=0}^{m_{\max}}s_{m}\) which is to be compared to \(2^{n}\ln(2^{n})\)

**Proposition 3.4**.: _Let \(n\in\mathbb{N}\), \(m_{\max}\) as in Definition 3.2 and \(s_{m}\) defined as in Definition 3.4. Then for \(n\) large enough:_

\[\sum_{k=0}^{m_{\max}}s_{m}<2^{n}\ln(2^{n}) \tag{33}\]

**Proof**:

For the sake of clarity, for \(m\in[0\ldots m_{\max}]\), we define:

\[u_{m}=\sin^{2}\left(\frac{\pi}{2(2m+3)}\right) \tag{34}\]

So that \(N_{m}=u_{m}2^{n}\). Instead of directly showing \(\sum_{m=0}^{m_{\max}}s_{m}<2^{n}\ln(2^{n})\), we will instead show:

\[\sum_{m=0}^{m_{\max}}\left(N_{m}\ln(N_{m})+5\right)<2^{n}\ln(2^{n}) \tag{35}\]

For the first sum:

\[\sum_{m=0}^{m_{\max}}N_{m}\ln(N_{m})=\sum_{m=0}^{m_{\max}}\ln\bigl{(}N_{m}^{N_ {m}}\bigr{)}=\ln\Biggl{(}\prod_{m=0}^{m_{\max}}N_{m}^{N_{m}}\Biggr{)} \tag{36}\]

And

\[\prod_{m=0}^{m_{\max}}N_{m}^{N_{m}} = \prod_{m=0}^{m_{\max}}(u_{m}2^{m})^{N_{m}}=\prod_{m=0}^{m_{\max} }u_{m}^{N_{m}}\prod_{m=0}^{m_{\max}}\left(2^{n}\right)^{N_{m}}=\prod_{m=0}^{m_ {\max}}u_{m}^{N_{m}}\prod_{m=0}^{m_{\max}}\left(2^{n}\right)^{u_{m}2^{n}} \tag{37}\] \[= \prod_{m=0}^{m_{\max}}u_{m}^{N_{m}}\prod_{m=0}^{m_{\max}}\left( \left(2^{n}\right)^{2^{n}}\right)^{u_{m}} \tag{38}\]
Because \(u_{m}\leq 1\), we have \(\prod_{m=0}^{m_{\max}}u_{m}^{N_{m}}\leq 1\), hence:

\[\prod_{m=0}^{m_{\max}}N_{m}^{N_{m}}\leq\prod_{m=0}^{m_{\max}}\left(\left(2^{n} \right)^{2^{n}}\right)^{u_{m}} \tag{39}\]

But:

\[\prod_{m=0}^{m_{\max}}\left(\left(2^{n}\right)^{2^{n}}\right)^{u_{m}}=\left( \left(2^{n}\right)^{2^{n}}\right)^{\sum_{m=0}^{m_{\max}}u_{m}} \tag{40}\]

And:

\[\sum_{m=0}^{m_{\max}}u_{m} =\sum_{m=0}^{m_{\max}}\sin^{2}\left(\frac{\pi}{2(2m+3)}\right) \tag{41}\] \[\leq\sum_{m=0}^{m_{\max}}\left(\frac{\pi}{2(2m+3)}\right)^{2}\] (42) \[\leq\frac{\pi^{2}}{4}\sum_{m=1}^{m_{\max}+1}\frac{1}{(2m+1)^{2}}\] (43) \[\leq\frac{\pi^{2}}{4}\left(\sum_{m=1}^{+\infty}\frac{1}{m^{2}}- \sum_{m=1}^{+\infty}\frac{1}{(2m)^{2}}-1\right)\] (44) \[\leq\frac{\pi^{2}}{4}\left(\frac{\pi^{2}}{6}-\frac{\pi^{2}}{24}-1\right)\] (45) \[\leq 0.58 \tag{46}\]

This means:

\[\prod_{m=0}^{m_{\max}}N_{m}^{N_{m}}\leq\left(\left(2^{n}\right)^{2^{n}} \right)^{0.58} \tag{47}\]

Hence:

\[\sum_{m=0}^{m_{\max}}N_{m}\ln(N_{m})\leq 0.58\times 2^{n}\ln(2^{n}) \tag{48}\]

Now for the second sum:

\[\sum_{m=0}^{m_{\max}}5=5(m_{\max}+1) \tag{49}\]

But \(m_{\max}\approx\sqrt{2^{n}}\) so for \(n\) large enough:

\[\sum_{m=0}^{k_{\max}}5\approx 5\sqrt{2^{n}}\lll 2^{n}\ln(2^{n}) \tag{50}\]

Its contribution is thus negligible in the overall sum and we have:

\[\sum_{m=0}^{m_{\max}}s_{m}<\sum_{m=0}^{m_{\max}}\left(N_{m}\ln(N_{m})+5\right) <2^{n}\ln(2^{n}) \tag{51}\]

In order to have a better idea of the reduction in oracle queries introduced by this algorithm, we have plotted in Figure 1 the ratio, as a function of \(n\) for \(n\geq 4\), between the total number of samples and \(2^{n}\ln(2^{n})\). As shown in Figure 0(a), for \(n\) large enough, the total number of samples is approximately halved when compared to the naive algorithm. To reduce further this number and speed up the training algorithm, we decided to increment \(m\), the number of amplification rounds, not by 1 but with powers of 2. The ratio of the total number of queries using this scheme, compared to the naive algorithm is given in Figure 0(b). In this case, we can see that it has been divided by more than 2. For these reasons, the increment schedule for \(m\) will now be:

\[\left[0,1,2,4,\ldots,m_{\max}\right] \tag{52}\]

The improved procedure is detailed in Algorithm 2. If \(m\) is the number of amplification rounds, the circuit used in Algorithm 2 is depicted in Figure 2.
#### 3.2.3 A further refinement

One issue with this algorithm resides in the fact that for \(n\in\mathbb{N}\) and \(0\leq m\leq m_{\text{max}}\), the range of misclassified inputs to be covered is:

\[\left]\sin^{2}\left(\frac{\pi}{2(2m+3)}\right)2^{n},\sin^{2}\left(\frac{\pi}{2(2 m+1)}\right)2^{n}\right] \tag{53}\]

So as \(m\) increases, the range will decrease. This means that approximating the number of misclassified inputs with the lower bound becomes more accurate as \(m\) increases. However, for small \(m\), this approximation is not as accurate. For example, for \(m=0\), the range given in Equation 53 becomes:

\[\left]\frac{2^{n}}{4},2^{n}\right] \tag{54}\]

This range can be refined by adding a second ancillary qubit, initialised in state \(\left|0\right>\) and a rotation gate acting on this qubit and controlled by the first ancillary qubit. We give a more accurate definition of this gate:

**Definition 3.5**.: _Let \(m_{0}\in\mathbb{N}\), we define:_

\[\theta_{m_{0}}=\frac{\pi}{2(2m_{0}+1)} \tag{55}\]

Figure 1: Ratio \(\sum_{m=0}^{m_{\text{max}}}s_{m}/2^{n}\ln(2^{n})\) as a function of \(n\) for \(n\geq 4\). In Figure 0(a) \(m\) has been incremented by 1 while in Figure 0(b), \(m\) has been incremented with powers of 2
_And we denote \(\mathbf{CR}_{m_{0}}\) the controlled rotation (around the \(y\)-axis) gate such that:_

\[\mathbf{CR}_{m_{0}}\left|10\right\rangle=\cos\left(\theta_{m_{0}}\right)\left|1 0\right\rangle+\sin\left(\theta_{m_{0}}\right)\left|11\right\rangle \tag{56}\]

Then if \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) is the target concept and the network is expressing \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) in its current state \(\mathbf{T}(h)\), we have:

\[\mathbf{CR}_{m_{0}}\mathbf{T}(h)\left|\psi(c)\right\rangle\left|0\right\rangle =\sin\left(\theta_{m_{0}}\right)\frac{1}{\sqrt{2^{n}}}\sum_{h(x)\neq c(x)} \left|x\right\rangle\left|11\right\rangle+\left|\bot\right\rangle \tag{57}\]

So the inputs of interest are now marked with the two ancillary qubits being in \(\left|11\right\rangle\) and the probability \(P_{11}\) of measuring such inputs is now such that:

\[P_{11}\in\left[0,\sin^{2}\left(\theta_{m_{0}}\right)\right] \tag{58}\]

And in this case:

\[\min_{P_{11}>0}=\sin^{2}\left(\theta_{m_{0}}\right)\frac{1}{2^{n}} \tag{59}\]

We adapt Definitions 3.1 and 3.2 to take into account this modification:

**Definition 3.6**.: _Let \(n\in\mathbb{N}\), \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) be the target concept and \(m_{0}\in\mathbb{N}\). Suppose that the network is expressing the function \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) in its current state \(\mathbf{T}(h)\). We denote:_

\[\mathcal{X}_{\alpha_{0}}(c)=(\mathbf{I}-2\left|\psi(c)\right\rangle\left\langle \psi(c)\right|)\otimes\mathbf{I} \tag{60}\]

\[\mathbf{U}_{m_{0}}(h)=\mathbf{CR}_{m_{0}}\mathbf{T}(h) \tag{61}\]

_And_

\[\mathcal{X}_{G}=\mathbf{I}^{\otimes n+1}\otimes\mathbf{Z} \tag{62}\]

_The diffusion operator \(\mathbf{Q}_{m_{0}}(c,h)\) is then defined as:_

\[\mathbf{Q}_{m_{0}}(c,h)=-\mathbf{U}_{m_{0}}(h)\mathcal{X}_{\alpha_{0}}(c) \mathbf{U}_{m_{0}}^{\dagger}(h)\mathcal{X}_{G} \tag{63}\]

We now define the quantities that are related to this modified process.

**Definition 3.7**.: _Let \(n\in\mathbb{N}\) and \(m_{0}\in\mathbb{N}\), we denote:_

\[\theta_{\min,m_{0}}=\arcsin\left(\sin\left(\theta_{m_{0}}\right)\frac{1}{ \sqrt{2^{n}}}\right) \tag{64}\]

_And:_

\[m_{\max,m_{0}}=\arg\min_{m\in\mathbb{N}}\left|(2m+1)\theta_{\min,m_{0}}-\frac {\pi}{2}\right| \tag{65}\]

Let \(m_{0}\in\mathbb{N}\). Now let \(\theta_{err}\in\left]0,\frac{\pi}{2}\right]\) such that:

\[\theta_{err}=\arcsin\Bigl{(}\sqrt{P_{11}}\Bigr{)} \tag{66}\]

Then there exists \(m\in\mathbb{N}\) such that:

\[\theta_{err}\in\left]\frac{\pi}{2(2m+3)},\frac{\pi}{2(2m+1)}\right] \tag{67}\]

But according to Equation 58, we have \(P_{11}\leq\sin^{2}\left(\theta_{m_{0}}\right)\) so it comes that:

\[m\geq m_{0} \tag{68}\]

Now if \(N_{err}\) is the number of misclassified inputs, then Equation 57 yields:

\[N_{err}=\sin^{2}(\theta_{err})\frac{2^{n}}{\sin^{2}(\theta_{m_{0}})} \tag{69}\]

Figure 2: Quantum circuit for the improved algorithm
Hence:

\[N_{err}\in\bigg{]}\!\sin^{2}\left(\frac{\pi}{2(2m+3)}\right)\frac{2^{n}}{\sin^{2 }(\theta_{m_{0}})},\sin^{2}\left(\frac{\pi}{2(2m+1)}\right)\frac{2^{n}}{\sin^{ 2}(\theta_{m_{0}})}\bigg{]} \tag{70}\]

So for \(m\geq m_{0}\), the ratio between the two bounds of this interval is:

\[1\leq\frac{\sin^{2}\left(\frac{\pi}{2(2m+1)}\right)}{\sin^{2}\left(\frac{\pi}{ 2(2m+3)}\right)}\leq\frac{\sin^{2}\left(\frac{\pi}{2(2m_{0}+1)}\right)}{\sin^{ 2}\left(\frac{\pi}{2(2m_{0}+3)}\right)}\approx\left(\frac{m_{0}+3}{m_{0}+1} \right)^{2}=\left(1+\frac{2}{m_{0}+1}\right)^{2} \tag{71}\]

Where the approximation is valid for \(m_{0}>0\). So as \(m_{0}\) grows, it is possible for the bounds of the interval given in Equation 70 to become quite close. Moreover, after \(m\) rounds of amplitude amplification, we have:

\[P_{11}^{(m)}\in\bigg{]}\!\sin^{2}\left(\frac{2m+1}{2m+3}\frac{\pi}{2}\right),1\bigg{]} \tag{72}\]

With:

\[\sin^{2}\left(\frac{2m+1}{2m+3}\frac{\pi}{2}\right)=\sin^{2}\left(\frac{\pi}{ 2}-\frac{\pi}{2m+3}\right)=\cos^{2}\left(\frac{\pi}{2m+3}\right)=1-\sin^{2} \left(\frac{\pi}{2m+3}\right) \tag{73}\]

As \(m\geq m_{0}\), we have:

\[\sin^{2}\left(\frac{2m+1}{2m+3}\frac{\pi}{2}\right)\geq 1-\sin^{2}\left(\frac{ \pi}{2m_{0}+3}\right) \tag{74}\]

Here again, for \(m_{0}\) large enough, it is possible for the lower bound to be very close to 1. This means that for \(m_{0}\) large enough, whatever the number of misclassified inputs (or equivalently the probability \(P_{11}\)), as long as it is non-zero, it is possible to find a \(0\leq m\leq m_{\max,m_{0}}\) such that after \(m\) rounds of amplitude amplification, the measurement process will be a random process where the probability of measuring a misclassified input is close to 1. In addition, the number of such inputs can more accurately be approximated by the lower bound of the interval given in Equation 70. However, it does not suffice to take \(m_{0}\) very large. Indeed, as \(m_{\max,m_{0}}\) increases with \(m_{0}\), so does the total number of samples. A good choice for this parameter is thus one that allows for the behaviour previously described while ensuring that the number of samples remains small enough.

**Definition 3.8**.: _Let \(n\in\mathbb{N}\), \(m_{0}\in\mathbb{N}\) and \(m_{\max,m_{0}}\) as in Definition 3.7. For \(m_{0}\leq m\leq m_{\max,k_{0}}\) we define:_

\[N_{m,m_{0}}=\sin^{2}\left(\frac{\pi}{2(2m+3)}\right)\frac{2^{n}}{\sin^{2}( \theta_{m_{0}})} \tag{75}\]

_And_

\[s_{m,m_{0}}=\max\left(N_{m,m_{0}}\ln(N_{m,m_{0}}),5\right) \tag{76}\]

The total number of samples during an update phase is thus \(\sum_{m=m_{0}}^{m_{\max}}s_{m,m_{0}}\) but in order to speed up the algorithm we chose to keep the schedule introduced in the first improvement hence:

**Definition 3.9**.: _Let \(n\in\mathbb{N}\), \(m_{0}\in\mathbb{N}\), \(m_{\max,m_{0}}\) as in Definition 3.7 and \(s_{m,m_{0}}\) as in Definition 3.8, then the total number of samples \(S_{m_{0}}\)during an update phase is given by:_

\[S_{m_{0}}=s_{m_{0},m_{0}}+\sum_{m_{0}<2^{p}<m_{\max,m_{0}}}s_{m,m_{0}}+s_{m_{ \max,m_{0}},m_{0}} \tag{77}\]

To guide the choice for a suitable \(m_{0}\), the ratio \(S_{m_{0}}/2^{n}\ln(2^{n})\) has been plotted for different values of \(n\in\mathbb{N}\) and \({}_{m}0\in\mathbb{N}\) in Figure 3. From this figure, it is apparent that the values \(0\leq m_{0}\leq 4\) are suitable with \(m_{0}=0\) corresponding to the first improvement introduced earlier. Algorithm 3 describes the training algorithm that will be used to train the network. Notice that when measuring, we still look at the first ancillary qubit. Indeed, because of the controlled rotation gate \(\mathbf{CR}_{m_{0}}\), a misclassified input will result in the ancillary qubits being measured either in state \(\left|10\right\rangle\) or \(\left|11\right\rangle\). While the latter is used in the amplification process to refine it, the former still corresponds to a state of interest and it would be a waste to ignore it during the measurements.

For \(m_{0}\in\mathbb{N}\) and \(m\in\mathbb{N}\), the circuit being measured is depicted in Figure 4.
### Implementation

Let \(n\in\mathbb{N}\). In order to specify the choice of \(m_{0}\) we have implemented Algorithm 3 for \(0\leq m_{0}\leq 4\) with the target being a generic Boolean function \(c\in\mathbb{B}^{\mathbb{B}^{n}}\). In detail, for \(4\leq n\leq 8\), 16 target functions have been chosen randomly and for each target function, the network has been trained 50 times. Each time, the number of samples needed until the algorithm stops has been recorded as well as the final error rate. As a comparison, the naive algorithm has also been implemented and studied under the same regime. Concerning the error rate, when using amplitude amplification, whatever the values for \(n\) and \(m_{0}\), the final error rate was consistently equal to 0, as shown in Figure 4(a), indicating that

Figure 3: Ratio \(S_{m_{0}}/2^{n}\ln(2^{n})\) as a function of \(n\) for different values of \(m_{0}\)
the target function has indeed been exactly learnt. On the other hand, when training with the naive algorithm, some of the experiments for \(n=4\) to \(6\) failed to exactly learn the target function as depicted in Figures 4(b) to 4(d).

Hence, when only looking at the goal of exactly learning, the algorithm using amplitude amplification performs better than the naive algorithm and thus for the different values of \(m_{0}\) that have been selected. To further confirm the advantage of the refined algorithm over the naive one, we put our focus on the number of samples required to learn the target functions. For each chosen \(m_{0}\), the mean number of samples taken over all the experiments, i.e. all the 16 functions and the 50 runs by function, has been plotted against the dimension of the input space \(n\) for \(4\leq n\leq 8\) in Figure 6. As a point of comparison, the same metric has been plotted for the naive algorithm.

What transpires from this comparison is that for the selected \(m_{0}\), the number of necessary samples is considerably lower than for the naive algorithm, with the gap increasing as the input dimension increases. Two values for \(m_{0}\) particularly stand out: \(m_{0}=2\) and \(m_{0}=4\) as they lead to the lowest number of samples with the plot for \(m_{0}=4\)

Figure 4: Quantum circuit for the improved algorithm

Figure 5: Final error rate for different experiments
being below the one for \(m_{0}=2\). While this trend seems to be contradictory with Figure 3, this can be explained by the fact that the number of updates when \(m_{0}=4\) is lower than when \(m_{0}=2\). Seeing that the difference in terms of sample number between these two choices is relatively small, it seems that \(m_{0}=2\) offers the best compromise between minimising the number of samples and minimising the running time of the training algorithm. In Section 4, a modified version of Algorithm 3 will be used with \(m_{0}=2\) to learn \(k\)-juntas. The modifications will concern the number of queries during an update stage as well as the update strategy with regard to the measurement outcomes.

## 4 Learning Positive \(k\)-Juntas

### Description of the Concept Class and the Update Algorithm

**Definition 4.1**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\). A Boolean function \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) is said to be a \(k\)-junta if its output only depends on at most \(k\) of its input variables, these variables are then called the relevant variables. Let \(\rho_{c}\subset[0\ldots n-1]\) be the set of the relevant variables of \(c\), then:_

\[|\rho_{c}|\leq k \tag{78}\]

_Additionally, we define a positive \(k\)-junta, \(c\in\mathbb{B}^{\mathbb{B}^{n}}\), as being a \(k\)-junta such that:_

\[c(0)=0 \tag{79}\]

_And we denote \(\mathcal{J}_{k}^{+}\) the class of the positive \(k\)-juntas._

The fact that a function is a positive \(k\)-junta will impose a restriction on its algebraic normal form:

**Proposition 4.1**.: _Let \(n\in\mathbb{N}^{*}\) and \(c\in\mathbb{B}^{\mathbb{B}^{n}}\) a positive \(k\)-junta. Then there exist \(u_{1}^{(c)},\ldots,u_{p}^{(c)}\in\mathbb{B}^{n}\setminus\{0\}\) with \(p<2^{k}\) such that:_

\[\forall i\in[1,p],1_{u_{i}^{c}}\subseteq\rho_{c} \tag{80}\]

_And:_

\[c=\bigoplus_{i=1}^{p}m_{u_{i}^{c}} \tag{81}\]

_We will call \(u_{1}^{(c)},\ldots,u_{p}^{(c)}\) the principals of \(c\)._

Figure 6: Mean number of samples taken over all the experiments (functions and runs) against the dimension \(n\) for different values of \(m_{0}\) (\(0\leq m_{0}\leq 4\)) and the naive algorithm
**Proof**:

Let \(n\in\mathbb{N}^{*}\), \(k<n\) and \(c\in\mathcal{J}_{k}^{+}\). For \(x\in\mathbb{B}^{n}\), we denote \(x_{|\rho_{c}}\) the restriction of \(x\) to the relevant variables of \(c\). As \(c\) is a \(k\)-junta, there exist \(c^{\prime}\in\mathbb{B}^{\mathbb{B}^{|\rho_{c}|}}\) such that:

\[\forall x\in\mathbb{B}^{n},c(x)=c^{\prime}(x_{|\rho_{c}}) \tag{82}\]

As \(c^{\prime}\in\mathbb{B}^{\mathbb{B}^{|\rho_{c}|}}\), it has an ANF, i.e. there exist \(u_{1}^{(c^{\prime})},\ldots,u_{p}^{(c^{\prime})}\in\mathbb{B}^{|\rho_{c}|}\) such that:

\[c^{\prime}=\bigoplus_{i=1}^{p}m_{u_{i}^{c^{\prime}}} \tag{83}\]

Because \(c(0)=c^{\prime}(0)=0\), we also have:

\[u_{1}^{(c^{\prime})},\ldots,u_{p}^{(c^{\prime})}\in\mathbb{B}^{|\rho_{c}|} \setminus\{0\} \tag{84}\]

Now to extend \(c^{\prime}\) to \(c\), for \(i\in[1\ldots p]\) we simply extend \(u_{i}^{c^{\prime}}\in\mathbb{B}^{|\rho_{c}|}\) to \(u_{i}^{c}\in\mathbb{B}^{n}\) by padding with zeros where necessary. This ensures that \(1_{u_{i}^{c}}\subseteq\rho_{c}\), \(u_{1}^{(c)},\ldots,u_{p}^{(c)}\in\mathbb{B}^{n}\setminus\{0\}\) and:

\[c=\bigoplus_{i=1}^{p}m_{u_{i}^{c}} \tag{85}\]

To understand the effect of the principals of a \(k\)-junta, we will introduce the notion of filter, derived from set theory:

**Definition 4.2**.: _Let \(n\in\mathbb{N}\) and \(u\in\mathbb{B}^{n}\). We denote by \({}_{\uparrow}u\) the filter generated by \(u\) defined by:_

\[{}_{\uparrow}u=\{v\in\mathbb{B}^{n}\mid 1_{u}\subseteq 1_{v}\} \tag{86}\]

By using the filters generated by the principals of a positive \(k\)-junta \(c\), a characterisation of the inputs \(v\in\mathbb{B}^{n}\) such that \(c(v)=1\) can be done.

**Proposition 4.2**.: _Let \(n\in\mathbb{N}^{*}\), and \(c\in\mathcal{J}_{k}^{+}\). Let \(u_{1}^{(c)},\ldots,u_{p}^{(c)}\) be the principals of \(c\), then for \(v\in\mathbb{B}^{n}\):_

**Proof**: \(1\) _if and only if there exists an odd number of principals, \(u_{i}^{(c)}\), such that \(v\) is an element of \({}_{\uparrow}u_{i}^{(c)}\)._

This result stems from the ANF of the function. \(\blacksquare\)

In order to show the effects of updating the network, we introduce the following:

**Proposition 4.3**.: _Let \(n\in\mathbb{N}^{*}\) and \(c\in\mathcal{J}_{k}^{+}\). Let \(v\in\mathbb{B}^{\mathbb{B}^{n}}\) such that \(c(v)=1\), then:_

\[\forall w\in{}_{\uparrow}v,c(w)\oplus m_{v}(w)=\overline{c(w)} \tag{87}\]

_And:_

**Proof**:

This is a consequence of Property 4.2.

Let \(v\in\mathbb{B}^{n}\) such that \(c(v)=1\). Then according to Property 4.2:

\[v\in\bigcup_{i=1}^{p}{}_{\uparrow}u_{i}^{(c)} \tag{89}\]

And because \({}_{\uparrow}v\subset\bigcup_{i=1}^{p}{}_{\uparrow}u_{i}^{(c)}\), it comes that any misclassified input is an element of the filter generated by at least one principal of the target function. By updating the network with gates controlled by misclassified inputs we thus ensure that at any time during the training process, the network will express a hypothesis \(h\in\mathbb{B}^{\mathbb{B}^{n}}\) such that:

\[h=\bigoplus_{u\in G}m_{u}\text{ where }G\subseteq\bigcup_{i=1}^{p}{}_{ \uparrow}u_{i}^{(c)} \tag{90}\]

So the goal of the tuning algorithm is to gradually descend to the principals of the target function by adding to the network gates controlled by inputs of progressively lower Hamming weight. Once a gate controlled by \(v\) is added, all the gates controlled by inputs in \({}_{\uparrow}v\) can be trimmed from the network.

To facilitate this process, it would be advantageous to measure misclassified inputs that are close, in terms of Hamming weight, to the principals of the target function. Indeed, by doing so, the network could be updated with gates that are closer to the principals, thus cutting down the number of update steps. This can be achieved by using, once more, amplitude amplification. The target function being a \(k\)-junta, we know that its principals have a Hamming weight of at most \(k\). So by using AA to focus on the inputs with that property, this descent process can be facilitated. Formally, let us define the following:
**Definition 4.3**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\). We define \(\mathcal{X}_{\leq k}\in U(2^{n})\) such that:_

\[\forall x\in\mathbb{B}^{n},\mathcal{X}_{\leq k}\ket{x}=\begin{cases}-\ket{x}& \text{if }w_{H}(x)\leq k\\ &\ket{x}&\text{else}\end{cases} \tag{91}\]

_Additionally, we define \(\mathcal{X}_{\psi}\in U(2^{n+1})\) by:_

\[\mathcal{X}_{\psi}=2\ket{\psi(c)}\!\!\bra{\psi(c)}-\mathbf{I} \tag{92}\]

_The diffusion operator for the inputs with Hamming weight of at most \(k\) is then given by:_

\[\mathcal{X}_{\psi}(\mathcal{X}_{\leq k}\otimes\mathbf{I}) \tag{93}\]

Because we know exactly how many of these inputs are in the superposition, we can determine the number of iterations of this diffusion operator are needed to appropriately amplify these inputs:

**Definition 4.4**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\). Let \(N_{\leq k}\) be the number of inputs with Hamming weight of at most \(k\), then:_

\[N_{\leq k}=\sum_{j=0}^{k}\binom{n}{j} \tag{94}\]

_This allows us to define \(p_{\leq k}\), the number of iterations for the diffusion operator defined in Definition 4.3:_

\[p_{\leq k}=\arg\min_{p\in\mathbb{N}}\left|(2p+1)\arcsin\left(\sqrt{\frac{N_{ \leq k}}{2^{n}}}\right)-\frac{\pi}{2}\right| \tag{95}\]

We can now abstract the amplification process into a unitary:

**Definition 4.5**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\). Let \(\mathcal{X}_{\leq k}\) and \(\mathcal{X}_{\psi}\) be the gates defined in Definition 4.3 and \(p_{\leq k}\) as in Definition 4.4, then the operator \(\mathbf{A}_{\leq k}\in U(2^{n+1})\) defined by:_

\[\mathbf{A}_{\leq k}=[\mathcal{X}_{\psi}(\mathcal{X}_{\leq k}\otimes\mathbf{I} )]^{p_{\leq k}} \tag{96}\]

_Will appropriately amplify the amplitudes of the inputs with Hamming weight of at most \(k\)._

Before continuing, we must briefly redefine the diffusion operator introduced in Definition 3.6 for it to be compatible with this additional procedure.

**Definition 4.6**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\) and \(\mathbf{A}_{\leq k}\) as defined in Definition 4.5. We denote:_

\[\ket{\psi_{\leq k}(c)}=\mathbf{A}_{\leq k}\ket{\psi(c)} \tag{97}\]

_From this, we redefine \(\mathcal{X}_{\alpha_{0}}\) as introduced in Definition 3.6 by:_

\[\mathcal{X}_{\alpha_{0}}=(\mathbf{I}-2\ket{\psi_{\leq k}(c)}\!\!\bra{\psi_{ \leq k}(c)})\otimes\mathbf{I} \tag{98}\]

_The other components remaining the same (with \(m_{0}=2\)) we then have:_

\[\mathbf{Q}=-\mathbf{U}(h)\mathcal{X}_{\alpha_{0}}(c)\mathbf{U}(h)^{\dagger} \mathbf{X}_{G} \tag{99}\]

_Where \(\mathbf{U}(h)=\mathbf{C}\mathbf{R}_{2}\mathbf{T}(h)\)._

The circuit used in the learning process is depicted in Figure 7.

An update phase will thus unfold as follows (to facilitate the explanation, a gate and its controlling input will be conflated). To take advantage of the filter structure, the measurements are separated into correctly classified and misclassified inputs. For each group, the inputs are sorted by increasing Hamming weight and treated in this order. For each of the misclassified inputs, the number of gates to be added, of which the misclassified input is an element of the filter, is counted. If this number is even, this input is added to the list of gates to be updated and all the gates that are in the current network and are also in this input's filter are to be removed. This update process is also performed with the correctly classified inputs but in this case, the number has to be odd in order to add the input to the list of gates to be updated. The update process described above is detailed in Algorithm 4.

One quantity that remains to be determined is the number of queries to the quantum example oracle during such an update phase. While it would have been possible to train the network using the sampling schedule introduced in Section 3.2, this approach is best used when no characteristic is known of the target concept. In the case of \(k\)-juntas, it seems natural for the query complexity to be a function of \(k\). As a result, when learning \(k\)-juntas, we chose to perform \(2^{k}\) measurements after each amplification phase leading to:
**Proposition 4.4**.: _Let \(n\in\mathbb{N}^{*}\) and \(k<n\). Suppose that the concept class is \(\mathcal{J}_{k}^{+}\). If the number of queries after each amplification phase is \(2^{k}\), then during an update phase, the number of queries to the quantum example oracle is in:_

\[\Theta(n2^{k}) \tag{100}\]

This leads to the sample complexity of the whole algorithm. Thanks to Property 4.4 we have already established that one update phase will perform \(\Theta(n2^{k})\) calls to the example oracle. To determine the number of updates, we make the following observation. Let \(u_{i}^{(c)}\) be one of the principals of the target function \(c\in\mathcal{J}_{k}^{+}\). Suppose further that we update the network with a gate controlled by \(v\in{{}_{\uparrow}u_{i}^{(c)}}\). We are assured that during a further update step, we will correct an input \(w\in{{}_{\uparrow}u_{i}^{(c)}}\) such that \(v\in{{}_{\uparrow}w_{i}}\). Either because \(w\) was measured randomly or because all of the elements of \({{}_{\uparrow}v}\) have been corrected beforehand, thus ensuring that \(w\) will be measured. However, thanks to the pre-amplification that focuses on the inputs with Hamming weight of at most \(k\), the first event is most likely to happen. Once the gate

Figure 7: Quantum circuit to learn \(k\)-juntas
controlled by \(w\) has been updated, the same process will repeat until we reach \(u_{i}^{(c)}\). All in all, we have that the number of updates is in \(O(n)\), and hence the query complexity is in:

\[O(n^{2}2^{k}) \tag{101}\]

### Experimental Results

We have implemented1 this learning algorithm for \(n\in[5\dots 8]\) and \(k\in[2\dots n-1]\). For each pair of \(n\) and \(k\), the network has been trained to learn 16 randomly created \(k\)-junta. Each training has been repeated 25 times. The final error rates for these experiments were all similar to what is reported in Figure 8.

Footnote 1: The code can be found here: [https://github.com/vietphamgo/exact_AA](https://github.com/vietphamgo/exact_AA)

This figure has been plotted using violin plots, hence it shows that all of the training successfully stopped with a correctly tuned network. We now focus on the number of update steps required to reach these results.

To have an overview of this metric, for a given \(n\) and a given \(k\), we have aggregated all of the training runs for all of the functions. For a given \(n\), this set of data has then been plotted against \(k\) using box plots. This way we can visualise the median, first and third quartiles, as depicted by the red line, the lower bound, and the upper bound of the box respectively. The maximum and minimum are indicated by the whiskers and the circles represent outliers. All of these are shown in Figure 9. From these results, we can see that for a given \(n\), the number of samples is indeed in the order of \(n\). But more interestingly, it slightly decreases as \(k\) increases. This can be explained by the fact that during an update phase, the update algorithm has access to more samples, hence the descent to the principals of the target function is quicker. Another reason comes from the fact that for the algorithm to find a principal when \(k\) is small, it will potentially have to go "deeper" as the Hamming weight of a principal is at most \(k\).

However, our upper bound of \(n\) still holds. From these experiments, we have verified that the total sample complexity is in \(O(n^{2}2^{k})\). In [11], the task was also to learn \(k\)-juntas while given access to a uniform quantum example oracle albeit in the QPAC-learning framework. The complexity of their algorithm was then \(O\left(\frac{k}{\epsilon}\log(k)\right)\). Assuming that this algorithm can be applied in the exact learning framework by taking \(\epsilon=\frac{1}{2^{n}}\), we end up with a complexity of \(O(2^{n}k\log(k))\). So in the case where \(k\ll n\), our algorithm will perform better.

## 5 Conclusion

In this work, we have devised an algorithm to train a tunable quantum neural network in the exact learning framework with access to a uniform quantum example oracle. We refined it by employing it to learn generic Boolean functions and by comparing it to a naive algorithm. We then adapted this algorithm to learn the class of \(k\)-juntas. Following the implementation of this approach, we found that the query complexity is in \(O(n^{2}2^{k})\). This complexity is lower than what can be found in the literature in the case where \(k\ll n\).
