Quantum Advantage in Information Retrieval

Random access codes have provided many examples of quantum advantage in communication, but concern only one kind of information retrieval task. We introduce a related task - the Torpedo Game - and show that it admits greater quantum advantage than the comparable random access code. Perfect quantum strategies involving prepare-and-measure protocols with experimentally accessible three-level systems emerge via analysis in terms of the discrete Wigner function. The example is leveraged to an operational advantage in a pacifist version of the strategy game Battleship. We pinpoint a characteristic of quantum systems that enables quantum advantage in any bounded-memory information retrieval task. While preparation contextuality has previously been linked to advantages in random access coding we focus here on a different characteristic called sequential contextuality. It is shown not only to be necessary and sufficient for quantum advantage, but also to quantify the degree of advantage. Our perfect qutrit strategy for the Torpedo Game entails the strongest type of inconsistency with non-contextual hidden variables, revealing logical paradoxes with respect to those assumptions.


INTRODUCTION
Random access coding involves the encoding of a random input string into a shorter message string. The encoding should be such that any element of the input string can be retrieved with high probability from the message string. Such tasks have long been studied as examples in which the communication of quantum informa-tion can provide advantage, i.e. enhanced performance, over classical information, e.g. [1][2][3][4][5][6][7][8].
However, random access coding concerns only one kind of information retrieval. In this work we introduce another such task -the Torpedo Game. It is similar to random access coding, but with additional requirements involving the retrieval of relative information about elements of the input string. Taking a geometric perspective it may also be viewed as a pacifist version of the popular strategy game Battleship (see Fig. 1). Quantum strategies can be implemented in prepare-and-measure scenarios, and outperform classical strategies for the Torpedo Games with bit and trit inputs. In particular, quan-arXiv:2007.15643v2 [quant-ph] 19 Nov 2020 tum perfect strategies exist in the trit case and provide a greater quantum advantage than for the comparable random access coding task [5].
Optimal quantum strategies emerge from an analysis in terms of the discrete Wigner function. Wigner negativity is a signature of non-classicality in quantum systems that is related to contextuality and that has been widely studied as a resource for quantum speed-up and advantage [9][10][11][12][13][14][15][16]. Knowing which characteristic lies at the source of better-than-classical performances can both allow for comparison of quantum systems in terms of their utility, and offer a heuristic for generating further examples of quantum-enhanced performance. Our optimal quantum strategies are indeed Wigner negative, with perfect quantum strategies derived from maximum Wigner negativity. Yet while negativity is necessary for advantage in the Torpedo game, it is not sufficient.
To more precisely pinpoint the source of quantum advantage we must look further. One candidate would be preparation contextuality [17], another signature of nonclassicality that has been linked to QRACs in numerous studies [3,6,18]. It has been shown to be necessary for advantage in a restricted class of random access codes subject to an obliviousness constraint [16,19].
In this work, however, we focus on a different characteristic called sequential contextuality [20]. It indicates the absence of a hidden variable model respecting the sequential structure of a given protocol. Subject to an assumption of bounded-memory, we find that this characteristic is necessary and sufficient for quantum advantage, not just in random access coding but in any information retrieval task. Moreover, we show that it quantifies the degree of advantage that can be achieved.
Contextuality can exhibit itself at the level of probability distributions, e.g. quantum violations of the CHSH inequality [21]. But in some cases it can also manifest at the level of the supports of these distributions. In other words contextuality can be inferred by a series of logical deductions about which events are possible or not, e.g. Hardy's paradox [22,23]. This situation has come to be known as logical contextuality [24]. In the most extreme cases, known as strong contextuality [24], every possible event triggers such a paradox [25], e.g. Popescu-Rohrlich box violations of the CHSH inequality [26] (see also [27,28]). Note that empirical data is always expressible as a convex mixture of classical and strongly contextual data [24,29]. For qutrits the quantum perfect strategies we introduce display analogous contextuality, and hence paradoxes, of this strongest form in a prepare-and measure scenario.
Sec. I gives an overview of information retrieval tasks including random access coding and the Torpedo Game. Sec. II provides background on discrete Wigner functions. Sec. III deals with optimal classical and quantum strategies for the Torpedo Game. Finally, Sec. IV establishes the relationship between sequential contextuality and quantum advantage in bounded-memory information retrieval tasks.

