Random access codes via quantum contextual redundancy

We propose a protocol to encode classical bits in the measurement statistics of many-body Pauli observables, leveraging quantum correlations for a random access code. Measurement contexts built with these observables yield outcomes with intrinsic redundancy, something we exploit by encoding the data into a set of convenient context eigenstates. This allows to randomly access the encoded data with few resources. The eigenstates used are highly entangled and can be generated by a discretely-parametrized quantum circuit of low depth. Applications of this protocol include algorithms requiring large-data storage with only partial retrieval, as is the case of decision trees. Using $n$-qubit states, this Quantum Random Access Code has greater success probability than its classical counterpart for $n\ge 14$ and than previous Quantum Random Access Codes for $n \ge 16$. Furthermore, for $n\ge 18$, it can be amplified into a nearly-lossless compression protocol with success probability $0.999$ and compression ratio $O(n^2/2^n)$. The data it can store is equal to Google-Drive server capacity for $n= 44$, and to a brute-force solution for chess (what to do on any board configuration) for $n= 100$.


Introduction
Redundancy in classical and quantum information is generally used towards error-correction and data compression.It allows efficient schemes to protect [1,2] or compress [3] classical data.In quantum systems, different strategies based on classical redundancy [4,5] or non-local storage of information have been proposed for compressing [6] and error-correcting [7,8] quantum data.
Redundancy can arise from certain types of quantum measurements.
As noted by the Kochen-Specker theorem [9], if we define a measurement context with a closed set of commuting observables, not all imaginable outcomes are possible.The outcomes are correlated, so an enumeration of them is redundant.This can be exploited for an encoding where lucky bitstrings are mapped into fewer (quantum) resources, but the same could be said of any {0, 1} a → {0, 1} a+b Boolean function using classical systems only, so applications of this are not immediately evident.
There is precedent for encodings between classical and quantum channels in quantum teleportation [10] and superdense coding [11], where their relative entanglement-assisted capacity is at most in a 2:1 ratio (2 bits are used to teleport 1 qubit, or 1 qubit can encode 2 bits) [12].In contrast to these digital encodings, a statistical approach could also be used, with intrinsic error probability.
A Random Access Code (RAC) is precisely that.It is a communication protocol in which a bitstring of data is encoded into less information units, and then a fragment of the original data is randomly accessed, retrieving it back with some success probability.Quantum and Entanglementassisted Random Access Codes [13][14][15][16] use quantum systems to store the data, and achieve a slight quantum advantage for small scales, but with a fast-decaying success probability as quantum system size increases [17,18].In these quantum versions, the measurement-basis choice is an integral part of the data retrieval.
In this Article, we propose a new kind of Quantum Random Access Code (QRAC) enhanced by measurement-context redundancy.This contextual QRAC encodes classical bits in n-qubit quantum states, and accesses the bits by choosing a measurement context of n-body Pauli observables.The quantum states used are eigenstates of these observables, chosen to minimize the sampling requirement for retrieval.We show a basic implementation of this QRAC, storing 40 binary digits of π/4 in 4-qubit states.We then provide a statistical analysis of performance metrics for arbitrary n.We prove that, for large n, our compression ratio scales with O(n 2 /2 n ) and the asymptotic success probability is greater than 1/2.More specifically, for n 10, we store O(3 n ) bits in O(n(3/2) n ) n-qubit states, allowing random access to any portion of the data at a time with a success probability that does not depend on n.This way, we showcase success probability higher than RACs for n ≥ 14 and higher than existing QRACs for n ≥ 16.For n ≥ 18, our code can be amplified to near-perfect success probability (F = 0.999) while maintaining compression (encoding the data into less information units).
In section 2 Preliminaries we present a basic QRAC scheme and the measurement bases used in previous literature.In section 3 Contextual QRAC we explain our proposal, a QRAC based on many-body Pauli observables, and show how it can exploit contextual redundancy.In section 4 Counting contexts we determine the number and size of complete sets of commuting observables of n-body Pauli observables, which are required to compute the asymptotic performance of our QRAC.In section 5 Implementation, we construct a 4-qubit implementation.In section 6 Statistical extrapolation we use statistical models to compute the sampling requirement and success probability for large number of qubits.In section 7 Wrapping up the QRAC we summarize the asymptotic results of the previous section and compute the compression ratio of our QRAC.In section 8 Comparison we compare against previous RACs and QRACs, and determine advantage regimes.In section 9 Applications we explain potential applications for large-scale Contextual QRACs.In section 10 Conclusion and outlook we summarize the results and address future research lines towards scalability.

Quantum Random Access Code
Consider a scenario where Alice has m bits of data that she wants Bob to randomly access.However, Alice can only send k two-level systems to Bob, with m > k.Once Alice finds a smart protocol to do this, what is the probability of Bob to recover an arbitrary piece of the data?This situation depicts a m → k RAC.For instance, in a 3 → 1 RAC Alice has three bits which she wants Bob to access with maximum success probability, but she can only communicate a one-bit message.A strategy for this code is to send the most common bit of the three.This way, averaging over all 8 possible scenarios (three bits), Bob has a 0.75 probability of guessing any one of the bits, although his guess will be the same no matter which of the three bits he is trying to guess.
A QRAC [13][14][15][16] is a RAC where the k twolevel systems sent are quantum systems.We maintain the m → k notation, but notice that it is incomplete to fully specify a QRAC, as it does not define the maximum entanglement size used or the amount of data Bob can access at a time, which is limited due to the destructive nature of quantum measurements.In general, a m → k QRAC can outperform the success probability of a m → k RAC.For instance, in a 3 → 1 QRAC Alice has three bits and is allowed to send a single qubit to Bob, on which he can perform measurements.A way to do this is for Alice to send one out of 8 possible quantum states, depending on what her 3-bit data is.The eligible states can be defined embedding a cube in Bloch's sphere with sides facing the axes.Each corner of the cube points at one quantum state with a preference for |+ over |− (or vice versa), |L over |R (or vice versa) and |0 over |1 (or vice versa).Here, Then, Bob can mea-sure the quantum state with observables X, Y or Z, to discover one of the three preferences with a success probability of 0.789.This way, Alice can send one qubit and allow Bob to discover one of her three bits with that success probability, which is greater than that of the 3 → 1 RAC.Note that this time, Bob performs different measurements depending on which bit he is trying to retrieve.
As can be seen, QRACs showcase quantum advantage over their classical counterpart when employing systems as small as one-qubit.An immediate question is the scalability of this advantage for larger quantum systems.
Casaccino et.al. [17] have studied (d + 1) dits → 1 qudit QRACs where Alice and Bob use d-level systems instead of bits and qubits, i.e. (d + 1) log 2 (d) → log 2 (d) QRACs in bit-qubit notation.They computed the dit-retrieval success probability up to d = 8, reproducing the aforementioned 3 → 1 QRAC (for d = 2) which is known to have advantage.However, they also showed that the success probability decays as d increases, which apparently argues against the usefulness of high-dimensional QRACs (we further discuss this in the Comparison section).
Similarly, Tavakoli et.al. [18] studied 2 dits → 1 qudit and 3 dits → 1 qudit QRACs and compared against the respective RACs, showing some quantum advantage but with diminishing returns: the ratio of success probabilities (quantum divided by classical) decreases for larger (d 6) system sizes.
Success probabilities of another kind of high-dimensional QRAC have been computed (bounded) by Pauwels et.al. [19], namely the 3 trits → 1 qudit scenario with d up to 20.In this case, success probability increases with d, as Alice has a fixed amount of data and a message size which depends on d.Reasonably, we expect perfect success probability at d = 27, which can store 3 trits.

Mutually Unbiased Bases (MUB)
In a QRAC, Bob chooses a basis to measure the quantum system sent by Alice.This choice depends on which of her bits (or dits) he wants to recover.So far, small and highdimensional QRACs have considered Mutually Unbiased Bases (MUBs) as choices for Bob.We say that the eigenbases of observables O A and O B are mutually unbiased if all the eigenstates of O A yield a homogeneous probability distribution when measured in O B .In other words, an eigenstate of O A has no bias in the eigenbasis of O B (and vice versa).The largest set of MUBs that can be formed grows linearly with the quantum system level d.Specifically, systems with primepower level d can be measured in d+1 MUBs [20], which includes any n-qubit system (d = 2 n ).
Note that this determines the number of MUBs, but does not provide a way to obtain them.This result is what allows Casaccino et.al. [17] to build QRACs where Alice has as many as d + 1 dits and grants random access to one by sending a qudit to Bob, who picks one of the d + 1 MUBs.However, the construction of these (d + 1) dits → 1 qudit QRACs has proved to be a hard mathematical problem, analytically and computationally, and their asymptotic success probability is yet to be determined (we just know it for d ≤ 8).On high-dimensional m → k QRACs, the study of this regime of high compression (k/m 1), where Alice has much more data than she sends to Bob, is still missing.

Contextual QRAC
In this Article, we propose the use of a different kind of observables, which appear in the field of contextuality: many-body Pauli observables.Unlike MUBs, which are unbiased and hard to compute, many-body Pauli observables share eigenstates between them but are a readily-defined set.Furthermore, unlike MUBs, each observable belongs to multiple measurement contexts.We employ these observables to build a m → k QRAC with states of arbitrary-n qubits, which we present in this section.

