---
title: Hamming Weight-Preserving Quantum Circuits
url: https://www.emergentmind.com/topics/hamming-weight-preserving-quantum-circuit
type: topic
---

# Hamming Weight-Preserving Quantum Circuits

A Hamming weight-preserving quantum circuit is a quantum circuit whose unitaries exactly conserve the total Hamming weight of computational-basis states, confining quantum evolution to subspaces of fixed population (number of qubit "1"s). These circuits are also called "subspace preserving," "energy-conserving" (in contexts where Z-eigenvalues are interpreted as energies), or "particle-number-conserving" in fermionic simulation. Hamming weight-preserving gates and variational ansätze exhibit distinctive expressivity, circuit complexity, and trainability properties. Recent developments reveal their utility in quantum machine learning, data encoding, and efficient simulation of symmetry-constrained physical systems, notably via architectures such as subspace preserving quantum convolutional neural networks and symmetry-aware VQE [2409.18918, 2412.04825, 2309.15547].

## 1. Definition and Structural Properties

Let $\mathcal{H} = (\mathbb{C}^2)^{\otimes n}$ denote the $n$-qubit Hilbert space. The Hamming-weight operator is defined as
\[
W = \sum_{i=1}^n |1\rangle\langle 1|_i,
\]
and the computational basis $\{|x\rangle:\;x\in\{0,1\}^n\}$ decomposes into subspaces of fixed Hamming weight:
\[
\mathcal{H} = \bigoplus_{k=0}^n \mathcal{H}_k,\qquad \mathcal{H}_k = \mathrm{span}\{\;|x\rangle\::\:HW(x)=k\;\}.
\]
Projectors onto these subspaces satisfy $P_kP_{k'} = \delta_{k,k'}P_k$ and $\sum_{k=0}^n P_k = \mathbb{I}$.

A unitary $U$ is called Hamming weight-preserving if it commutes with $W$:
\[
[U,W]=0 \Longleftrightarrow U = \bigoplus_{k=0}^n U^{(k)}, \qquad U^{(k)}: \mathcal{H}_k\to\mathcal{H}_k,
\]
i.e., $U$ is block-diagonal and never mixes different weight sectors [2409.18918, 2309.11051].

## 2. Gate Sets and Circuit Construction

The canonical elementary gate is the two-qubit Reconfigurable Beam Splitter (RBS):
\[
\mathrm{RBS}(\theta) = 
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & \cos\theta & -\sin\theta & 0 \\
0 & \sin\theta & \cos\theta & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\]
in the basis $\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}$. This generator commutes with $Z\otimes I + I\otimes Z$ and thus strictly preserves total weight.

Circuits are typically composed of layered patterns of RBS gates ("pyramid," "butterfly," "X" layouts), enabling the realization of arbitrary real orthogonal transformations within fixed-weight subspaces [2409.18918, 2405.20408]. More general constructions exploit XX+YY interaction ("XY model") gates [2309.11051] or balanced-symmetric (BS) gate variants for complex-valued transforms [2412.04825]. Every such gate acts nontrivially only on the $\{|01\rangle, |10\rangle\}$ subspace, fixing $|00\rangle, |11\rangle$.

The expressivity of these circuits is quantified by the dynamical Lie algebra they generate. Full SU($\dim(\mathcal{H}_k)$) can be reached with suitable gate choices and all-to-all connectivity (see [2412.04825], Theorem 1). Nearest-neighbor universality is also attainable under mild conditions on the gate generators.

## 3. Data Encoding and State Preparation

Efficient amplitude encoding into $\mathcal{H}_k$ is central to applications in quantum machine learning [2405.20408, 2508.14470, 2309.15547]. Classical data $x\in\mathbb{R}^{d}$ with $d=\binom{n}{k}$ is mapped to
\[
|\psi\rangle = \frac{1}{\|x\|_2}\sum_{j=1}^d x_j|b_j\rangle,
\]
where $|b_j\rangle$ runs over all weight-$k$ basis states. Farias et al. [2405.20408] present an optimal sequential RBS-gate algorithm, generating an exact amplitude encoding using only $d-1$ real parameters (complex case: $2d-1$). This circuit can be compiled to $O(kd)$ CNOTs.

Further, recent work gives log-depth, size-optimal state preparation circuits for all Hamming-weight-preserving states, matching lower bounds on circuit size and depth as a function of $(n,k)$, and allowing trade-offs between ancillary qubits and depth [2508.14470]. For $k=2$, such states correspond to graphs: grid/tree-structured cases can be realized ancilla-free, while general graphs require $O(m)$ ancillas ($m=$ edges), but $O(\log n)$ depth.

## 4. Quantum Machine Learning Architectures

Quantum convolutional and pooling layers can be realized within the Hamming-weight-preserving framework [2409.18918]. Data tensors are encoded as fixed-weight quantum states. Quantum convolutional layers apply local blocks of RBS-based orthogonal circuits, exactly mimicking classical convolution by processing $K^2$-size pixel blocks. Measurement-based pooling combines amplitude from pixel neighborhoods while retaining global Hamming weight symmetry (except in classical postprocessing). Dense layers are realized as orthogonal transformations in these subspaces.