A. Random Access Codes
An (n, m) 2 Random Access Code (RAC), sometimes denoted n → m, is a communication task in which one aims to encode information about a random n-bit input string into an m-bit message where m < n, in such a way that any one of the input bits may be retrieved from the message with high probability. An (n, m) 2 Quantum Random Access Code (QRAC) instead encodes the input into an m-qubit (quantum) message state.
Such tasks may be considered as two-party cooperative games in which the first party, Alice, receives a random input string from a referee. She encodes information about this in a message that is communicated to the second party, Bob. The referee then asks Bob to retrieve the value of the bit at a randomly chosen position in the input string. We will assume that the referee's choices are made uniformly at random.
For instance, for the (2, 1) 2 RAC game [1] an optimal classical strategy is for Alice to directly communicate one of the input bits to Bob. If asked for this bit, Bob can always return the correct answer, otherwise Bob guesses and will provide the correct answer with probability 1 2 . Thus the game has a classical value of Quantum strategies can outperform this classical bound.
The four red dots correspond to the four states |ψx 1 ,x 2 defined in Eq. (1) depicted as points on the equator of the Bloch sphere.
An optimal quantum strategy is for Alice to communicate the qubit state where (x, z) is the input bit-string she has received. Bob measures in the X basis when asked for x 1 and in the Y basis when asked for x 2 (see Fig. 2). If he obtains the +1 eigenvalue he returns the value 1 and if he obtains the −1 eigenvalue he returns 0. This yields a quantum value for the game of θ Q 2→1 = cos 2 π 8 ≈ 0.85 .

B. General Information Retrieval Tasks
One may also consider more general communication scenarios. In an (n, m) d communication scenario the input is a random string of n dits and the message is a string of m (qu)dits, for d ≥ 2. (Q)RAC tasks have previously been considered in such scenarios, e.g. in [5,30].
However, we also wish to accommodate for a much wider range of information retrieval tasks. An information retrieval task in an (n, m) d communication scenario is specified by a tuple Q, {w q } q∈Q .
• Q is a finite set of questions.
• The w q : Z n d → Z d are winning relations, which pick out the good answers to question q given an input string in Z n d . Note that there may be more than one good answer, or none. It is assumed that inputs and outputs are endowed with the structure of the commutative ring Z d .
Standard (n, m) d (Q)RACs are recovered when the questions ask precisely for the respective input dits. In that case the winning relations w i reduces simply to projectors onto the respective dits of the input string. However, other interesting tasks arise when the questions also concern relative information about the input string, in the form of parities or linear combinations modulo d of the input dits. A similar generalisation for d = 2, using functions rather than relations, has been independently proposed in [31].

C. The Torpedo Game
Of particular interest in the present work is an information retrieval task for (2, 1) d communication scenarios. We take the game perspective and refer to the task as the dimension d Torpedo Game (see Fig. 1 in dimension 3). Let x and z be the two input dits. There are d + 1 questions Q = {∞, 0, 1, . . . , d − 1}. The labelling comes from a geometric interpretation to be elaborated upon shortly. Winning relations for the Torpedo Game are given by All arithmetic is modulo d.
For d = 2, the Torpedo Game is equivalent to a (2, 1) 2 (Q)RAC, but with an additional question. Bob may be asked to retrieve either one the individual input dits, or to retrieve relative information about them in the form of their parity x ⊕ z. We note that dimension 2 is the only case where the winning relations are actually functions (there is only one good answer per question). The Torpedo Game may be framed as cooperative, pacifist alternative to the popular game Battleship, in which Alice and Bob, finding themselves on opposing sides in a context of naval warfare, wish to subvert the conflict and cooperate to avoid casualities while not directly disobeying orders.
We take the input dits received by Alice as designating the coordinates in which she is ordered by her commander to position her one-cell ship on the affine plane of order d. We may think of the affine plane as a toric d × d grid, with x designating the row and z the column. E.g. in Fig. 4 we identify the top edge with the bottom edge and the left edge with the right edge.
Bob is a naval officer on the opposing side who is ordered by his commander to shoot a torpedo along a line of the grid with slope specified by q ∈ Q. The ∞ question requires Bob to shoot along some row, and the 0 question requires Bob to shoot along some column, etc. However, Bob retains the freedom to choose which row, or column, or diagonal of given slope, as the case may be. In other terms, upon receiving q Bob must shoot along a lines qx − z = c (if q = ∞) or x = c (if q = ∞) but is free to choose the constant c.
Alice and Bob wish to coordinate a strategy for avoiding casualities, while still obeying their explicit orders. Alice may communicate a single (qu)dit to Bob -greater communication may risk revealing her position should it be intercepted -and based on this Bob must choose his c in such a way that he avoids Alice's ship.
FIG. 4. The red arrows depict the directions or slopes (∞, 0, 1, 2, respectively) along which Bob may be asked to shoot in the d = 3 Torpedo Game. For each direction, Bob has three possibilities, depicted by the blue lines. In the affine plane of order 3, each of these groups of three blue cells forms a line.