Overview
We propose a special kind of m → k QRAC (Fig. 1) based on many-body Pauli observables, where Alice has m bits of data that she wants Bob to randomly access.To do this, she sends N states of n qubits, including duplicates that may be needed.The total number of qubits sent is k = N n, with maximum entanglement size n.We consider a fixed n from which we determine m and k, the latter also in terms of the code success probability.To randomly access Alice's data from these states, Bob measures with n-body Pauli ob-Alice maps her data to outcomes of n-body Pauli observables … X 1 X 2 X 3 X 4 < l a t e x i t s h a 1 _ b a s e 6 4 = " + s f J H z V O g L M V w n 2 7 3 e x h J M J 5 Z z 8 = " > A A A D j H i c b V J f b 9 M w E P c a / o w A W w e P v F h U l X i q m q 4 S C I Q 0 g V T x s I d N W r d K b V U 5 j r t 6 c e J g n 9 e F K J + E V / h Q f B s u b T S R j l P O u v z u 3 8 / n C z M l L f T 7 f / Z a 3 q P H T 5 7 u P / O f v 3 h 5 c N g + e n V p t T N c j L l W < l a t e x i t s h a 1 _ b a s e 6 4 = " Z V V M 5 F d i Z q w 6 U D I e g 7 q z H 4 0 0 I 8 Y = " > A A A D j H i c b V J d b 9 M w F P U a P k a A r Y N H X i y q S j x V T V c J B E K a Q K p 4 2 M M m r V t R W 0 W O 4 6 4 m T h z s 6 3 U h 6 i / h F X 4 U / 4 a b N p p I h x V b N + d + H R / f K F f S Q r / / Z 6 / l P X j 4 6 P H + E / / p s + c H h + 2 j F 5 d W O 8 P F m G u l z S R i V i i Z i T F I U G K S G 8 H S S I m r K P l c + a 9 u h L F S Z x d Q 5 G K e s u t M L i R n g F D Y P p y E A Z 2 E A 9 z H 9 G s 4 D N u d f q + / W f S + E d R G h 9 T r L D x q i V m s u U t F B l w x a 6 d B P 4 d 5 y Q x I r s T a n z k r c s Y T d i 2 m a G Y s F X Z e b p i v a R e R m C 6 0 w Z 0 B 3 a D / Z p Q s t b Z I I 4 x M G S z t r q 8 C / + e b O l i 8 m 5 c y y x 2 I j G 8 b L Z y i o G k l A 4 2 l E R x U g Q b j R i J X y p f M M A 4 o V q N L Z F g i Y N 3 E I q 1 i L F o R l z H e X E J B d S 4 M A 0 R m F Z 0 o K o N m U o U a u 7 D r 7 g i D u M N H u R H 0 d B t u u S l P m 2 J l 2 q R M i X R e O j z X 3 Q t N u d H W U h C 3 Q F c S l n S G c w B l p N j 2 2 + 2 X C C 6 U Q p 6 j j c A O h 4 L C U v I k E 1 i m G h l b 1 5 k s q 7 9 y M G P G s M J g w 5 W M U V r f 9 7 v n j m X g U s q l 4 U 4 C r e u / b 7 5 F / M 1 Z i P R t k w P I 5 M c W q S w l U U x T l N + r i n e e O 7 5 O g T R 6 1 U Q 5 y / A S a x 8 H M 9 g d w / v G 5 a A X H P c G 5 8 P O y a d 6 R P 3 M e G 2 5 7 t c r l N Y s q q h g O g x R 1 M N h d r f P 8 K Z y 3 m t 3 9 9 u 9 0 9 f N g 8 P N i e 6 S F + Q l e U W 6 5 A 0 5 Alice has m bits of data that she wants Bob to randomly access Y 6 e s q B x S z 7 y u k 0 K T w w z S L 7 F u R 8 c Z y w 9 d J F E b P q y h n y j e R B / 4 w w / U z v K 2 c d 9 v h f r t 7 + q p x 8 L 4 8 0 S 2 y S 1 6 Q F g n J a 3 J A j s g and +1 in , with probability 1 Step-by-step summary of a m → k Quantum Random Access Code using n-qubit systems with n-body Pauli measurements.Alice encodes her data in the preferred outcomes of n-body Pauli observables, and sends to Bob a batch of n-qubit states which collectively yield that preference.In total, she sends k/n states of n qubits, counting all the different states sent and their copies.Bob retrieves a fragment of her data by measuring the states in some observables of his choosing.

servables
{X, Y, Z} ⊗n . (1) These 3 n observables have two eigenvalues each, ±1, and thus are massively degenerate with dimension 2 n−1 .We will refer to these outcomes as parities, since canonical states measured in Z ⊗n yield +1(−1) when they have an even(odd) number of 1s (e.g.|1001 yields +1 and |1011 yields −1).This way, a set of states sent by Alice could communicate 3 n bits to Bob, defined by the preferred outcome of each observable.For instance, in the n = 2 case, if Alice sent a few copies of the states he would determine that |ψ 1 and |ψ 3 always output +1, i.e. they have a welldefined outcome, whereas |ψ 2 outputs both +1 and −1 with equal probability, i.e. it is unbiased.This way, Bob has learned that the preferred outcome of Z 1 Z 2 in this set of states is +1, equivalent to one bit of information.Other observables, such as Z 1 X 2 , do not have a preferred outcome in this set of states.
We will now allow some freedom in our m → k QRAC.We choose Alice's data to be size m = (3 n − 1)/2 by associating every bit to two Pauli observables instead of one, which leaves one of the 3 n observables out.This introduces a wiggle room in the encoding, to increase the success probability of our code.In the end, if this probability is high enough, our main metric of interest becomes the compression ratio k/m.Also note that the m bits held by Alice are completely arbitrary, so we can assume this data to already be in its classical lossless-compression limit.Consequently, if the success probability of our QRAC aproaches 1, any compression ratio k/m < 1 that we achieve will be on top of the classical limit, i.e. a quantum advantage.

Contextuality
We have proposed to use a group of n-qubit states {|ψ i } i to store data in their collective n-body Pauli statistics, that is, in whether each of the 3 n observables yields preference for +1 or −1 outcomes (parities).However, as studied in the field of quantum contextuality, there exist restrictions that outcomes of a complete set of commuting observables must adhere to, like the ones presented in Fig. 2. As a rule of thumb, any nqubit state should be able to yield only 2 n different outcomes.Thus, if a measurement context is defined by more than n (commuting) observables with 1-bit outputs, as is the case for n-body Pauli observables, they are necessarily correlated, and the information given by enumerating all the outputs of the context is redundant (contextual redundancy).
In this section, we show that all 2 3 n preferred parities (two options per observable) can be produced by the collective statistics of a set of nqubit states {|ψ i } i .Afterwards, we establish a sampling requirement metric for mixed states, which proves useful despite our QRAC not using mixed states.Then, we introduce context eigenstates as convenient states {|ψ i } i for the encoding.Finally, we show in a 2-qubit simulation that some preferred parities are more prevalent in the mixed-state phase space and are easier to sample from, particularly those satisfying more Magic Square restrictions (Fig. 2).Proof.The collective preferred parities of N states {|ψ i } i can be computed by the homogeneous mixed state ρ = 1 N i |ψ i ψ i |, and ρ can also be used to measure how strong the bias is.Trivially, we can show that in a sufficientlylarge collection of states, all preferred parities are possible, by considering a mixed state ρ test of 3 n states |φ j , each one eigenstate to a single n-body Pauli observable and unbiased for the rest.This allows independent control for the outcome preference of each observable.E.g., the state |+ + ++ (|+ + +− ) is eigenstate to X 1 X 2 X 3 X 4 with eigenvalue +1 (−1), and both states yield unbiased statistics on all other 4body Pauli observables.The associated mixed state ρ test = 1 3 n j |φ j φ j | can yield any of the 2 3 n preferred parities.

Producing all preferred parities
Note, however, that the example above yields a mixed state with probability distribution {1/2 ± 1/3 n , 1/2 ∓ 1/3 n } (for {+1, −1} outcomes, respectively) on all n-body Pauli observables.In-tuitively, these distributions have a weak bias, such that determining the preferred parity requires many samples of the state.

Sampling requirement metric
The retrieval protocol of our QRAC does not use mixed states, but instead allows Bob to measure a number of copies of each state |ψ i individually.However, a sampling requirement metric based on mixed states is convenient, as it can be used for comparative purposes.Given a set of N states {|ψ i } i , the homogeneous mixed state for each n-body Pauli observable.For each of them, we can compute the required number of samples to guarantee with success probability f that the majority yield the preferred parity of O, is the binomial density function for j successes in s shots with probability p O .Then, this sampling requirement can be averaged over all 3 n observables, obtaining S mix , which is a general sampling requirement metric for the homogeneous mixed state of {|ψ i } i in all n-body Pauli observables.

