Quantum Random Access Memory for Dummies

Quantum Random Access Memory (QRAM) has the potential to revolutionize the area of quantum computing. QRAM uses quantum computing principles to store and modify quantum or classical data efficiently, greatly accelerating a wide range of computer processes. Despite its importance, there is a lack of comprehensive surveys that cover the entire spectrum of QRAM architectures. We fill this gap by providing a comprehensive review of QRAM, emphasizing its significance and viability in existing noisy quantum computers. By drawing comparisons with conventional RAM for ease of understanding, this survey clarifies the fundamental ideas and actions of QRAM. QRAM provides an exponential time advantage compared to its classical counterpart by reading and writing all data at once, which is achieved owing to storage of data in a superposition of states. Overall, we compare six different QRAM technologies in terms of their structure and workings, circuit width and depth, unique qualities, practical implementation, and drawbacks. In general, with the exception of trainable machine learning-based QRAMs, we observe that QRAM has exponential depth/width requirements in terms of the number of qubits/qudits and that most QRAM implementations are practical for superconducting and trapped-ion qubit systems.


I. INTRODUCTION
Quantum Computing (QC) has progressed rapidly in the past decade.With the advancement in qubit technologies such as superconducting qubits [1], trapped ion qubits [2], photonic qubits [3], quantum dots [4] and diamond nitrogenvacancy centers [5], implementation of quantum algorithms on quantum computers has become practically possible.This has also enabled the application of quantum computing in various fields such as machine learning [6], finance [7], chemistry [8], cybersecurity [9], and advanced manufacturing [10].A potential game changer in quantum computing is the augmentation of Quantum Random Access Memory (QRAM) that has shown a potential to provide exponential speedup for algorithms such as, Fourier transform [11], discrete logarithm [12], and pattern recognition [13]- [15].QRAM is also a key requirement for important quantum algorithms such as quantum searching of classical database [16], [17], collision finding of hash and claw-free functions [18] and distinctness of elements in a list [19], [20].Along with this, a QRAM can also serve as an important memory element to load classical data into the quantum Hilbert space, compared to simpler methods like amplitude, angle, and basis embeddings [21].
Existing literature on QRAM fails to summarize key aspects of QRAM and explain them in layman's terms which is the objective of this paper.In [22], the authors discuss various QRAMs such as bucket-brigade QRAM, large width small depth QRAM, and small width large depth QRAM but from a fault-tolerance standpoint rather than a fundamental explanatory perspective.An overview of the practicality of QRAM in modern NISQ systems is provided in [23] however, it can be esoteric at times to fully comprehend.We provide a simpleto-grasp review of QRAM for readers interested in diving deep into the field of quantum memories.While complex mathematical knowledge of quantum physics is not required, we do assume that the readers know the fundamentals of quantum computing [24] such as the ket notation, quantum gates, and quantum circuit notation.
This paper is organized as follows: In Section II, we provide preliminaries on quantum computing and the workings of classical RAM.In Section III, we delve into the fundamentals of QRAM, answering key questions about its structure, utility, and requirements.Section IV explores the practical implementation of QRAM, while Section V offers an overview of the challenges in implementing QRAM and its future potential.Finally, we conclude in Section VI.

II. PRELIMINARIES
A. An Overview of Quantum Computing a) Qubits: Qubits, the elementary units of quantum computing, are distinct from classical bits in that they can exist in a superposition of states and represent both 0 and 1 simultaneously.This unique property allows quantum computers to perform multiple computations in parallel, providing the potential for exponential speedup compared to classical computers.In a Hilbert space, a qubit is represented by a twodimensional vector denoted as |ψ = α |0 + β |1 , where α and β the coefficients of the basis states of a qubit.These coefficients are constrained by the normalization condition |α| 2 + |β| 2 = 1, and the probabilities of measuring the state of the qubit in the basis state of |0 or |1 are given by |α| 2 or |β| 2 [24].
b) Quantum Gates: Quantum gates are the fundamental operations that act on qubits in a quantum circuit, akin to how classical logic gates operate on classical bits.These gates include the Pauli-X, Pauli-Y, Pauli-Z, Hadamard, CNOT, and Toffoli gates.They are often depicted as unitary matrices that act on qubit states, maintaining the quantum properties of the system [25].Quantum gates are created and realized physically utilizing a variety of techniques, including lasers, magnetic fields, and microwave pulses [24].c) Quantum Circuit: Quantum circuits are collections of quantum gates that work together to carry out particular quantum computations.Initialization of the qubits is the first step of a quantum circuit.Gate operations, such as multiqubit gates like the CNOT gate and the Toffoli gate, as well as single-qubit gates like the Hadamard and Pauli gates, are used to change the qubits to the required state.Prior to execution, the high-level gates in the circuit, including the Toffoli gate, are disassembled into a native gate set of the quantum hardware (called transpilation).The output of the quantum circuit is then obtained by measuring the qubits using a measurement gate, which converts the quantum state into a classical state [26].d) Quantum Entanglement: When two or more qubits are correlated in a way that prevents one qubit from being described independently of the other qubits, this phenomenon is known as quantum entanglement.This characteristic is critical for the development of effective quantum algorithms and protocols, including quantum teleportation and superdense coding [27].The non-local correlations of entanglement highlight its importance in quantum computing by allowing the execution of tasks that are classically impossible.
e) Quantum Superposition: Superposition is a phenomenon that allows both the computational basis states |0 and |1 to exist in quantum Hilbert space at the same time.A qubit state can be put into superposition using Hadamard (H) gate.If the initial qubit state is |0 (|1 ), then the superposition state becomes after the H gate.We present an example in Fig. 1 to generate a superposition of all the basis states for a two-qubit system.
f) Quantum Algorithms and Applications: The potential of quantum computing has been illustrated by a number of quantum algorithms.Examples include Grover's method for exploring unsorted databases [16], Shor's algorithm for factoring large integers [12], and the quantum simulation algorithms [28].Among other applications, these algorithms have substantial effects on cryptography, optimization, and quantum system simulation.Combinatorial optimization issues can be resolved using variational quantum-classical algorithms such as, Quantum Approximate Optimization Algorithm (QAOA) [29], Variational Quantum Eigensolver (VQE) [30] and Quantum Machine Learning (QML) models like Quantum Support Vector Machine (QSVM) [31] and quantum principal component analysis (QPCA) [6].

