On the robustness of bucket brigade quantum RAM

We study the robustness of the bucket brigade quantum random access memory model introduced by Giovannetti, Lloyd, and Maccone [Phys. Rev. Lett. 100, 160501 (2008)]. Due to a result of Regev and Schiff [ICALP '08 pp. 773], we show that for a class of error models the error rate per gate in the bucket brigade quantum memory has to be of order $o(2^{-n/2})$ (where $N=2^n$ is the size of the memory) whenever the memory is used as an oracle for the quantum searching problem. We conjecture that this is the case for any realistic error model that will be encountered in practice, and that for algorithms with super-polynomially many oracle queries the error rate must be super-polynomially small, which further motivates the need for quantum error correction. By contrast, for algorithms such as matrix inversion [Phys. Rev. Lett. 103, 150502 (2009)] or quantum machine learning [Phys. Rev. Lett. 113, 130503 (2014)] that only require a polynomial number of queries, the error rate only needs to be polynomially small and quantum error correction may not be required. We introduce a circuit model for the quantum bucket brigade architecture and argue that quantum error correction for the circuit causes the quantum bucket brigade architecture to lose its primary advantage of a small number of"active"gates, since all components have to be actively error corrected.

We study the robustness of the bucket brigade quantum random access memory model introduced by Giovannetti, Lloyd, and Maccone [Phys. Rev. Lett. 100, 160501 (2008)]. Due to a result of Regev and Schiff [ICALP '08 pp. 773], we show that for a class of error models the error rate per gate in the bucket brigade quantum memory has to be of order o(2 −n/2 ) (where N = 2 n is the size of the memory) whenever the memory is used as a oracle for the quantum searching problem. We conjecture that this is the case for any realistic error model that will be encountered in practice, and that for algorithms with super-polynomially many oracle queries the error rate must be super-polynomially small, which further motivates the need for quantum error correction. We introduce a circuit model for the quantum bucket brigade architecture and argue that quantum error correction for the circuit causes the quantum bucket brigade architecture to lose its primary advantage of a small number of "active" gates, since all components have to be actively error corrected.

I. INTRODUCTION
A random access memory (RAM) is a device that stores information in an array of memory cells in the form of bits. In contrast to other types of information storage devices, the access latency to any memory cell is constant and does not depend on the location of the information in the RAM. Information stored in the RAM is retrieved by inputting the address of the desired memory cell in a routing circuit. Any address in a RAM with N = 2 n memory cells can by addressed via a unique n bit input query string. The corresponding output register contains the contents of the addressed memory location.
The typical physical implementation of the addressing mechanism uses the fanout architecture [1,2], in which the routing scheme corresponds to a binary tree. Each node consists of a pair of transistors which routes the electronic signal down one of the two paths to the subsequent level. In the fanout architecture, a given level has all nodes sharing the same routing direction (left or right), set by the corresponding address bit. An n bit query string determines a unique path in the binary tree, corresponding to the desired memory location. In the process, O(2 n ) transistors are activated.
Alternative routing schemes with O(poly(n)) activated transistors have been proposed, corresponding to exponentially lower energy consumption. One such example is the "bucket brigade" scheme [3,4]. However, most of the classical implementations follow the simpler fanout architecture, as the power consumption of RAM is negligible in comparison with the power consumption of other components in the architecture.
The classical RAM addressing scheme can be generalized to a quantum RAM (which we simply call qRAM from here on) scheme, where the input is a quantum state, the routing components are inherently quantum, and the information stored can be either classical, i.e. |0 or |1 but not a superposition of both, or quantum, i.e. any arbitrary superposition of |0 and |1 . In the present paper we consider qRAM that stores only classical information. Such memory allows querying superposition of addresses where j α j |j is a superposition of queried addresses and |m j represents the content of the j-th memory location. A memory that stores classical information but allows queries in superposition is required for quantum algorithms such as Grover's search on a classical database [5], collision finding [6], element distinctness [7], dihedral hidden subgroup problem [8] and various practical applications mentioned in [9].
In fact, such a quantum memory plays the role of the oracle and is ideal in implementing any oracle-based quantum algorithm, in which the oracle is used to query classical data in superposition.
A conceptually simple physical implementation of a qRAM corresponds to a direct generalization of the fanout architecture used in classical RAMs. However, the number of faulty components that can be tolerated by the quantum architecture arXiv:1502.03450v3 [quant-ph] 17 Apr 2015 is of prime importance due to the difficulty in maintaining quantum coherence. This motivates searching for schemes with fewer faulty components. A fundamental assumption of the qRAM architecture is that "active" gates 1 are the only ones with significant errors.
In this paper we investigate the bucket brigade qRAM proposal introduced in [3,4]. Assuming one seeks a small constant error for the oracle query, then with the bucket brigade error model it suffices to have an error rate that is on the order of O(1/n 2 ). In the bucket brigade model, one assumes that each computational path only contains O(n) components that are faulty, and that a total of O(n 2 ) faulty operations are performed. One can argue that it is optimistic to assume that the so-called "non-active" components will be completely errorfree. And, one could counter-argue that the error rates will be much lower, and thus ignored for problem instances of appropriate size. For the purposes of this article, we set aside these concerns and accept the premise of there only being O(n) faulty components.
In contrast to such a qRAM, if one just used a regular fanout circuit for the lookup, with no error correction, one would need to maintain quantum coherence over an exponential number of components [4]. In order to achieve a constant error rate for the ultimate query in this case, one would need to implement a fault-tolerant version of the look-up circuit, which would normally incur an overhead that is polynomial in n. One advantage of bucket brigade qRAM is thus to bypass the poly-log overhead of fault tolerant quantum error correction needed to achieve a constant error rate for a look-up. Such an error rate would be sufficient if the qRAM is used in an algorithm making a constant number of queries, for example, for certain state generation algorithms [10,11]. In general, for an algorithm with inverse polynomially many queries, it would suffice to reduce the query error rate to be polynomial in the inverse of n, e.g. [12,13].
In this article, we firstly shed doubt on the usefulness of a qRAM that provides queries with constant probability of error, when used with algorithms that make super-polynomially many oracle queries. As an aside, we note that if the imperfect query operation is assumed to be unitary, and if one can apply the inverse of this imperfect query, then one can apply simple amplification methods to achieve queries with arbitrarily small error δ using a number of repetitions that is proportional 1 The concept of "active" gates introduced in [3,4] is somewhat unnatural when extended to quantum gates. At the physical level, a gate is considered active if it physically acts on its input. Since the qRAM may be in a superposition of querying many (or all) possible bit values in the memory, every gate may be in a superposition of being active or not. Implicitly, there is a physical process that is checking whether each gate is active, and then acting in that case, and such a process will not be perfect in practice. Translated into the circuit model, such gates may be modelled as controlled-gates, i.e. gates that act on its input provided that the control qubit is set to |1 . Therefore, such a gate is considered "active" if its control is set to |1 and "non-active" otherwise. In practice, even non-active gates will be prone to errors. The implicit assumption is that these errors are much smaller than the errors in active gates, and the focus of the bucket brigade models is to reduce the impact of the higher order errors found in the active part of a gate.
to log(1/δ). It was shown that this logarithmic overhead is not necessary for quantum searching [14] and other problems [15]. However, there is no reason to expect the errors in a realistic qRAM to behave this way, and in this article we consider incoherent errors. We first show that for a very simple model of incoherent physical errors, which induce an overall query error similar to the one described by Regev and Schiff [16], a qRAM that produces queries with constant error will not permit the quadratic speed-up provided by Grover's search algorithm or any other quantum search algorithm one might design. We show that one cannot escape achieving an error rate that is super-polynomially small. We conjecture that this error model nullifies the asymptotic speed-ups of other quantum query algorithms as well, and leave as open questions the extension of this result to other important query problems.
This negative result implies the need for some means of error reduction for the qRAM, with a look-up error rate exponential in n. For consistency we assume a physical error rate that is inverse polynomial in n, the logarithm of the size of the database. We thus explore a natural approach, using quantum error correcting codes, to provide this error reduction, and argue that the apparent advantage of qRAM disappears in this case; in principle, one can make the error rate arbitrarily small, however the advantage of a small number of activated gates in the bucket brigade architecture appears to be lost when active error correction has to be performed on each gate. The main motivation for the quantum bucket brigade approach over a straightforward binary-tree approach is that the equivalent of the active gates are the only gates prone to error, and thus an inverse polynomial in n error rate suffices in order to achieve an overall constant error per qRAM look-up.
The remainder of this paper is organized as follows. In Sec. II we describe the bucket brigade qRAM architecture and prove that for the Regev and Schiff model [16] the error rate per gate must decrease faster than any inverse polynomial in the size of the system. In Sec. III we develop and analyze a simple error model that provides intuition for the overall behaviour of the memory with realistic noisy environments. In Sec. IV, in order to discuss approaches for introducing quantum error correction inside the qRAM architecture, we introduce a circuit model for the bucket brigade architecture. We then argue in Sec. V that a fault-tolerant bucket brigade qRAM loses the advantage of small number of active components. Finally, in Sec. VI we conclude and present some open problems and directions for future research.

II. QUANTUM RAM ARCHITECTURES
In [3,4], Giovanetti et al. proposed a quantum bucket brigade addressing scheme requiring only O(n) activations per memory call. The nodes of the routing binary tree are three level quantum systems (qutrits), with an energy spectrum schematically depicted in Fig. 1.
The 2 n qutrits at the nodes of the binary tree are initially prepared in the ground state |• , named the "wait" state, and the memory address is specified by a qubit string |a 0 a 1 . . . a n−1 . At time t 0 , the address qubit |a 0 is input at the root of the tree and it interacts with the qutrit at node 0 changing its state from |• to |a 0 . The states {|0 , |1 } of the node qutrit are coupled to two spatial directions (paths), right and left respectively. The role of the coupling is to route the following incoming address photon along the correct path of the binary routing tree. At time t 1 , the subsequent address qubit |a 1 is input at the root of the tree. The address qubit |a 1 interacts with the qutrit at node 0 and is physically routed down the left or right path of the tree depending upon the state |a 0 of node 0. Consequently it changes the state of the corresponding node at level 1 to |a 1 . The process continues until all of the remaining address qubits are sent through the tree, with the k-th address qubit changing the state of the node at the k-th level from |• to |a k . After O(n 2 ) time steps 2 , a routing path is assigned from the root of the tree to the desired memory location, with only n nodes in the path (one node per level) having a state different from |• . A bucket brigade 2 The k-th address qubit interacts with the first k −1 routing nodes, followed by a single interaction with the corresponding node at the k-th level. Considering each interaction takes a single time step, the k-th address qubit changes the state of the corresponding node at the k-th level after k time steps. Considering there are a total of n address qubits, the overall time required is O(n 2 ).
routing scheme for an 2 3 -address qRAM is schematically depicted in Fig. 2. The proposed physical implementation of bucket brigade in [4] uses atoms in a cavity as routing nodes and polarization photon states as addressing qubits.
In [4], the authors claim that the bucket brigade scheme is coherent as long as the error per gate, ε scales as O(1/n 2 ). For this error scaling, as n increases, the overall error rate of the qRAM oracle asymptotically approaches a constant. Although constant or polynomial error rates suffice for some quantum algorithms [12,13], such error rates are not favourable for some other important quantum algorithms. For example, Regev and Schiff [16] showed that the quadratic speed-up in Grover's searching algorithm vanishes when using oracles with a constant error rate. Namely, in order to regain the quadratic speed-up, the error rate per oracle call should scale no worse than O(2 −n/2 ) (therefore the error rate not only needs to be non-constant but it must vanish at a fast enough rate with increasing n).
In the next few sections, we construct a simple model of bucket brigade qRAM with errors and show in Appendix A that Regev and Schiff error model [16] resembles the model we construct. Based on this resemblance and assuming O(n 2 ) faulty operations per memory call, we conjecture that in order to implement the qRAM for quantum searching, the overall error rate per memory call has to be in O(2 −n/2 ). In fact, for this to hold, the error rate per gate ε should decrease faster than 1/f (n), where f (n) ∈ ω(2 n/2 ). Thus ε has to be in o(2 −n/2 ) and hence much smaller than O(1/n 2 ), since the overall error rate per memory call and thus to have Recently Hong et al. [17] proposed a bucket brigade qRAM scheme in which the number of time steps required per memory call is reduced from O(n 2 ) to O(n). While this reduction decreases the overall error rate, the error rate per gate ε must still be in o(2 −n/2 ).
The need for super-polynomially small (in n) error rate per gate for real world applications motivates a more thorough analysis of the bucket brigade qRAM scheme and the need for quantum error correction, these topics being the subject of the following sections.

III. ERRORS ANALYSIS
In this section we introduce a simple toy error model for the physical implementation proposed in [4], in which the qutrits are implemented by trapped atoms in cavities. The address qubits are implemented by photons that propagate along the network of cavities, and excite the corresponding qutrit to either of the states |0 or |1 , depending on their polarization. In this way, the incoming address photons create a "path" through the binary tree of cavities, leading to the desired memory location. The readout is performed by injecting a "bus" qubit (photon) at the root of the tree that interacts with the desired memory location, copies its value (the states stored by the memory are |0 or |1 , and not any superposition), and finally is sent back along the routing tree exiting through the root with the corresponding memory location content. For more details about the physical model an interested reader is referred to [4].

A. Toy Error Model
In the following we assume that the only source of errors in the above model is due to random flips between the states |0 and |1 of the qutrit. We assume a typical symmetric bit-flip error, in which at each time step the state |j can either flip to |j ⊕ 1 with probability ε or remain unchanged with probability 1 − ε. The motivation for considering this error model is that, since the states {|0 , |1 } are close together in the energy spectrum, significantly less energy is required to cause a flip between them, hence such flips are more likely to occur. In reality, there may be other sources of errors such as coupling errors, decaying of excited qutrit states to the ground state, loss of photons during the routing process and so on. However, our toy model illustrates the effects of an error that would naturally occur in a realistic physical realization of a qRAM. There is no reason to expect these other sources of errors would help matters (otherwise, one could seek to deliberately introduce or simulate such errors).
It is not hard to observe that any error in the routing process can propagate through the tree resulting in various possibilities. Considering all possible errors in such a model, the possible paths that the bus photon could take in the final step termed as right path, wrong path and no-path, respectively. For convenience, we further assume the operations used to un-compute the path information encoded in the qRAM are error-free.
1) Right path -This scenario occurs when no flips (errors) arise during the routing process. In this ideal scenario, the bus reaches the correct location in the qRAM as specified by the input address. Fig. 2 depicts an example of a right path given an input address |010 .
To compute the probability p rp of such an event, we require that no bit flip occurs at each of the j levels. Taking the intersection of such events for all n − 1 levels of the binary tree gives the probability of the right path 2) Wrong path -This error refers to the cases wherein the the bus reaches any other location in the qRAM other than the location corresponding to the input address. A wrong path error occurs at level i if the state |j of the active routing qutrit at level i flips to |j ⊕1 and no other errors occur subsequently (at later time steps). The scenario where another error occurs at a later time step in the levels preceding to the j-th level leads to a no-path error which we discuss later. The following two figures illustrate two possible wrong paths for the input address |010 . In Fig. 3, the error is assumed to occur in the third time step, due to which the bus accesses the wrong location corresponding to |011 . In Fig. 4, the error is assumed to occur in the second time step, with the bus wrongly accessing the location corresponding to |000 . In order to calculate the probability of a wrong path occurring, we consider the probability of any path occurring, regardless of whether it is the right or wrong path, we denote this probability by p path . Suppose the state |ψ j is being routed down the qRAM circuit to the j-th level. If any of the (j − 2) first routing nodes have flipped then the state will be routed down an unexpected branch and will not excite the j-th level of the tree, resulting in a no-path. The probability of success at this given time step is therefore (1 − ε) j−1 , where ε is the probability of a node flipping, recall we must include the level-0 root node here. This can only for levels 2 and above. The overall probability of success is therefore the product of each of the individual probabilities of success at each time step (including the time step to send the bus qubit down the tree to recover the information stored in the RAM). This probability is given by: As we computed before the probability of a right path p rp in Eq. (5), the probability of a wrong path is then 3) No-path -This error refers to the scenario where the bus never reaches any location of the qRAM. Such an error arises when a bit flip error occurs in levels 0 to n − 3. The smallest such tree where this error can occur is therefore a three-level tree (corresponding to a qRAM with 2 3 memory cells), as shown in Fig. 5. The difference between a wrong path and a no-path is that, in the latter, the bus photon does not reach the memory address, hence does not read any information, whereas in the former scenario the bus reaches the wrong address in the qRAM and after the un-computing stage, the bus contains the information of some particular address in the qRAM.
We present an example of a no-path error in Fig. 5, for an input address 010. At the first time instant, the first address photon (i.e. |0 ) activates the switch (qutrit) in the first layer of the tree. At the second time instant, the address photon |1 interacts with the switch in the first layer, now in state |0 , to decide the direction in which it has to be routed. Assuming no error during the second time step, the second address photon is correctly routed to the left path. Assume now that at the third time instant, a flip error occurs on the root qutrit, which flips its state from |0 to |1 . The third address photon would then be incorrectly routed to the path on the right. As it can be seen from Fig. 5, at the third time instant there are two activated switches in the second level. The readout bus photon can no longer reach any of the memory locations, and will be lost in the second level of routing tree.
The probability of a no-path event is simply If the qRAM is used to implement a quantum oracle O, then O will be faulty, with an error model described by withÔ denoting a perfect oracle. Here E wp (·) and E np (·) are error channels that corresponds to the wrong path and no-path errors, respectively. Our error model Eq. (9) is less optimistic than the one of Regev and Schiff [16]  main difference is that the latter does not mix the amplitudes of the initial starting superposition state in Grover's search algorithm, whereas our model decoheres the system much faster due to the non-trivial errors E wp and E np . Although we do not have a proof that the quantum query complexity of our model cannot be less than the one considered in [16] (i.e. linear in N ), we conjecture (based on a formal proof for a similar decoherence model, see Appendix A) that this is indeed the case.