II. THE DISCRETE WIGNER FUNCTION
It is possible to represent finite-dimensional quantum states as quasi-probability distributions over a phase space of discrete points. Wootters [32,33] introduced a method of constructing discrete Wigner functions (DWF) based on finite fields, wherein vectors from a complete set of mutually unbiased bases in C d are put in one-to-one correspondence with the lines of a finite affine plane of order d. This geometric picture of the DWF is useful for visualizing our Torpedo Game as exemplified in Fig. 4, where each distinct orthonormal basis corresponds to a set of d parallel (non-intersecting) lines. Gross [34] singled out one particularly symmetric definition of DWF that obeys the discrete version of Hudson's Theorem. This theorem says that an odd-dimensional pure state is non-negatively represented in the DWF if and only if it is a stabilizer state (defined below). The discrete Hudson's Theorem has remarkable implications, providing large classes of quantum circuit with a local hidden variable model that enables efficient simulation [10,35]. Clearly, negativity in this DWF is a necessary prerequisite for quantum speed-up. Howard et al. [11] showed that this negativity actually corresponds to contextuality with respect to Pauli measurements, thereby establishing the operational utility of contextuality for the gate-based model of quantum computation (particularly in a fault-tolerant setting). The equivalence of Wigner negativity and contextuality was established by deriving a noncontextuality inequality using the graph-theoretic techniques of Cabello, Severini and Winter [36] which extend Kochen-Specker type state-independent proofs to the state-dependent realm. This proof (and a subsequent alternate proof [37]) requires that, as well as the system displaying Wigner negativity, a second ancillary system must be present in order to have a sufficiently rich set of available measurements.

A. DWF Formalism
The discrete Wigner function is both foundationally interesting as well as practically relevant for fault-tolerant quantum computing via its link with so-called "stabilizer states". The qudit versions of the X and Z Pauli opera-tors are where ω = exp(2πi/d) and arithmetic is modulo d. The qudit Pauli group has elements which are products of (powers of) these operators e.g. X x Z z for x, z ∈ Z d . A unitary U stabilizes a state |ψ if U |ψ = |ψ . A stabilizer state is the unique n-qudit state stabilized by a subgroup of size d n of the Pauli group. Equivalently, stabilizer states may be understood as the image of computational basis states under the Clifford group, which is the set of unitaries that map the Pauli group to itself under conjugation.
For an arbitrary d × d Hermitian operator Q of unit trace (typically a density matrix), its Wigner representation will consist of d 2 real quasi-probabilities W x,z for x, z ∈ Z d . In particular, the quasi-probability associated with the point (x, z) ∈ Z 2 d is given by where A x,z are the so-called phase point operators to be defined shortly. The unit trace of Q will ensure that x,z W x,z = 1. Taking the magnitude |W x,z | of each quasi-probability will lead to x,z |W x,z | = 1 if and only if the quasi-probability distribution is actually a legitimate (non-negative) discrete probability distribution. In contrast, the presence of negative quasi-probabilities entails x,z |W x,z | > 1, and in fact the departure of x,z |W x,z | from unity is a sensible measure of "how negative" or "how non-classical" the DWF of an operator is [10,38].
When working with the DWF, it is convenient to use the Weyl-Heisenberg notation and phase convention for the qudit Pauli operators i.e.
where they go by name displacement operators. The phase point operator at the origin of phase space A 0,0 is given by the simple expression and the remainder are found by conjugation with displacement operators

B. DWF and Information Retrieval
The eigenvectors of phase point operators are objects of interest. The maximizing eigenvectors of the phase point operators in Eq. (3) (and additional ones from different choices of DWF) were used in Casaccino et al. [30] as the encoded messages of a (d + 1, 1) d QRAC. This is natural given the use of MUBs in constructing DWFs, and prominence of MUBs in the QRAC literature. If Alice receives input k k k = (k 1 , k 2 , . . . , k d+1 ) ∈ Z d+1 d that she encodes in ρ k k k and transmits to Bob, then the average probability of success for the Casaccino et al. QRAC is where Π i q is the projector corresponding to dit value i in Bob's q-th measurement setting. Since phase point operators are constructed using sums of projectors from MUBs i.e., Π k1 d+1 , the use of a maximizing eigenvector of a phase point operator for ρ k k k is natural to maximize Eq. (4).
In this work we instead make use of the minimizing eigenvectors of phase point operators. The rationale for this is two-fold (i) these eigenvectors display remarkable geometric properties with respect to the measurements in (their constituent) mutually unbiased bases, and (ii) negativity (of a state in the DWF) is the hallmark of non-classicality which has already been identified with contextuality (with the already mentioned caveat that an additional "spectator" subsystem was required). These will be seen to lead to a perfect quantum strategy for the Torpedo Game.