B. Classical RAM
Desktop computers can often slow down when running dataintensive applications.To address this issue, one solution is to install additional Random Access Memory (RAM), which can provide a temporary storage medium for the central processing unit (CPU) to retrieve data quickly in any order while executing a program.It is a volatile 'read/write' memory that stores data temporarily while the computer is operational.Left: Depiction of the placement of RAM within the memory hierarchy, highlighting its proximity to the CPU.The RAM's speed can be attributed to this closeness, as it serves as an intermediary between the CPU and auxiliary memory systems.Right: A detailed representation of the various functional components within a RAM, illustrating their organization and interconnections.Memory Array: It is made up of a grid of rows and columns that stand in for memory cells used to store data.One piece of information is stored in each cell.Input Register: During a write operation, it temporarily stores the data that will be stored in the memory array.Output Register: During a read operation, it temporarily stores the data that was read from the memory array.Decoder: This component takes the memory address from the address bus and converts it into row and column coordinates so that it can access the associated memory cell.To demonstrate the flow of row and column signals, arrows from the decoder should point in the direction of the memory array.Control Bus: This transmits read and write enable signals to the memory array to control data access activities.
When the computer is switched off, the stored data is lost due to its volatile nature.RAM is more efficient than hard drive storage for temporary storage due to faster access time.The fundamental capability of any computing device is the ability to store and manipulate information in a series of memory cells organized in an array [32].RAM is the most well-known architecture for such a memory array since it allows each cell to be addressed [33].
A memory array, an input register, and an output register constitute RAM.The memory cells are organized into rows and columns, with each cell holding one bit of data.Data is accessed and manipulated using address lines, data lines, and control lines (read and write enable signals).When the CPU needs to access data from the memory, it sends the memory address through the address lines.Depending on the read or write signal, the data is either retrieved from the memory cell (read operation) or stored in the memory cell (write operation) [34].The contents of a memory cell are recovered and transferred to the output register when the address of that cell is loaded into the address register (a procedure known as 'decoding').A traditional RAM requires effective data storage, retrieval, and manipulation in order to function.The two main types of RAM, Static Random Access Memory (SRAM), and Dynamic Random Access Memory (DRAM), have unique characteristics that determine their use in different applications [35].Fig. 2 illustrates the position of RAM within the memory hierarchy and presents a functional block diagram showcasing its key components and their interactions. In. In.

III. FUNDAMENTALS OF QRAM
A QRAM is a memory element analogous to RAM that is able to store data in quantum format.Similar to RAM, a QRAM has three components, the input (or address) register, the output (or data) register, and the memory arrays.The difference here though is that the input and output registers are composed of qubits instead of bits, while the memory arrays can be either classical or quantum depending on the usage of QRAM [36].For example, for the two fanout QRAM implementations in [37] the optical implementation has 1bit classical memory cells that change the polarization of the output register photons based on the bit value, while the phase gate implementation uses two superconducting qubits in a single memory cell (one for storing information, one for extracting information).Table I shows the difference between RAM and QRAM.Another key difference in QRAM is the way memory access is performed.Rather than accessing a single memory location at a time, QRAM uses superposition to simultaneously access multiple memory locations.This is made possible by leveraging the power of quantum Hilbert space, where all memory addresses are first loaded into superposition.The overall state is then passed through the QRAM to obtain another superposition state, this time with addresses and data combined.Let's say that we have n qubits and consequently N = 2 n address lines.All the addresses will be represented as basis states, from |0 to |N − 1 [36], and are stored in address register r.Each address |i will have amplitude α i , so the effective superposition of addresses will be N −1 i=0 α i |i r .This superposition state is then sent to QRAM and the output is another superposition state, which contains both the address state and the data state picked from data register o.If X i is the data in address i, then the output state of QRAM is Effectively, the storage of data in QRAM can be summarized through the following equation However, retrieving the data can be challenging due to the no-cloning theorem [38].This is generally taken care of by performing entanglement operations between memory cell qubits and output register qubits using gates such as SWAP gate or CNOT gate.
With the aforementioned statements, readers may become curious and ponder over several crucial aspects of QRAM, namely: (i) the motivation behind the need for QRAM: Why do we need a QRAM? (ii) the configuration of QRAM: What is the structure of a QRAM? and (iii) the extent of QRAM's utility and its usage: Where is a QRAM used?In the following sub-sections, we provide answers to these questions.
A. Why do we need a QRAM?
In quantum computing, the fundamental building blocks of computation are quantum states, which can represent information as a superposition of basis states.These quantum states are fragile and sensitive to external disturbances, such as environmental noise and decoherence [39], which can cause them to rapidly lose coherence and become unusable for computation.Therefore, it is crucial to be able to efficiently store and retrieve quantum states themselves in order to execute quantum algorithms.
Classical memory devices are not suitable for storing quantum states since they will require collapsing of the wavefunction with a measurement operation [40].The collapse of the wavefunction destroys the superposition of states and causes the quantum state to take on a singular classical value (either 0 or 1), which can be stored in classical RAM but no longer be valuable for quantum computation.QRAM is a potential solution to this problem as it allows quantum states to be stored and retrieved efficiently without collapsing the superposition of states.This is accomplished by using quantum mechanics to encode information in a way that is resistant to decoherence and other sources of noise [41].This allows quantum states to be stored and retrieved with minimal error, making QRAM an essential component of quantum computing technology.
QRAM can also be potentially useful for loading classical data into quantum Hilbert space.Hybrid quantum-classical optimization algorithms in the field of QML often require the conversion of classical data in Euclidean space (e.g., image datasets like MNIST, Iris, CIFAR-10/100, etc.) to quantum Hilbert space into quantum states.This is achieved using encoding methods such as angle embedding, amplitude embedding, and basis embedding [21].Amplitude embedding embeds 2 n classical features on n qubits, while angle and basis embeddings embed n classical features on n qubits.A problem with these methods, however, is that they are rather simplistic in nature and do not take the complexity of the dataset into account.A QRAM-based loading of data can potentially address the above issue.

