---
title: Haar Random Quantum Codes
url: https://www.emergentmind.com/topics/haar-random-codes
type: topic
---

# Haar Random Quantum Codes

Haar random codes are quantum codes whose codespace is chosen uniformly at random from the Grassmannian of \(K\)-dimensional subspaces of \(\mathbb C^N\), equivalently by choosing a Haar-random isometry \(V:\mathbb C^K\to\mathbb C^N\). In quantum Shannon theory, random subspaces of this type already appeared in proofs that the coherent information is an achievable rate, although the Haar-random subspace was then “distorted” by the sender’s input density operator \(\rho\) through \(\sqrt{\rho}\) [0712.0975]. In current quantum error-correction theory, Haar random codes are studied directly as maximally unstructured code families, and recent work shows that, with high probability, they are excellent approximate quantum error-correcting codes: for a prescribed family of \(m\) Pauli or more general unitary errors, they approximately attain the quantum Hamming bound whenever the packing condition \(mK\ll N\) holds [2510.07158].

## 1. Definition and ensemble structure

A quantum code is specified by an isometric encoder
\[
V_{\mathrm{Enc}}:\mathbb C^K\to\mathbb C^N,
\]
with codespace
\[
C=\mathrm{Im}(V_{\mathrm{Enc}})\subseteq \mathbb C^N.
\]
Here \(N\) is the dimension of the ambient Hilbert space and \(K\) is the logical dimension. When \(N=2^n\) and \(K=2^k\), the code may be viewed as encoding \(k\) qubits into \(n\) qubits [2510.07158].

A Haar random code is obtained by choosing the \(K\)-dimensional subspace uniformly at random from the Grassmannian of \(K\)-dimensional subspaces of \(\mathbb C^N\), or equivalently by choosing a Haar-random isometry. Concretely, if
\[
\mathbf U=\sum_{i=1}^N |\mathbf u_i\rangle\langle i|
\]
is Haar-random in \(U(N)\), then
\[
\mathbf V=\sum_{i=1}^K |\mathbf u_i\rangle\langle i|
\]
is a Haar-random isometry and
\[
\mathbf C=\mathrm{span}\{|\mathbf u_1\rangle,\dots,|\mathbf u_K\rangle\}\subseteq \mathbb C^N
\]
is the corresponding random codespace. In this formulation no direction in Hilbert space is preferred [2510.07158].

An older but structurally important formulation samples the code from Gaussian vectors. If \(|g_j\rangle\) are i.i.d. complex Gaussian vectors, then their span is Haar-distributed, and the code vectors may be pushed through \(\sqrt{|A|\rho}\) to form
\[
|\gamma_j\rangle=\sqrt{|A|\rho}\,|g_j\rangle,
\]
followed by orthonormalization via \(\Gamma^{-1/2}\), where \(\Gamma=\sum_j |\gamma_j\rangle\langle\gamma_j|\). This produces a \(\rho\)-adapted random code ensemble whose underlying subspace is Haar-random but whose final measure is distorted by \(\sqrt{\rho}\) [0712.0975].

## 2. Approximate quantum error correction and the quantum Hamming bound

The recent theory of Haar random codes is formulated for a unitary error set
\[
\{E_1,\dots,E_m\},
\]
where each \(E_i\) is unitary and the family is Hilbert-Schmidt orthogonal:
\[
\operatorname{tr}(E_i^\dagger E_j)=0 \qquad (i\neq j).
\]
The code is required to correct the entire linear span
\[
\mathcal E=\mathrm{span}\{E_1,\dots,E_m\},
\]
so any noise channel whose Kraus operators lie in \(\mathcal E\) is included [2510.07158].

Approximate correctability is measured in diamond norm. The code corrects \(\mathcal E\) with disturbance \(\varepsilon\) if there exists a decoding channel \(\mathrm{Dec}\) such that
\[
\frac12\|\mathrm{Dec}\circ \mathcal N\circ \mathrm{Enc}-\mathcal I\|_\diamond \le \varepsilon
\]
for every \(\mathcal N\) with Kraus operators in \(\mathcal E\) [2510.07158].