III. OPTIMAL STRATEGIES FOR THE TORPEDO GAME
Here we gather the optimal classical, quantum and (in one case) post-quantum strategies for the Torpedo Game. We only focus on Torpedo games with power-of-prime dimension d as we are able to provide perfect quantum strategies in these cases (for d ≥ 3) due to the fact that there exist d + 1 MUBs for those dimensions. The quantum case differs depending on whether we use a qubit or a qudit of odd prime power dimension. The classical optimum can only be established rigorously for small dimensions, owing to the proliferation of possible hidden variable assignments as the dimension increases. We obtain a quantum advantage for dimension 2 and 3. At the conclusion of this article we sketch a modified Torpedo Game that we believe may have a lower classical value whenever d ≥ 5, thereby re-establishing a quantum advantage in those dimensions.

A. Optimal Quantum and Post-Quantum Strategies
a. Quantum Perfect Strategy for Odd Power-of-Prime Dimension. From Eq. (5) it follows that there is a perfect quantum strategy for the dimension d Torpedo game for any for odd power-of-prime d: 1. Upon receiving dits x and z Alice sends the following state to Bob: 2. Bob receives |ψ x,z and is asked a question q ∈ {∞, 0, . . . , d − 1}. He measures the state in the MUB corresponding to q and outputs the dit corresponding to the measurement outcome.
This quantum strategy wins the Torpedo Game deterministically, i.e. with probability 1. In Fig. 5 we provide geometric intuition for why this strategy is perfect. b. Optimal Quantum Strategy for Qubits. An analogous strategy to the qudit case can be employed for the qubit Torpedo Game, using message states |ψ x,z = X x Z z |ψ 0,0 where X, Y and Z are the usual qubit Pauli spin matrices and |ψ 0,0 ψ 0,0 | = The perfect quantum strategy can be understood by plotting the Discrete Wigner Function of the message state sent by Alice. In the above qutrit case, Alice is in coordinate (x, z) = (2, 0), so she sends Bob the state |ψ2,0 whose Wigner function is −1/3 at coordinate (2, 0) and 1/6 otherwise. Bob measures this state along any of the four allowed directions, wherein the probability of each outcome is given by sum of quasiprobabilities along the corresponding line. Hence, the only outcomes with non-zero probability of occurring correspond to lines not passing through (2, 0). Whichever outcome Bob sees, he may fire his torpedo along the corresponding line, safe in the knowledge that it will not intersect Alice's ship. In this figure the solid blue lines correspond to the possible outcomes for the q = 0 direction, but the same argument holds for all the other directions.
constitute a perfect strategy it still achieves an advantage over classical strategies. In fact, it turns out to be an optimal strategy: this strategy achieves a winning probability of approximately 0.79 and we show that this is optimal. First we can leverage the fact that the (3, 1) 2 (Q)RAC attributed to Isaac Chuang is at least as hard to win as the Torpedo Game because for the last question, instead of asking to retrieve the parity of the input bits, the (3, 1) 2 (Q)RAC ask to retrieve a third independent bit. Thus we get a lower bound of 1 2 1 + 1 √ 3 ≈ 0.79 on the optimal quantum value. To obtain a matching upper bound, we implemented numerically the NPA hierarchy [43] which is a hierarchy of semi-definite programs converging from the exterior to the correlations arising from quantum systems. Because the message sent from Alice to Bob is of finite dimension we relied mostly on [44] which allows to characterise correlations arising from finite-dimensional quantum systems. We found a matching upper bound proving that indeed θ Q d=2 ≈ 0.79.  d+1 − I, where scare quotes reflect the fact that, although it is Hermitian and has unit trace, its spectrum is not necessarily nonnegative. In fact the "state" above is a phase point operator, A k k k , for one of Wootters' discrete Wigner functions. Since phase point operators obey Tr(AI) = 1 and Tr(AA) = d then In other words, there is a perfect strategy by using post-quantum states. Seen in this way, phase point operators in a (d + 1, 1) d QRAC scenario are similar to Popescu-Rohrlich [26] boxes in the CHSH scenario. As seen above, our Torpedo Game has a perfect strategy within quantum mechanics for all odd power-of-prime dimensions, by construction. In contrast, we saw that the qubit Torpedo Game only has quantum value of roughly 0.79. To reach a perfect strategy, we must once again use a phase point operator as the non-physical "state" that Alice sends to Bob, see Fig. 6.