Quantum subspace-preserving neural architectures exhibit polynomial forward-pass circuit-depth savings over classical counterparts. For instance, a $K\times K$ quantum convolutional layer has depth $O(\log K)$ (classical: $O(K^2)$ multiplications per output), and quantum pooling reduces to constant depth, compared to $O(d^2)$ (with $d=$ input size) classically. Parameter count per quantum filter is substantially lower due to the structure of the fixed-weight block [2409.18918].

Empirical results on MNIST, Fashion-MNIST, and CIFAR-10 show that subspace-preserving QCNNs match or outperform classical baselines with fewer parameters and polynomial circuit-depth advantages.

## 5. Expressivity, Trainability, and Avoidance of Barren Plateaus

The expressivity of a Hamming-weight-preserving circuit is governed by the controllability of $\mathcal{H}_k$. Orthogonal transformations on $\mathcal{H}_k$ require $O(d_k^2)$ circuit parameters, but practical tasks (e.g., ground state preparation for VQE) typically need only $O(d_k)$ [2412.04825, 2309.15547]. The dynamical Lie algebra analysis confirms when a given two-qubit gate set is universal within a fixed-weight subspace [2412.04825].

Trainability is enhanced due to the reduced dimensionality of the subspace: the variance of loss-function gradients over random initializations decays only as $O(1/d_k)$, not $O(1/2^n)$ as in generic variational circuits [2309.15547]. This mitigates concentration of measure and precludes the onset of barren plateaus (exponentially vanishing gradients) for circuits with sufficiently small $k$. Full parameter controllability can be certified using the rank of the quantum Fisher information matrix (QFIM), which is almost everywhere maximal in parameter space [2309.15547].

## 6. Computational and Physical Relevance

Hamming-weight-preserving circuits provide polynomial or exponential resource savings for machine learning, data compression, and simulation of fermionic/particle-conserving Hamiltonians [2405.20408, 2412.04825]. In condensed-matter and quantum chemistry, these circuits naturally encode particle-number symmetries and support hardware-efficient variational ansätze for energy minimization in VQE [2309.11051, 2412.04825].

For circuit synthesis, the resource-optimality is proven both for general amplitude encoding and for the simulation of arbitrary subspace-preserving unitaries. The key scaling is
- Gate count: $O(kd)$ for state preparation in $\mathcal{H}_k$ [2405.20408]
- Circuit depth: $O(\log d)$ possible with sufficient ancillas [2508.14470]
- Exact synthesis of arbitrary energy-conserving unitaries: $O(4^n n^{3/2})$ gates, near the information-theoretic minimum [2309.11051]

Universal subspace-preserving ansätze can achieve chemical accuracy in electronic structure tasks across molecular and Hubbard models, outperforming standard hardware-efficient ansätze [2412.04825].

## 7. Algorithmic and Implementation Constraints

The practical realization of Hamming-weight-preserving circuits requires precise gate compilation. Two-qubit RBS or XY-type gates, layered in minimal architectures, enable both universal and application-specialized ansätze. Implementation constraints arise from connectivity (nearest-neighbor vs. all-to-all), hardware gate sets, and ancillary space (needed for simultaneous log-depth and minimal size [2508.14470]). In platform-specific mapping (e.g., ion traps, superconducting qubits with native XY interaction), circuit depth, gate count, and robustness to noise become interdependent [2405.20408].

Notable optimization strategies include:
- Minimal ancilla circuits, trading off depth and parallelism [2404.06052, 2508.14470]
- State preparation "fan-out" and unary encoding with log-depth trees of two-qubit gates
- Error mitigation enhancements for NISQ hardware, exploiting the subspace concentration of amplitude [2405.20408]
- Efficient classical simulation for fixed small $k$, as circuit complexity grows polynomially in $n$ for amplitude encoding in $\mathcal{H}_k$ [2309.15547]

**Table: Comparison of quantum convolutional vs. classical convolutional layers [2409.18918]**

| Layer Type        | Classical (asymptotic)   | Quantum HWP circuit (asymptotic) |
|-------------------|-------------------------|-----------------------------------|
| Convolution       | $O(C^2 K^2 \sum_j d_j)$ | $O(\max_j\log K_j)$               |
| Average-pooling   | $O(C \sum_j d_j^2)$     | $O(1)$                            |
| Dense (param. $p$)| $O(p\sum_j d_j)$        | $O(p)$ (lower parameters)         |

## References

- Subspace Preserving Quantum Convolutional Neural Network Architectures [2409.18918]
- Universal Hamming Weight Preserving Variational Quantum Ansatz [2412.04825]
- Quantum encoder for fixed Hamming-weight subspaces [2405.20408]
- Trainability and Expressivity of Hamming-Weight Preserving Quantum Circuits for Machine Learning [2309.15547]
- Preparation of Hamming-Weight-Preserving Quantum States with Log-Depth Quantum Circuits [2508.14470]
- Synthesis of Energy-Conserving Quantum Circuits with XY interaction [2309.11051]
- Shallow Quantum Circuit Implementation of Symmetric Functions with Limited Ancillary Qubits [2404.06052]

Source: https://www.emergentmind.com/topics/hamming-weight-preserving-quantum-circuit