The organizing notion is approximate nondegeneracy. For a basis \(\{|v_j\rangle\}_{j=1}^K\) of the codespace, exact nondegeneracy means that the \(mK\) vectors
\[
\{E_i|v_j\rangle\}_{i\in[m],\,j\in[K]}
\]
are mutually orthogonal, which immediately forces \(mK\le N\). The approximate version is stronger than pairwise small overlaps: it requires these vectors to form a \(\delta\)-approximately orthonormal basis, equivalently that the synthesis map be a \(\delta\)-approximate isometry. In matrix form,
\[
Y=\sum_{i=1}^m E_i V\otimes \langle i|
\]
must be a \(\delta\)-approximate isometry. This is the paper’s approximate Knill-Laflamme condition [2510.07158].

The first theorem states that approximate nondegeneracy already implies approximate quantum error correction: if \(V\) is a \(\delta\)-approximate nondegenerate code with respect to \(\{E_i\}_{i=1}^m\), then it corrects \(\mathcal E\) with disturbance \(\delta\). The second theorem is the Haar-random statement: there is a universal constant \(C>0\) such that if
\[
\delta \coloneqq 3\left(\sqrt{\frac{Km}{N} + C\sqrt{\frac{m(\log N)^3}{N}}}\right) < 1,
\]
then with probability at least
\[
1-\frac{2}{N^{(\log N)^2}},
\]
a Haar-random isometry \(\mathbf V:\mathbb C^K\to\mathbb C^N\) is a \(\delta\)-approximate nondegenerate code for \(\{E_1,\dots,E_m\}\), and hence an AQEC for \(\mathcal E\) [2510.07158].

When \(K\ge (\log N)^3\), the disturbance simplifies to
\[
\delta = O\!\left(\sqrt{\frac{Km}{N}}\right).
\]
Thus whenever
\[
mK\ll N,
\]
Haar random codes have small disturbance. This is the sense in which they approximately attain the quantum Hamming bound. For exact nondegenerate codes the bound is the packing inequality \(mK\le N\); Haar random codes realize the same threshold up to vanishing error, but only in the approximate sense [2510.07158].

## 3. Qudit parameters, thresholds, and coding transitions

For \(N=q^n\) and \(K=q^k\), a \(K\)-dimensional subspace of \((\mathbb C^q)^{\otimes n}\) encodes \(k\) qudits into \(n\) qudits. If one wishes to correct all weight-\(\le t\) Pauli errors, the number of relevant Pauli operators is
\[
m=\sum_{i=0}^t \binom{n}{i}(q^2-1)^i,
\]
and the exact nondegenerate Hamming bound is
\[
m\le q^{n-k},
\qquad
\log_q m \le n-k=n(1-R),
\qquad
R=\frac{k}{n}.
\]
The Haar-random theorem implies approximate correction whenever
\[
q^k\cdot m \ll q^n,
\]
equivalently \(\log_q m\ll n-k\), with disturbance
\[
\delta = O\!\left(q^{(k-n+\log_q m)/2}\right)
\]
when the logarithmic correction is negligible [2510.07158].

This yields explicit asymptotic corollaries. Under \(K\ge (\log_2 N)^3\), with high probability Haar random codes correct erasures on up to
\[
t\le \frac n2(1-R-\gamma)
\]
with disturbance \(O(q^{-\gamma n/2})\), and correct general \(t\)-local errors up to
\[
t\le \frac n2\left(1-R-\frac{2}{\log_2 q}\right)
\]
with disturbance \(O(2^{-n/2})\). The paper frames the second statement as essentially achieving twice the exact quantum Singleton bound for general local errors [2510.07158].

A complementary analysis studies Haar-random quantum codes under iid single-qudit depolarizing noise through the spectrum of the noisy encoded density matrix. In that setting, the noisy spectrum develops well-separated bands labeled by error weight; low-weight bands remain isolated and correctable, while high-weight bands merge as the error rate increases. The coding transition occurs when the bands associated with typical errors cease to fit into mutually distinguishable subspaces, and the threshold saturates the hashing bound
\[
H(p_c)=1-\frac{k}{N},
\]
so Haar-random codes have the same asymptotic threshold as random stabilizer codes. For zero-rate qubit codes this gives \(p_c\simeq 0.189\). Above the hashing threshold, typical errors are uncorrectable, but postselected error correction remains possible up to the higher detection threshold
\[
p_d = 1-\frac1q,
\]
which is \(1/2\) for qubits [2510.07396].