B. Optimal Classical Strategies
In what follows, we describe an encoding map E = {p E (·|x, z)} x,z as specifying a probability distribution over messages j ∈ Z d for each combination of inputs x, z ∈ Z d . Similarly a decoding map D = {p D (·|j, q)} j,q specifies a probability distribution over outputs c ∈ Z d for each combination of a message and question, j, q ∈ Z d respectively.
Combining an encoding E and a decoding D results in an empirical behaviour e = {p e (·|x, z, q)} x,z,q . This is a set of probability distributions over outputs c ∈ Z d , one for each combination of the referee variables x, z, q ∈ Z d , such that By comparison, quantum mechanical empirical behaviours arise via the Born rule: p e (c|x, z, q) = Tr(ρ x,z Π c q ). Assuming the referee variables to be uniformly distributed, a strategy has a winning probability given in terms of its empirical probabilities as The classical value of the Torpedo Game for dimension d can thus be expressed as For evaluation of this expression note that it suffices to consider deterministic encodings and decodings. In the presence of shared randomness, nondeterministic strategies can always be obtained as convex combinations of deterministic ones and the expression is convex linear [45]. Furthermore, for each encoding there exists a decoding that is optimal with respect to it. This fact was also observed for one-way communication tasks with messages of bounded dimension in [16]. Thus it is possible to evaluate the classical value by enumerating over deterministic encodings only. Proposition 1. The classical value of an information retrieval task can be expressed as a maximum over encodings as Proof. Starting from Eq. (8), where the last line follows by using a deterministic decoding that is optimal with respect to the encoding.
A useful way of representing any deterministic encoding is as a colouring of the d × d affine plane using no more than d colours. Observe that a deterministic encoding can alternatively be expressed as a function z) is the message dit to be sent (with probability 1) given inputs x, z. Thinking of the inputs as coordinates in the d × d affine plane a deterministic encoding is equivalent to a partition of the plane into no more than d equivalence classes, or a colouring using no more than d colours.
a. Optimal Strategies for d = 2 and d = 3. In general there are d d 2 partitions of a d × d grid. For low dimensions the expression in Eq. (9) can be evaluated by exhaustive search over partitions. For dimension 2 and 3 we find Example of strategies that attains these values are depicted below in Fig. 7 and in Fig. 8.  Fig. 4) show where Bob chooses to shoot, given a direction and a colour. For the first direction, when asked to shoot horizontally in the grid, notice that Bob may avoid Alice with certainty if she is in either of the red or green partitions. Lines that avoid Alice with certainty are depicted in the corresponding colour, whereas black lines intersect with Alice's position with probability 1 3 . Overall, this strategy wins the Torpedo Game with probability 1 4 ( 8 9 + 8 9 + 1 + 8 9 ) = 11 12 .
b. Optimal Strategies for d = 5 and beyond. As d increases it quickly becomes infeasible to perform an exhaustive search over all partitions. We have, however, found perfect classical strategies, i.e. strategies that win with probability 1, for d = 5 (see Fig. 9) up to d = 23. This leads us to conjecture that there exists a perfect classical strategy for all d > 5, FIG. 9. A perfect classical strategy for the d = 5 Torpedo Game. As Fig. 8, same coloured cells belong to the same partition. The lines that avoid Alice are depicted below for every questions Bob can be asked.

C. Comparison of Quantum and Classical Game Values
Recall the optimal quantum values established in Sec. III A, Comparing these with the classical bounds from Sec. III B we obtain the ratios By comparison, it was shown in [5] that the classical and quantum values of the (4, 1) 3 (Q)RAC are 16 27 and 0.637, respectively, giving a ratio of θ Q d=3 /θ C d=3 1.075. Accordingly, we note that the d = 3 Torpedo Game admits a greater quantum-over-classical advantage than the standard random access coding task whose optimal QRAC also exploits the 4 mutually unbiased bases available in dimension 3.

IV. CHARACTERISING AND QUANTIFYING CONTEXTUALITY IN INFORMATION RETRIEVAL TASKS
When quantum advantage is observed in a boundedmemory information retrieval task like a (Q)RAC task or the Torpedo Game, it highlights a difference between the information carrying capacities of qudits compared to dits for a fixed dimension. It can be remarked that such a difference is a consequence of the different geometries of the respective state spaces. In this section, however, we seek a sharper, quantified analysis of the source of the advantage in terms of contextuality. We follow the sequential approach to contextuality of [20], as a behavioural characteristic that may arise in sequences of operations and is distinct from that of Spekkens [17]. For the bounded-memory regime we are interested in sequential contextuality also matches the characteristic introduced byŻukowski in [46]. While [20] was concerned specifically with sequences of transformations, we take a broader view that applies also to prepare-and-measure scenarios.
The study of contextuality arose in quantum foundations, where a major theme is the attempt to understand empirical behaviours that may appear non-intuitive from a classical perspective, e.g. the EPR paradox [47]. The typical approach is to look for a description of physical systems at a deeper level than the quantum one at which more classically intuitive properties may be restored. Such a description is usually formalised as a hidden variable model for the behaviour (sometimes also referred to as an ontological model [17]). The great significance of the celebrated no-go theorems of quantum foundations, like Bell's Theorem [48] and the Bell-Kochen-Specker Theorem [49,50], was to prove that certain 'non-classical' features of the empirical behaviours of quantum systems are necessarily inherited by any underlying model.
Non-classical features of quantum systems like contextuality are also increasingly investigated for their practical utility. For instance, in previous work involving present authors, contextuality of the Bell-Kochen-Specker kind was shown to be a prerequisite for quantum speed-up [11] and to quantify quantum-over-classical advantage in a variety of informational tasks [29].
Bell-Kochen-Specker contextuality essentially concerns the statistics that arise under varied measurements on a physical system. In contrast, our notion of contextuality concerns the statistics that arise from sequences of operations -preparations, transformations and measurements -all of which can vary. As a behavioural feature sequential contextuality signifies the absence of a hidden variable model that respects the sequential structure of these operations.
Rather than focusing on characteristics that must be inherited by all hidden variable models, as is common in foundational works, we also take a practical perspective and shift focus to characteristics that must be inherited by bounded-memory models -a constraint that matches the informational problem at hand. In this respect, the significance of sequential contextuality in what follows can be viewed through a practical rather than a foundational lens, as a characteristic that quantifies quantum advantage.