B. What is the structure of a QRAM?
Various flavors of QRAM architectures have been proposed as described below: a) Bucket-Brigade QRAM: The very first proposal of a QRAM [36] implemented a bifurcation graph-based structure as compared to the traditional d-dimensional lattice of memory arrays (shown in Fig. 2).It is called bucket-brigade QRAM, and the bifurcation graph for this QRAM is a binary tree with the leaf nodes as the memory cells, and the rest of the nodes as switches to route the address state to the correct cell.Overall, there are three main components of this QRAM: the input register, the QRAM itself, and the output register.Note, input/index/address register and output/data register/quantum bus are used interchangeably in the literature.For ease of understanding, we use the terms input and output registers in this paper.There are primarily two cases to explain how a bucket-brigade QRAM works.First, is when there is only a single address in the input register, and second, is when there is a superposition of addresses in the input register.We explain them in the following paragraphs: Single address case: Let's consider a QRAM that supports two addresses (two qubits) and four memory cells for storage.The bifurcation graph for this QRAM at the start is shown in Fig. 3, with the quantum switches initialized at the wait state, and the four memory cells present at the leaf nodes.Each quantum switch is a three-level system with states |• , |0 , and |1 unlike a qubit which is a two-level system (|0 and |1 ).This three-level system is often referred to as a qutrit and is inspired by the classical three-level system trit, which are generally tri-state logic multiplexers [42].The significance of the wait state |• in each quantum switch is that whenever a qubit state (either |0 or |1 ) is received by the switch, it changes from |• to the received state.This helps to achieve that the next time the same switch receives another qubit state, it will route the qubit state to one of its children's node switches.The wait state ensures that un-accessed memory cells are not disturbed.The direction of routing depends on the state of the qubit.Typically |0 (|1 ) routes the next state to the left (right) child.
Next, we show the example of an incoming address |01 accessing the initialized QRAM.The address state comes from the input register in a sequential fashion from the Most Significant Bit (MSB) to the Least Significant Bit (LSB).Since the address is |01 , the MSB is |0 and the LSB is |1 .Therefore, state |0 is first sent to the root node switch of the QRAM.Since the root node switch is in the |• , it changes state to |0 (Fig. 3.2(a)).Next, the LSB state |1 arrives at the root node switch which routes it to the left child.The left child is then activated to state |1 (Fig. 3.2(b)).In this way, all the address qubits in the input register are used to create a route to memory cell |X 01 .Along with the In. graph-based implementation, we also show the circuit-based implementation of the bucket-brigade QRAM with two address lines and four memory cells (inspired from [43]) in Fig. 4.
After the creation of the route, the data in the output register can either be stored or read in the routed memory cell.In Fig. 3.3, we show the example of reading contents of address |01 (|X 01 ) from the memory cell to the output register via the route.Note that if one wants to store new data, the direction of routing will be opposite i.e., from the output register to the memory cell.
Superposition of addresses: In this case, all the qubits will be present in a superposition state similar to the case shown in Fig. 1.When a qubit in superposition encounters a quantum switch, the switch will also change from |• to superposition state |+ = 1 √ 2 (|0 + |1 ).Because the superposition state has the presence of both |0 and |1 state, the quantum switch ends up activating both the left and right routes.In this way, when all the superposition address qubits arrive on all the quantum switches, the routes to all memory cells get activated (Fig. 3.4(a)).Next, when the read operation on the output register is performed, contents from all the memory cells traverse from all the activated routes and load a superposition of all the data b) Fanout QRAM: A follow-up paper [37] on the original bucket-brigade QRAM work [36] presents architectural implementations of bucket-brigade QRAM along with another QRAM termed 'fanout' QRAM.Fanout QRAM is taken directly from its classical equivalent fanout RAM, where k th address bit controls 2 k switches.Usually, for n-bit binary  Single address case: Let us first take the simple case of single address access, where the memory cell in address |01 (X 01 ) is being addressed.The MSB address state |0 has index 0 and it will control 2 0 = 1 quantum switch, which is the root node switch.The LSB address state |1 has index 1 so it will control 2 1 = 2 quantum switches which are the two child switches of the root node switch.The root node switch will stay at state |0 while the child switches will change state to state |1 (Fig. 5.2).As a consequence of this, all the quantum switches are activated, but only a single complete path from the root node to the memory cell (X 01 in this case) is active.After this, the contents from the memory cell are either updated from or loaded into the output register via the active path (Fig. 5.

3).
Superposition of addresses: Extrapolating the above process to a superposition of addresses, the quantum switches will also be switched to superposition.As a result of superposition, each quantum switch will activate routes towards both of its child switches.We show this in Fig. 5.4.Finally, for a read operation, contents from all the memory cells will traverse all the active routes and the output register will read a superposition of data (similar to Fig. 3.4(b)).Compared to the bucket-brigade QRAM, the fanout QRAM activates O(2 n ) switches for both single address access as well as for accessing the superposition of all addresses.c) Flip-Flop QRAM: A more recent quantum circuitbased QRAM implementation called flip-flop QRAM (FF-QRAM) has been proposed in [44].The FF-QRAM stores binary data in superposition one by one, such that the overall circuit has exponential circuit depth and linear width in terms of the number of address lines (or address qubits).Let's assume there are n address lines and the size of each binary data in an address is m bits.Then, the QRAM circuit will have circuit depth O(2 n ) and circuit width O(n + m).Storing a single data point occurs in three stages: the flip stage, the register stage, and the flop stage.The flip stage is a 'compute' stage that is used to make all the data and address qubit states to |1 that is being stored, the register stage consists of a multicontrolled rotation gate that stores the data in a register qubit, and the flop stage is an 'un-compute' stage which performs the inverse operation of the compute stage on the address and data qubits.
To explain the working of FF-QRAM, consider a twoaddress line QRAM with four address-data pairs with each data point of size 2 bits (n = 2; m = 2).For each of the four addresses, we have the data as shown in Table II, and for each data, we generate its respective rotation angle in two steps, (i) we normalize the data.Given we have the data {2, 3, 1, 1}, the normalization factor will be √ 2 2 + 3 2 + 1 2 + 1 2 = √ 15, and we divide the dataset with the normalization factor, so new normalized dataset becomes 1 √ 15 {2, 3, 1, 1} = {0.51,0.77, 0.25, 0.25}.(ii) We compute the rotation angle for each data using the normalized values.The rotation angle θ k for a datapoint x k with normalized value x k,n is given as θ k = 2arcsin(x k,n ) [45].For the example shown in Table II, the rotation angles will be 2arcsin({0.51,0.77, 0.25, 0.25})= {1.06, 1.74, 0.5, 0.5}.
Once we have the rotation values computed, we can build the FF-QRAM circuit for these address-data pairs.We show the FF-QRAM for our example dataset in Fig. 6.The quantum circuit will have 2 qubits for address lines, 2 qubits for data lines, and 1 qubits for register lines.First, all the address and data qubits are initialized to |0 state and put into superposition using Hadamard gate.After this, the process of storing the data starts.As mentioned earlier, the data is stored one by one in three stages.In the flip stage, which is the compute stage the qubit states of the relevant address and data are flipped to |1 so that the multi-controlled R y rotation gate is triggered to store the rotation of the desired data.This is achieved using classically controlled-NOT gates [44].Basically, when the classical bit value is 0 the NOT gate is activated otherwise the NOT gate is not activated.We present a simpler version of this Generator Discriminator Fig. 7. EQGAN variational QRAM circuit for storing superposition of data from class 0. For storing the superposition of data in class 1, the generator ansatz is slightly different.
gate for ease of understanding as follows: when the classical bit value is 0, we place an X gate and when the classical value is 1, we do not place the X gate.Consider the first address-data pair |00 − |10 in Fig. 6.For address qubits, since both the target address lines are in state |0 , we put an X gate on both the qubits.Similarly, for the data lines, we put an X gate only on the LSB qubit.Next is the register stage where we add the multi-controlled R y gate with the computed rotation angle of 1.06 radians.Finally, we then add the inverse of the flip stage in the flop stage, which will be X gates placed only on those qubits where X gates were placed in the flip stage.The same process is repeated for all the remaining address-data pairs as shown in Fig. 6.The end result of this repetitive process is that the FF-QRAM will have a superposition of addresses and their corresponding data and angle stored in the address, data and register qubits, respectively.d) Entangling Quantum Generative Adversarial Network (EQGAN) QRAM: EQGAN [46] is pure quantum entanglement-based Generative Adversarial Network (GAN) which is PQC-based and has a quantum generator and a quantum discriminator.They both are trained together with a minimax game.For discriminator model D with parameters θ d , generator model G with parameters θ g , real data σ and generated data ρ(θ g ), the minimax problem is given as This EQGAN model is used for variational QRAM as an application, where data points from two Gaussian distributions are stored.The QRAM [46] uses two generators with exponential peak ansatz, one for class 0 and one for class 1 (each class signifies data from one Gaussian distribution), and a swap-testbased discriminator.We show the circuit of this variational EQGAN QRAM in Fig. 7 which stores data from class 0. For class 1 the PQC is nearly the same, with a slight difference in generator ansatz.Using this generator-discriminator setup, in constant O(1) gates the QRAM is able to store data into superposition approximately.Another advantage of this QRAM is observed in a classification task.Without QRAM, training the data on a Quantum Neural Network (QNN) yielded an average 45% classification accuracy, and with the QRAM augmented, the average classification accuracy increased to around 65%.
1 Decompression Fig. 8. Compression and decompression circuits for a 2-3-1 compression scheme [48].The compression circuit compresses the contents of three qubits (A,B,C) in two qutrits (A',B') and generates a free ancilla in state |0 (C').The decompression circuit again reverts the qutrits and ancilla back to the original three qubits.e) Qudits-based memory: Qudits are higher-state quantum units that contain more than two computational basis states.While a qubit in superposition can be represented as |ψ = α |0 + β |1 , the superposition in a qudit with d computational basis states is represented as Recent works such as, [47], [48] propose qudits-based quantum memory where qubits are compressed onto qudits temporarily in their higher states using reversible compression circuits.When unused, the qudits can be used as ancilla bits somewhere else.During computing, the qudits can be reverted back to qubits by performing the inverse operation of the compression circuit.
The authors in [48] define two higher state gates analogous to the X-gate.Let's assume that the input qubit state is |i , then (i)X +t gate performs the operation |i There are also the two-qudit controlled versions of these gates where the control qudit has a reference control state and the target qudit has the gate.They also introduce an x-y-z qudit-qubit compression scheme that is dependent on the radix of the input and output qudits.Here, x is the radix of the input qudits, y is the radix of the output qudits and z are the number of ancilla generated.The compression scheme should follow x a ≤ y b , such that 0 < b < a and a − b = z, where a,b are integers.
x a denotes the number of computational basis states of the input and y b denotes the number of computational basis states of the output.A natural restriction is that the computational basis states of the output should be higher than that of the input.Another restriction is that the number of input qudits a should be greater than the number of output qudits b for enabling compression.As a result of this compression, a total of a − b = z ancilla qubits are generated.
A simple example is the conversion of qubits (d = 2) to qutrits (d = 3).Three qubits can store 2 3 = 8 computational basis states, and two qutrits can store 3 2 = 9 computational basis states.So three qubits can be compressed into two qutrits and the leftover qubit can be generated as an ancilla that can be used in other circuits.For this example, we have x = 2, y = 3, and z = 1, so it is a 2-3-1 compression scheme.We show the compression and decompression circuits  [48].
of this scheme in Fig. 8.The compression circuit consists of controlled X +1 and X 01 conditioned either on |1 or |2 states.
The decompression circuit has the gates of the compression circuit in reverse order with an added difference of having controlled X −1 gates instead of controlled X +1 gates.The truth table of the 2-3-1 compression scheme is shown in Table III.By substituting values of the qubits A, B, C in the circuit and performing higher level qudit operations, it can be verified that the compression yields corresponding A', B' (qutrits) and C' (ancilla in |0 state) entries from the truth table and decompression yields back original values of A, B, and C. f) Approximate PQC-based QRAM: A trainable PQCbased QRAM [49] similar to EQGAN QRAM is proposed that is able to store data in the quantum Hilbert space by training the PQC.Compared to the EQGAN, the approximate PQCbased QRAM does not store data in superposition but oneby-one in sequential order and is able to store more complex datasets such as image datasets like the UCI digits dataset.The approximate PQC-based QRAM is also used for the pure storage of binary data.The detailed PQC of the approximate QRAM is shown in Fig. 9.It consists of an embedding scheme such as angle, amplitude, or basis embedding to load classical data, followed by 3 sets of circular layers and strongly entangling layers respectively.It has been noted that loading images from QRAM and sending them to a QNN yields faster convergence of classification (by 6 th epoch) as compared to loading images without QRAM (around 15 th epoch), and for pure storage the QRAM is able to store 4-bit binary data without any errors.

C. Where is a QRAM used?
A QRAM that is able to store and load data in superposition is very helpful for certain classes of quantum algorithms.
• Database search: Grover's algorithm [16] and its more generalized version Quantum Amplitude Amplification and Estimation (QAE) [17] have been proposed to perform a database search for an element out of n elements with complexity O( √ n).They take data in superposition as input and perform the amplification operation O( √ n) times prior to performing estimation with a reduced number of measurements.
• Element distinctness: Given a set of n elements, the element distinctness problem asks whether all n elements in the set are distinct.Classically it takes O(n log(n)) time . PQC structure of approximate PQC-based QRAM.In the given context, 'C' symbolizes the control qubit, while 'T' stands for the target qubit.
while quantum algorithms such as [19] solve it in O(n 3 ) time.
• Collision detection: Collision detection is an important problem in cryptography.Given a collision function H, the collision detection problem asks to find two distinct inputs x and y such that H(x) = H(y).Quantum versions of the collision detection problem such as [18] report O(n ) runtime where n denotes the cardinality of the domain of collision function.
• NAND tree evaluation: In this problem, a Boolean expression is solved using a tree of NAND gates.For an input of size n, quantum algorithms such as [50] propose a runtime of O( √ n).• Quantum forking: In classical operating systems, forking is the process of creating a child process from a parent process which is a copy of it, while retaining the parent process.Quantum forking is a similar idea, where the QRAM output superposition state is forked on ancilla qubits and then both the original state and forked state are multiplied with the same or different unknown unitaries.The new states then undergo a swap-test procedure to verify if the unitaries applied are the same or different [44], [51].• Storage of classical data: As mentioned previously, works such as [46], [49] use a PQC-based QRAM circuit to store classical data such as data from a normal distribution, images, and binary data into quantum Hilbert space by training the PQC like a machine learning model.

IV. PRACTICALITY OF QRAM
Follow-up paper [37] on [36] provide possible physical implementations of bucket-brigade QRAM and fanout QRAM.We first explain these implementations followed by implementation details on the FF-QRAM, qudits-based storage, and trainable PQC-based QRAM.We also show a detailed tabular comparison of different QRAMs in Table IV.
a) Bucket-Brigade QRAM implementation: For physically implementing the bucket-brigade QRAM, the authors in [37] incorporate (i) address qubits in the input register as photons that can be sent sequentially and (ii) the qutrits as trapped atoms inside cavities.The qubits encoded in the photons traverse the cavity by encountering the trapped atombased qutrits.The three states of the qutrits are realized as three different energy levels, with the |• being the lowest energy state, with two higher energy levels |zero that is coupled with the left spatial path i.e., to the left qutrit along the bifurcation graph and |one that is coupled to the right spatial path to the right qutrit.This coupling is represented using further higher energy states |← (for left spatial path) and |→ (for right spatial path).We show the energy diagram of the qutrit switches in Fig. 10.Initially, all the qutrits are initialized to the lowest energy state |• .When the first photon traverses through the cavity and reaches the root node switch, it gets absorbed into the higher energy state of the qutrit, either |zero or |one thereby changing the state of the qutrit depending on the quantum state encoded in the photon.This process is often referred to as the Raman transition, where a photon is scattered by a molecule, resulting in a change in the energy of the photon and the vibrational state of the molecule [52].This is achieved with the help of strong laser fields [53] that help in changing the state of the qutrit from |• to |zero if the photon state is |0 and from |• to |one if the photon state is |1 .After this, when the second photon arrives at the root node switch it once again gets absorbed and undergoes a Raman transition, but this time either from |zero to |← or |one to |→ and will be remitted to the qutrit along the correct spatial path based on the state of the qutrit (|zero : left path, |one : right path).In this way, all the photons of the input register set the qutrit switches one by one until a path from the root node switch to the desired memory cell is created.The output register then either loads contents from the memory cell or stores new data in it via the created path of qutrit switches.Once the load/store operation is complete, all the qutrits starting from the last node to the root node undergo a final Raman transition sequentially to go back to |• state.
A recent work [43] proposed a quantum circuit-based implementation of the bucket-brigade QRAM.For n address