B. Asymptotic Behaviour
In Figs. 6, 7 and 8 we analyze the probabilities of the three types of errors discussed in the previous subsection. The parameters of interest are the error probability per gate, denoted by ε, the overall fidelity of the addressing circuit (i.e. the probability of a right-path), denoted by p rp , and the number of levels in the qRAM addressing binary tree denoted by n (corresponding to 2 n memory locations).
For a fixed ε, we see that the no-path behaviour becomes the dominating term in the error model, asymptotically with n, as depicted in Fig. 6. For a fixed n, again the no-path term dominates when the error per gate ε becomes large, see Fig. 7. Finally, for a fixed desired overall fidelity p rp , the maximum allowed error probability per gate ε to achieve the overall fidelity p rp decays exponentially as a function of n, as plotted in Fig. 8. From Fig. 8 it can be seen that, the error rate per gate of O(1/n 2 ) (blue line in Fig. 8) as considered in Giovannetti et al. [4] is more optimistic than our error rate ε(n) (red line in Fig. 8) For larger output fidelity p rp , ε(n) will always be bounded above by 1/n 2 , with the gap between the two increasing as p rp approaches towards 1. Asymptotically in n, the two graphs converge towards zero.
Simply, the difference between our error ε(n) and the one in [4] can best be understood by investigating the series expansion In [4] the authors considered only the first order 1/n 2 as a desirable error rate per gate. However, when the output fidelity p rp approaches 1, this approximation is no longer accurate, and higher order terms are important. As mentioned at the end of Sec. II, inverse polynomial error rates are not good enough in implementing Grover's search with a qRAM-based oracle.
In fact, overall error rates of at most O(2 −n/2 ) are essential.
The dominant no-path error term poses a fundamental implementation problem, due to lack of oracle information, similar (see Appendix A) to the noise model investigated by Regev and Schiff [16]. If in the future, qRAM designs could be constructed without the presence of such a no-path term (i.e. with only wrong-path noise), one can attempt error correction to efficiently reduce the error rate. We demonstrate in Appendix B a possible error correction scheme for a simplified wrong-path term governed by bit-flip channels, then show however that the scheme is not applicable to our errormodel or to the Regev and Schiff error model [16].