Context eigenstates
We have proved that all preferred parities can be produced, but a more efficient construction with lower sampling requirement is still required.For an efficient encoding of our QRAC, instead of using states which are eigenstate to a single observable and unbiased in the rest, we use states which are eigenstates to as many observables as possible (and unbiased in the rest).To do this, we must consider sets of commuting n-body Pauli observables.In general, commuting operators have common eigenbases.This eigenbasis is unique in the case of complete sets of commuting n-body Pauli observables.We call these commuting sets contexts -short for measurement contexts-, and refer to the common set of eigenstates as context eigenstates.Within the limits of n-body Pauli observables, context eigenstates are unbiased outside of their context.

+1
< l a t e x i t s h a 1 _ b a s e 6 4 = " Z w s s E q r j a 6 F J 5 s G j 6 m 6 a f a P r 7 m x g q t L q D I + T w j V 0 o k g h H w 0 P j r I s J f < l a t e x i t s h a 1 _ b a s e 6 4 = " X z r Z P s P   Square [9] using two-body Pauli observables.This grid of observables is organized in such a manner that any row or column is a complete set of commuting observables, a measurement context.Any quantum state measured in one of these rows(columns) will collapse onto a context eigenstate and yield outcomes which multiply to −1(+1).In other words, not all imaginable outcomes of a measurement context are possible; there are restrictions.
Context eigenstates of two qubits have eigenvalues restricted by the same conditions of the Mermin-Peres Magic Square.For instance, the Bell state The rest of the Bell basis shares the same context, with eigenvalues that also multiply to −1.On the other hand, the i-phase Bell state with respective eigenvalues {+1, +1, +1}.The rest of the i-phase Bell basis shares the same context, with eigenvalues that also multiply to +1.Note that -in contrast to MUBs-an observable can belong to multiple contexts, such that Alice can express the parities she wants with the most convenient context eigenstates.

Contextual redundancy
Consider a configuration of preferred parities on all 3 n observables, that is, +1 or −1 biases that we want on each n-body Pauli observable.For n = 2, due to the Mermin-Peres Magic Square, one would expect that preferred parities that satisfy more measurement context restrictions (the row or column outcome product) should be possible to express with context eigenstates instead of eigenstates to individual observables.This would produce probability distributions with more extreme biases, reducing the sampling requirement < l a t e x i t s h a 1 _ b a s e 6 4 = " O n H X l b f H u j P Z Y Z 2 2 / m 2 j h 7 l O h X s = " > A A A D b n i c j V L b b h M x E P U m X E q 4 t U X i B S E s k q J U g m h 3 U w n E U 0 V f e E I t I m 2 l O I q 8 X i c x 8 X q 3 9 i w k W P s t v M I n 8 R d 8 A t 5 s I E 3 T B 0 a y d D R z Z o 5 9 x l E m h Q H f / + X V 6 j d u 3 r q 9 d a d x 9 9 7 9 B w + 3 d 3 Z P T Z p r x n s s l a k + j 6 j h U i j e A w G S n 2 e a 0 y S S / C y a H p X 1 s y 9 c G 5 G q T z D    We plot these two values, obtaining a graph with 512 points.In the quantum circuit, Classical randomness to generate mixed states is introduced with a random-not gate: RNot(x) = X with probability x, and RNot(x) = 1 otherwise.The preferred parities are labeled according to the total number of Magic Square restrictions satisfied (1 R, 3 R or 5 R) and marked with a star when all rows or all columns are satisfied.Notably, the preferred parities cluster according to these labels.
for retrieval.We test this conjecture by producing random 2-qubit mixed states and classifying them according to their preferred parities, which have 2 3 2 = 512 configurations.In the horizontal axis of Fig. 3, we count how often each preferredparity configuration occurs.In the vertical axis of Fig. 3, we compute the mixed-state sampling requirement metric S mix and show the smallest value reached by each preferred-parity configuration.Notably, the preferred parities occur more often and have lower sampling requirements when they satisfy more Magic Square restrictions, particularly if all rows or all columns are satisfied.Although this test has been performed for n = 2, a general conclusion can be drawn: not all 2 3 n preferred parities are equally prevalent on the phase space of n-qubit mixed states, and some preferred parities allow for probability distributions which are easier to sample from.Thus, in the following section, we employ the wiggleroom granted by our 2-to-1 encoding to map our data into the most convenient preferred parities.
Figure 4: Discretely-parametrized quantum circuit to generate eigenstates of contexts of maximum size for n = 4. Depending on its parameters, this circuit constructs a GHZ or i-phase GHZ state and applies X and Z gates, as well as Pauli-basis transformations, allowing us to produce any context eigenstate.Here, H is the Hadamard gate, and α i = {0, 1} and β i = {0, 1, 2} are discrete parameters.The gates are defined such that S (0 Specifically, preferred parities that can be expressed with context eigenstates.

Encoding
In our code, Alice has m = (3 n − 1)/2 bits of data b = {b } that she encodes into preferred parities of n-body Pauli observables.This is a 2-to-1 mapping between data and observables, which allows her to have some wiggle room in choosing preferred parities.To specify which data bit corresponds to which observable pair, an ordered set of observable-couples ..} is agreed beforehand between Alice and Bob.The order itself is irrelevant, but it is convenient for retrieval purposes that the couples commute.This way, the -th data bit b is stored in the -th couple of observables G , leaving one observable out.Without loss of generality, we identify bit b = 0 (1) with equal (=) and different ( =) preferred parities, respectively, when measuring the corresponding pair of observables.Each bit of data can be encoded in two ways, so Alice can choose from 2 m compatible preferred parities to represent her data, which is a super-exponential degree of freedom in n.To reduce the retrieval sampling requirement, Alice considers the preferred parities compatible with her data, and chooses the one with most redundant contexts, i.e. statistics resembling those of context eigenstates.In the Implementation section, we do this for the n = 4 case by constructing and maximizing a scoring function based on Hamming distances.
Finally, Alice computes a selection of context eigenstates to send to Bob with collective statistics resembling her target preferred parities.These states can be generated and measured with discretely parametrized quantum circuits of low depth, as shown in Fig. 4 and Fig. 5.By computing the measurement statistics in terms of the parameters, states are chosen such that the selection size and retrieval sampling requirement are minimized.An encoding example is given in Fig. 6.

Retrieval
In this protocol, Bob sequentially measures the selection of states sent by Alice in an observable O of his choosing, filtering out those with unbiased statistics.This measurement is performed with the circuit in Fig. 5. Recall that Alice sends context eigenstates, and thus they yield outcomes with either well-defined or fully unbiased probability distributions.In T measurement steps, Bob !< l a t e x i t s h a 1 _ b a s e 6 4 = " w U O e y S p g / U y 7 < l a t e x i t s h a 1 _ b a s e 6 4 = " p w u Q D j A W e 4 4 c S L 0 k 0 < l a t e x i t s h a 1 _ b a s e 6 4 = " l F A c e O a V y 5 0 b p i x a X w N W q e M 4 c w W G p H x 8 w u G T q q U < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " V A 6 1 J s n j 9 r o o R 9 H / 2 P d q 2 / O g X w s < l a t e x i t s h a 1 _ b a s e 6 4 = " P p y p 9 a / 7 c v 3 t / 9 J H w 5 a 0

Z1X2
< l a t e x i t s h a 1 _ b a s e 6 4 = " Z w s s E q r j a 6 F J 5 s G

Z1Y2
< l a t e x i t s h a 1 _ b a s e 6 4 = " q + Y R 8

X1Z2
< l a t e x i t s h a 1 _ b a s e 6 4 = " X z r Z P s P . Let Alice's data be b = 0010 and let the order of observable-couples G agreed beforehand be the alphabetical order.This means that X 1 X 2 and X 1 Y 2 must have equal preferred parities (bit 0), X 1 Z 2 and Y 1 X 2 must have equal preferred parities (bit 0), Y 1 Y 2 and Y 1 Z 2 must have different preferred parities (bit 1), Z 1 X 2 and Z 1 Y 2 must have equal preferred parities (bit 0), and Z 1 Z 2 may have any parity.There are several preferred parities compatible with the data, but Alice chooses one which satisfies five Magic-Square restrictions, allowing her to express the 9 preferred parities with three row context eigenstates.
measures at most that many copies of each state.We consider a sufficiently large T to statistically distinguish well-defined from unbiased parities.If the prepared states are ideal, they are filtered out if they yield a changing outcome at any point, since Bob can immediately conclude that those states are not well-defined, as shown in Fig. 7.In that case, unbiased states are filtered out exponentially fast.On the other hand, if the prepared states are noisy, a threshold to distinguish nearlywell-defined from almost-unbiased states must be considered, and the number of required samples would increase.Both for ideal or noisy states, once this filtering is performed, the most frequent outcome among unfiltered states defines the preferred parity retrieved by Bob.
Repeating the measuring process for part(all) of the observables, the original data can be partially(completely) retrieved.Note that commuting observables can be measured using the same samples.
In the Statistical Extrapolation section, we consider ideal states to model the required number of samples for any number of qubits n.In this scenario, the only error source in the retrieval are the remaining unfiltered unbiased states.
Step 1: Step 3:  4 3 I e S q E 9 K W f P + p r t M 6 4 F Y 6 r x U 6 3 y 2 7 m 1 f t L s l P q 5 r T Y g m 5 4 K l p L t C 3 I X L q Y 1 y 7 k g 8 5 b i F N 4 8 t L w B / N x j d E Z 3 6 x 2 W i O B r p u B G N j 0 R u P n c 7 C b D e M B c k T i C c c K 3 U c N D P d N l h q R j g F 9 F z R D G j g H j 0 G M 8 U J V W 0 z 4 m d R H T w x 6 g o J v 1 S j k f d q h M G J U s M k g p 2 O p Z p c c 8 5 p a 8 e 5 7 r 5 r G  6, with three measurements steps (requiring at most three copies of each state).The protocol consists in filtering out eigenstates with unbiased statistics in O by performing successive measurements and discarding those that change their outcome.Both states |ψ 1 and |ψ 3 have unbiased probability distributions when measured in Z 1 X 2 , which is why they are likely to eventually change their outcome, whereas |ψ 2 always yields −1.In general, the expected number of unbiased states that fail to be filtered decreases exponentially in the number of retrieval steps.

