Scalable and High-Fidelity Quantum Random Access Memory in Spin-Photon Networks

A quantum random access memory (qRAM) is considered an essential computing unit to enable polynomial speedups in quantum information processing. Proposed implementations include using neutral atoms and superconducting circuits to construct a binary tree, but these systems still require demonstrations of the elementary components. Here, we propose a photonic integrated circuit (PIC) architecture integrated with solid-state memories as a viable platform for constructing a qRAM. We also present an alternative scheme based on quantum teleportation and extend it to the context of quantum networks. Both implementations rely on already demonstrated components: electro-optic modulators, a Mach-Zehnder interferometer (MZI) network, and nanocavities coupled to artificial atoms for spin-based memory writing and retrieval. Our approaches furthermore benefit from built-in error-detection based on photon heralding. Detailed theoretical analysis of the qRAM efficiency and query fidelity shows that our proposal presents viable near-term designs for a general qRAM.


I. INTRODUCTION
Random access memory (RAM) is a fundamental computing unit that allows on-demand storing and retrieving data. While a classical RAM addresses one memory cell in the database per operation, a quantum RAM permits querying a superposition of multiple memories [1]. Given a superposition of addresses j, the 'qRAM' returns a correlated set of data D j : α j |j a |D j b (1) where N is the number of memory cells and the subscripts a and b denote the address and bus qubits, respectively. One efficient implementation of qRAM proposed by Giovannetti, Lloyd, and Maccone (GLM) [1,2] is the 'bucket-brigade model': a binary tree of memory nodes that direct the bus qubit to the data layer. Each preceding layer i in a tree of depth n represents the register k i of the address |j = |k 1 k 2 ...k n−1 k n , which sets the path leading to the corresponding memory cell D j (Fig. 1(a)).
Principally, these memory nodes must (1) store an address register qubit that (2) routes ensuing qubits for addressing and retrieval. The register |k i sets layer i's internal state that governs routing of the subsequent registers {|k i+1 , |k i+2 , ...}. A qRAM query thus performs a sequence of alternating state transfer and routing operations, with each register qubit determining how the node routes the subsequent register. Once the binary tree has been programmed by the state of address qubits, j α j |j a , it is traversed by the bus photon |↓ b to access the memory cells {D j } in superposition. The bus qubit travels back up the tree and addresses are mapped onto the returning register qubits to disentangle them-selves from the nodes, producing the qRAM output state |ψ out . The ability to perform this operation in log(N ) time steps highlights the advantage of quantum parallelism and offers polynomial speedups in quantum algorithms for applications such as quantum machine learning [3], matrix inversion [4], quantum imaging [5], and quantum searching [6].
Despite its mathematical elegance, proposed implementations of qRAM have not been experimentally demonstrated. The existent proposals are based on neutral atoms [2,7,8] and superconducting circuits [9], but still requiring elementary components to be realized. Here, we introduce a scheme that assembles separately demonstrated technologies into a photonic integrated circuit (PIC) architecture integrated with artificial atoms. Namely, the system contains a high-fidelity frequency beam splitter [10][11][12], nanocavities strongly coupled to long-lived spin memories [13,14], and a scalable nanophotonic Mach-Zehnder interferometer (MZI) array [15]. Importantly, the protocol relies on a cavityassisted controlled-phase (CZ) gate [16] whose heralding inherently provides the ability to detect qubit loss. We estimate our PIC implementation of the GLM scheme to achieve efficiency of kHz query rate for a qRAM containing > 10 2 memory cells. Furthermore, we propose an alternative approach based on quantum teleportation. This teleportation scheme enables scaling to 10 5 memories and still achieving >kHz query rate. More importantly, the protocol's framework applies to quantum networks that require no additional modifications. Thus, our study provides a promising blueprint for building a general qRAM essential for quantum information processing. (c) For our implementation, each tree node is a Λ-atom coupled to a single-sided nanocavity whose resonant frequency ωc is tuned to the average of the two atomic transition frequencies, ω0 and ω1, which are separated by a Zeeman splitting ∆. For layer 1, the register |k1 sets the node's internal state to |ψA = α1 |↓ + β1 |↑ that routes the successive register |k2 . Two essential operations are (d) the setting mode via cavity reflection and (e) the routing mode.