A. Empirical Behaviours and Hidden Variable Models
Recall from Section III B that any strategy for an information retrieval task gives rise to an empirical behaviour e = {p e (·|i, q)} i,q . In other words, for each combination of input string i ∈ Z n d and question q ∈ Q there is a resulting probability distribution over outputs. This is true regardless of whether the strategy is classical, quantum, post-quantum, or other. The combination of input string and question will be referred to as the context. This description of empirical behaviour echoes the formalism of empirical models for measurement scenarios in [24].
Given an empirical behaviour, one can ask whether it can be simulated by a bounded-memory hidden variable model. In particular we will be interested in models that respect the sequential structure of the strategy, bearing in mind that the inputs and questions specify a sequence of operations: either preparations, transformations, or measurements. Our main focus is on prepare-and-measure scenarios, in which sequences arise from a combination of a preparation and a measurement.
To match the constraints of information retrieval tasks, memory is bounded by the dimension of the message string.
In a bounded-memory model, the hidden variable is restricted to take values in Z d with d fixed by the communication scenario. A state preparation P is modelled by a probability distribution p π (· | P ) over the hidden variable space Z d . Similarly, a measurement M is modelled by a family of probability distributions {p µ (· | λ, M )} λ over the outcome space, which to match the communication scenario is also Z d . A hidden variable model, e.g. for a prepare-and-measure sequence of operations M q • P x,z as in Fig. 10, simulates an empirical behaviour as With this in mind, the bounded-memory classical strategies of Sec. III can also be interpreted as boundedmemory hidden variable models themselves. To see this, note that in Eq. (7) encoding corresponds to hiddenvariable preparation and decoding to hidden-variable measurement.
While the above description makes contact with the strategies and empirical behaviours of Sec. III, it will be convenient for the remainder of this section to use a simplified notation. Let us work in the real vector space with basis given by the hidden variable states Z d . For all preparations P x,z , the probability distribution p π (· | P x,z ) will be more concisely denoted as a probability vector λ λ λ x,z . For measurements, we express {p µ (· | λ, M )} λ more concisely as a set v v v c q c∈Z d of positive real vectors, one for each outcome c ∈ Z d . These satisfy the property that for all q, c∈Z d v v v c q = 1 1 1, the vector all of whose entries are 1. If we also denote by e x,z,q := p e (· | x, z, q) the empirical probability vector over outcomes Z d , then Eq. (14) can be rewritten for each outcome c ∈ Z d in simplified notation as the dot product As our focus is on prepare-and-measure scenarios, we have not discussed hidden-variable modelling of transformations. This is discussed in the appendix, Sec. A 1.

B. Sequential Contextuality in Information Retrieval Tasks
An empirical behaviour is sequential noncontextual if it admits a hidden variable model that: (i) preserves a modular sequential description of operations, and (ii) the hidden variable representation of operations is contextindependent.
These assumptions have been implicitly built into the above definition of hidden-variable models. For (i), note that each operation has an individual description at the hidden-variable level. For example, to obtain predictions for a prepare-and-measure experiment we compose the individual hidden-variable descriptions of the preparation and of the measurement, as in Eq. (15). And for (ii), note for example that regardless of which context the preparation P x,z appears in it should be modelled by the same vector λ x,z . One could relax these assumptions, in which case it would become trivial to find a hiddenvariable model for any behaviour, but it would also entail giving up the intuitive sense of what the model means.
If an empirical behaviour does not admit a sequential noncontextual hidden-variable model it is said to be sequential contextual. In this article we will only be considering sequential contextuality with respect to boundedmemory models, though the definition may be applied more generally.
A useful intuition for sequential contextuality is that, within the memory constraints, for any faithful model of the behaviour the whole (the description of the context) is more than the composition of its parts (the description of the individual operations). A contextual model would always involve additional memory and communication to track the context, which would be outside of the constraints of the task -involving, e.g., a contextuality demon analogous to Maxwell's demon in thermodynamics. Indeed it was shown in [51] that a related characteristic incurs a simulation cost as measured by Landauer erasure.