Counting contexts
To analyze the performance of our QRAC for arbitrary number of qubits n, we need to count the number of available contexts and context eigenstates.For simplicity, we only consider even n, as odd-sized Pauli observables introduce additional considerations.
Using n-body Pauli observables, the number of contexts and their sizes are trivial for n = 2.In the Mermin-Peres Magic Square, there are 6 contexts (complete sets of commuting observables), and each one has 3 observables.For n = 4, there are 270 contexts of size 9 (which we prove later in this section).However, for n > 4, contexts no longer have a unique size.
Large context sizes define eigenstates with welldefined parities in several observables simultaneously, so for arbitrary n we focus on counting and constructing the largest contexts possible.This way, we prove, count and construct contexts of size 2 n−1 + 1, which are of maximum size to the best of our knowledge when contrasted with numerical simulations of up to n = 20.(3) Note that they all commute with O 0 since n is even.Not all observables in C mutually commute, but C can be split into two subsets C 1 and C 2 of equal size where this is true.In our example, C 1 (C 2 ) comprises all the observables in C with even(odd) number of Pauli X.In this manner, two contexts are defined, C 1 = {O 0 }∪C 1 and With this method, each generator defines two contexts of size 2 n−1 + 1, and 3 n observables can be used as generators.This would seem to prove the existence of 2 × 3 n contexts, but we need to guarantee that none of them is counted twice.For n ≥ 4, we prove in the following that all contexts have a unique generator.Lemma 4.2.For n-body Pauli observables with even n, contexts of size greater than three can have at most one observable which shares no terms with the rest.Proof.Consider a set of three n-body Pauli observables {O 1 , O 2 , O 3 } sharing no terms with each other (in the same qubit positions).This is possible, as each qubit position can be X, Y or Z.For even n, this set commutes, as its observables have even number of changes to each other, and X, Y and Z anticommute.If we were to add a fourth different n-body Pauli observable O 4 which commuted with the rest (even number of changes), it would necessarily share terms with at least two other observables in the set.This way, constructively, any context with size larger than three can have at most one observable sharing no terms with the rest.This implies that for n ≥ 4 the context generators in Lemma 4.1 produce unique contexts.Lemma 4.1 and Lemma 4.2 prove that: Theorem 4.3.For n-body Pauli observables with even n ≥ 4, there exist at least 2 × 3 n contexts of size 2 n−1 + 1.
In the case of n = 2, different generators can produce the same contexts, so there are only 6 contexts instead of 2 × 3 n .In the case of n = 4, the method in Lemma 4.1 constructs 2×3 n = 162 contexts of size 2 n−1 + 1 = 9, which are the ones used in the implementation section, but partitioning the system into two 2-qubit subsystems (which can be done in 3 ways) and using the known n = 2 contexts yields additional contexts of size 9, namely 3 × 6 × 6 of them, to a total of 270.Fortunately, this double source for maximum-sized contexts happens exclusively in n = 4.For n ≥ 6 there are exactly 2 × 3 n contexts of size 2 n−1 + 1.

Implementation
In the following, we construct a toy implementation of our QRAC for n = 4 qubits.Alice grants random access to a data of m = (3 n − 1)/2 = 40 bits by sending a selection of 4-qubit states to Bob.We choose this data to be binary digits of π/4.The implementation consists in finding states from the quantum circuit in Fig. 4 with statistics that collectively match the data.However, recall that the mapping between data and preferred parities is not straightforward.Every bit is associated to a pair of (four-body) Pauli measurements over the selection of states; if the pair yields equal preferred parities, the encoded bit is 0, and vice versa.Thus, we must first decide a configuration of preferred parities that we will try to target with the selection of states.This way, we have a two-step optimization: 1) choosing target preferred parities and 2) building up a selection of states to encode it.Then, we analyze the probability distributions of the resulting state selection and compute the retrieval sampling requirement.

Target preferred parities
To find convenient preferred parities for the encoding, we must perform an optimization on the phase space of compatible parities to our data.We use alphabetical order for forming observable couples Each of the 40 couples can encode a bit in one out of two ways, so there are 2 40 ≈ 10 12 compatible preferred parities to our data.In other words, one compatible configuration can be expressed with 40 bits (too).We do not explore them all, but instead stochastically optimize this 40-bitstring by doing random bit flips and maximizing a scoring function.
We build the scoring function based on the Hamming distance (the number of differences) between eigenstate well-defined outcomes, i.e. their eigenvalues, and compatible preferred parities.For this, we first compute the eigenvalues of all context eigenstates.For n = 4, we use 2 × 3 n = 162 contexts (of size 9), and each one has 2 n = 16 eigenstates, so there are 2592 context eigenstates in total.Computing all of their eigenvalues is not efficient for general n, but can be done for n = 4.For our scoring function, we count the number of eigenstates with Hamming distance i (0 ≤ i ≤ 9, as contexts are size 9) and denote it by M i .The scoring function is computed as using the weights w 0 = 100, w 1 = 10, w 2 = 1, and w i = 0 for i ≥ 3. Consequently, the scoring function L primarily rewards compatible configurations having several context eigenstates with perfect match, and then rewards eigenstates with lower number of matches.The result of this optimization is a configuration of 81 target preferred parities, although arguably one observable is uncoupled, so its parity does not really matter.

Eigenstate selection
We need to build a selection of context eigenstates {|ψ i } i which matches the target preferred parity that we obtained in the previous optimization.We denote the number of states in this selection by N s .For n = 4, there are 2592 context eigenstates, so an arbitrary selection of them has a very large number of configurations.We can reduce this phase space by considering the best states from each context (the ones with most matches to the target preferred parity), to an eligible pool of O(162) states, which is more manageable.Afterwards, we minimize the size of the selection N s and a sampling requirement metric based on the corresponding mixed state.As noted before, the retrieval protocol of our QRAC does not use mixed states, i.e. classical random ensembles of pure states, but rather Bob receives states which he can access individually.However, ρ = 1 Ns i |ψ i ψ i | can still serve to compute a sampling requirement metric, like the one in Eq.
(2).We use that metric, and for computation efficiency take the normal approximation, obtaining where Erf −1 (•) is the inverse of the error function, and p O is the higher value of the probability distribution of observable O in ρ.Since we only need a metric for the overall probability-distribution values, we omit the term in brackets, and then use as metric the average for all observables O. Furthermore, to avoid diverging values when p O approaches 1/2, we take a large number u and use it as boundary.We also assign u to our metric when the higher probability is not on the target parity.This way, for probability p O of the target parity in observable O, we have and our sampling requirement metric is its average over all observables, S mix .Now we obtain the state selection cost function by multiplying the two quantities: This cost function allows to obtain a small selection of states which minimizes the retrieval sampling requirement.We stochastically train in the phase space of possible state selections, which is a bitstring of size O(162) indicating whether each of the eligible states is present in the selection.We employ random bit-flips to train this bitstring, taking the smaller L at each step and artificially maintaining a sparse bitstring.We also occasionally branch into several lines and skip the cost function test, to avoid local minima.Finally, we consider variations L i of the We consider 9 ≤ N s ≤ 14; N s = 9 is the least states that could cover all observables with well-defined parities (contexts of n = 4 are size 9), and N s = 14 is the smallest instance of perfect encoding.The main performance metrics are the encoding success probability f e and the retrieval sampling requirement S. To compute the latter, we consider a negligible retrieval noise ν (probability of not filtering an unbiased state) with respect to encoding errors by setting a number of retrieval steps T .The N s = 14 is an exception, as it already has perfect encoding, so we set the same T as the previous case.
cost function, where the i worst observables are not taken into account while computing the sampling requirement.This allows us to obtain state selections with different tolerance to error.