II. ARCHITECTURE
In our PIC implementation, the address register and the bus qubits are frequency-encoded photons |ψ P = α |ω 0 +β |ω 1 prepared by a frequency beam splitter [10][11][12] shown in Fig. 1(b). They arrive at each node in the binary tree and interact with a cavity-coupled atom, which has two spin states |↓ and |↑ . Both states are coupled to an excited state |e with respective transition frequencies ω 0 and ω 1 shown in Fig. 1(c). In this proposal, we specifically consider diamond's negatively charged silicon-vacancy (SiV − ) center strongly coupled to a single-sided cavity [13,14]. By having the cavity resonance ω c equally detuned from the two transitions, i.e. ω 0,1 = ω c ± ∆/2 where ∆ is the Zeeman splitting between the spin states, the resulting Fano interference satisfies the following conditions: upon a cavity reflection, the photon acquires no phase shift when it is reso-nant with the atomic transition; otherwise, it receives a π phase shift (see App. A).
This spin-dependent phase shift enables the two operation modes necessitated by the bucket-brigade model: the photonic qubit "setting" the spin state ( Fig. 1(d)) and the spin qubit routing the subsequent register qubits ( Fig. 1(e)). The cavity interaction enables a CZ gate for heralding a quantum state transfer between the photonic and the spin qubits, as shown in Fig. 2(a). The very same phase dependence on the atomic state also allows quantum routing by leveraging the cavity system as an interferometer.
Setting mode The circuit representation of a quantum state transfer operation that maps the register qubit |ψP onto the atomic qubit |ψA . (b) In the setting mode, the photon undergoes a CZ operation to complete quantum state transfer. After passing through the MZI, the |ω0 component resonantly couples to the add-drop filter that imparts a π phase shift upon reflection off the mirror, while the |ω1 component interacts with the atom-cavity system and acquires a spin-dependent phase shift. (c) In the routing mode, the MZI is set to a 50:50 beam splitter, and the top waveguide of the add-drop filter is decoupled such that the ring resonator imparts a π/2 phase shift to the |ω0 component upon a single pass. After cavity reflection, the returning photon re-interferes with itself and is routed to either the |↓ path with probability |α| 2 or the |↑ path with probability |β| 2 .
Explicitly in the PIC platform, each node comprises an MZI, an add-drop filter resonant with the ω 0 component, and a single-sided nanocavity coupled to an SiV − center. First, in the setting mode, the atom is initialized in a superposition state |ψ A = (|↓ + |↑ )/ √ 2 by a Hadamard operation. Fig. 2(b) shows the register qubit |ψ P = α |ω 0 + β |ω 1 arriving at the MZI and exiting out of the top output port. An add-drop filter then di-rects the ω 0 component to a mirror (e.g. Sagnac loop reflector) such that |ω 0 acquires a π phase shift upon reflection regardless of the spin state. On the other hand, the ω 1 component continues down the path and reflects off the atom-cavity system, acquiring a spin-dependent phase shift. Finally, the ω 0 and ω 1 components recombine and undergo a Hadamard transformation by a frequency beam splitter before heralding the completion of quantum state transfer. It is essential for the detection system to be shared by all the qRAM layers at the root of the tree. A local detection would otherwise unveil the path information and thereby collapse the superposition of addresses. In other words, all the register qubits must reflect off the qRAM nodes and return to the root to preserve entanglement between the spin qubits and the address paths.
After the photon detection, the MZI is switched to a 50:50 beam splitter and the tunable add-drop filter is turned "off" such that the ring resonator only imparts a π/2 phase shift to the ω 0 component upon a single pass (see App. B). Hence, the photon acquires a spindependent phase shift independent of the frequency component. Illustrated in Fig. 2(c), the subsequent register qubit |k 1 arrives at the 50:50 beam splitter. One of the MZI output ports connects to the same path as before, while the other leads to a mirror. As a result, the photon taking the former route acquires a spin-dependent phase shift from interacting with the cavity while one taking the latter route always acquires a π phase from reflecting off the mirror. The returning photon then interferes with itself at the beam splitter and is routed to an exit port depending on the spin state. With |α| 2 probability, the photon exits out of the top path corresponding to the |↓ spin state; and with |β| 2 probability, it travels down the bottom path corresponding to the |↑ spin state. Effectively, the beam splitter in conjunction with the atom-cavity system constitute an MZI with the spincavity system acting as a phase shifter.
Both the setting and routing operations are repeated alternatingly, carving out the path for the bus qubit to arrive at the desired memory cells. The data can be transferred onto the bus qubit with the same cavity reflection scheme by reversing the role of the photonic and the spin qubits, followed by a projective measurement on the atom. Finally, the sequence is run backwards to disentangle the binary tree from the address qubits, leaving the data qubits |D j correlated with their respective addresses |j .

A. Fidelity
In our cavity-assisted scheme, qubit loss is a heralded error. Therefore, a sequence of successful photon detection guarantees the absence of infidelity stemming from photon loss in the qRAM output. Here, we analyze imperfections in the atom-cavity system that critically affects quantum state transfer as the primary sources of infidelity in our protocol, since any inexact mapping from the register qubit to the spin qubit would result in faulty routing of the subsequent registers. To characterize the setting fidelity given an input register |ψ P = α |ω 0 + β |ω 1 , we calculate the resultant spin state |ψ A after heralding via a Schrodinger picture evolution: where r on (r off ) is the on-resonance (off-resonance) cavity reflectivity and r m is the mirror reflectivity.
Its overlap with the target state |ψ A = α |↓ + β |↑ defines the state transfer fidelity F, of which we take the average over six representative states |φ i (axes of a Bloch sphere) [17,18]: where The setting mode's performance relies on the cavity's coupling strength to the output waveguide mode. When the waveguide-cavity coupling is unity, i.e. κ wg /κ = 1, the cavity reflection solely determines the transfer fidelity that scales as (C − 1)/(C + 1) in the large cooperativity limit [19,20]. However, for any reduced κ wg /κ < 1, the need to balance losses becomes especially important. For example, for a desired state |φ 3 where α = β = 1/ √ 2, balancing losses entails matching the moduli of the on-and off-resonance cavity reflectivities r on ∝ κ wg (C − 1)/(C + 1) and r off ∝ κ wg /κ (see App. C).
In Fig. 3, we analyze F as a function of κ wg /κ, C, and δB, which is the deviation from the optimal magnetic field B opt ∝ γκ (2C + κ (κ − κ wg ) /4 − γ 2 /4) for the suitable Fano line-shape (see App. A). For each point in the fidelity contour, a particular value of r m is chosen to optimize the fidelity assuming the mirror is tunable. When δB = −20%, Fig. 3(a) indicates that only a selective range of C 20 and κ wg /κ ∈ {0.83, 0.98} result in F > 0.995. However, as the magnetic field deviation reduces to −10% from the optimum, the transferred state fidelity can exceed 0.999 for a selected range of C and κ wg /κ. Fig. 3(c) shows that at the optimal magnetic field, i.e. δB = 0%, the transfer fidelity well exceeds 0.999 for any C > 20 and κ wg /κ > 0.94. Interestingly, a small region of cooperativities C < 20 and κ wg /κ < 0.94 can still achieve F > 0.999 by carefully balancing losses. However, the tolerance to a varying C diminishes as κ wg /κ decreases. As δB approaches 10%, however, the setting fidelity can no longer reach 0.999. Its disparity with δB = −10% stems from the asymmetry exhibited by Fano interference (see App. A).