C. Quantifying Contextuality via the Contextual Fraction
For any fixed (n, m) d communication scenario empirical behaviours are closed under context-wise convex combinations -a property that is inherited from probability distributions. In operational terms, if shared randomness is used to choose between several strategies the result is still an empirical behaviour.
For any empirical behaviour e, we can consider convex decompositions of the form where e NC and e are empirical behaviours for the same task and e NC is noncontextual. The maximum of ω over all such decompositions is referred to as the noncontextual fraction of e, written NCF(e). Similarly, the contextual fraction of e is CF(e) := 1 − NCF(e). This provides a measure of contextuality in the interval [0, 1], where CF(e) = 0 indicates that e is noncontextual, CF(e) > 0 indicates that e is contextual, and CF(e) = 1 indicates that e is maximally contextual (also referred to as strong contextuality).
The contextual fraction was used as a measure for sequential contextuality in [20]. It extends a natural measure for Bell-Kochen-Specker contextuality [24], which itself generalises measures based on Bell-inequality violations [29]. 10. The Torpedo Game in a prepare-and-measure (top) vs transformational scenario (bottom). The empirical models ex,z,q in either scenario are the same both quantumly and classically. Hence classical and quantum strategies for any (2, 1) d information retrieval task can be equivalently expressed in prepare-and-measure or transformational form.
Though we focus here on the prepare-and-measure version of the Torpedo game, note that it can be equivalently expressed in a sequential scenario with fixed preparation and measurement (see Fig. 10). In Appendix A we provide the explicit quantum and classical strategies for this purely transformational version of the Torpedo Game as well as the equivalence between prepare-and-measure and sequential protocols.
Proposition 2. For d = 2 and d = 3, strong sequential contextuality with respect to bounded memory is necessary and sufficient to win the Torpedo Game deterministically.
Proof. Suppose a bounded-memory hidden variable model realises an empirical model that wins the Tor-pedo Game deterministically. Input-question combinations (x, z, q) label the contexts. Recall that the wining relation is ω q (x, z), and the winning condition for the torpedo game is p e (c ∈ ω q (x, z) | x, z, q) = 0. (17) Using notations introduced in Sec. IV A, the hidden-variable model must specify probability vectors {λ x,z } x,z∈Z d and positive vectors v v v c q c∈Z d ,q∈Q such that for all x, z ∈ Z d , ∀q ∈ Q and c ∈ ω q (x, z).
As mentioned in Sec. III B, it suffices to consider deterministic strategies. Eq. (18) reduces to a set of binary linear equations (36 equations for d = 3) that any sequentially noncontextual realisation must jointly satisfy.
This cannot be possible since it would provide a perfect classical strategy for the d = 2 and d = 3 Torpedo Games, violating the optimal bounds Eq. (10) that were obtained by exhaustive search. On the other hand, it is always possible to obtain a contextual realisation, by taking context-wise solutions to Eq. (18): e.g. where the choice of λ λ λ x,z is not only a function of x and z, but also of q.
It can further be observed that if any fraction of an empirical model e can be described noncontextually, i.e. NCF(e) = p > 0, then with an average probability at least p the empirical model e fails in the Torpedo Game. Therefore, to win the Torpedo Game deterministically requires strong contextuality.
An explicit noncontextual memory-bounded hidden variable model that fails to fully realise the empirical predictions but that satisfies the maximum of 33 out of 36 constraints from Eq. (18) for d = 3 is the following. Measurement and state vectors are given in terms of the computational basis vectors, where f f f k denotes the kth computational basis vector (zero-indexed) in the vector The state vectors are This corresponds to the strategy depicted in Fig. 8.
We also obtain the following more general result, of which Proposition 2 is a special case.
Theorem 3. Given any information retrieval task and strategy with empirical behaviour e, ε ≥ NCF(e) ν where ε is the probability of failure, averaged over inputs and questions, NCF(e) is the bounded-memory noncontextual fraction of e with memory size d fixed by the scenario, and ν := 1 − θ C measures the hardness of the task, θ C being the classical value.
Proof. The empirical behaviour can be decomposed as: where e is necessarily strongly contextual. From this convex decomposition, we obtain that the probability of success using the empirical model e reads: p S,e = NCF(e)p S,e NC + CF(e)p S,e where p S,e NC and p S,e are the average probabilities associated with empirical models e NC and e respectively. At best, e wins with probability 1 and thus: where ε e NC = 1 − p S,e NC is the average probability of failure associated with e NC . Since the latter is noncontextual, we know that the minimum probability of failure is ν = 1 − θ C , where θ C is the classical value of the game.
Then ε e NC ≤ ν, from which we obtain the desired inequality: This provides a quantifiable relationship between quantum advantage and sequential contextuality. Inequalities of this form are also known to arise for a variety of other informational tasks that admit quantum advantage, with hardness measures and notions of nonclassicality adapted to the particular task [20,29,52].