Feature
Bucket-Brigade QRAM [36] Fanout QRAM [37] Flip-Flop QRAM [44] Qudits-based memory [48] Approximate PQC-based [ lines, the quantum circuit requires O(n) qubits for address, O(2 n ) ancilla qubits for incorporating the quantum switches, O(2 n ) qubits for memory cells and one qubit for readout of the memory cell.We show an implementation of quantum circuitbased bucket-brigade QRAM for two address lines and four memory cells in Fig. 4 where memory cell in address |01 is being accessed.First, |a 1 = |0 changes the state of the first ancilla qubit which then changes the state of the next ancilla qubit.Based on the output, the path is then routed to the left child switch, where |a 0 = |1 is used to switch the right ancilla qubit to |1 state.Finally, a set of Toffoli gates with ancilla qubit as one control and the memory cell qubit as another control are used to perform readout.Depending on the address state, only the Toffoli gate controlled by its corresponding memory cell will be triggered.In this case, the Toffoli gate corresponding memory cell |m 01 is triggered to perform a readout operation on the readout qubit.b) Fanout QRAM implementation: Two implementations, namely optical implementation and phase gate implementation have been proposed for the fanout QRAM [37].Understanding the implementations in the original paper may be challenging, as it assumes knowledge of optical and cavitybased quantum systems.
In the phase gate implementation, (i) the address qubits in the input register are photons, and (ii) the quantum switches are also photonic qubits trapped inside microwave cavities.Overall, for n address qubits there are O(2 n ) microwave cavities with each cavity containing a photonic qubit.As mentioned earlier, the k th index qubit fans out and controls 2 k quantum switches.This is achieved using conditional phase shifters.The MSB address qubit will only polarize the root node photon inside the microwave cavity via the conditional phase shifter attached to it.The next address qubit will polarize two child photons via a conditional phase shifter.This continues until all the photons inside the microwave cavity are polarized.As a result of this, a resonant path will be created from the root cavity to the desired memory cell.Each memory cell consists of two superconducting qubits, such that one is for storing information, and one is for extracting information.The contents of the memory cell are then transferred back to the output register using a SWAP gate via an outgoing photon from the memory cell with the help of the extraction qubit.
Next, we discuss the optical implementation.Here, (i) the address qubits are atoms trapped in a magneto-optical trap and (ii) the quantum switches are photonic qubits that hit the trapped atomic address qubits one by one.When the first quantum switch photon hits the first address qubit inside the trapped atom, the trapped atom acts as a controller for changing the polarization state of the photon.This photon then passes through a polarization beam splitter and a half-wave plate to transfer this information to another spatial degree of freedom and create two spatial modes.The two spatial modes will be two photonic quantum switches for the next address qubit.Once again, each spatial mode will transfer the state of the address qubit via a change of polarization and create two new modes.This continues until 2 n spatial modes are created, one for each memory cell.Out of these, only one spatial mode will be active depending on the address, and the contents of the desired memory cell corresponding to the active spatial mode are swapped out with the contents of the output register using a SWAP gate.c) EQGAN QRAM implementation: Since EQGAN QRAM is a quantum circuit-based QRAM, it can be implemented on superconducting and trapped ion qubits.The authors in [46] implement the EQGAN QRAM on 5 qubits of Google's Sycamore superconducting processor such that the readout qubit (top qubit in Fig. 7) is the center physical qubit and the rest of the qubits are physically coupled with the readout qubit in the shape of a (+) sign on a grid of qubits.
d) Qudit implementation: Qudits are implementable on physical quantum systems that have an infinite spectrum of states, like superconducting qubits (magnetic flux spectrum) [54], trapped ion qubits (energy band spectrum) [55], and Orbital Angular Momentum (OAM spectrum) based photonic qubits [56].For example, in bucket-brigade QRAM, the qutrit switches are implemented using trapped atoms in a cavity, with the |• state at a lower energy level and |zero and |one states at a higher energy level.
e) Approximate PQC-based QRAM & Flip-Flop QRAM implementations: Similar to the EQGAN QRAM, since both of these QRAMs are quantum-circuit based they can be implemented on superconducting and trapped ion qubits.With the quantum circuit known, the QRAM architectures can be replicated on known quantum computing platforms such as Qiskit [57] from IBM, Pennylane [58] from Xanadu, IonQ [59] and many more.The users can replicate the quantum circuit and send it either for simulation on a noiseless/noisy simulator (better for approximate PQC-based QRAM [49] as it is iterative), or run it on actual quantum hardware (better for FF-QRAM [44] as it is non-iterative).