B. Efficiency
Next, we analyze the qRAM efficiency by first calculating the success probability of heralding each register qubit |k i and then the average rate of completing a single query call. Recall that for the bus qubit to reach the memory layer in an n-level qRAM, each register photon |k i must travel to the node in layer i ∈ {1, ..., n} and return to the detector after cavity reflection. Given a propagation loss η p , the probability of completing the round-trip without loss is e −ηpL(i) , where L(i) is twice the distance between the layer i and the root node. However, since the photon can scatter off the single-sided cavity and the mirror into non-waveguide modes, interaction at each layer further reduces the probability of detecting the returning register qubit by R cav and R m , which represent the cavity and mirror reflection coefficients, respectively. We take their mean reflection coefficient and define the setting efficiency as η s = η det (R m +R cav )/2, where η det is the detection efficiency. Similarly, the routing efficiency for each layer i would be η r = R cav assuming lossless transmission through the interferometric coupler. As a result, the probability of successfully heralding each register |k i is: To calculate the success rate, we must now include both the round-trip travel time to each layer i denoted as   and v g,PIC (v g,dmd ) are the travel distance and group velocity in the PIC (diamond) waveguide. The average time until a successful query call can be found by using the linearity of expectation value. For example, the expected time for a 2-level qRAM is: where τ reset = 5 µs is the spin reset time. The first term on the right-hand side is the case of no photons being lost, thus its expected time is simply the product between the success probability of two consecutive heralds p 1 p 2 and the total travel time t 1 +t 2 . The next term represents the case of the k 1 register photon being lost before detection with probability 1 − p 1 . Consequently, the average query timeT n=2 is penalized by the additional time t 1 + τ reset . Similarly, if the k 1 photon is heralded but the subsequent register k 2 is lost with probability p 1 (1 − p 2 ),T n=2 is lengthened by t 1 + t 2 + τ reset . Solving forT n=2 yields: The expression can be treated as a summation of each layer's round-trip time weighted by its correspond geometric mean, subtracted by τ reset since the final trial is a successful run without the need to reset. We can generalize the average time for a n-level qRAM: Finally, the query rate is then: shows the qRAM query rate as a function of the number of memories N memories = 2 n for different waveguide-cavity coupling κ wg /κ = 0.95, 0.965, 0.98, 0.995. As N memories increases, the rates roll off polynomially on the log-log scale since the success probability p succ diminishes super-exponentially with increasing n (see App. F). Furthermore, p succ intimately depends on the cavity reflection coefficient R cav ∝ κ wg /κ, causingΓ to vary drastically with the waveguide-cavity coupling. For example, the difference between κ wg /κ = 0.95 and κ wg /κ = 0.995 exceeds more than an order of magnitude for N memories > 10 2 , and the disparity grows exponentially as the circuit depth n increases. The unforgiving drop-off in the success rate emphasizes the need for a highly over-coupled single-sided cavity in our protocol.
On the other hand, our cavity-assisted scheme's builtin loss detection enables a slight boost in success rate. For a scheme without such loss detection, the qRAM must complete the entire sequence of setting and routing all n register qubits before needing to reset, assuming qubit loss has occurred and been detected after the query. The corresponding success rate would be: In contrast, our protocol periodically checks for register losses via photon detection. Therefore, time can be saved by halting and immediately resetting the spins as soon as quantum state transfer fails to herald. Note that the gain in rate, however, depends on the ratio between travel time t i and τ reset . Fig. 4(b) shows a modest increase in success rate for our scheme with t i < 1 µs and τ reset = 5 µs relative to one without loss detection. If τ reset t i , the slight improvement in efficiency would dwindle asΓ converges toΓ no LD .
Lastly, due to the need to balance losses to achieve high transfer fidelity as noted in Sec. II A, there exists an inevitable fidelity-rate trade-off. Given a qRAM containing 2 6 memory cells, Fig. 4(c) shows that F reaches its maximum at κ wg /κ ≈ 0.97. However, the success rate still increases monotonically with κ wg /κ even past this optimum fidelity point. The waveguide-cavity coupling regime in which the trade-off exists narrows with higher atom-cavity cooperativity, since both |r on | and |r off | increase with C and κ wg /κ. Nonetheless, at C = 100 (which has been experimentally demonstrated in Ref. [13,14]), the success rate can already exceed 1 kHz while maintaining high fidelity F > 0.999.