Implementation results
A target preferred parity was obtained from the first optimization, using scoring function L.
Then, using the state selection cost function L i for a varying tolerance to error 0 ≤ i ≤ 6, we obtain state selections with sizes 9 ≤ N s ≤ 14.Afterwards, we compute performance metrics for encoding success probability and for retrieval sampling requirement, using negligible retrieval errors.The results are shown in Table 1.
The metric f e is the fraction of observables which match the target preferred parity, and can be interpreted as the encoding success probability.The rest of the metrics are related to retrieval performance.We briefly explain them in the following.For retrieval in an arbitrary Pauli observable O, the number of well-defined states is N O ≈ P O N s , where P O = (2 n−1 + 1)/3 n = 9/81 is the fraction of observables in a given context.This way, N O ≈ N s /9.The retrieval consists in measuring the states on O during T steps, filtering out those with unbiased statistics.The expected number of unbiased states which fail to be filtered is ν = (N s − N O )/2 T −1 , and the total number of states measured is S ≈ 3(N s − N O ) + T N O (sampling requirement).We choose T such that ν is negligible with respect to encoding errors, ν (1−f e ); specifically choosing ν ≈ (1−f e )/10 in this problem.An exception is made for the N s = 14 case, as its encoding is perfect, so the previous T for N s = 13 is maintained.
With this implementation, we have shown a simplified training process to store data into nbody Pauli statistics, allowing random access by measuring those observables.We were able to reach a perfect encoding for 40 bits with as few as 14 different states of 4 qubits, or imperfect encodings with less states.However, in all cases, the total number of resources sent is greater than the original data, so for n = 4 our proposal is technically not a QRAC.In the following section, we develop a statistical model to calculate the performance of our proposal for larger n.

Statistical extrapolation
In this section, we measure the efficiency of this protocol via a statistical analysis of both the retrieval sampling requirement and the success probability.This is done for arbitrary number of qubits n, and in particular for even and large n 10 values.

State selection size
First, we estimate the number N s of different context eigenstates that Alice can use in the encoding, in terms of how perfect she wants them to be.We consider N C = 2 × 3 n contexts of size d C = 2 n−1 +1, each with 2 n unique context eigenstates.Then, we model the number of matches between arbitrary context eigenstates and arbitrary preferred parities using a binomial distribution since each well-defined parity of a context eigenstate has probability 1/2 of matching an arbitrary preferred parity.Then, we model the number of eigenstates with up to h mismatches in their context as where p h = h k=0 B(d C , 1/2; k) is the probability that an eigenstate has up to h mismatches, and it can be lower-bounded by This defines the eligible states given some mismatch tolerance ε = h/d C < 1/2.Then, we take into account the 2-to-1 encoding, which causes 2 m configurations of preferred parities to be compatible with the data, where m = (3 n − 1)/2.Each compatible configuration is described by one instance of the statistical model in (9).We compute N s as the largest number of eligible states (up to mismatch tolerance ε) between compatible configurations.This can be done by finding the number N s such that the expected number of compatible configurations with that many eligible states is 1, i.e.
Applying Stirling's approximation and keeping the dominant term in n yields where Notice that N s → (3/2) n when ε → 0. Also note that N s cannot be greater than 2×6 n (for n ≥ 4), as we are considering 2 × 3 n contexts with 2 n eigenstates each.This imposes a restriction of ε < 0.474, which softens as n increases above 4, but which poses no problem.

Sampling requirement
Let us now compute the retrieval sampling requirement.Given a process to retrieve the parity of an arbitrary observable O with T measurement steps, half of the unbiased-parity states are discarded at each step after the first one, so the total number of measurements performed on undefined-parity states is , whereas the N O welldefined states are never discarded and are measured T times.Then, the total number of states used to measure one observable is though we can also upper-bound the sampling requirement with T N s , considering that T is the maximum number of copies needed per state.This bound has the advantage of being applicable to measurements with a context of observables instead of just a single one (commuting observables can share the same samples).
We have yet to set an adequate value for T .In the process of measuring undefined-parity states, an average of ν = (N s − N O )/2 T −1 states fail to be filtered out, which can be interpreted as the probability of having a single unfiltered state if ν 1, i.e. a retrieval noise probability.By inverting this relation, we determine T = log 2 (N s − N O ) − log 2 (ν) + 1.Note that ν can be set to a negligible value with respect to encoding errors without increasing S (or T N s ) too much.In that case, virtually no unbiased states are mistakenly labeled as well-defined states while computing the preferred parity of O.This way, the overall success probability depends only on encoding errors, and not on any undefined state that failed to be filtered during retrieval.

Success probability
The value of 1 − ε can be used to lower-bound the probability of one parity matching between one state of the selection and the desired preferred parity.We use it to compute the encoding success probability of our set of N s states.For this end, let O be an arbitrary n-body Pauli observable whose preferred parity we want to retrieve from the set of states.Statistically, most of the selected states have an unbiased parity in this observable.As noted before, unbiased states are later filtered out by the retrieval protocol, so only well-defined parities matter for a successful encoding.Given N s random context eigenstates, we say that N O are well-defined in O. Considering that P O = (2 n−1 + 1)/3 n ≈ (1/2)(2/3) n is the fraction of observables contained in any context, N O can be modeled by B(N s , P O ; •), and from Eq. (11) we note that N O = P O N s ≈ (1/2)g(ε) −1 , which does not depend on n.If the majority of the N O well-defined states yield the target parity, the encoding has been successful.This way, we compute the encoding success probability f e as a function of n and ε: for odd N O , with an additional term B(N O , 1 − ε; N O /2)/2 in even cases.Notably, since N O ≈ (1/2)g(ε) −1 is independent of n, it seems intuitive that the success probability is also independent of n.To be certain, we numerically compute the expected success prob- ability f e for encoding one preferred parity using N O ∼ B(N s , P O ; •).Since a data bit is retrieved successfully when both of its associated parities are correct or both are wrong, the expected success probability for encoding each data bit is f e = ( f e ) 2 +(1− f e ) 2 .This expression does not depend on the variance of f e due to N O being mostly independent for each observable.
The result of this computation is shown in Fig. 8, where we provide f e as a function of ε, for n = 4, 8, 12. Discontinuities in f e tend to vanish for large number of selected states N s , such that it converges into a single smooth curve for large number of qubits (n 8) and large mismatch tolerances (ε 0.3), as they both increase the number of selected eigenstates.Most importantly, for large n, the success probability reaches an asymptotic value defined only by ε and higher than 0.5.This allows to reach any success probability with a fixed number of repetitions, as we show in the next subsection.On a second note, when increasing ε, the increase of the number of selected eigenstates favors higher success probability but at the same time hinders it because the states have a poorer resemblance to the target preferred parities.This dual behaviour explains the local minima of f e .
Notice that the local maxima of f e is not necessarily the optimal ε, as the sampling require-ment must be taken into account too.If we want a fair comparison between ε values, we need to fix either the success probability or the sampling requirement and compare the other value in terms of ε.We do this by introducing repetitions of the code.

Repetitions
In order to obtain the mismatch tolerance ε that minimizes the sampling requirement given a fixed success probability, we increase the success probability by means of protocol repetitions with majority-rule, fixing it to a constant value among all ε.This allows us to compare sampling requirements (modified by the repetitions) and calculate the optimal mismatch tolerance ε .In general, a code with success probability f repeated r times yields an amplified success probability assuming odd r for simplicity.Thus, minimizing the sampling requirement for fixed F (through r repetitions) yields an optimal mismatch tolerance ε = 0.0480 (±0.0034) for n ≥ 16.
For n ≥ 16 and using the optimal ε, the average encoding success probability in our code is f e (ε ) = 0.5983, and also acts as general success probability, due to the negligible retrieval noise ν (1 − f e ).Considering that this success probability is low but independent of n, we note that we can apply protocol repetitions not just as a mathematical artifice to optimize ε, but also as an actual tool for the protocol.Alice could use a different G ordering on each iteration to guarantee statistical independence for the encodings, and Bob would apply a majority-rule between the iterations to retrieve each data bit.This way, for n ≥ 16, r = 243 repetitions suffice to achieve final success probability F = 0.999.Furthermore, to obtain an asymptotic relationship between r and F, the former can be isolated from Eq. ( 14) by taking the normal approximation.Using the success probability f e (ε ), this yields r ≈ 49.7 (Erfc −1 (2−2F)) 2 , where Erfc −1 (•) is the inverse complementary error function.Considering that Erfc −1 (y) ≈ ln(1/y) for y 1, we obtain r ∼ O(ln(1/(1 − F))), i.e. infinite repetitions for the limit F → 1 − , as is to be expected.Now that the final success probability F is defined, we substitute ε to re-calculate all param-eters related to the sampling requirement.With ε , the size of the state selection becomes Then, with ε , the number of retrieval steps can be upper-bounded by using ν = 2 −7.5 (1 − f e ), and considering log 2 (N s − N O ) ≈ log 2 (N s ) due to N O = 0.6925 N s .Recall that N s T bounds the total number of states used in the code, even if a full context of observables is measured in the retrieval.
Equivalently, with ε , we can express the expected sampling requirement for retrieval of one observable (Eq.( 12)) as a function of n alone, where we have rounded up N O = 1 (from N O = 0.6925) to be on the safe side.(19) Here, the final success probability F imposes a fixed number of repetitions, but it does not scale with n, thus the number of sent resources k scales with a lower order than the original data size m.We can choose an arbitrarily-high success probability F and show that the compression ratio k/m of this QRAC is of order O(n 2 /2 n ), or O(m −0.63 ) in terms of the original data size.This way, setting r = 243 for success probability F = 0.999, Alice sends less resources than her original data for n ≥ 18, achieving compression.If instead we set no repetitions, the success probability is f e ≈ 0.5983 and compression is achieved for n ≥ 10.