IV. CIRCUIT MODEL
To facilitate the discussion of error correction, in this section we reformulate the physical model of bucket brigade qRAM in [4] as a quantum circuit. In Fig. 9 we present a possible circuit description for an N = 2 3 qubit bucket brigade qRAM, in which the memory contains only states in the computational basis {|0 , |1 }. Our circuit is immediately extendable to N = 2 n and closely simulates the physical model 3 proposed in [4].
The circuit description of the bucket brigade addressing scheme accounts for the temporal aspects of the bucket brigade scheme. Namely, since the address qubits are introduced into the binary tree architecture sequentially, the circuit description should respect this ordering. The input to the circuit are the address qubits |a 0 a 1 . . . a n . The circuit resembles a binary tree composed of 2 n − 1 routing nodes, 2 n memory cells and 2 n readout nodes that perform the inverse operations of the routing circuit, used to decouple the qRAM from the address qubits. Additionally, a bus qubit is introduced that interacts with the memory nodes to extract the information stored in the appropriate memory location. It is worth noting that this bus qubit as described may not be physically realistic since it may interact with all the bits in the qRAM. We leave it as such, for simplicity. In practice, if such a non-local qubit is not feasible, one may either work with a phase shift oracle (as described in Ch. 8 of [18]), or one may use a binary-tree circuit to bring the result of the qRAM look-up to a specific qubit that will be accessed by the quantum algorithm that performs the look-up.
The address qubit |a 0 is used to activate the appropriate branch at the first level of the routing. The address qubit is coupled via a CNOT to an ancillary state prepared in the  9. (Color online) Circuit for bucket brigade qRAM. Nodes to the left of the memory cell are routing nodes. The dashed squares represents the memory locations. The first layer of nodes immediately to the right of the memory are the coupling nodes. Finally, the nodes on the right are the read out nodes. A possible input is e.g. |a0a1a2 = |010 , for which the circuit reads the memory location m010. The path leading to the location m010 is represented in blue colour, and the active routing and readout nodes are highlighted. One could more closely mimic the physical flow of information in the bucket brigade qRAM by adding an additional qubit at each node in the binary tree we see in the diagram. Then, for each k = 0, . . . , n − 1, we add an initial controlled-NOT gate to copy a k to the root node, followed by a series of O(2 k ) controlled-SWAPs that will bring the value of a k to the unique node in level k defined by the bits a0, a1, . . . , a k−1 . While this adds exponentially many gates, it does not change the overall gate complexity, and these additional gates only add O(k) to the depth of the circuit. This also illustrates that the exponential depth implicit in the circuit we describe in the diagram can easily be reduced to polynomial depth by further mimicking the ideas presented in the qRAM proposal. We leave the circuit diagram in this simpler form, since it does not affect our arguments in Sections III and V. state |0 . This qubit then serves as one of the input qubits along with an additional qubit prepared in the |1 state for the routing node (a CNOT gate with the first qubit as control). Depending on the state of the address qubit, the resulting twoqubit output of the routing node will have a single excited qubit in the |1 state, which we shall call the activated qubit. The activated branch of the tree governs the routing of the subsequent interactions with the address qubits, playing the role of the routing atom in the case of the bucket brigade outlined in [4].
The two qubits at the exit of the level-0 routing node serve as inputs to the second register of the two level-1 routing nodes. These qubits control which of the routing nodes are activated at the next level of the qRAM binary tree architecture. Namely, the qubit that is excited in the |1 state allows for the coupling between the address qubit and an introduced |0 state ancilla via a Toffoli gate. Therefore the input to the active routing node is either |01 or |11 depending on the state of the address qubit |a 1 . Effectively, the routing operation given by a CNOT gate activates a branch of the tree. For the node that is non-active, the state at the output of the previous level is |0 , meaning the Toffoli is not activated and the resulting input and output state to the routing node remains |00 . Therefore, after two routing node levels, the output of the routing qubits is composed of 2 2 qubits, with only a single branch being excited depending on the state of the first two address qubits |a 0 a 1 . Therefore, this corresponds to an isometry: where the excited output qubits in the |1 state represent an active physical path for the subsequent qRAM operations. This procedure is repeated for n levels, where at the k-th level there are 2 k Toffoli gates and routing nodes. The 2 k Toffoli gates are required to route of the address qubit |a k through the previous k levels and the routing node establish the output states in order to route the subsequent address qubits. Since such a circuit performs the appropriate unitary mapping of the address qubits for all computational basis state inputs, by linearity it will extend to all superpositions of input address qubits. An example of the routing procedure for a three-qubit input address state |010 is presented in Fig. 9, where the blue highlighted nodes correspond to the activated nodes. After the completion of the n routing node levels, memory readout is performed. The reading is performed by introducing a bus qubit prepared in the |0 state which is the target of 2 n Toffoli gates. Each of the 2 n qubits at the output of the qRAM routing nodes pair with one of the memory cells to serve as control qubits for the Toffoli gates. Since only a single output qubit from the routing scheme is activated, only a single Toffoli gate couples with a memory location to the bus qubit. The bus qubit is represented by the bottom qubit in Fig. 9 while the 2 3 memory qubits are represented between the qRAM routing architecture and the bus qubit.
Having completed the coupling of the address qubit, the state of the qRAM routing qubits must be decoupled from the address and bus qubits. Each of the gates from the routing circuit are performed in reverse order, which corresponds to performing the inverse unitary coupling transformation between the address qubits and the routing qubits. The resulting state couples the address qubits with the corresponding memory qubit and has decouples the routing qubits to their input ancillary states.