III. TELEPORTATION SCHEME
While the aforementioned scheme is viable for a lowdepth qRAM, the need to sequentially set each address register via cavity reflection inhibits scaling up to 10 6 memories due to photon loss from cavity interaction. Here, we present an alternative approach that writes the address registers onto all the layers simultaneously via quantum teleportation. Crucial to this step is the ability to perform high-fidelity two-qubit gate operation locally between an electron spin (broker qubit) and its neighboring nuclear spin (memory qubit). We assume > 0.99 gate fidelity to be easily achievable via composite pulses and optimal classical control [21].
Let us suppose the qRAM is spatially separated from a quantum computer (QC) that holds the list of query addresses j α j |j a . Each register |k i lives in a nuclear spin that is a long-lived memory qubit and is accompanied by an electron spin acting as a broker qubit |ψ a,QC . The electron spin is remotely entangled with another broker qubit |ψ a,qRAM in the qRAM via photon-assisted Bell state creation (see App. G 1). All the nodes (except the leftmost node that is entangled with the QC) within each layer i in the binary tree are first initialized as a GHZ state: Then, a local SWAP operation between the nuclear and electron spins (see App. G 2) in each layer's leftmost node produces GHZ states spanning both the QC and the qRAM, as depicted in Fig. 5(a).
Subsequently, each register qubit undergoes a local Bell state measurement (BSM) followed by conditional Pauli transformations, as illustrated in Fig. 5(b). As a result, the query addresses are teleported onto the qRAM for all the layers simultaneously (Fig. 5(c)). Prior to sending the bus qubit to the qRAM, all the nodes undergo a SWAP operation between the memory and the broker qubits, resulting in the final entangled network shown in Fig. 5(d). Local bell state measurements (BSM) and subsequent Pauli transformations teleport the query addresses onto the binary tree (c) Then, in each node, the memory (red circle) and the broker (gray circle) qubits undergo a SWAP operation, leaving (d) the qRAM ready for the data retrieval process. (e) After the bus qubit has completed querying, the registers are swapped back onto the memory qubits. (f) After the ancillary qubits are remotely entangled, local SWAP operation prepares entanglement between QC's memory qubits (blue circles) and the qRAM. (g) Local BSM in the qRAM then teleport the query addresses back onto the QC, returning (h) the binary tree to its original state.