Comparison
To compare our m → k QRAC against other codes, we consider the protocol before the repetitions, for simplicity.This means that the number of resources sent by Alice is k = nN s (n)T (n) ∼ O(n 2 (3/2) n ) and the success probability is f e = 0.5983.Like before, m = (3 n − 1)/2 and the compression ratio is k/m ∼ O(n 2 /2 n ).As mentioned earlier, we can assume the data encoded in the code to already be in the lossless compression limit of maximum entropy.This way, any additional lossless compression is quantum advantage, and any additional lossy compression with greater success probability than classical RACs is also quantum advantage.

Comparison against RACs
To perform this comparison, we need to calculate the success probability of an equivalent m → k random access code.This can be done partitioning the problem into k RACs of the form m k → 1.Each one would send 1 bit and grant random access to m/k bits, with average success probability greater than 1/2.The original data in each of these smaller RACs does not overlap, so it is sufficient to calculate the success probability of a single one of them.This has previously been calculated in [21].In the following, we obtain the same result with a slightly different procedure, specifically tailored to our problem.
To compute the success probability of a m k → 1 RAC we use the most-common-bit approach which was used in the 3 → 1 RAC.Essentially, the single communicated bit indicates what is the most common bit in the original data, and this information allows us to use that bit as guess for any of the m/k bits.We can model the total number of 1s in an arbitrary m k -bit configuration with a binomial distribution B(m/k, 1/2; •).If the communicated bit is 0(1), it means that our current configuration lies in the first(second) half of the distribution (assume odd m/k for simplicity).This way, the expected number of 0s(1s) in the configuration is obtained from the expectation of the renormalized first(second) half of the distribution.Dividing this result by the bitstring length m/k, we obtain the probability of an arbitrary bit in the configuration being 0(1), that is, the success probability f in agreement with [21].
Our QRAC has asymptotic success probability (per bit) f e = 0.5983.It is greater than RAC success probability in Eq. (22) for k/m < 0.0607, that is, n ≥ 14 when substituting k and m in terms of n.This is because RAC success probability decays exponentially fast in n, with f m/k→1 RAC = 1/2 + O n 2 n/2 .In short, our QRACs are better than RACs when employing systems of n ≥ 14 qubits.

Comparison against QRACs
In contrast to a RAC, a m → k QRAC cannot be partitioned into k QRACs of the form m k → 1 without losing significant quantum advantage.This is because QRACs are fundamentally defined by a number of measurement-basis choices, which in general grow exponentially with the number of qubits of the sent state(s).This is both true for MUBs or n-body Pauli observables.Ambainis et.al. [21]  QRACs.Setting m = m/k for ease of comparison, these bounds are: where the lower bound is greater than f m/k→1 RAC .Furthermore, building a m → k QRAC with k QRACs of the form m k → 1 shows that our QRAC proposal has greater success probability than this upper bound when n ≥ 16.This further proves that partitioning a QRAC into smaller pieces is suboptimal.
Thus, the success probability m → k QRACs with high-dimensional quantum systems is still unbounded, and this is precisely the family of QRACs which can exploit the exponential increase of measurement-basis options.To the best of our knowledge, the best precedent we have of high-dimensional QRACs in the literature is the (d + 1) log 2 (d) → log 2 (d) QRAC of Casaccino et.al. [17], which employs MUBs and has been computed for 2 ≤ d ≤ 8 (skipping d = 6 as it is not a prime-power).They show decaying success probabilities as d increases, but these probabilities are for retrieving a full dit, which has zeroknowledge success probability of 1/d, something that already decays in d.For a fair comparison of success probability between different values of d (and against all other RACs and QRACs we have mentioned so far), we use their dit success probability f dit to estimate a bit success probability f bit = (f dit ) 1/ log 2 (d) .As we can see, this function transforms zero-knowledge success probability (dlevel) to zero-knowledge success probability (2-level) f dit = 1/d → f bit = (1/d) log 2 (d) = 1/2 for any d ≥ 2 and also transforms f dit = 1 → f bit = 1.We apply it on the results of their QRAC (Table 2), and note that an asymptotic behaviour of bit success probability greater than 1/2 cannot be discarded until further study.We also note that the bit success probabilities on the d = 4 and d = 8 cases, which correspond to 10 → 2 and 27 → 3 QRACs, slightly breaks the upper bound in Eq. (23) for 5 → 1 and 9 → 1 QRACs, respectively.Once again, this shows that higher dimensional QRACs provide an improvement, and that partitioning QRACs (e.g.partitioning a 27 → 3 QRAC into three 9 → 1 QRACs) reduces their advantage.
These MUB-QRACs showcase a compression ratio of 1/(d + 1) ∼ O(1/2 n ), exponential in n when considering n-qubit systems, like our proposed QRAC.For now, our approach has the advantage of having a confirmed asymptotic bit success probability (greater than 1/2), and of encoding the data into states which can be produced with low-depth quantum circuits (Fig. 4).Finally, the mathematical complexity of working with MUBs for large n is a drawback to also take into account (d = 8 is 3 qubits, and it already is hard), whereas n-body Paulis are readily-defined, and their context construction is provided for any n in this paper.

Applications
Besides its large compression ratio (small k/m), the m → k QRAC presented in this paper has a distinguishing feature from previous QRACs: its success probability can be amplified (by repetitions) to near-perfect values while still being a random access code, that is, while encoding the original data into less information units.
Where's the catch?The amount of information that is randomly accessed by Bob must be much smaller than the original data, even if it can be any fragment of the data.This is certainly a limitation, but leaves room for applications where a large amount of data needs to be stored and only-partially queried.For instance, as exemplified in [14], one could encode the contents of an entire telephone directory and then, via a suitably chosen measurement, look up any single telephone number of choice.Or, using a more modern example, encode everyone's Google Drive data and, via suitable measurements, retrieve any single file.Indeed, Google Drive has approximately 1 billion users [24] with ∼ 100 Gigabytes each (800 Giga-bits), and the amount of data that our QRAC can randomly access is m = (3 n − 1) bits, in terms of the size n of quantum states used.This way, systems of n = 44 qubits are sufficient to randomly access such volumes of information, with a compression ratio k/m = 5.75 × 10 −8 for near-perfect bit success probability F = 0.999.
Our proposed QRAC is also a fitting solution to store and consult decision trees, i.e. bruteforce strategies.The total size of a decision tree scales exponentially fast, but only one branch needs to be consulted at a time if we want to put it to use.For instance, a brute-force solution for chess would imply storing a database with what move to make on each possible board configuration.Chess has an upper bound of 2 155 existing board configurations [25] and a branching factor of ∼ 35 possible plays per turn [26], thus there exist 35 2 155 brute-force strategies (all possible moves for all possible board configurations).Storing one of them amounts to 2.34 × 10 47 bits.Our QRAC would need systems of n = 100 qubits to store this volume of information, and would reach a compression ratio of k/m = 3.52×10 −24 for nearperfect bit success probability F = 0.999.