V. ERROR CORRECTION
The results from Sec. III motivate the need for quantum error correction to be implemented at each node in order to protect against errors that may cause detrimental faults in path information.
A. Imposing a quantum error correcting code In choosing a quantum error correcting code (QECC) to protect the path information that is stored in each node, it is essential to choose an encoding that can be implemented fault-tolerantly, to allow for the generalization to large computational systems. Moreover, the QECC should be chosen such that it can naturally be incorporated from the quantum computer that is accessing the qRAM. In order to analyze the desired error correction properties of a bucket brigade qRAM architecture we consider the circuit presented in Fig. 9. The key gate components at each site are the CNOT and Toffoli gates.
The most natural construction of a QECC that can implement such operations with minimal overhead would be the 15-qubit Reed-Muller code. The reason for choosing such a code would be that decomposing the gate operations in the routing circuit as a sequence of CNOT and Toffoli gates has the advantage that each of these gates can be implemented in a transversal manner. Transversality is defined as the ability to implement a logical gate by applying physical gates that have support at at most a single location per encoded codeblock: it is the most natural way to guarantee fault-tolerance. However, if the quantum computing device leads more naturally to another form of quantum error correction encoding, methods such as state distillation or other schemes for universal faulttolerance can be used [19][20][21][22][23].
The focus of many fault-tolerant implementations are through the CSS code construction [24][25][26]. A CSS quantum code is constructed using two classical error correcting codes, each individually used to address X and Z type errors. Given that any quantum error can be decomposed in terms of a linear combination of Pauli operators, developing an error correcting code that can address both types of errors will be sufficient for the construction of a QECC.
Let C X be a classical error correcting code of length n that has the associated parity check matrix H X , where each 0 in the parity check matrix of the classical code is replaced by the two-dimensional identity matrix I and each 1 in the classical parity check matrix is replaced by the Pauli X operator. Similarly, let C Z be a second classical error correcting code of length n with an associated parity check matrix H Z , where each 1 in the classical parity check matrix has been now replaced by the Pauli Z operator. If C ⊥ X ⊆ C Z then by combining the stabilizers generated from the parity check matrices of both codes, H X and H Z , the resulting stabilizer code forms a QECC. The number of physical qubits in the code is n, the number of logical qubits is given by k X + k Z − n, where k i is the number of logical states in the given classical code i and the distance of the code is at least the minimum of the distance of the two classical codes. One of the many appealing features of the CSS code construction is the transversality of the CNOT gate, a feature of the X and Z stabilizers being independent. A particular example of a CSS code is the 15-qubit Reed-Muller code mentioned above.