V. CHALLENGES AND FUTURE DIRECTION
In this section, we examine the current limitations and future directions of various QRAM architectures and the challenges.Some of the common challenges include: • Scalability: Scalability is a major challenge in QRAM designs due to constraints in qubit interactions, quantum memory, and coherence.Increasing memory elements in bucket-brigade, fanout, and FF-QRAMs leads to exponential growth in circuit width and depth.Thus, scalability remains a significant hurdle for large-scale QRAM implementations.• Noise resilience: Noise resilience is a crucial challenge in QRAM architectures, as quantum systems are sensitive to environmental noise.In various QRAM types, increasing memory elements results in higher circuit depth and qubit count, making the system more vulnerable to noise.Bucket brigade QRAM is comparatively more noiseresilient than fanout QRAM [41], while FF-QRAM is susceptible to noise with increasing address lines.PQCbased QRAMs have constant circuit depth but are still prone to noise-related errors, affecting performance on real hardware versus simulation.• No-cloning theorem: The no-cloning theorem [38], [60], a fundamental quantum mechanics principle, prohibits exact copying of unknown quantum states and poses challenges for various QRAM designs.In bucket brigade and fanout QRAM, the theorem limits duplication of quantum states during memory readout.Solutions like CNOT or SWAP gates are available, but the no-cloning theorem still complicates error correction and redundancy schemes in most QRAM designs, presenting a significant challenge [23].• Instability of qudits: Qudit instability primarily affects qudit-based quantum memory, where qudits are quantum systems with d > 2 levels.While qudit-based memory can store more information than qubit-based systems, higher qudit states are unstable and prone to errors [61], [62].For example, the energy gap between higher states in superconducting qubits is less [1].This issue is not directly relevant to qubit-based QRAM designs, but incorporating qudits for increased storage would introduce similar challenges related to qudit instability.• Limited applicability: Some QRAM architectures face limitations due to their novelty, experimental difficulties, or specific focus.For example, FF-QRAM has limited applicability beyond quantum forking due to its targeted design.Similarly, qudits face challenges arising from limited research and increased complexity compared to qubits.Addressing these challenges is essential for advancing broader applications in quantum computing.
While current QRAM designs face the above challenges, ongoing research strives to overcome them.Several recent works have made significant progress in the implementation of bucket brigade QRAM.In one study [63], researchers construct a circuit implementation of the aforementioned QRAM, demonstrating that when used with classical data, it can quickly and repeatedly prepare arbitrary quantum states once the data is already present in memory.Another work [64] discusses the parallelization of queries in a bucket-brigade QRAM, showing that the parallelization method is compatible with surface code quantum error correction.In theory, faulttolerant bucket-brigade QRAM queries can be performed at speeds comparable to classical RAM.A separate article [43] addresses the robustness of bucket brigade QRAM, revealing that when quantum error correction is applied to the bucket brigade QRAM circuit, the circuit loses its advantage of having a small number of active gates, as error correction operates on all of its components.
The precise evaluation of the hardware expenditure associated with QRAM designs, especially in the realm of fault-tolerant systems, may constitute a significant subject of forthcoming research [23].It is reasonable to anticipate that when compared to conventional surface code implementations [65], the hardware expenses and intricacy will be substantially reduced owing to the noise resilience inherent in bucketbrigade QRAM and the implementation of low-overhead fault tolerance techniques utilizing qubits.While there have been notable advancements in hardware efficiency, it remains a challenge to develop a QRAM capable of addressing millions or billions of individual memory elements in the near future.Exploring applications where smaller QRAMs can provide value and conducting tailored resource estimations for these use cases could be key for future progress and development.