That spectral viewpoint also yields Rényi thresholds
\[
H_\alpha(p_c^{(\alpha)})=1-\frac{k}{N},
\]
with low-weight bands dominating postselected states below the corresponding threshold and a reservoir of high-weight errors taking over above it. A plausible implication is that Haar-random codes furnish a particularly clean laboratory for separating ordinary decoding thresholds from detection and postselection thresholds, because the random-subspace geometry suppresses algebraic code-specific effects [2510.07396].

## 4. Proof architecture and geometric mechanism

The proof that approximate nondegeneracy implies decodability is constructive at the operator level. If the shifted codewords \(E_i|v_j\rangle\) were exactly orthonormal, the decoder would be the partial isometry
\[
D = \sum_{i\in[m],\,j\in[K]} |j,i\rangle \langle v_j| E_i^\dagger.
\]
In the approximate case one first considers
\[
\widehat D = \sum_{i,j} |j,i\rangle\langle v_j|E_i^\dagger = \sum_i V^\dagger E_i^\dagger \otimes |i\rangle,
\]
then rounds its singular values to \(1\) in the SVD to obtain a true partial isometry \(D\) satisfying
\[
\|\widehat D-D\|\le \delta.
\]
This yields the diamond-norm recovery guarantee uniformly over all channels supported on \(\mathcal E\) [2510.07158].

At the level of error-correction conditions, the key object is
\[
Y^\dagger Y = \sum_{a,b} V^\dagger E_a^\dagger E_b V \otimes |a\rangle\langle b|.
\]
Showing that \(Y\) is an approximate isometry means
\[
Y^\dagger Y \approx I_{Km},
\]
hence blockwise
\[
V^\dagger E_a^\dagger E_b V \approx \delta_{ab} I_K,
\]
or equivalently
\[
P E_a^\dagger E_b P \approx \delta_{ab} P
\]
on the codespace. For a Hilbert-Schmidt orthogonal unitary error set, the target matrix is diagonal [2510.07158].

The probabilistic core replaces the Haar isometry by a Gaussian matrix \(G\in\mathbb C^{N\times K}\) with i.i.d. complex Gaussians of variance \(1/N\), and studies
\[
X=\sum_{i=1}^m E_i G\otimes \langle i|.
\]
Although \(X\) has highly correlated entries, the proof uses a recent matrix concentration theorem of Bandeira, Boedihardjo, and van Handel. For this \(X\),
\[
M_1=\sum A_\ell^\dagger A_\ell = I_{Km},
\qquad
M_2=\sum A_\ell A_\ell^\dagger = \frac{Km}{N}I_N,
\qquad
v(X)=\sqrt{\frac mN}.
\]
These parameters imply that \(X\) is an approximate isometry with the optimal \(mK\ll N\) scaling. The final step is to pass from \(G\) to the Haar-random isometry
\[
V=\mathrm{isometrize}(G)=G(\sqrt{G^\dagger G})^{-1},
\]
using the Ginibre SVD decomposition \(G=W\Sigma U\) and the fact that \(WU\) is Haar-random [2510.07158].

The resulting geometric picture is simple. A Haar-random code scatters its basis vectors uniformly through \(\mathbb C^N\). After applying a fixed family of unitary errors, the \(mK\) shifted vectors still behave almost orthogonally until dimensional packing fails. The only fundamental obstruction is that once \(mK\) approaches \(N\), approximate orthogonality must break down [2510.07158].

## 5. Haar-like encoders, structured variants, and analytic infrastructure

The full Haar ensemble is often too expensive to realize directly, so several adjacent literatures study surrogates for Haar-random encoders. One route is to generate exact Haar-random unitaries in hardware. In linear optics, “direct dialling” gives an operationally simple method that samples physical parameters independently from explicit distributions, avoiding the generate-then-decompose workflow. The resulting interferometer implements a Haar-random unitary directly, and the same parameterization can be mapped to qubit circuits. For random coding constructions defined by the first \(K\) columns of a Haar-random unitary, this is a direct route to implementing random isometries [1506.06220].