B. Number of activations in a CSS code
In the implementation of Giovanetti et al. [4], one of the primary advantages is the number of gate activations that are needed per level of the bucket brigade scheme. More simply, a CNOT (Toffoli) gate in their scheme is "activated" only when the control qubit(s) is (are) in the state |1 . Since only one register is in such a state at a given level, the total number of activations can thus be kept low. In a physical implementation, this is relevant as an activated path may represent the presence of a physical excitation without which no physical process occurs, therefore one can think of these non-activated gates as in fact being the identity operation. However, such an advantage vanishes when imposing a CSS code in order to protect from errors due to the symmetry in the number of |0 and |1 states the logical states encoding the path information.
In the CSS code construction, two classical codes were taken to form a QECC. Therefore, given some codeword of the classical code c ∈ C Z , the equivalent quantum state written out in computation basis |c must be stabilized by the Z generators of the code, by definition of being a codeword of the classical code C Z . However, in order to be a logical state of the CSS code, it must also be stabilized by the elements of the group generated by the X stabilizers. Therefore, the codestate will be the superposition of the application of all X stabilizers upon |c , where {S X,i } are the generators of the X stabilizer group, equivalently given by the rows of the parity check matrix H X .
Consider the form of Eq. (12), given the state |c written in the computational basis, the action of the operator (I ⊗n + S X,1 ) will be the equally weighted superposition of the state |c and S X,1 |c , which will differ at the location where S X,1 has a Pauli X in its description. Therefore, at these locations half of the states in the superposition will have a physical |0 state and half will have a physical |1 state. Then acting upon the state with the operator (I ⊗n + S X,2 ) will have the same effect on all the states in the superposition, with now an even number of physical |0 and |1 states occurring at location with Pauli X in S X,2 . Repeating this for all X generators, any location with a X operator in one of the stabilizers will necessarily have half of the states in the superposition in each of the physical basis states. In order for the code to protect against any arbitrary single qubit error, each physical qubit must be protected by at least one X stabilizer operator with support the given location, otherwise it would be vulnerable to a single Z error at this location. As such, all relevant CSS codesstate will have an equal number of each of the physical basis states when writing out the expansion of the state in the computational basis.
In a physical implementation, such as that of Giovanetti et al. [4], a qubit in the state |1 represents an activated physical process, and as such the advantage of the bucket brigade scheme is that the number of such processes are kept low. However, due to the symmetry in the number of activations that must exist in both the logical ground and excited states, this advantage no longer exists when considering CSS codes. More generally, non-symmetric codes, that is codes where the logical |0 state and logical |1 have a differing number of physical states in the excited state |1 , are not desirable for the purposes of error correction as they will be more susceptible to Z errors. The three-qubit repetition code is an extreme example of such a property.
In principle, for the physical error model discussed in Section III, one can envision using the detection of a photon lost in the routing structure as a means to correct for no-path errors (see Figure 5). However, detecting the exact node at which a photon was lost reveals path information about the state being read by the qRAM (since the previous node in the routing structure would have necessarily been activated by the address qubits) which leads to a loss of coherence in the system. Therefore, any photon detection has to identify the level at which the photon was lost, while not revealing exactly where. It is hard to envisage a practical means for experimentally realizing a photon detection with this property (for example, by somehow symmetrizing the loss of the photon across the exponentially many nodes at a given level). Furthermore, even if this is achieved, one still faces the problem that the lost photon contained path information. Thus, destroying the photon with this path information is equivalent to a dephasing error leading to a further loss of coherence.
In conclusion, if one encodes each node of the bucket brigade qRAM in an error correcting code, then all nodes of the circuit are activated at a physical level, and essentially the qRAM architecture becomes equivalent to a fanout architecture. Even it the latter case, designing a good quantum error correcting code is highly non-trivial. An important issue is that the syndrome measurement should not reveal any information whatsoever about the physical location of the nodes affected by errors. Otherwise, path information is being revealed, which decoheres the system.