VI. CONCLUSION
Quantum Random Access Memory (QRAM) serves as a specialized form of memory that enables direct access and manipulation of quantum states, thereby facilitating expedited and efficient data retrieval and storage within quantum systems.Unlike conventional RAM structures that store information in classical bits, which are incompatible with quantum systems, QRAM operates on the principles of quantum computing.This enables QRAM to store and manipulate quantum data effectively, resulting in considerable acceleration of known quantum algorithms.This review provides a thorough assessment of QRAM, emphasizing its importance and practicality within the context of contemporary quantum computing.We explain the fundamentals of quantum computing and conventional RAM, before delving into the foundations of QRAM.Five notable types of QRAM designs are outlined, including bucket-brigade QRAM, fanout QRAM, flip-flop QRAM, qudits-based quantum memory, and approximate PQC-based QRAM.By comparing these diverse architectural approaches and carefully analyzing their implementation, the feasibility of QRAM is thoroughly explored.The analysis concludes by discussing the primary challenges associated with QRAM development and future directions.
Fig. 2.Left: Depiction of the placement of RAM within the memory hierarchy, highlighting its proximity to the CPU.The RAM's speed can be attributed to this closeness, as it serves as an intermediary between the CPU and auxiliary memory systems.Right: A detailed representation of the various functional components within a RAM, illustrating their organization and interconnections.Memory Array: It is made up of a grid of rows and columns that stand in for memory cells used to store data.One piece of information is stored in each cell.Input Register: During a write operation, it temporarily stores the data that will be stored in the memory array.Output Register: During a read operation, it temporarily stores the data that was read from the memory array.Decoder: This component takes the memory address from the address bus and converts it into row and column coordinates so that it can access the associated memory cell.To demonstrate the flow of row and column signals, arrows from the decoder should point in the direction of the memory array.Control Bus: This transmits read and write enable signals to the memory array to control data access activities.