Conclusion and outlook
We have proposed a m → k Quantum Random Access Code (QRAC) which grants random access to an m-bit data by sending relatively few quantum states of high-dimension (nqubit states).In terms of n, the original data has m ∼ O(3 n ) bits and the total number of qubits sent is k ∼ O(n 2 (3/2) n ) for an arbitrarily high bit-retrieval success probability F, or k ∼ O(n 2 (3/2) n ln(1/(1 − F))) in terms of it.This means that the compression ratio between sent resources and original data is k/m ∼ O(n 2 /2 n ), or O(m −0.63 ) in terms of the original data size m.This is the first instance of a QRAC being calculated on the asymptotic limit of large quantum systems.
Instead of using Mutually Unbiased Bases (MUBs) like previous proposals, we based our QRAC on the family of n-body Pauli observables grouped into different measurement con-texts, and encoded our data using the most convenient eigenstates to these contexts.We showed that these states can be generated with lineardepth quantum circuits, and provided a toy implementation on n = 4, storing 40 binary digits of π/4 into quantum states.Notably, the current main limitation to large-n implementation is not the quantum hardware, but classical training routines, which we have implemented simplistically.
Contrasting against previous literature, our QRAC has no advantage for low number of qubits, but improves upon any other random access code for large n.We obtain greater success probability than classical random access codes for n ≥ 14, greater success probability than other quantum random access codes for n ≥ 16, and can amplify the success probability to nearperfect values (F = 0.999) for n ≥ 18 without ceasing to be a QRAC (less resources sent than held originally).
Finally, we note on the applicability of our QRAC to problems where large data is to be stored and accessed with small queries.Everyone's Google Drive data, equivalent to m ∼ O (10 20 ) bits, could be stored using systems of n = 44 qubits and one file (any file) be retrieved using O(10 −8 ) times less resources than m.Also, decision trees are fitting problems for our QRAC, as the trees can be very large but require querying for a single branch.We take as example a brute-force solution for chess, equivalent to m ∼ O(10 47 ) bits of data, which can be stored using systems of n = 100 systems.A game of chess could be optimally played using O(10 −24 ) times less resources than m.
In future research lines, classical optimization routines to find the best context eigenstate for the encoding should be improved in order to scale up the implementation from a toy model of fourqubit systems to the relevant n ≥ 14 regime in which Contextual QRACs show advantage.
r d X o B e S b m C b t O 5 V J y B g g t 2 o e T R U A n i w H q M e p w 0 e 7 0 e / 2 N 0I d G U B s d U s v Z 4 q g l Z p H m L h E p c M W s n Q b 9 D O Y F M y C 5 E q U / c 1 Z k j M f s W k z R T F k i 7 L z Y M C 9 p F 5 G I L r V B T Y F u 0 H 8 z C p Z Y m y c h R i Y M V n b X V 4 H / 8 0 0 d L D / M C 5 l m D k T K t 4 2 W T l H Q t B o D j a Q R H F S O B u N G I l f K V 8 w w D j i s R p f Q s F h A 2 c R C r S I s W h G X E d 5 c Q k 5 1 J g w D R G Y V n T A s g m Z S h R q 7 t G V 3 h E H c 4 a P c C n q 6 D b f c F K f N Y a X a J E y J Z F 4 4 P M v u h a b c a G s p i D u g a w k r O s M 9 g C J U b P v t 9 o s F F 0 o h z 9 F m w A 6 X g s J K 8 j g V W K Z a G V v X m a y q v 2 I w Y 8 a w 3 G D D t Y x w t L 7 v d 8 8 d S 8 E l l E v D n Q R a 1 / / Y f I v o x l k I 9 V 2 T A 8 j 4 x x a p L C V x m C Y v v l c V 7 z 3 3 f J 0 C a f S 6 i X K W 4 i V K H x cz 2 F 3 D h 8 b l o B c c 9 w b n w 8 7 J l 3 p F 9 8 k b 8 p a 8 I w F 5 T 0 7 I N 3 J G x o Q T R 3 6 S X + S 3 d + A N v U / e 5 2 1 o a 6 / O e U 0 a 4 o 3 + A o U a K y A = < / l a t e x i t > X 1 X 2 X 3 Y 4

2 9 r 2 B
9 8 H 7 u E n d 3 a l r X p K G e c O / j m w r I w = = < / l a t e x i t > t e x i t s h a 1 _ b a s e 6 4 = " 9 1 k l A W 7 u r A Y O 5 B w B / n k 7

Theorem 3 . 1 .
A set of n-qubit states {|ψ i } i can have any collective (majority) bias in the outcomes of n-body Pauli observables.
s h a 1 _ b a s e 6 4 = " 3 h e j X 2 8 R 9 M V q D V 3 W o 7 h T a N 2 W / / 4 = " > A A A D g 3 i c b V J b a 9 s w F F b j d e u 8 W 7 s 9 7 k U s B A a D E G e F j c G g b F D 2 0 I c W m i Y 0 C U G S 5 U a 1 L H n S U V P P + E f s d f t l + z e T E 1 P m d A f b H H / n 9 p 0 L z a W w M B j 8 2 e k E D 3 Y f P t p 7 H D 5 5 + u z 5 i / 2 D l x d W O 8 P 4 O H a w j 9 e F K D + C V / h l / B u c N p p I x 1 E S n X z n 9 p 0 L z a W w M B j 8 2 e k E 9 3 b v P 9 h 7 G D 5 6 / O T p s / 2 D 5 5 d W O 8 P 4 r u a O H a w j 9 e F K D + C V / h l / B t O 2 m g i H U d J d P K d 2 3 c u c a 6 k g 8 H g z 0 4 n u L d 7 / 8 H e w / D R 4 y d P n + 0 f P L 9 w x l s u R t w o Y 8 c x c 0

X 1 Y 2 <
e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 7 9 C i c < / l a t e x i t > l a t e x i t s h a 1 _ b a s e 6 4 = " 6 / o U T 9 2 v y Q u e U S D F + U 2 x p 8 z F 6 / A = " > A A A D g 3 i c b V J b b 9 M w F P Y a B i P c N n j k x a K q h I R U N W U S C A l p A m n i Y Q + b t G 5 F b V U 5 j r u a O H a w j 9 e F K D + C V / h l / B t O 2 m g i H U d J d P K d 2 3 c u c a 6 k g 8 H g z 0 4 n u L d 7 / 8 H e w / D R 4 y d P n + 0 f P L 9 w x l s u R t w o Y 8 c x c 0

Z 1 Y 2 <
e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 4 0 S i b < / l a t e x i t > l a t e x i t s h a 1 _ b a s e 6 4 = " q + Y R 8x 3 H q L F K O H u h J K w 1 A y c w o u M = " > A A A D g 3 i c b V J b b 9 M w F P Y a B i P c N n j k x a K q h I R U N d 0 k E B L S B N L E w x 4 2 a V 0 L b V X Z j r O aO H a w j 9 e F K D + C V / h l / B u c N p p I x 1 E S n X z n 9 p 0 L z a W w M B j 8 2 e k E 9 3 b v P 9 h 7 G D 5 6 / O T p s / 2 D 5 5 d W O 8 P 4 r u a O H a w j 9 e F K D + C V / h l / B t O 2 m g i H U d J d P K d 2 3 c u c a 6 k g 8 H g z 0 4 n u L d 7 / 8 H e w / D R 4 y d P n + 0 f P L 9 w x l s u R t w o Y 8 c x c 0

Y 1 X 2 <
1 x P 2 e A s U l p K n W m C e + l J c k 2 i 8 r P / K 4 Z R Z y w q L F V c y w d m G Y d g 7 8 0 y D z y i X l n s J t M n / o b 2 M 5 J t 3 E J u b d t M g 0 x 8 b p N a U x G n a o v x e Z 7 y 1 3 P L 1 C q Q 1 q z b K m c Y m q h A v M 9 q + w 7 v K x b A f v e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 7 7 C i c < / l a t e x i t > l a t e x i t s h a 1 _ b a s e 6 4 = " + F h t v g+ j E u N Q p + w b C C Z 9 5 F E M Q M 0 = " > A A A D g 3 i c b V J b b 9 M w F P Y a B i P c N n j k x a K q h I R U N W U S C A l p A m n i Y Q + b t G 5 F b V U 5 jr u a O H a w j 9 e F K D + C V / h l / B t O 2 m g i H U d J d P K d 2 3 c u c a 6 k g 8 H g z 0 4 n u L d 7 / 8 H e w / D R 4 y d P n + 0 f P L 9 w x l s u R t w o Y 8 c x c 0

Figure 2 :
Figure2: A version of the Mermin-Peres Magic Square[9] using two-body Pauli observables.This grid of observables is organized in such a manner that any row or column is a complete set of commuting observables, a measurement context.Any quantum state measured in one of these rows(columns) will collapse onto a context eigenstate and yield outcomes which multiply to −1(+1).In other words, not all imaginable outcomes of a measurement context are possible; there are restrictions.
r 9 E h e o + O U Q 8 x b + 5 9 9 3 5 4 P 2 u / 6 4 / r T + v P K m r N W / Y 8 Q m t R b / 8 B / k I W 3 Q = = < / l a t e x i t > Occurrences < l a t e x i t s h a 1 _ b a s e 6 4 = " l y 3

l a t e x i t > hS mix i < l a t e x i t s h a 1 _
b a s e 6 4 = " K Y X y O P 8 H M m y N A R Z v 7 Y n / m o i P Y B o = " > A A A D m X i c b V L N a t t A E N 5 E / U n V P 6 c 9 + r I k G A o F Y 7 u H l p 7 c F k I o O S Q k T g y W M a v V y t 5 o t a v u z s Z W h Q 5 9 h 7 5 D r + 3 j 5 G 2 6 s k y o n A 6 S G H 3 z P / O F m e A G e r 3 b n V 3 v w c N H j / e e + E + f P X / x s r X / 6 t I o q y k b

Figure 3 :
Figure3: Using a parametrized circuit (shown in inset), 10 6 random 2-qubit mixed states were generated and classified according to their 2-body-Pauli preferred outcomes (512 possible configurations), counting the number of occurrences of each configuration and taking note of the lowest average sampling requirement S mix (f = 0.95) of each configuration.We plot these two values, obtaining a graph with 512 points.In the quantum circuit,U (θ, φ) = R z (φ)R x (−π/2)R z (θ)R x (π/2), with θ ∈ [0, π], φ ∈ [0, 2π].Classical randomness to generate mixed states is introduced with a random-not gate: RNot(x) = X with probability x, and RNot(x) = 1 otherwise.The preferred parities are labeled according to the total number of Magic Square restrictions satisfied (1 R, 3 R or 5 R) and marked with a star when all rows or all columns are satisfied.Notably, the preferred parities cluster according to these labels.