QC qRAM
The data retrieval process remains the same as before. Starting from the root node, the bus photon propagates down the binary tree and is routed based on the state-dependent cavity reflection at each layer. After which, the addresses are swapped onto the memory qubits ( (Fig. 5(e)), followed by generating remote entanglement between |ψ a,QC and |ψ a,qRAM (( Fig. 5(f)). Then, a local SWAP operation entangles the QC's memory qubits with the qRAM. Finally, local BSMs for all the qRAM layers teleport the query addresses back onto the QC (( Fig. 5(g)), returning the binary tree in its waiting state for subsequent queries (( Fig. 5(h)).
Importantly, the proposed architecture extends beyond a PIC platform and can be run on a quantum network, in which each network node represents a tree node in the qRAM. Distillation can be used to generate high-fidelity Bell states [22], which are then joined to form the GHZ states in the same fashion as heralding entanglement links in a quantum repeater. The protocol's modularity effectively allows the qRAM query to act as a subroutine for distributed quantum computing.

A. Efficiency comparison
Here, we compare the efficiency of the two proposed schemes. The teleportation approach, similar to the GLM scheme, still requires restarting the query procedure if the bus photon is lost during the retrieval step since the path information is revealed by the environment. Despite which, the rate of success for the teleportation scheme still scales much more favorably than the GLM approach. Fig. 6 compares the query efficiency between the two approaches. For small circuit sizes < 10 2 memories, the GLM scheme achieves higher success rates since the process of generating GHZ states and remote entanglement links is more costly in time than directly transferring the registers sequentially. However, as the qRAM depth increases past the crossover region with ∼ 10 2 − 10 3 memories, the GLM scheme's efficiency rolls off rapidly.
On the other hand, the teleportation scheme's success rate decreases relatively slowly. Its efficiency is primarily constrained by the retrieval step that succeeds with probability ∝ η n r , as opposed to ∝ η n(n−1)/2 r η n s in the GLM scheme. Its favorable scaling is conducive to increasing the circuit size for general-purpose applications such as quantum machine learning [3]. Our efficiency simulations (see App. G 5) show that the teleportation-based approach can theoretically achieve an average >kHz query rate for a qRAM containing 10 5 memories.

B. Query fidelity
One potential drawback of the teleportation approach is its requirement to prepare a GHZ state, whose decoherence rate increases linearly with its size. Here we consider the worst case where the entirety of the binary tree is active, meaning all possible addresses are used. Assuming the coherence times of the electron [23] and nuclear spins [24] to be 10 −2 s and 10 s, respectively, we estimate the infidelity caused by decoherence to be < 10 −1 for N memories = 10 3 (see App. G 7). Engineering a 12 C-rich environment [25] could further improve the coherence times and thereby reduce the infidelity.
Other sources of infidelity include depolarization, measurement errors, and imperfect two-qubit interaction between nuclear and electron spins. To simplify the discussion, we combine all types of errors into one collective "physical error rate" . We propose having interconnects interspersed between the layers that allow for arbitrary routing (see App. G 6). As a result, only the necessary number of nodes are activated and the teleportation scheme still adheres to the bucket-brigade model. Hence, the infidelity caused by physical errors is still O(log(Nmemories)) [1]. However, for applications that require querying most addresses, the physical error rate could quickly decohere the qRAM since the infidelity rapidly grows as 1 − F q ∝ (1 − ) 2 n −1 for a circuit depth of n. Assuming a physical error rate of = 10 −4 and n = 10, the query infidelity is already ∼ 10 −1 . Therefore, scaling up the qRAM necessitates further exploration in converting each tree node to a logical qubit and adapting quantum error correction [26,27].

IV. CONCLUSION
In summary, we introduced a qRAM implementation in a PIC platform integrated with solid-state spin memories. Our numerical simulations show that our architecture can achieve > 0.99 fidelity with >kHz query rate for a qRAM containing 10 2 memory cells. Moreover, our cavity-assisted scheme relies on heralding the requisite operations, thereby providing built-in qubit loss detection that further improves the query efficiency. Although high success rates demand a sufficiently over-coupled cavity to the waveguide, existing photonic crystal cavity designs [28][29][30] already show that they can reach near-unity coupling. We stress that our architecture is technologically feasible given rapidly advancing electro-optic platforms [31,32] and experimentally shown large-scale integration of artificial atoms in PICs [33].
Additionally, we proposed an alternative scheme based on quantum teleportation that allows for efficiency scaling favorably with the circuit size. With sufficiently strong cavity-waveguide coupling, the teleportation approach enables >kHz query rate for a qRAM containing 10 5 memories, a size unattainable by the conventional approach. We emphasize that the protocol is modular and can be applied to a quantum network, in which each net-work node acts as a tree node in the qRAM. The nodes would again be entangled via heralding, which removes qubit loss as a potential error.
The architecture also extends to other atomic memories: quantum dots [34] and rare-earth ions [35] strongly coupled to nanocavities, and even trapped-ions [36] and neutral atoms [37] suitable for creating large GHZ states. With rapid advancements in constructing high-fidelity atom-photon interfaces, our proposal presents a scalable design of a general qRAM in the NISQ era. The reflectivity of a single-sided cavity coupled with a quantum emitter is: where g is the atom-cavity coupling strength, γ is the emitter's spontaneous emission rate, κ is the cavity's total decay rate, κ wg is the waveguide-cavity coupling rate, and ∆ a = ω a − ω and ∆ c = ω c − ω are the atomic and cavity detuning from the probe, respectively. In the large cooperativity C = 4g 2 /κγ 1 limit and considering a perfectly over-coupled cavity, the reflectivity of an onresonance probe ∆ a = ∆ c = 0 simplifies to Therefore, r approaches +1 when C increases, whereas a far off-resonance emitter decoupled from the cavity mode would yield r → −1. In our cavity-assisted scheme, the photonic qubits are encoded in the frequency basis {ω 0 , ω 1 }. By appropriately choosing the atomic and cavity detuning, the resultant Fano interference can satisfy the following truth table, whose entry represents the probe's acquired phase from reflecting off the nanocavity: |↓ |↑ |ω 0 0 π |ω 1 π 0 This can be satisfied by demanding the reflectivity to be +1 when the spin state is on-resonance and −1 when it is off-resonance. Using Eq. S.1, we arrive at the following equation: We let the cavity resonance centered at the average between the two transition frequencies: ω c = (ω 0 + ω 1 )/2. Therefore, given the Zeeman splitting ∆, the cavity detuning would be half of the spin driving frequency: Similarly, the atomic detuning would exactly equal the splitting: ∆ a = ∆. In the Purcell regime, Eq. S.3 leads to the following condition: Therefore, given a fixed set of atom-cavity parameters {g, γ, κ, κ wg }, we may set the corresponding magnetic field B opt that satisfies the appropriate Zeeman splitting ∆ ∼ µgB opt / where µ = q /2m e is the Bohr magneton and g≈ 2 is the Lande g-factor.  FIG. S1. Cavity reflectivity as a function of probe frequency. The normalized probe frequency ω/κ is centered at the cavity resonance (black dashed line) ωc. The magnetic field is appropriately chosen such that the two atomic transition frequencies ω0 and ω1 coincide with the cavity reflectivity maximum r = +1 and minimum r = −1. The reflectivity when (a) the spin is in the |↓ state is the mirror of when (b) the spin is in the |↑ state.

Appendix B: Frequency-dependent add-drop filter
To perform both the (1) setting and (2) routing operations, the add-drop filter must resonantly couple to only the ω 0 component to impart (1) a π phase shift upon reflection off an mirror and (2) a π/2 phase shift through a single pass after decoupling the resonator from the mirror waveguide. The system can be modeled by tracking the evolution of the field propagating through the MZI (or interferometric) couplers [38]. As illustrated in Fig. S2(a), the outputs of the MZI couplers are: where T (n) = C (n) Z (n) C (n) for n = {m, i}. The matrices C (n) and Z (n) are transfer matrices that describe the beam splitter and the interferometer arms: where ν n represents the coupling to the throughwaveguide, Ψ nT and Ψ nB are the phases accumulated in the phase shifter and the resonator arms, respectively. For the remainder of the section, we assume a balanced interferometric coupler such that ν n = 1/ √ 2. Explicitly, we can write the MZI transfer matrix as: where φ n (ω) = k(ω)∆L n + ∆φ n and k(ω) = (n eff /c)ω 0 + (n g,PIC /c)(ω − ω 0 ). Here, ∆L n is the path length difference between the two arms and k(ω) is the propagation constant governed by the effective and group indices in the PIC, n eff and n g,PIC , respectively.
where φ c (ω) = ψ iR + φ im + ψ mR + φ mi = k(ω)L c is the phase acquired in the resonator, and ζ n = ν 2 n − e iφn (1 − ν 2 n ). For the routing operation, we wish to have s m = s m+ = 1 (correspondingly s out = 0) such that the ω 0 component is entirely directed to the mirror. In Fig. S2(b,c), we plot the output intensity |s m | 2 and |s out | 2 as a function of ∆φ i and ∆φ m set by the phase shifters in the MZI couplers. In order to maximize |s m | 2 , we find that the phases must satisfy the condition: It is equally essential for the resonator to have a sufficiently high quality factor (Q) such that the linewidth is narrow enough to only couple to the ω 0 instead of both frequencies. For the simulations presented in the main text, the Zeeman splitting is assumed to be ∼ 12 GHz, which implies that the Q must be > 10 4 to resolve between ω 0 and ω 1 . In Fig. S3(a), we find that κ is smallest at ∆φ i = ±π, which corresponds to the resonator completely decoupled from the input waveguide (source) and cavity leakage is maximally suppressed. Similarly, when ∆φ m = 0, the ring (source) is completely decoupled from the mirror waveguide. As long as ∆φ i is sufficiently close to π, Fig. S3(b) indicates that the resonator linewidth is sufficiently smaller than the Zeeman splitting of ∼ 12 GHz. For example, at ∆φ i = 0.95π such that ∆φ m = 0.05π, |s m | 2 is approximately unity and hence satisfies the setting mode. In the routing mode, we only need to minimally shift ∆φ m to 0 such that |s out | 2 = 1 and |s m | 2 = 0, as indicated by the drastically varying region near ∆φ i = π and ∆φ m = 0, as shown in Fig. S2(b,c). With ∆φ m = 0 fixed, we validate that the narrowness of the resonator linewidth as illustrated by Fig. S3(c). κ is expectedly smaller in the routing mode than the setting mode since the resonator is decoupled from the mirror waveguide, thereby having one fewer leakage channel.
Lastly, we can appropriately choose ∆φ R , which is the phase shifter within the resonator, such that traversing through the resonator imparts a π/2 phase to the ω 0 component upon a single pass. In a round-trip, |ω 0 effectively undergoes a Pauli X gate, rendering the truth table: The atom is first initialized in a superposition of the two ground states: |ψ A = (|↓ + |↑ )/ √ 2. With the incoming frequency-encoded photonic qubit, |ψ P = α |ω 0 + β |ω 1 , the joint (unnormalized) photon-atom state is: The add-drop filter resonantly couples to only the ω 0 component that then reflects off a mirror, acquiring π phase shift regardless of the atomic state. On the other hand, the ω 1 component interacts with the atom-cavity system and acquires a spin-dependence phase shift. After the CZ operation, the photon and the atom are entan-gled: The returning photon then goes through a frequency beam splitter that performs a Hadamard gate. After which, the two frequency components are routed to different photon detectors: Upon heralding, the atom undergoes another Hadamard gate to complete quantum teleportation: The end result is: if ω 1 is detected neglecting global phase. Note that an additional Pauli-Z operation is needed if ω 1 is detected. Now, let us consider an imperfectly over-coupled single-sided cavity with waveguide-cavity coupling κ wg /κ < 1. We denote r off and r on as the off-and on-resonance cavity reflectivities, and r m as the mirror reflectivity. Assuming the interferometric couplers are lossless in the add-drop filter, the photon-atom entangled state is then: |ψ = αr m |ω 0 , ↓ + αr m |ω 0 , ↑ + βr off |ω 1 , ↓ + βr on |ω 1 , ↑ (S.5) After the Hadamard on the photon: The additional Hadamard on the atom would yield: If the register qubit is |ψ P = (|↓ + |↑ )/ √ 2 such that α = β = 1/ √ 2 and we assume |r m | = 1, detection on the ω 0 port would herald the state: Since sgn(r on ) = 1 and sgn(r off ) = −1, we see that |ψ ⇒ |↓ + |↑ requires |r on | = |r off |, which hints at the need to "balance" these two reflectivities. Eq. S.1 dictates that r on ∝ κ wg (C −1)/(C +1) while r off ∝ κ wg /κ such that only a suitable regime of {g, γ, κ, κ wg } would maximize the quantum state transfer fidelity as shown in Fig. 3.

Spin-to-photon
Once the bus qubit retrieves the data from the memory layer, we must extract the address out of the qRAM to obtain the correlated output state j α j |j a |D j b . By sending additional photons, we can perform quantum state transfer that maps the spin qubits onto the photonic qubits. Similar to the heralding procedure for transferring the photonic states to spin qubits, the spins must undergo projective measurements to complete the spin-to-photon mapping. While it is feasible to perform single shot readout on one spin, it is experimentally difficult to simultaneously perform projective measurements on multiple spins within one layer. The issue can be circumvented by introducing an ancillary photon that is entangled with the spins for each layer, and heralding on such photon equates to performing projective readout on the spin qubits.
After data retrieval, the spin holds the routing state |ψ A = α |↓ + β |↑ . The incoming photon initialized in the superposition state (un-normalized) |ψ P 1 = |ω 0 1 +|ω 1 1 interacts with the cavity, producing the output state: After a Hadamard operation on the spin qubit, the entangled state becomes: We then send a subsequent photon |Ψ P 2 = |ω 0 2 + |ω 1 2 that will entangle with the spin qubit for performing the projective measurement. Similarly, the composite state undergoes a CZ operation upon cavity reflection, resulting in: Another Hadamard operation on the second photon would produce an entangled state: As a result, any projection on the frequency-encoded photon is a projective measurement on the spin as well. If |ω 0 2 is detected, the effective projection onto |↓ results in the transferred state onto the first photon. Instead, if |ω 1 2 is detected, an additional π-pulse would be applied to the first photon to construct α |ω 0 1 + β |ω 1 1 . Imperfections in the cavity system would be treated in the same fashion as the previous section by taking account non-unity reflectivities: r on , r off , r m .

Appendix D: Quantum routing
In the routing mode, the MZI in Fig. 2(e) is tuned to operate as a 50:50 beam splitter whose unitary matrix is denoted as B. Let a, b be the annihilation operators for the top and bottom spatial modes such that a † |0 a |0 b = |1 a |0 b represents one photon present in the top waveguide and no photon in the bottom waveguide. The MZI provides the following unitary transformation on the operators: Assuming input from strictly the top waveguide, our initial state is |φ 0 = |1 a |0 b = a † |0 a |0 b . After passing through the MZI, the state becomes: At this point, recall that the photon exiting out of the bottom output inherits a π phase shift upon a reflection off the mirror. The photon exiting out of the top output receives either no phase shift or a π phase shift depending on the spin state. Therefore, the cavity system effectively acts a phase shifter controlled by the spin qubit. We can denote the unitary transformation of the atom-coupled cavity system (in conjunction with the resonator) as P aP † = ae iφ . Note that it is only acting on the top waveguide and has no effect on b. As a result, the photonic qubit after reflection off the mirror and the cavity system becomes: Lastly, the photon returns to and interacts with the MZI once again: If the spin is in the down state |↓ , the photon acquires a π phase shift. However, because the mirror reflection imparts a π phase shift as well, the relative phase φ between the two arms is effectively zero. Hence, the output would all go to the top path, i.e. the spatial mode |1 a . On the other hand, if the spin is in the up state |↑ , a π relative phase is acquired in the interferometer, resulting in an output going to the bottom path, i.e. the spatial mode |1 b .
Appendix E: PIC implementation Fig. S4 illustrates a more detailed schematic of our PIC implementation for each tree node. Specifically, a circulator is appended so the incoming photon can be routed to the children nodes as opposed to returning to the root.

Appendix F: Success probability
For the bus qubit to reach the memory layer in a n-level qRAM, each register photon must traverse to layer i < n. Therefore, considering a propagation loss of η p (see Table S1), the probability of reaching layer i is e −ηpL(i) , where L(i) is the distance between the said layer and the  root node. Since the photon can scatter off the singlesided cavity and the mirror, interaction at each layer reduces the probability of detecting a returning register photon by R cav and R m , which represent the cavity and mirror reflections, respectively. If we define the setting efficiency as η s = η det (R cav + R m )/2 and the routing efficiency as η r = R cav , the probability of completing each layer i is then: A successful qRAM query would consequently occur with a probability that is the product of all the layer probabilities: Expectedly, Fig. S5 shows a polynomial roll-off in the success probability p succ as the number of memory cells N memories = 2 n increases. Since the waveguide-cavity coupling κ wg /κ mainly determines the cavity reflection, p succ can differ by orders of magnitude and the difference increases with N memories .

Appendix G: Teleportation scheme
Essential to the setup of the teleportation scheme is to create a GHZ state for each layer prior to quantum teleportation. Below, we break down its creation process into 3 critical steps: photon-assisted Bell state creation, Bell state swap between nuclear (memory) and electron (broker) spins, and GHZ state creation by joining adjacent pairs. After which, we explain how a Bell state measurement can be made on two remotely entangled spins via the photon-assisted cavity interaction. Lastly, we provide an example of how teleportation enables transferring addresses onto the qRAM.

Photon-assisted Bell state creation
In order to create a Bell state between neighboring matter qubits, a photon is sent to reflect off each cavity consecutively. Importantly, the node is in the "setting" mode such that reflection off the cavity system generates a CZ gate. Here, we provide an example of how a photon interacting with two cavities aids construction of a Bell state between the two spin qubits. We begin with the photonic and the spin qubits prepared in the |+ state such that composite state is: where the subscripts 1 and 2 denote different spins. After the photon reflects off the first spin qubit coupled to the cavity, the state becomes an entangled state: Upon reflecting off the second cavity system, it produces the state: A Hadamard operation on the photon leads to the final state: If the ω 0 detection port clicks, the Bell state |Φ + = |↓↓ + |↑↑ is heralded. On the other hand, if the ω 1 port registers a click, the Bell state |Ψ + = |↓↑ + |↑↓ is created. An Pauli X gate can be applied to the second spin qubit to transform |Ψ + to |Φ + . Multiple pairs of adjacent tree nodes can simultaneously undergo the aforementioned evolution to create Bell states. Then, the entangled spin qubit pairs can be linked by the same procedure. As opposed to having a single photon reflecting off all the nodes across each layer to create a GHZ-like state, a process that inevitably suffers from exponentially decaying success probability, the pairwise creation protocol described here is much more efficient.

Bell state swap between electron and nuclear spins
Electron Nuclear CNOT  Fig. S6(a) shows two electron spins eL and eR entangled in a Bell state: |00 e + |11 e . Let the nuclear spins initialized in the ground state |0 nL/nR . A CNOT operation where eL acts as the control and nL as the target yields an effective GHZ state: |0 nL |00 e + |1 nL |11 e . Then, an X measurement on eL disentangles the electron spin from the GHZ state, leaving the final state |ψ : Similarly, a CNOT operation between eR and nR produces |0 nL |0 eR |0 nR ± |1 nL |1 eR |1 nR . A subsequent X measurement on eR then leaves a Bell state between the nuclear spins: |ψ = ( 0| ± 1|) eR (|0 eR |00 n ± |1 eR |11 n ) (S.7) = |00 n ± |11 n (S.8)

GHZ state creation
Now, we assume two adjacent pairs of nuclear spins, {n1, n2} and {n3, n4} are entangled in a Bell state, as shown in Fig. S6(b). n2 and n3's corresponding electron spins are also entangled in a Bell state via a photonassisted interaction. We first consider the composite state including n1, n2, eL, eR after a CNOT operation between n2 and eL, in which n2 is the control and eL is the target: |ψ = |00 n |00 e + |00 n |11 e + |11 n |10 e + |11 n |01 e (S.9) = (|00 n |0 eR + |11 n |1 eR ) |0 eL + (|00 n |1 eR + |11 n |0 eR ) |1 eL (S.10) where |ij e = |i eL |j eR . A subsequent Z measurement on eL followed by a conditional Pauli transformation on eR yields a GHZ state: |00 n |0 eR + |11 |1 eR . Then, similarly, a CNOT operation between n3 and eR followed by a Z measurement on eR yields the final GHZ state (conditional Pauli transformation on the nuclear spins):

Teleportation
We present here an example of mapping 2-register addresses j α j |k 1,j k 2,j onto a 2-level binary tree. Suppose the query addresses compose the superposition state, α |00 + β |01 + γ |10 + δ |11 , where each register represents the state of the corresponding node at each tree level. We consider the formalism that the atomic state |0 routes the subsequent qubit to the left branch, and |1 to the right. For an instance, the address |01 means the root (level 1) node is in the state |0 and the left node of level 2 is in the state of |1 . S7. A 2-level qRAM is first entangled with a remote QC. Local BSMs in the QC complete quantum teleportation of the query addresses onto the binary tree. The memory layer is not shown in the schematic for simplicity.

QC qRAM
Each layer in the qRAM is initialized as a GHZ state, e.g. |0 + |1 / √ 2 where |ĩ = |ii...i . Importantly, the first register of each GHZ state belongs to an ancillary qubit in the QC, as shown in Fig. S7.
The un-normalized composite state would then be: where the subscripts 1 and 2 denote the layer number. The state can be re-written as: Bell state measurements for each layer would then project the composite state into one of the 16 possible combinations. Followed by conditional Pauli transformations, the query addresses are finally teleported onto the binary tree.

Efficiency simulations
The teleportation scheme includes 4 steps: (1) initializing the entanglement links, (2) teleporting the addresses to the qRAM, (3) querying, and (4) teleporting the addresses back to the QC. We perform event-based simulations to estimate the time of completing all four steps.
In step (1), all the nodes except the leftmost node within each qRAM layer are entangled to form a GHZ state. During its creation process, pairs of the nearest neighbors are first entangled by heralding, with success probability p ep = η path η 2 s η det (see App. II B). If the entanglement attempt fails, the spins undergo reinitialization for τ reset = 5 µs. If it succeeds, the electron spins (broker qubits) are swapped with their respective nuclear spins (memory qubits), an operation which we assume to take t e→n = 16 µs. Then, the unlinked neighbors are subsequently entangled in the same fashion. To reduce computational costs, we assume the rate is limited by the largest layer and only simulate its GHZ state creation process.
Simultaneously in step (2), we attempt to generate entanglement between the QC's broker qubit and the qRAM's leftmost node for each layer. Once the entan-glement link is generated, the electron and nuclear spins are again swapped. In simulation, we take the maximum between the time to generate a GHZ state and the time to produce QC-qRAM Bell state. Once both states are constructed, the leftmost node is entangled with the GHZ state composed of the remaining nodes within the same layer. Then, a local BSM is made between the address register and the QC ancillary qubits. To fairly compare the teleportation scheme's efficiency with the GLM scheme, we neglect the physical distance between the QC and the qRAM in Fig. 6.
In step (3), a bus photon arrives at the root node of the binary tree and is routed to the memory layer with the query success probability p i for an i-level qRAM. Finally, in step (4), a QC-qRAM Bell state is constructed again for each layer with probability p ep , followed by local BSMs on the leftmost nodes in the qRAM.
In Fig. 6, the simulation data are plotted along with their analytical fits. Recall that the GHZ states are produced by linking multiples of Bell pairs. If each Bell pair creation succeeds with probability p, it would take a geometric mean of 1/p attempts. In the case of p = 1, the GHZ state creation process would merely be a two-step process. For example, for a layer with 4 nodes, nodes 1 and 2 as well as nodes 3 and 4 are entangled in the first time step. Then, nodes 2 and 3 are entangled to complete the GHZ state creation. However, with a non-unity p, the GHZ state creation is ultimately limited by the pair that fails the most number of times. In other words, the rate is mainly determined by the outlier. We fit the guessed model f (N ) = aN −b multiplied with the analytical rate (based on geometric mean) to the simulation data, where N is the number of nodes within the largest layer. The coefficients a, b capture the outlier's scaling with the circuit depth. Their fitted values averaged over the considered κ wg /κ ratios are summarized in Table S1.  Within each interconnect layer, a network of MZIs is classically controlled to direct the single photons to either the subsequent cavity or the detection system for heralding during GHZ state creation. It is then switched to a transparent state during the data retrieval step.

PIC interconnect
In contrast with the GLM scheme, the teleportation scheme requires greater connectivity in the qRAM. Each node is not only connected to two children nodes in the next layer, but also to the rest of the nodes in the same layer. Here, we detail its PIC construct. Importantly, as shown in Fig. S8(a), the architecture requires interconnect layers interspersed between the binary tree layers. Additionally, a photon detection system resides between each neighboring pair. Assuming the single photons are propagating in one direction, i.e. incoming from the right of each layer, the detector would register photons after they interact with the cavities to its right.
Within each interconnect layer, MZI switches are classically controlled to enable routing the single photons to individual cavities. The cavity depicted in Fig. S8(b) is the same construct shown in Fig. S4. To entangle two neighboring nodes, each tree node first operates in the setting mode. A single photon reflects off the first cavity and is directed to the second cavity via a circulator. After entering the second node through the MZI and reflecting off the cavity, the photon is again routed to an MZI switch via a circulator. Except now, the switch directs the photon to the detector for heralding a Bell state creation. We stress here that the interconnect layer enables beyond nearest neighbor connection. Therefore, given prior knowledge of the query addresses, the architecture provides the ability to only entangle the necessary nodes and reduces state infidelity. After the addresses are teleported from the QC to the qRAM, the cavity nodes are changed to the routing mode to direct the bus qubit to the memory layer at the bottom of the binary tree. In this step, the interconnect layer is essentially transparent by having the photon bypassing the circulators.

Infidelity from decoherence
We define the query fidelity as the fidelity of the prepared tree state. To calculate infidelity caused by decoherence for each layer, we take the decoherence rate γ d to be proportional to N t e→n /T 2,n/e , where N is the number of nodes and t e→n is the approximate entanglement time. We assume perfect single qubit rotations, readout, and setting fidelity by optimally balancing losses (see App. II A). We only consider the effect of decoherence caused by continuous dephasing and neglect other physical errors such as imperfect nuclear-electron spin interaction. In Fig. S9(a), at N memories = 10 3 , the query fidelity drops to near F q = 0.5, suggesting the prepared tree is no better than a maximally mixed state. Improvements on the nuclear and electron spin coherence times by an order-of-magnitude can increase the fidelity to F q > 0.9, as shown in Fig. S9(b).