Fig. 3 . 1 √ 2 (
Fig. 3. Working of a bucket-brigade QRAM with 2 address lines and 4 memory cells. 1 Initial state of the QRAM, all quantum switches are initialized to |• state which is a waiting state where the quantum switch waits for incoming qubit states of the memory address to be accessed.2 Input register activates switches for output register to access data in address |01 (|X 01 ).The address qubits are sent in a sequential top-down fashion starting from the Most Significant Bit (MSB) all the way to the Least Significant Bit (LSB).In the example shown, first MSB qubit |0 is sent that changes the state of the root quantum switch a , followed by the LSB qubit |1 that routes the switch to the direction of the memory cell |X 01 b .3 Output register reads data |X 01 via route of activated quantum switches.4 Superposition of all addresses turning on all quantum switches a to read superposition of all the data b .Note that |+ = 1 √ 2 (|0 ) + |1 )., In.: Input register, Out.: Output register.

Fig. 4 .
Fig. 4. Circuit-based implementation of a bucket-brigade QRAM.Data in memory cell m 01 with address |01 is being accessed via a series of CNOT and Toffoli gates performing intermediate computation on ancilla qubits.Note that the CNOT gates highlighted in red are the ones getting activated and the red path represents the active route of the QRAM.

Fig. 5 .
Fig. 5. Working of a fanout QRAM. 1 Fanout QRAM initialization with all quantum switches initialized to |0 state. 2 Address qubits in the input register controlling the state of their respective quantum switches and creating a path from root node switch to the desired memory cell X 01 .3 Data in memory cell X 01 being accessed in output register via the active route of switches.4 Superposition of addresses switching on all routes to access contents of all memory cells.