A second route replaces exact Haar measure by approximate unitary \(t\)-designs. General non-Haar random circuits are proved to form unitary designs as fast as the corresponding Haar-random circuits, up to a constant-factor overhead independent of system size. For single-layer-connected architectures,
\[
L = 2(\Delta_{\mathrm{loc},\nu}^{(t)})^{-1} L^{\rm H},
\]
and analogous multiplicative comparisons hold for brickwork, multilayer, and patchwork architectures. This is not a direct code theorem, but it rigorously supports Haar-random-like encoder ensembles whenever the coding argument depends only on low moments, especially \(t=2\) [2504.07390].

A third route keeps exact Haar sampling but restricts the ambient group. In fermionic linear optics, exact Haar-random active and passive FLO circuits can be sampled natively from brick-wall nearest-neighbor architectures with optimal \(\Theta(n)\) depth, \(\Theta(n^2)\) gate count, and \(\Theta(n^2)\) classical overhead. These are exact structured Gaussian ensembles, not substitutes for full Haar-random unitaries on \(\mathbb C^{2^n}\), because FLO preserves parity, and in the passive case particle number as well [2505.24212].

For symbolic analysis, the Random Tensor Network Integrator implements graphical Weingarten calculus for tensor networks containing Haar-random unitaries. It computes averages of random-encoder observables as weighted sums of tensor networks while keeping subsystem dimensions symbolic. In the context of Haar-random codes, this is useful for reduced-state moments, channel overlaps, and decoupling-type expressions built from random isometries represented as unitary dilations [1902.08539].

## 6. Scope, limitations, and adjacent meanings of the term

The strongest coding theorem for Haar random codes is nevertheless limited in a precise way. It is approximate, not exact; it holds with high probability over Haar measure; it corrects channels whose Kraus operators lie in the span of a fixed finite unitary error set; it gives no efficient encoding or decoding algorithm; and the clean \(O(\sqrt{mK/N})\) disturbance requires the mild technical assumption \(K\ge (\log N)^3\) [2510.07158].

There are also limits on efficient Haar-like realizations. For random quantum circuits with independent local Haar-random gates, a Carbery-Wright-style anti-concentration theorem for the unitary Haar measure implies a lower bound on scrambling speed: every input qubit has influence at least exponentially small in depth on any output qubit touched by its lightcone. One consequence is an optimal depth lower bound
\[
D\ge \Omega(\log \varepsilon^{-1})
\]
for \(\varepsilon\)-approximate unitary designs. A plausible implication is that shallow local Haar-gate circuits cannot serve as fully Haar-like random encoders even at low design order [2407.19561].

Real-valued surrogates are also intrinsically limited. The exact trace distance between \(t\) copies of a real Haar-random state and \(t\) copies of a complex Haar-random state is known, with a sharp transition at \(t\sim \sqrt d\): for \(t=o(\sqrt d)\) the ensembles are asymptotically close, whereas for \(t=\omega(\sqrt d)\) the trace distance tends to \(1\). Consequently, any real-valued approximate state \(t\)-design must incur at least the orthogonal-Haar-to-unitary-Haar moment error. This matters whenever “Haar random code” arguments are implemented with real-valued state ensembles rather than full complex Haar randomness [2507.16939].

Finally, the term appears in code-like but non-error-correcting settings. In the Haar random oracle model, reusable unclonable encryption is realized by a family of message subspaces of the form
\[
\operatorname{Span}\{X^k U|m,r\rangle\}_r,
\]
so encryption is a shifted sample from a Haar-random message subspace rather than a QECC codeword. Related pseudorandom-state and pseudorandom-function-like constructions use columns of a shared Haar-random unitary as keyed random codebooks. These are not quantum error-correcting codes, but they show that Haar-random subspaces and Haar-random basis images function as a general-purpose encoding resource well beyond QEC proper [2603.11437].

In that broader sense, Haar random codes designate both a specific family of random quantum error-correcting codes and a general paradigm: encode information into uniformly random subspaces or uniformly random basis images, exploit the geometric genericity of Haar measure, and use structured surrogates only to the extent that they preserve the moment or spectral features relevant to the task.

Source: https://www.emergentmind.com/topics/haar-random-codes