Transitions in Entanglement Complexity in Random Circuits

Entanglement is the defining characteristic of quantum mechanics. Bipartite entanglement is characterized by the von Neumann entropy. Entanglement is not just described by a number, however; it is also characterized by its level of complexity. The complexity of entanglement is at the root of the onset of quantum chaos, universal distribution of entanglement spectrum statistics, hardness of a disentangling algorithm and of the quantum machine learning of an unknown random circuit, and universal temporal entanglement fluctuations. In this paper, we numerically show how a crossover from a simple pattern of entanglement to a universal, complex pattern can be driven by doping a random Clifford circuit with $T$ gates. This work shows that quantum complexity and complex entanglement stem from the conjunction of entanglement and non-stabilizer resources, also known as magic.


Introduction
One of the most fundamental properties of nature is the inevitable creation of disorder from order, leading to equilibration and thermalization. Classically, such behavior arises from extreme sensitivity to initial conditions [1][2][3][4], that is, chaos. High sensitivity to initial conditions, also dubbed the "butterfly effect", is easily observed at the macroscopic level [3,4]. In quantum mechanics, the characterization of chaos in quantum systems is an ongoing enterprise that is central in the field of quantum information and quantum many-body theory [5][6][7][8][9][10]. For example, studies in random matrix theory [5,[11][12][13][14][15][16][17] have provided analytical means of identifying chaos in quantum Hamiltonians and systems of entangled qubits. Indeed, it is well known that the emergence of chaos in quantum systems goes hand in hand with entanglement [9,[18][19][20][21][22][23][24], a fact that has brought the problem of creating sufficiently complex entanglement to the forefront of quantum computing [25,26] as physicists endeavour to recreate the information scrambling properties of nature's most chaotic systems such as black holes [10,13,[26][27][28][29][30][31][32].
In a quantum computer, qubits are entangled by a circuit of unitary logic gates. Clifford gates represent an important subgroup of the unitary group because they can be efficiently simulated by a classical computer, and yet are still very effective in attaining maximum entanglement [9,[33][34][35]. However, while these gates are easily simulated on classical machines, they are only capable of producing non-complex patterns of entanglement, and are therefore not sufficient for true chaotic behavior in quantum systems [9,33,[35][36][37][38][39][40]. Including gates outside the Clifford group provides a set that is universal for quantum computation and induces complex entanglement and chaotic behavior [23,24,34,41,42]. The expensive nature of such gates introduces yet another problem, that of optimizing the use of non-Clifford resources [37][38][39][40][43][44][45][46][47]. As such, a greater understanding of what lies between Clifford and universal entanglement is necessary not only in the development of quantum technology, but also in painting a complete picture of the transition in quantum physics from order to chaos. We therefore aim to study quantum circuits that induce different levels of complexity between these two extremes.
In this paper, we study the onset of complex entanglement in systems of qubits by numerically simulating random Clifford circuits doped with a controlled number n T of T gates -which do not belong to the Clifford group -showing the full transition from nonchaotic to chaotic behavior and from non-complex to complex entanglement by the emergence of typical entanglement properties belonging to random universal circuits. In particular, we monitor (i) the entanglement spectrum statistics, showing that, as the T −doping increases, we obtain a crossover towards the universal Wigner-Dyson distribution for the gaps in the reduced density matrix spectrum, the so-called Entanglement Spectrum Statistics (ESS) [11,[48][49][50][51]. Color map representation of a 16-qubit state after 10N 2 random Clifford gates, then n T random T gates (Top row: n T =5. Bottom row: n T =20), then another 10N 2 random Clifford gates are applied, starting with the initial state |ψ 0 = |0 ⊗N . The image is arranged by partitioning the state into two equal subsystems and expanding one along each axis. A pixel at some position (x, y) is mapped from the magnitude of the amplitude for the computational basis state |σ xy = |σ x ⊗ |σ y (for example, the pixel at (0, 0) corresponds to the state |σ 00 = |0 ⊗N/2 ⊗ |0 ⊗N/2 ). The action of a T gate, being a phase gate, does not change the color map representation at all. However, after being spread around by the second Clifford circuit, the color map representation becomes more mixed for the circuit with the larger number of inserted T gates, showing the interplay between the non-Clifford resources and the operator spreading through Clifford-driven entanglement in the onset of quantum chaos.
We also compute (ii) the fluctuations of entanglement, showing how doping drives the transition towards universal fluctuations computed through the Haar measure on the unitary group [23,24,37,38]. Finally, we demonstrate (iii) that the quantum complexity conjured by entanglement and T gates is characterized by the hardness of the entanglement cooling algorithm and find a quantitative relation between the doping n T and the performance of the algorithm in undoing any initial scrambling [48,49]. As the disentangling algorithm allows the learning of a random quantum circuit, these results show how the quantum machine learning of a random circuit increases in complexity with the number of T gates.
2 Complexity as Revealed by the Entanglement Spectrum

Entanglement Heating Setup
In this section, we describe the setup of the problem. Each simulation begins with a process called entanglement heating, during which a random quantum circuit is used to produce a highly entangled state.
We begin with a system of N qubits initialized in the zero state of the computational basis |ψ 0 = |0 ⊗N . The dimension of the Hilbert space will be denoted by d=2 N . The entanglement heating process involves applying a random unitary circuit U containing an assortment of 10N 2 quantum gates chosen from a predetermined set, either Clifford U 0 or universal U U . The Clifford set includes the CNOT , Hadamard, and S gates P π 2 . A universal gate set is created by including T gates P π 4 along with the Clifford set [33]. A doped Clifford+T circuit (U n T ) is a random Clifford circuit in which a controlled number n T of non-Clifford resources -in this case, T gates -are inserted. The actions of π/4phase shifts (T gates) alone have no effect on entanglement, as single qubit operations do not change the Schmidt decomposition of a state. However, when utilized in conjunction with the Clifford set (which includes the two-qubit CNOT gate), a T gate applied to some qubit acts as a seed of chaos. These seeds are subsequently propagated by random Clifford gates, resulting in operator spreading and growth [50,[52][53][54], therefore unleashing chaotic behavior [55,56]. This effect can be seen in Fig. 1, where a visualiza-tion of the bipartite weights of the wave function is shown at three different stages of a circuit: first after a random Clifford circuit, then after a layer of T gates, and finally after a second Clifford circuit. As we can see, the complexity resulting from operator spreading is evident already at the visual level, which suggests a machine-learning approach to the detection of quantum chaos [50].
In the following simulations, we employ Clifford+T circuits U n T designed by alternating single T gates and operator-spreading blocks of 10N 2 Clifford gates for a total of n T T −layers between n T +1 Clifford blocks, as shown in Fig.  2. The choice of T gate placement (i.e. which qubit it acts on) is not a contributing factor during this process [37], and so is chosen at random. We perform exact numerical simulations of these circuits ranging from N =8 to N =18 qubits, with various values of n T ∈ [0, 40]. For every doping n T , 200 realizations are run to obtain an ensemble of states In addition, for each instance of N , we generate states {U U i |ψ 0 } 200 i=1 evolved with random universal circuits U U . Figure 2: Schematic of the Clifford+T circuit design used for entanglement heating (U n T ) and entanglement cooling (U C ). In the heating circuit, single T gates are inserted between blocks of 10N 2 Clifford gates, thus n T is also the number of T −layers. For example, n T =2 in the circuit U 2 shown here. Regardless of the number of layers in the heating circuit, the subsequent cooling circuit always contains a single block of 40N 2 Clifford gates (the exception to this is the case of infinite temperature cooling performed in section 3, during which 10N 2 gates are used).

Post-Heating Level Spacing Statistics
After heating, the output |ψ =U n T |ψ 0 of each circuit is analyzed by characterizing entanglement complexity in terms of the ratio of adjacent gaps in the entanglement spectrum as defined in [50]. Given a composite state |ψ = |ψ A ⊗ |ψ B under equal bipartition such that each subsystem con- tains where the eigenvalues are ordered such that p k >p k+1 . Any degeneracy is accounted for by including an additional instance of r k for each occurrence of p k . In the case of a random circuit with universal gates (or just for a random unitary operator on the full space of N qubits), one obtains the universal ESS {r k } exhibiting a Wigner-Dyson (W-D) distribution, following the surmise [11] (1) where the Gaussian Unitary Ensemble P GU E (r) is given by Z=4π/81 √ 3 and β=2. Given this known property, one way we characterize a state's entanglement complexity is by the degree of similarity between the distribution P (r) of its entanglement spectrum and that of a Gaussian P GU E (r). We quantify this statistical distance by calculating the Kullback-Leibler divergence: .
As the doping level n T in the heating circuit increases, we observe the emergence of the Wigner-Dyson distribution for the ESS, see Fig. 3. The resulting calculations of Eq. (2) for each (N, n T ) pair are shown in Fig. 4. We see that the divergence D KL displays a non-trivial behavior: as n T approaches N , there is an extensive divergence D KL . This is the signature of a sudden change in the pattern of entanglement, which can occur despite the absence of other typical critical behaviors (e.g. the change between different patterns of entanglement across the factorization point in spin chains [57]). Above this critical value, we can fit the data for n T ≥N with the formula For large n T , the error ≡ 24d 1.25(1−n T /N ) is exponentially suppressed and Eq. (3) yields the universal value D uni KL = 24/d 0.6 + 0.16, which is in perfect agreement with the numerical value of D KL computed for a random universal quantum circuit. This result raises the question of how many T gates one needs to add before the D KL crosses over and begins to approach the universal limit. In other words, we want to know the minimum value of n T such that the error is smaller than the universal value, that is, This minimum n min D T is calculated for a given system size by plugging (n T ) ≡ 24d 1.25(1−n T /N ) into Eq.
This result, in addition to the collapse shown in Fig. 4, demonstrates a linear scaling with N of the number of T gates n T needed to attain the universal Wigner-Dyson distribution. In other words, a finite density of T gates drives the transition towards universal ESS. This result is to be compared with that of [50], where it was shown that a single T gate on a random product state was sufficient to obtain the transition. However, a random initial product state contains an O(N ) number of non-Clifford resources in the preparation of the initial state. It is remarkable, though, that one seed of operator spreading is both necessary and sufficient for the transition after initial state preparation with a random product state.  2)) from W-D distribution plotted against n T /N for all system sizes. All curves collapse to a universal scaling function f (n T /N ) for n t ≥ N (Eq. (3)).

Fluctuations of Entanglement Entropy
In this section, we study the temporal entanglement fluctuations under a random Clifford circuit following the entanglement heating process, schematized with a blue block in Fig.2, the so-called cooling circuit. If the Clifford circuit is completely random, this corresponds to an infinite temperature of the cooling algorithm, see section 4.
We monitor the entanglement in the system during both the heating and the cooling procedure as a function of time, that is, after every new gate in the circuit. The entanglement between certain qubits at a particular point in time is determined again by partitioning the state into two subsystems |ψ . We then calculate the Von Neumann en- In order to fully consider the relative entanglement between various subsystems, this entropy is calculated for all N −1 possible bipartitions and averaged to obtain a final value S k , with k representing the number of gates that have so far been applied. With this definition, S k = 0 if and only if the state is completely factorized. At the end of the circuit U , all recorded S k form a set S U := {S k } U . By performing these calculations after each gate, we observe the inevitable increase in entanglement entropy that has come to be expected under random unitary transformations, as well as its eventual saturation at a maximum value [23,24,49,58].
After the entanglement heating, the system has typically reached an equilibrium, with a nearly maximal value for the entanglement entropy. If one then continues to apply random Clifford operations, no further drift will be observed; rather, only fluctuations around the equilibrium value will occur. We analyze these fluctuations through further stochastic evolution of the fully thermalized state U |ψ 0 with a new random circuit U C of 10N 2 Clifford gates (this is an example of the cooling algorithm at infinite temperature, see section 4). We continue to calculate the entanglement entropy S(ψ A ) at each step in the circuit, giving a new set of quantities S U C in addition to our previously gathered data S U . The temporal variance of S U C is then calculated as where . . . denotes the temporal average of a single realization. We then average across all realizations for a final quantity V ar U . Studying the resulting variance calculations for all circuit realizations, we find a direct relationship between the average variance V ar U of entanglement entropy in U C , the number of T gates n T added to the heating circuit, and the dimension d of the full system. In the case of a random universal circuit U U where n T is not a fixed quantity, a fit of the results shows that V ar U decreases with d as 0.2/d 1. 25 . The T −doped Clifford circuits likewise mimic this result for large values of n T . Specifically, upon fitting the data (Fig. 5), we find that demonstrating a definitive rate of change in entropy variance as more T gates are added to the circuit and the system begins to approach universal behavior. As with the process of calculating Eqs. (4)-(5), we obtain the minimum number of T gates n min V T needed to approach the universal limit for each system size ( i.e. the minimum n T that satisfies the inequality , fitting the results to find Comparing this result with Eq. (5), we observe that the crossover to universal fluctuations occurs with the same linear scaling as that of universal statistics. This result is in agreement with that of [37,38], where it was shown that universal fluctuations of subsystem purity in a doped random Clifford circuit also require a doping scaling with N . In other words, universal entanglement fluctuations are a good probe to the approach to universal entanglement spectrum statistics.  6)) for circuits U C , which are applied to fully entangled states U n T |ψ 0 (see Fig. 2). The variance of U C can be seen trending to zero as the initial doping n T increases (fit by Eq. (7)).

Doping, Complexity, and Entanglement Reversibility
We have seen that the entanglement entropy of any subsystem in |ψ is statistically guaranteed to increase and saturate over time under a random quantum circuit, a phenomenon we called entanglement heating. If one knew everything about the heating circuit U , one could reverse the evolution and return to the initial factorized state |ψ 0 by simply acting with U † , bringing us to the state U † U |ψ 0 = |ψ 0 . If, however, we instead only have access to the entangled state U |ψ 0 and not any information about the heating circuit, we must use other methods to find a new circuit that will undo the original one. Previous works [48,49] have shown that a Clifford circuit can be reversed by a Metropolis-like entanglement cooling algorithm. Unsurprisingly, though, a random quantum circuit realized with a universal set of gates cannot be reversed (except by exhaustive search). We ask the question of how the crossover between these two extreme behaviors is driven by the doping n T . If we gradually dope the circuit with one seed of chaos at a time, exactly how much is enough to make it virtually impossible to reverse? More specifically, if we dope the circuit with O(N ) non-Clifford gates, thereby obtaining the transition to universal ESS and universal entanglement fluctuations, is this enough to make the entanglement pattern so complex that -as in a completely random state -no entanglement cooling is possible?

Entanglement Cooling Setup
Given the absence of an exact inverse circuit U † , we implement a Metropolis-like algorithm to learn a sufficient entanglement cooling circuit U C . This algorithm is described below as in Ref. [49]: S old ← S new 12: end while Starting with a maximally entangled state U |ψ 0 , the way the algorithm builds U C is by applying a random gate, calculating the new entropy S new , and comparing it to the entropy of the previous state S old . In cases where S new >S old , the action is accepted with a probability exp[−β(S new −S old )]. In this algorithm, the abstract inverse temperature β represents the probability of accepting a gate that increases the entropy. At infinite temperature β=0, every gate is accepted, resulting in an algorithm equivalent to the heating process outlined in section 2.1. For the cooling algorithm, we use β=1e4. If a gate is rejected, we revert back to the previous state and try again. Any action that decreases the entropy is automatically accepted. This process is continued until either zero entropy is reached or a maximum of 40N 2 gates have been applied (Fig. 2). In the former case, any remaining steps become "do nothing" operations, keeping the state constant until the 40N 2 limit has been reached. In the end, we are left with a new set of entropy values S U C (as with the fluctuation analysis, this set excludes the initial heating data S U ).
We now want to remark that the gates used to construct U C are chosen only from the Clifford group. Although the exact inverse of a T −doped circuit must include T gates, allowing the cooling algorithm to choose non-Clifford operations ends up being counterproductive. The scrambling power of T gates that features heavily during the heating process works against us when attempting to undo the entanglement, as we do not have the control necessary to direct that power exactly where we need it to go. We therefore work only with Clifford gates to improve the algorithm's chance of success.
When implemented to reverse a random Clifford circuit, this algorithm is known [48,49] to successfully disentangle a system of qubits. Because the entanglement in this case is very easy to undo, we characterize it as being non-complex. If, however, U is a random universal circuit, then the algorithm has no effect on entanglement, and as such U C U |ψ 0 is just as entangled as U |ψ 0 . In other words, U |ψ 0 has complex entanglement [49]. We quantify the algorithm's level of success in disentangling an N −qubit state U |ψ 0 by comparing the final entropy after is the average final entropy over 200 realizations of disentangling a random N −qubit universal circuit U U . We define the reversibility R U of the initial heating circuit U using the average (over the different realizations) difference per qubit between these two quantities: Given the algorithm's ineffectiveness in disentangling Haar-random states -that is, any U U |ψ 0 obtained from a random circuit with universal gates [49] -a relatively large R U would indicate that the complexity of entanglement present in U |ψ 0 is significantly lower than that of the universal case. On the other hand, complex entanglement in U |ψ 0 would cause R U to approach zero as the entanglement becomes just as hard for the algorithm to reverse as that generated by U U . As noted in [50], factorizing the state is equivalent to learning one column of the random circuit. The complexity of entanglement due to the spreading of non-Clifford resources is thus also connected to the hardness of the quantum machine learning of a random quantum circuit.

Results and Analysis
As expected [48,49], the cooling algorithm succeeds in reversing all Clifford circuits U 0 , reaching a factorized state in every realization. Conversely, the algorithm has no effect on the universal circuits, failing entirely to disentangle U U |ψ 0 even a small amount; instead, the system remains at its maximum entropy during the entirety of the algorithm (Fig. 6). This behavior reiterates the role of the cooling algorithm in characterizing entanglement complexity as described above.
Turning to the results from our Clifford+T simulations (Fig. 7), we do in fact see confirmation of a gradual transition from non-complexity to complexity as n T increases and the algorithm's effectiveness lowers. Such a transition can be seen in the inset of Fig. 6; the more T gates added to the heating circuit, the harder it becomes for the algorithm to lower the entropy of the system, until eventually the entropy cannot be lowered at all. It is important to note that trials involving only a small number of T gates were sometimes successful in disentangling U |ψ 0 , with the likelihood of reaching a factorized state decreasing as n T increases until vanishing entirely for large n T . In analyzing the relationship between n T and the reversibility R U defined in Eq. (9), we find the following fit of our data: where γ = 4 log(d + 560) − 109/3. Here we see that a circuit U does indeed become less reversible as each T gate is added.  9)) of Clifford+T circuits U n T as n T increases, fit by Eq. (10). As with the analytical results of the variance V ar U shown in Fig.  5, the reversibility of a random circuit can be seen approaching zero for circuits with high levels of doping.
As stated above, low reversibility corresponds to an increase in entanglement complexity, eventually approaching universal complexity as R U approaches zero. Remarkably, we find that R U has the exact same lower bound of 0.2/d 1.25 with increasing n T as V ar U . We again calculate the minimum number of T gates needed for Eq. (10) to approach this limit and fit the results: (11) An important remark is that the algorithm uses a fixed number of accepted gates 40N 2 . This number is not the total number of gates tried in the algorithm (i.e. does not include the number of operations that were rejected along the way). Additional trials are necessary to obtain an accepted gate when n T increases, and thus Eq. (10) is not a universal scaling function. The exact scaling is expected to depend on the parameters of the algorithm, such as the cooling schedule used. Nevertheless, the result above demonstrates that a circuit U does indeed become less reversible as each T gate is added.
Comparing all three calculated T gate minima, we begin to paint a picture of the onset of the three characteristics of entanglement complexity analyzed in this work. The number of T gates needed to induce this onset for a system of size N is shown below in Table 1, summarized for each characteristic. We can therefore see that small temporal entanglement fluctuations and complexity of entanglement are two aspects of the same thing, namely the entanglement complexity driven by the doping of non-Clifford gates that are spreading in the system.  Additionally, one can draw a direct connection between the results put forth here and recent studies of barren plateaus in quantum machine learning [59][60][61][62]. In particular, the complexity transitions explored in this work reveal that the flattening of our training landscape (i.e. small entropy fluctuations brought on by adding non-stabilizer resources) significantly hinders the learnability of a successful disentangling circuit. The relationship between magic and barren plateaus will therefore be an important topic for future studies.

Conclusions
In this work, we study the transition in entanglement complexity in random Clifford circuits driven by the doping of local non-Clifford T gates. Operator spreading by Clifford blocks applied after each T gate results in the emergence of universal entanglement spectrum statistics and temporal fluctuations, typically associated with the onset of quantum chaos [37,38]. In addition, this transition directly affects the performance of the entanglement cooling algorithm, a process which can be used to learn a disentangling circuit that will reverse the initial stochastic evolution. Irreversibility in a quantum circuit thus gradually emerges as entanglement complexity increases.
These results put forth additional questions regarding chaos characterization, such as what impact (if any) our choice of doping gate has on this complexity transition. If, for instance, we instead simulate Clifford + Toffoli circuits, how quickly would we reach a chaotic state? Additionally, other potential cost functions for the cooling algorithm may be explored in future works. The 2-Rényi stabilizer entropy, for instance, can also be calculated to detect the presence of chaos in quantum states [63][64][65]. From the point of view of the theory of the Markov chain, it would be a decisive step forward to be able to prove why large fluctuations of the cost function ensure a greater performance of the entanglement cooling algorithm.
This work shows that entanglement complexity arises from the interplay of magic and entanglement, which has also been shown [37] to be at the root of the onset of complex behavior as revealed by OTOCs [9,66]. We believe that the same mechanism is responsible for a more general transition to complex quantum behavior, for instance in the retrieval of information (or lack thereof) from a black hole [67]. Since the undoing of entanglement is equivalent to the learning of an unknown quantum circuit, the complexity of entanglement also has consequences for the complexity of quantum machine learning algorithms, which is the scope of further investigations.
Even more importantly, at the theoretical level, we see that neither the non-stabilizerness (induced by the T gates) nor entanglement (due to the two-qubit Clifford gates) is on its own responsible for the onset of complex, universal entanglement. It is the marriage of the two -that is, the operator spreading of non-Clifford resources -that is responsible for the onset of complex quantum behavior. While this transition can be marked in terms of the adherence to universal ESS or the eight-point out-of-time-order correlation functions, one needs a more complete theoretical framework to describe the spreading of such magical resources and what makes a quantum system truly complex.