1 2 3 i=0
|X i on the output register.Compared to a classical RAM, the advantage provided by bucket-brigade QRAM is that for n address lines the classical RAM requires O(2 n ) transistor activations for accessing data in a single address, while the QRAM takes only O(n) quantum switch activations.Furthermore, at a comparable classical cost of O(2 n ) quantum switch activations, the QRAM can read data from all the addresses.
MSB is considered 0 th address bit and the LSB is considered n − 1 th address bit.The quantum version of the fanout RAM has k th address qubit controlling 2 k quantum switches.A difference between the quantum switches of bucket-brigade QRAM and the fanout QRAM is that while bucket-brigade QRAM requires qutrits, the fanout QRAM requires only a two-level system so qubits are used as the quantum switches.Initially, all the quantum switches are initialized to |0 state.Next, the address qubits present in the input register are used to change the state of the quantum switches.All the quantum switches connected to an address qubit in state |0 will remain at state |0 while the ones connected to an address qubit in state |1 will change their state to |1 .To explain the functionality of the fanout QRAM, we once again consider a QRAM with two address lines and four memory cells.The bifurcation graph for the QRAM with the quantum switches initialized to |0 state is shown in Fig.5.1.The input register like the previous case can contain either a single address or a superposition of addresses.

Fig. 10 .
Fig. 10.Energy levels of trapped atom-based qutrit switches in bucketbrigade QRAM. 1 Initialized state of qutrit. 2 First incoming photon getting absorbed and changing the state of the qutrit and routing it either in |zero or |one direction based on the state of the qubit encoded in the photon.3 Subsequent photons getting absorbed to |← or |→ and remitted to the next qutrit based on the state of the previous qubit.

TABLE I A
COMPARISON OF CLASSICAL RAM AND QUANTUM RAM.

TABLE II CREATION
OF DATASET WITH ROTATION ANGLE FOR FF-QRAM.

TABLE III TRUTH
TABLE FOR 2-3-1 COMPRESSION SCHEME

TABLE IV TABLE
OF COMPARISON BETWEEN DIFFERENT QRAM TECHNOLOGIES.