V. DISCUSSION
We have formalised a class of information retrieval tasks in communication scenarios, of which the muchstudied problem of (quantum) random access coding is a special case. We showed that quantum-over-classical advantage is explained by quantum contextuality. We have identified a distinct information retrieval task that we have presented as the Torpedo Game, which admits a greater quantum-over-classical advantage than the comparable QRAC for qutrits by exploiting Wigner negativity. Remarkably, the qutrit torpedo strategy is maximally contextual, meaning that no fraction of it can be explained by an underlying noncontextual model.
To obtain quantum perfect strategies for the Torpedo Game we have derived a prepare-and-measure scenario for which quantum mechanics exhibits logically paradoxical behaviour (with respect to noncontextual hidden variable assumptions). More generally, we have identified this as a characteristic that quantifies quantum advantage for any bounded-memory information retrieval task.
In the specific case of random access coding, some works have imposed obliviousness constraints as part of the task as opposed to bounded-memory. These restrict what information the receiver can be allowed to infer about the input string. Whereas preparation contextuality is known to be necessary and sufficient for quantum advantage in oblivious tasks [16,19], we have shown sequential contextuality to be necessary and sufficient characteristic for bounded-memory tasks.
We briefly comment on possible generalisations of the Torpedo game. In Eq. (11) we conjectured, based on an explicit proof in 5 ≤ d ≤ 23, that there is a perfect classical strategy in all d ≥ 5 for the Torpedo game with standard winning conditions as in Eq. (2). In order to re-instate a quantum-over-classical advantage, as we had in dimensions two and three, we may modify the Torpedo game to make it harder to win classically. Note that the following modifications have no effect on the quantum values, which remain θ Q d≥3 = 1. Because the −1 subspace of Gross' phase point operator A has dimension d−1 2 it is possible to enlarge Alice's input from d 2 to d 2 (d−1) 2 . Formally, let 0 ≤ < d−1 2 , so Alice sends Bob |ψ x,z, = X x Z z (| + 1 + |−( + 1) ) / √ 2, instead of just |ψ x,z, =0 := |ψ x,z as before. The modification changes a single relation from w ∞ (x, z) = {a ∈ Z d | a = x} to w ∞ (x, z, ) = {a ∈ Z d |a ∈ {x + + 1, x − − 1}}, whereas the remaining conditions persist i.e, w q (x, z, ) = w q (x, z) in Eq. (2) for q ∈ {0, 1, . . . , d − 1}. It seems reasonable that such a game, with more restrictive winning conditions, should be harder to win. Indeed, we were unable to find any perfect classical strategy by sampling, although we cannot rule out its existence since we were unable to exhaustively check all classical strategies. More generally, we have motivated how our perfect quantum strategies for this information retrieval task arise from a remarkable geometric feature of maximally negative states (c.f. Eq. (5)), and we expect that this insight can be further mined for quantum advantage in future work. mentation of the NPA hierarchy that allowed us to bound the quantum value of the Torpedo game for d = 2.
Funding is gratefully acknowledged from the Irish Research Council, the French Ministry for Europe and Foreign Affairs, and the French Ministry for Higher-level Education, Research and Innovation under the PHC Ulysses Programme 2019. M.H. is supported by a Royal Society-Science Foundation Ireland University Research Fel-lowship. S.M. was supported by the Bpifrance project RISQ, and for most of the period during which this work was carried out was based at the Paris Centre for Quantum Computing and the Institut de Recherche en Informatique Fondamentale, University of Paris, where he wishes to thank Iordanis Kerenidis.
Contributions All authors contributed equally to this work.
setting. Our proof uses the matrix elements of A x,z combined with the Clifford gates that map the computational basis to each of the additional measurement bases. For this we use the symplectic representation of the Clifford group. The expressions below hold for odd prime d (in the odd prime power case d = p n one should replace Z d with F d ). Clifford group elements are written as C = D x,z U F [55] where where H and S are the qudit versions of the Hadamard and Phase gate respectively. Using Eq. (A3), and the fact that