VI. CONCLUSIONS AND OPEN QUESTIONS
We analyzed the robustness of the bucket brigade qRAM scheme introduced in [3,4] under an optimistic error model. The primary advantage of the bucket brigade scheme is the need for a polynomial in n (rather than exponential) number of gate activations per memory reading. Yet, we give evidence for the hypothesis that for realistic error models, whenever the qRAM is used as a oracle for quantum searching, its error rate per gate has to scale as o(2 −n/2 ). Such an error rate is exponentially smaller than the error O(1/n 2 ) proposed in [4] (which is sufficient for algorithms with low query complexity), motivating the need for quantum error correction.
We argued that using traditional error correcting techniques offsets the main advantage of the bucket brigade scheme when used with algorithms that make super-polynomially many oracle queries. Since each component of the routing architecture has to be actively error corrected in order to protect against detrimental faults, the overall scheme must then require an exponential number of physical gate activations, even if the number of logical gate activations remains polynomial.
An interesting open question is the existence of a realistic architecture-specific error correction technique that could recover the polynomial number of physical gate activations of the routing scheme while still guaranteeing fault-tolerance. For example, if one tries to use an error correction mechanism whereby one only uses multi-qubit code states along the active path, then one has the problem of extracting syndromes and applying corrections in a way that does not identify which path has the non-trivial syndromes (since such information would lead to decoherence). If in this case, for example, one attempts to extract the syndrome without leaving a trace of which node in a given level it came from, then the problem seems at least as challenging as implementing a reliable qRAM.
Moreover, it would be interesting to investigate whether the requirement for a super-polynomial suppression of the error rate is a characteristic of quantum searching algorithms or a more general feature of faulty oracle query problems. Let us consider the error model considered in [16], withÔ denoting the perfect oracle for quantum searching and let us define as the multi-qubit bit-flip channel where X is a shorthand notation for a tensor product of σ X bit-flip operators acting on some fixed subset of the oracle qubits. The proof technique presented below for D q also applies to the case of multi-qubit dephasing channels). The error model proposed in this paper (see Eq. (9)) is We show that the composition R p • D q resembles (although it is not exactly the same) our error model Eq. (9), for suitable chosen p and q. It follows immediately that Ω(N ) lower bound for the searching algorithm considered in [16] is also a lower bound for the composition R p • D q , since channel composition cannot decrease the query complexity (one can simply incorporate D q into an appropriate unitary for the R p algorithm). A simple calculation yields: We now identify the coefficients in Eq. (A3) and Eq. (A4) and note that for any given probabilities p rp , p wp , p np satisfying p rp + p wp + p np = 1, the system of equations Eq. (A5) has the solution We can therefore write (A7) Comparing Eq. (A3) and Eq. (A7), we observe that the term O( Xρ X † )Ô † is very similar to our wrong path term E wp (ρ) (the error that corresponds to reading out an incorrect memory location). The last term term D q (ρ) in Eq. (A7) is not of the form of our no-path error term E np (ρ), as the latter consists of depolarizing channels of different strengths depending on the position of the address qubit (i.e., the qubits are affected in decreasing order of significance, that is, the first qubit is affected the most, whilst the last one the least). However, D q (ρ) is a decohering term, which seems to be a "weaker" form of noise than E np (ρ). We showed above that even with this weaker de-coherence term the quadratic speedup of any searching algorithm is lost. Therefore we have strong reasons to believe that adding a stronger decoherence term will not lower the quantum query complexity for the quantum searching problem. A rigorous proof of this conjecture remains an open problem.
Appendix B: Error correction schemes