5 4 2 z 5 X
x 0 9 p 0 j h + S e 5 D Z z 2 7 m d / P f 8 j / y v / O / h 1 P m 5 1 O e x M 9 b y f / 4 C N V 5 Q S Q = = < / l a t e x i t > !< l a t e x i t s h a 1 _ b a s e 6 4 = " w U O e y S p g / U y 7 A 0 b B 1 Y C T S Q o 8 + T g = " > A A A C 9 3 i c b V J L b 9 Q w E P a G V w m v F o 5 c L L Y r c V o l 2 w O I U w U S 4 t B D K 7 F t p d 2 o c p z J r l n H T u 1 x I U T 5 H R y B C + L K f + H C v 8 H Z j S r S M p K l T 9 + 8 v p l x W k p h M Y r + D I I b N 2 / d v r N 1 N 7 x 3 / 8 H D R 9 s 7 j 4 + t d o b D 1 9 z z V 6 D P g 0 n I v E e b 6 7 + u P k Z 5 7 h 8 x c 1 i + N c v R l x l R I y T B N O y k + V 4 q L y K J f r 1 B a M 6 6 z n O p w i a k z 4 2 U f 3 g S H v U 7 8 p t P b 6 2 1 s f Z h 7 d J U 8 I y / I K x K T t 2 S L f C K 7 5 I B w 8 r v x t A G N 5 8 2 r 5 r f m 9 + a P W e p K Y 3 7 m C a m t 5 s 8 / 2 0 t N 6 A = = < / l a t e x i t > t e x i t s h a 1 _ b a s e 6 4 = " y 3i W r J h l a y o R O A A 9 n Q o k u l r E 6 j s = " > A A A D l 3 i c b V L b b t M w G P Y W D i O c O r i a u L G o K n F V N R 0 I x A 0 T S N U u d r G i d a v U l M p x n N X Es Y P 9 e 1 2 I I p 6 G W 3 g e 3 g a n j S b S Y T n W l + 8 / H 6 J c c A O D w Z + d X e / O 3 X v 3 9 x 7 4 D x 8 9 f v K 0 s / / s 3 C i r K Z t Q J Z S e R s Q w w S W b A A f B p r l m J I s E u 4 j S T 7 X 8 4 o p p w 5 U 8 g y J n 8 4 x c S p 5 w S s B R i 8 7 B G x w C u 4 Z y / U Z J + b m q 6 b b 2 3 p F S t k m T P C P P S Y / s k j 1 y S I 7 J g H D y l X w n P 8 j P e r P + t n 5 Y f 1 + 6 1 r b W M U 9 J R e o f / w I L d T X 2 < / l a t e x i t > Ci X1X2 < l a t e x i t s h a 1 _ b a s e 6 4 = " 2 C p E 0 v L z a p u B m 1 d 7 c 2 Q d h U w X F W o = " > A A A D g 3 i c b V J b a 9 s w F F b j d e u 8 W 7 s 9 7 k U s B A a D E G e F j c G g b F D 2 0 I c W m j a Q h C D L S q N a l j z p q K l n / C P 2 u v 2 y / Z s d J 6 b M 6 Q 6 2 O f 7 O 7 T u X O F f S w W D w Z 6 c T P N h 9 + G j v c f j k 6 b P n L / Y P X l 4 4 4 y 0 X I 2 6 U s e O Y O a 9 c D P v R + / 7 w 7 L B 7 9 K W 5 0 T 3 y m r w h b 0 l E P p A j 8 o 2 c k h H h J C U / y S / y O 9 g N 3 g X D 4 H D j 2 t l p Y l 6 R l g S f / w L 1 t i i a < / l a t e x i t > Y1Y2 < l a t e x i t s h a 1 _ b a s e 6 4 = " 4 N Q / m D h O E M J S o q C J P C W 9 6 6 m m a A k = " > A A A D g 3 i c b V J b a 9 s w F F b j d e u 8 W 7 s 9 7 k U s B A a D E G e F j c G g b F D 2 0 I c W m i Y l C U G S 5 U a 1 L H n S U V P P + E f s d f t l + z e T E 1 P m d A f b H H / n 9 p 0 L z a W w M B j 8 2 e k E D 3 Y f P t p 7 H D 5 5 + u z 5 i / 2 D l x d W O 8 P 4 e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 7 9 C i c < / l a t e x i t > X1Y2 < l a t e x i t s h a 1 _ b a s e 6 4 = " 6 / o U T 9 2 v y Q u e U S D F + U 2 x p 8 z F 6 / A = " > A A A D g 3 i c b V J b b 9 M w F P Y a B i P c N n j k x a K q h I R U N W U S C A l p A m n i Y Q + b t G 5 F b V U 5 j r u a O H a w j 9 e F K D + C V / h l / B t O 2 m g i H U d J d P K d 2 3 c u c a 6 k g 8 H g z 0 4 n u L d 7 / 8 H e w / D R 4 y d P n + 0 f P L 9 w x l s u R t w o Y 8 c x c 0 e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 4 0 S i b < / l a t e x i t > e 0 P z w 6 7 R 5 + a G 9 0 j L 8 k r 8 p p E 5 B 0 5 I l / I K R k R T l L y k / w i v 4 P d 4 E 0 w D A 4 3 r p 2 d J u Y F a U n w 8 S / 7 7 C i c < / l a t e x i t > Y1X2 < l a t e x i t s h a 1 _ b a s e 6 4 = "

Figure 6 :
Figure 6: Example of a 4-bitstring encoded by three two-qubit context eigenstates: |ψ 1 = 1 8 7 P M d f 9 8 5 c a K M M 6 W b z d 8 z s / c q 9 x 9 U 5 x 7 6 j x 4 / e f p s f u H 5 g R K 5 J H S f C C 7 k U Y Q V 5 S y l + 5 p p T o 8 y S X E S c X o Y D T 6 4 9 c M T K h U T 6 Z 4 e Z r S d 4 F 7 K u o x g D a 7 O Q q

Figure 7 :
Figure 7: Retrieval protocol for the preferred parity of observable O = Z 1 X 2 from states |ψ 1 , |ψ 2 and |ψ 3 of Fig.6, with three measurements steps (requiring at most three copies of each state).The protocol consists in filtering out eigenstates with unbiased statistics in O by performing successive measurements and discarding those that change their outcome.Both states |ψ 1 and |ψ 3 have unbiased probability distributions when measured in Z 1 X 2 , which is why they are likely to eventually change their outcome, whereas |ψ 2 always yields −1.In general, the expected number of unbiased states that fail to be filtered decreases exponentially in the number of retrieval steps.

Lemma 4 . 1 .
For n-body Pauli observables with even n, each observable can be associated to two contexts of size 2 n−1 + 1.Proof.For even n, choose an arbitrary n-body Pauli observable O 0 , which we will refer to as our context generator.Without loss of generality, consider O 0 = Z ⊗n .There are 2 n n-body Pauli observables which share no term with the generator in the same qubit positions, C = {X, Y } ⊗n .

1 √ 2 ( 1 √ 2 ( 1 √ 2 (
Each context has an associated basis of 2 n unique context eigenstates.For generator O 0 = Z ⊗n , one of the context eigenstates of C 1 is the n-qubit GHZ state |00 . . .0 + |11 . . . 1 ), and one of the context eigenstates of C 2 is the n-qubit i-phase GHZ state |00...0 + i |11...1 ).The rest of their bases can be obtained with local Pauli gates X and Z.For any other generator, the context eigenstates of generator O 0 = Z ⊗n can be rotated into the corresponding basis.For instance, |LLLL + |RRRR ) and1 √ 2 (|LLLL + i |RRRR ) are eigenstates of contexts generated by Y 1 Y 2 Y 3 Y 4 .This allows us to build a discrete-parameter circuit which can generate any context eigenstate (Fig.4).

7
Wrapping up the QRACThis way, we can summarize the whole m → k QRAC, including the repetitions, as a function of n and the success probabilityF.Alice has a data of m = (3 n − 1)/2 ∼ O(3 n ) (18)bits that she wants Bob to randomly access (one context at a time).To grant this access she sends at most N s (n)T (n) ∼ O(n(3/2) n ) states of n qubits, and repeats this r ∼ O(ln(1/(1 − F))) times to reach a final success probability of F. At most, the total number of states sent is N = rN s T and the total number of qubits sent is n times that:k = rnN s (n)T (n) ∼ O n Note that this yields the known success probability f m/k→1 RAC = 0.75 for m/k = 3.For large m/k we can obtain a cleaner expression with the normal approximation.

Table 1 :
Performance metrics for a QRAC trained to encode 40 binary digits of π/4 into N s context eigenstates of 4 qubits, via the statistics of 81 Pauli observables.
Notably, there is an asymptotic f e (ε) curve as n increases.Right axis: number of required samples S (dashed line) for negligible retrieval noise ν = 2−6(1 − f e ), and eigenstate selection size N s multiplied by 3 (dotted line), for same system sizes and as a function of ε.Notice that S and 3N s are approximately equal, implying that in average 3 measurements are required per eigenstate (see Eq. (12)).

Table 2 :
[17] shown lower and upper bounds for the success probability of m → 1QRAC (d + 1) log 2 (d) → log 2 (d) Success probability f dit for d-dimensionalQRACs, of the form (d + 1) log 2 (d) → log 2 (d) (in bit→ qubit notation), as obtained in[17]for all prime-power d ≤ 8. Since the original success probability is calculated for guessing dits (d-levels), we additionally compute a metric for bit success probability, f bit = (f dit ) 1/ log 2 (d) .