Correcting simple bit-flip errors
We show below that for a qRAM governed by a toy error model of the form the query error rate can be made arbitrarily small by using quantum error correction. HereÔ denotes the perfect oracle and X represents a multi-qubit bit-flip channel (a tensor product of individual bit-flip operators acting on an arbitrary subset of qubits). While such error models are not realistic for the architecture presented in this work, it may be that future designs allow for simpler error propagation. Such schemes could benefit from quantum error correction to sufficiently reduce their error rate to enable Grover search. As Grover's algorithm requires O( √ N ) steps, one desires a target logical error rate of δ = O(1/ √ N ). Since the faulty oracle has an error model that consists of a bit flip channel followed by the perfect oracle call, one can use a quantum error correcting code and apply the oracle in parallel along the qubits composing the code. The parallelism of the oracle calls mimics majority counting and allows for error correction to be performed between logical oracle call steps. For simplicity, we provide an example that corrects against bit flip errors only using the repetition code, however such an analysis could be extended to correct for phase flips using code families such as the color codes [27], higher dimensional Shor codes [28], or triorthogonal codes [29].
For example, consider an oracle of the form |a |b → |a |b ⊕ f (a) , where a, b ∈ {0, 1}. A logical oracle call that uses an n-qubit repetition code behaves as follows for states in the computational basis: where V denotes the isometric encoding. Therefore, given a repetition code of length d, the code corrects for all errors up to d/2 − 1 physical bit flips by majority counting, using non-destructive Z-type stabilizer measurements. Therefore, the logical error rate becomes p L = p d/2 . Choosing d large enough allows the logical error rate to satisfy p L = p d/2 < δ, where δ is the desired target fidelity. Therefore Each of the n address qubits that serve as input to the oracle call must be encoded into a repetition code of length d. Hence, the total number of oracle calls for the complete Grover search algorithm is O(nd √ N ) = O(n 2 √ N ) = O( √ N (log N ) 2 ). As such, there is a logarithmic penalty for error correction, yet the scaling is not linear as in the error model of Regev and Schiff [16].
2. The failure of repetition codes for Regev and Schiff error model The above error correction scheme is not applicable to the error model presented in [16], described by R p (ρ) = (1 − p)ÔρÔ † + pρ, since the failure of an oracle call can lead to an uncorrectable error, as demonstrated below. Consider the following example of the 3-qubit repetition code, where rather than all three oracles calls succeeding, the oracle call on the first set of qubits fails. The computational states evolve as: Consider the action of such a faulty oracle on the encoded state (|000 + |111 )/ √ 2, for f (0) = 0 and f (1) = 1 . The resulting mapping is The syndrome check operators for the repetition code are the parity check operators {Z 1 Z 2 , Z 2 Z 3 }. They are used to determine if an oracle call has failed by measuring the ancilla qubits. However, the measurement collapses the state to either |000 |000 or |111 |011 . Upon applying the appropriate correction based on the measured syndromes, the resulting state becomes either |000 |000 or |111 |111 . Therefore, the logical oracle call has failed, since the correct result must yield the superposition (|000 |000 + |111 |111 )/ √ 2. As expected, the error correction properties of the repetition code are not in violation of the results of Ref. [16], which state that a linear number of noisy black-box oracle calls are required, even with the addition of error correction.

The failure of repetition codes for our error model
Consider the oracle error model: whereÔ is the perfect oracle call while E wp (ρ) and E np (ρ) are the wrong path and no-path terms, respectively. We model the wrong path term as a convex combinations of bit-flip channels followed by perfect oracle calls. An example of one of those terms is the second term in Equation B1. We model the nopath term as taking any input state and mapping it to a fixed state |g , which represents the loss of a qubit to be replaced by any fixed ancillary state. It should be noted that in the no-path case, the readout ancilla state does not change. Consider the action of the noisy channel on the five-qubit repetition code. Each instance of the channel has a certain probability of failure given by the associated weights. Focusing on one particular instance where the first address photon is lost and the second is affected by a bit flip, the resulting mapping on the computational basis states is given by: Again choosing f (0) = 0 and f (1) = 1, a superposition of input states in the computational basis evolves as where P[•] denotes the projector onto its argument. The measurement of the stabilizers of the 5-qubit code on the ancillary states results in the collapse of the state into one of two terms depending on the syndrome measured. Note that the no-path term is the term that destroys coherence, similarly to the error term in the Regev and Schiff model [16].