<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Quantum_error_mitigation on vrusso</title><link>https://vrusso.com/tags/quantum_error_mitigation/</link><description>Recent content in Quantum_error_mitigation on vrusso</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 10 Feb 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://vrusso.com/tags/quantum_error_mitigation/index.xml" rel="self" type="application/rss+xml"/><item><title>The QEM Zoo: A catalog of quantum error mitigation techniques</title><link>https://vrusso.com/posts/qem_zoo/</link><pubDate>Tue, 10 Feb 2026 00:00:00 +0000</pubDate><guid>https://vrusso.com/posts/qem_zoo/</guid><description>In a comprehensive review paper on quantum error mitigation by Cai et al. (arXiv:2210.00921), the authors posed an open problem: what is the full landscape of the &amp;ldquo;zoo&amp;rdquo; of QEM techniques?
I recently launched a website to help address this: the QEM Zoo.
It&amp;rsquo;s a living catalog of quantum error mitigation and suppression techniques, inspired by the Complexity Zoo and the Error Correction Zoo. The site organizes techniques into protocols, supporting methods, noise models, and applications—all searchable and filterable.</description><content>&lt;p>In a comprehensive review paper on quantum error mitigation by Cai et al.
(&lt;a href="https://arxiv.org/abs/2210.00921">arXiv:2210.00921&lt;/a>), the authors posed an open problem: what is the full landscape of
the &amp;ldquo;zoo&amp;rdquo; of QEM techniques?&lt;/p>
&lt;p>&lt;img alt="qem-open-problem" src="https://vrusso.com/blog/qem_open_problem.png">&lt;/p>
&lt;p>I recently launched a website to help address this: the &lt;a href="https://qemzoo.com/">QEM Zoo&lt;/a>.&lt;/p>
&lt;p>It&amp;rsquo;s a living catalog of quantum error mitigation and suppression techniques, inspired by the &lt;a href="https://complexityzoo.net/">Complexity
Zoo&lt;/a> and the &lt;a href="https://errorcorrectionzoo.org/">Error Correction Zoo&lt;/a>. The site organizes
techniques into protocols, supporting methods, noise models, and applications—all searchable and filterable.&lt;/p>
&lt;p>Contributions welcome: &lt;a href="https://github.com/vprusso/qemzoo">github.com/vprusso/qemzoo&lt;/a>&lt;/p></content></item><item><title>Quantum error mitigation by layerwise Richardson extrapolation</title><link>https://vrusso.com/posts/lre/</link><pubDate>Sat, 24 Jan 2026 00:00:00 +0000</pubDate><guid>https://vrusso.com/posts/lre/</guid><description>In a previous post, I gave a high-level overview of zero-noise extrapolation (ZNE) and how we can increase the noise of quantum circuits for ZNE using a technique known as quantum circuit unoptimization. In this post, I&amp;rsquo;ll describe a technique that my colleague Andrea Mari and I came up with called layerwise Richardson extrapolation (LRE), which can be thought of as a generalization of standard ZNE.
The paper can be found on arXiv (arXiv:2402.</description><content>&lt;p>In a &lt;a href="https://vrusso.com/posts/circuit_unopt_zne/">previous post&lt;/a>, I gave a high-level overview of zero-noise extrapolation (ZNE) and how we
can increase the noise of quantum circuits for ZNE using a technique known as quantum circuit unoptimization. In this
post, I&amp;rsquo;ll describe a technique that my colleague &lt;a href="https://github.com/andreamari">Andrea Mari&lt;/a> and I came up with called
&lt;em>layerwise Richardson extrapolation&lt;/em> (LRE), which can be thought of as a generalization of standard ZNE.&lt;/p>
&lt;p>The paper can be found on arXiv (&lt;a href="https://arxiv.org/abs/2402.04000">arXiv:2402.04000&lt;/a>) and was published in Physical
Review A (&lt;a href="https://doi.org/10.1103/PhysRevA.110.062420">Phys. Rev. A 110, 062420, 2024&lt;/a>). LRE has also been integrated
into the open-source quantum error mitigation toolkit &lt;a href="https://mitiq.readthedocs.io/en/stable/guide/lre.html">mitiq&lt;/a>,
developed by the &lt;a href="https://unitary.foundation/">Unitary Foundation&lt;/a>.&lt;/p>
&lt;h3 id="quick-recap-standard-zne">Quick recap: standard ZNE&lt;/h3>
&lt;p>To set the stage, let&amp;rsquo;s briefly recap how standard ZNE works (see the &lt;a href="https://vrusso.com/posts/circuit_unopt_zne/">previous post&lt;/a> for more
detail). The idea is:&lt;/p>
&lt;ol>
&lt;li>Take a quantum circuit and create multiple copies of it where the noise has been progressively amplified (e.g., via
unitary folding).&lt;/li>
&lt;li>Execute each noisy circuit and collect the expectation values.&lt;/li>
&lt;li>Fit a curve through these data points and extrapolate back to the zero-noise limit.&lt;/li>
&lt;/ol>
&lt;p>The key point is that standard ZNE treats the circuit&amp;rsquo;s noise as a &lt;em>single&lt;/em> scalar parameter \(\lambda\). When you fold
the circuit (say, with global folding), every layer gets scaled by the same factor. The extrapolation is then a
&lt;em>univariate&lt;/em> polynomial fit: \(f(\lambda) = a_0 + a_1\lambda + a_2\lambda^2 + \cdots\).&lt;/p>
&lt;p>This is a perfectly reasonable approach, but it makes an implicit assumption: that all layers of the circuit experience
the same type and magnitude of noise. In practice, this is often not the case. Different layers can have different gate
error rates, different qubit connectivities, and different levels of crosstalk. Standard ZNE has no way to account for
this layer-to-layer variation.&lt;/p>
&lt;h3 id="the-idea-behind-lre">The idea behind LRE&lt;/h3>
&lt;p>The core idea of LRE is to treat the noise in each circuit layer as an &lt;em>independent&lt;/em> variable. Instead of a single
noise-scale factor \(\lambda\), we now have a &lt;em>vector&lt;/em> of scale factors \(\mathbf{\lambda} = (\lambda_1, \lambda_2, \ldots, \lambda_l)\), where \(l\) is the number of layers in the circuit.&lt;/p>
&lt;p>&lt;img alt="zne-vs-lre" src="https://vrusso.com/blog/lre_zne_vs_lre.svg">&lt;/p>
&lt;p>By scaling each layer independently, we can capture the distinct noise characteristics of different parts of the circuit.
The extrapolation then becomes a &lt;em>multivariate&lt;/em> polynomial fit over this higher-dimensional space, allowing for a more
fine-grained and accurate estimate of the zero-noise expectation value.&lt;/p>
&lt;h3 id="how-lre-works">How LRE works&lt;/h3>
&lt;p>The LRE workflow consists of two main stages:&lt;/p>
&lt;p>&lt;img alt="lre-workflow" src="https://vrusso.com/blog/lre_workflow.svg">&lt;/p>
&lt;p>&lt;strong>Stage 1: Multivariate noise scaling.&lt;/strong> Given a circuit with \(l\) layers and a chosen polynomial degree \(d\), we
generate a collection of noise-scaled circuits. Each circuit in this collection has its layers folded according to a
specific scale-factor vector \(\mathbf{\lambda}_i = (\lambda_1^{(i)}, \lambda_2^{(i)}, \ldots, \lambda_l^{(i)})\).
The total number of noise-scaled circuits we need is determined by the number of monomials in the multivariate
polynomial basis:&lt;/p>
$$M = \binom{d + l}{d}$$
&lt;p>For example, with degree \(d = 2\) and \(l = 2\) layers, the monomial basis is \(\{1, \lambda_1, \lambda_2, \lambda_1^2, \lambda_1\lambda_2, \lambda_2^2\}\), giving us \(M = 6\) terms and hence 6 noise-scaled circuits.&lt;/p>
&lt;p>&lt;strong>Stage 2: Multivariate Richardson extrapolation.&lt;/strong> After executing all the noise-scaled circuits and collecting their
expectation values \(\langle O(\mathbf{\lambda}_i)\rangle\), we compute the zero-noise estimate as a linear
combination:&lt;/p>
$$O_{\text{LRE}} = \sum_{i=1}^{M} c_i \langle O(\mathbf{\lambda}_i)\rangle$$
&lt;p>The coefficients \(c_i\) are determined analytically from multivariate Lagrange interpolation theory. Specifically, they
are given by the ratio of determinants:&lt;/p>
$$c_i = \frac{\det(B_i(\mathbf{0}))}{\det(A)}$$
&lt;p>where \(A\) is the sample matrix formed by evaluating the monomial basis at each scale-factor vector, and
\(B_i(\mathbf{0})\) is the matrix obtained by replacing the \(i\)-th row of \(A\) with the monomials evaluated at
\(\mathbf{\lambda} = \mathbf{0}\) (i.e., the zero-noise point). This is analogous to Cramer&amp;rsquo;s rule applied to the
interpolation problem.&lt;/p>
&lt;h3 id="using-lre-in-mitiq">Using LRE in mitiq&lt;/h3>
&lt;p>LRE is available in &lt;a href="https://mitiq.readthedocs.io/en/stable/guide/lre.html">mitiq&lt;/a>, making it straightforward to apply
in practice. Here&amp;rsquo;s a minimal example using Cirq:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> numpy &lt;span style="color:#66d9ef">as&lt;/span> np
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> cirq &lt;span style="color:#f92672">import&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> DensityMatrixSimulator, depolarize,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> LineQubit, Circuit, Moment,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> H, CNOT, rx, ry,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> mitiq.lre &lt;span style="color:#f92672">import&lt;/span> execute_with_lre
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Define a circuit with a few layers.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qubits &lt;span style="color:#f92672">=&lt;/span> LineQubit&lt;span style="color:#f92672">.&lt;/span>range(&lt;span style="color:#ae81ff">2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>circuit &lt;span style="color:#f92672">=&lt;/span> Circuit([
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Moment([H(qubits[&lt;span style="color:#ae81ff">0&lt;/span>])]),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Moment([CNOT(qubits[&lt;span style="color:#ae81ff">0&lt;/span>], qubits[&lt;span style="color:#ae81ff">1&lt;/span>])]),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Moment([rx(np&lt;span style="color:#f92672">.&lt;/span>pi &lt;span style="color:#f92672">/&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span>)&lt;span style="color:#f92672">.&lt;/span>on(qubits[&lt;span style="color:#ae81ff">0&lt;/span>]), ry(np&lt;span style="color:#f92672">.&lt;/span>pi &lt;span style="color:#f92672">/&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>)&lt;span style="color:#f92672">.&lt;/span>on(qubits[&lt;span style="color:#ae81ff">1&lt;/span>])]),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>])
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Define an executor that simulates a noisy backend.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">execute&lt;/span>(circuit, noise_level&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0.02&lt;/span>):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> noisy_circuit &lt;span style="color:#f92672">=&lt;/span> circuit&lt;span style="color:#f92672">.&lt;/span>with_noise(depolarize(p&lt;span style="color:#f92672">=&lt;/span>noise_level))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> rho &lt;span style="color:#f92672">=&lt;/span> DensityMatrixSimulator()&lt;span style="color:#f92672">.&lt;/span>simulate(noisy_circuit)&lt;span style="color:#f92672">.&lt;/span>final_density_matrix
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> np&lt;span style="color:#f92672">.&lt;/span>real(rho[&lt;span style="color:#ae81ff">0&lt;/span>, &lt;span style="color:#ae81ff">0&lt;/span>])
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Run LRE.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mitigated_value &lt;span style="color:#f92672">=&lt;/span> execute_with_lre(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> circuit,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> execute,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> degree&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> fold_multiplier&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>noisy_value &lt;span style="color:#f92672">=&lt;/span> execute(circuit)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ideal_value &lt;span style="color:#f92672">=&lt;/span> execute(circuit, noise_level&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0.0&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Ideal value: &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>ideal_value&lt;span style="color:#e6db74">:&lt;/span>&lt;span style="color:#e6db74">.5f&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Noisy value: &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>noisy_value&lt;span style="color:#e6db74">:&lt;/span>&lt;span style="color:#e6db74">.5f&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Mitigated (LRE): &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>mitigated_value&lt;span style="color:#e6db74">:&lt;/span>&lt;span style="color:#e6db74">.5f&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Running this produces:&lt;/p>
&lt;pre tabindex="0">&lt;code>Ideal value: 0.33839
Noisy value: 0.32722
Mitigated (LRE): 0.33687
&lt;/code>&lt;/pre>&lt;p>The LRE-mitigated value (0.33687) is closer to the ideal (0.33839) than the raw noisy value (0.32722), reducing the error from ~0.011 to ~0.002.
The two key parameters are:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>degree&lt;/code>&lt;/strong>: The degree of the extrapolating polynomial. Higher degree can capture more complex noise behavior, but
requires more noise-scaled circuits.&lt;/li>
&lt;li>&lt;strong>&lt;code>fold_multiplier&lt;/code>&lt;/strong>: Controls how aggressively each layer is folded. A larger fold multiplier means more separation
between noise levels.&lt;/li>
&lt;/ul>
&lt;h3 id="under-the-hood">Under the hood&lt;/h3>
&lt;p>If you want more control, mitiq exposes the two stages of LRE as separate functions:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> mitiq.lre.multivariate_scaling &lt;span style="color:#f92672">import&lt;/span> multivariate_layer_scaling
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> mitiq.lre.inference &lt;span style="color:#f92672">import&lt;/span> multivariate_richardson_coefficients
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Stage 1: Generate noise-scaled circuits.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>noise_scaled_circuits &lt;span style="color:#f92672">=&lt;/span> multivariate_layer_scaling(circuit, degree&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>, fold_multiplier&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Number of noise-scaled circuits: &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>len(noise_scaled_circuits)&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Execute each noise-scaled circuit.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>noisy_exp_values &lt;span style="color:#f92672">=&lt;/span> [execute(circ) &lt;span style="color:#66d9ef">for&lt;/span> circ &lt;span style="color:#f92672">in&lt;/span> noise_scaled_circuits]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Stage 2: Compute Richardson coefficients and combine.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>coefficients &lt;span style="color:#f92672">=&lt;/span> multivariate_richardson_coefficients(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> circuit, fold_multiplier&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>, degree&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mitigated_value &lt;span style="color:#f92672">=&lt;/span> sum(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> exp_val &lt;span style="color:#f92672">*&lt;/span> coeff &lt;span style="color:#66d9ef">for&lt;/span> exp_val, coeff &lt;span style="color:#f92672">in&lt;/span> zip(noisy_exp_values, coefficients)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;pre tabindex="0">&lt;code>Number of noise-scaled circuits: 10
Mitigated (manual): 0.33687
&lt;/code>&lt;/pre>&lt;p>For this 3-layer circuit with degree 2, we need \(\binom{2+3}{2} = 10\) noise-scaled circuits. This gives you the
flexibility to batch the circuit executions, use different backends, or inspect the intermediate noise-scaled circuits.&lt;/p>
&lt;h3 id="performance-comparison-lre-vs-zne">Performance comparison: LRE vs. ZNE&lt;/h3>
&lt;p>To see how LRE compares to standard ZNE, consider a 12-moment circuit under layer-dependent noise where later layers
experience up to 5x higher depolarizing rates than early layers:&lt;/p>
&lt;p>&lt;img alt="lre-test-circuit" src="https://vrusso.com/blog/lre_test_circuit.svg">&lt;/p>
&lt;p>Averaging over 10 random circuits at each noise level, LRE consistently achieves lower error than ZNE:&lt;/p>
&lt;p>&lt;img alt="lre-vs-zne-performance" src="https://vrusso.com/blog/lre_vs_zne_performance.png">&lt;/p>
&lt;p>The trade-off is circuit overhead: for a 12-layer circuit with degree 2, LRE requires \(\binom{14}{2} = 91\)
noise-scaled circuits, while ZNE typically uses 3-5. Whether this is worthwhile depends on your application&amp;mdash;on
simulators the overhead is negligible, while on real hardware with limited shot budgets, chunking (discussed below)
can reduce the number of circuits substantially.&lt;/p>
&lt;p>The benefit is most pronounced for deeper circuits where noise accumulation across layers becomes significant. For
shallow circuits or uniform noise, LRE and ZNE tend to perform similarly (since uniform noise reduces the multivariate
model to the univariate case).&lt;/p>
&lt;h3 id="tuning-lre-degree-and-fold-multiplier">Tuning LRE: degree and fold multiplier&lt;/h3>
&lt;p>The two main hyperparameters that control LRE&amp;rsquo;s behavior are the polynomial degree and the fold multiplier. Higher
degree allows the polynomial to capture more complex noise dependencies, but requires exponentially more noise-scaled
circuits. The fold multiplier controls the spacing between noise levels.&lt;/p>
&lt;p>&lt;img alt="lre-degree-comparison" src="https://vrusso.com/blog/lre_degree_comparison.png">&lt;/p>
&lt;p>As the plot shows, increasing the degree from 1 to 2 yields lower error, as the polynomial model becomes more
expressive. Degree 3 is not shown because the sample matrix becomes too large to compute determinants reliably even
for an 8-layer test circuit&amp;mdash;this is exactly where chunking becomes necessary.&lt;/p>
&lt;h3 id="chunking-handling-large-circuits">Chunking: handling large circuits&lt;/h3>
&lt;p>For circuits with many layers, the number of required noise-scaled circuits grows combinatorially. The formula
\(M = \binom{d+l}{d}\) means that a 20-layer circuit at degree 2 requires 231 noise-scaled circuits, and a 20-layer
circuit at degree 3 requires 1771.&lt;/p>
&lt;p>&lt;img alt="lre-scaling-overhead" src="https://vrusso.com/blog/lre_scaling_overhead.png">&lt;/p>
&lt;p>To address this, LRE supports &lt;em>chunking&lt;/em>, where consecutive layers are grouped together and treated as a single unit
for the purposes of noise scaling. This reduces the effective number of independent variables from \(l\) to the number
of chunks.&lt;/p>
&lt;p>&lt;img alt="lre-chunking" src="https://vrusso.com/blog/lre_chunking.png">&lt;/p>
&lt;p>The visualization above shows how an 8-layer circuit, which would require \(\binom{10}{2} = 45\) noise-scaled circuits
without chunking, only requires \(\binom{6}{2} = 15\) circuits when grouped into 4 chunks. In mitiq, this is a single
parameter:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>mitigated_value &lt;span style="color:#f92672">=&lt;/span> execute_with_lre(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> circuit,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> execute,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> degree&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> fold_multiplier&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> num_chunks&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>, &lt;span style="color:#75715e"># Group layers into 4 chunks.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This trades some granularity in the layer-by-layer noise model for practical feasibility. For large circuits, chunking
is essential to keep the circuit overhead manageable.&lt;/p>
&lt;h3 id="when-to-use-lre">When to use LRE&lt;/h3>
&lt;p>LRE is particularly well-suited for circuits where different layers have meaningfully different noise characteristics.
This includes scenarios where:&lt;/p>
&lt;ul>
&lt;li>The circuit has a mix of single-qubit and two-qubit gate layers (two-qubit gates typically have higher error rates).&lt;/li>
&lt;li>The circuit uses qubits with varying coherence times or gate fidelities.&lt;/li>
&lt;li>Crosstalk effects are localized to specific layers.&lt;/li>
&lt;li>Noise accumulates with circuit depth (as is common on real hardware).&lt;/li>
&lt;/ul>
&lt;p>When the noise is perfectly uniform across all layers, LRE and standard ZNE yield similar results (as expected, since
uniform noise means the multivariate model degenerates to the univariate case). So there is no penalty for using LRE
in the uniform case&amp;mdash;it simply reduces to the standard approach.&lt;/p>
&lt;h3 id="further-reading">Further reading&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Paper&lt;/strong>: &lt;a href="https://arxiv.org/abs/2402.04000">arXiv:2402.04000&lt;/a> (Phys. Rev. A 110, 062420, 2024)&lt;/li>
&lt;li>&lt;strong>Mitiq docs&lt;/strong>: &lt;a href="https://mitiq.readthedocs.io/en/stable/guide/lre.html">LRE user guide&lt;/a>&lt;/li>
&lt;/ul></content></item><item><title>Digital zero-noise extrapolation via quantum circuit unoptimization</title><link>https://vrusso.com/posts/circuit_unopt_zne/</link><pubDate>Mon, 10 Mar 2025 00:00:00 +0000</pubDate><guid>https://vrusso.com/posts/circuit_unopt_zne/</guid><description>While quantum computers have continued to improve over the past few years, it&amp;rsquo;s a known issue that error rates cannot be made low enough simply by improvements to the hardware. One approach to this problem is the domain of quantum error correction (QEC) which promises fault-tolerant devices that properly deals with the issue of noise. While the theory of QEC is well-established, the implementation of the theory is still a while away from being physically realizable.</description><content>&lt;p>While quantum computers have continued to improve over the past few years, it&amp;rsquo;s a known issue that error rates cannot be
made low enough simply by improvements to the hardware. One approach to this problem is the domain of &lt;em>quantum error
correction&lt;/em> (QEC) which promises fault-tolerant devices that properly deals with the issue of noise. While the theory of
QEC is well-established, the implementation of the theory is still a while away from being physically realizable. One
strategy to deal with the noise in a less idealized manner in the interim is the field of &lt;em>quantum error mitigation&lt;/em>
(QEM).&lt;/p>
&lt;p>There are a variety of QEM techniques that are the subject of active research, for example, zero-noise extrapolation
(ZNE), probabilistic-error cancellation (PEC), dynamical decoupling (DD), and Clifford data regression (CDR) to name a
few.&lt;/p>
&lt;h3 id="zero-noise-extrapolation-zne">Zero-noise extrapolation (ZNE)&lt;/h3>
&lt;p>As you can probably tell from the title, we will be focused on ZNE in this post. The general idea of ZNE is quite simple
(although, perhaps at first, a bit counterintuitive). Here&amp;rsquo;s a memorable tongue-and-cheek description of the technique:&lt;/p>
&lt;p>&lt;strong>Basic idea of ZNE&lt;/strong>: Quantum computers are noisy and they kinda suck. To make them suck less you can do something
counterintuitive and deliberately make them suck &lt;em>even more&lt;/em> by chopping up the quantum circuit you want to run on the
quantum computer and increasing the suck factor. Then, you can statistically extrapolate the suckiness of how much it
sucked to the point of least suckiness.&lt;/p>
&lt;p>Let&amp;rsquo;s make this a bit more formal. You have a quantum circuit that you want to run on a quantum computer. You know that
the device is inherently noisy, so you expect your result to be impacted by this noise. However, you would like to know
what the output of your computation was if you had run it in an ideal (noiseless) environment.&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Progressively increase the noise for a set of quantum circuits that are obtained from your original quantum circuit
(we will discuss ways to do this later). Generate a set of data points by calculating expectation
values for each circuit in this set.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Plot each of these expectation values on a graph and draw a line through them (extrapolate) to the so-called
&amp;ldquo;zero-noise limit&amp;rdquo; to infer what the expectation &lt;em>would&lt;/em> be if it was executed in a noiseless environment.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>&lt;img alt="zne-extrapolation" src="https://vrusso.com/blog/zne_extrapolation.png">&lt;/p>
&lt;p>That&amp;rsquo;s the basic idea in a nutshell; pump up the volume and then ride the wave. The figure above shows the basic idea of
how these two steps can be used to statistically infer the expectation value at the zero-noise limit. Each of the data
points labeled as \(\lambda_{i_1}, \lambda_{i_2}\), and \(\lambda_{i_n}\) are called &lt;em>noise-scale factors&lt;/em> (which we
describe in greater detail in the subsequent sections).&lt;/p>
&lt;h3 id="boosting-the-volume-increasing-the-noise">Boosting the volume (increasing the noise)&lt;/h3>
&lt;p>So &lt;em>how&lt;/em> can one increase the noise of a quantum circuit, and do so in a way that is controlled. It&amp;rsquo;s not difficult to
completely garble the circuit so that it&amp;rsquo;s a complete mess of noise and sadness (which is not helpful for us). Instead,
we want something like a volume knob that, at specific discrete points in the dial, turns the volume up by a specific
amount.&lt;/p>
&lt;p>&lt;img alt="zne-volume" src="https://vrusso.com/blog/zne_volume.png">&lt;/p>
&lt;p>One way you can do this for quantum circuits (like the ones you might define in a library like Qiskit to be run on a
quantum computer) would be to use the technique of &lt;em>unitary folding&lt;/em>. Given a quantum circuit, unitary folding increases
the effective length (or depth) of the quantum circuit by adding a larger number of gates in a specific way which
inherently increases the noise.&lt;/p>
&lt;p>There are a couple of different flavors of unitary folding, but for simplicity we will just look at &lt;em>global folding&lt;/em>.
The other folding techniques are all means to the same end with minor tweaks, but global folding is one of the more
straightforward approaches.&lt;/p>
&lt;p>In global folding each set of layers in the circuit are replaced by \(G G^{\dagger}G\). Since \(G G^{\dagger} =
\mathbb{I}\), in the case where we are running our circuit on an ideal (noiseless) simulator this has no effect on the
circuit. However, if we run this circuit on a noisy device, this increases the noise and effective gate errors of the
computation.&lt;/p>
&lt;p>The &amp;ldquo;volume level&amp;rdquo; (or noise-scale factor) is usually referred to as a parameter \(\lambda\), which in this case,
determines how many times to fold the gates in the circuit.&lt;/p>
&lt;p>&lt;img alt="global-folding" src="https://vrusso.com/blog/global_folding.png">&lt;/p>
&lt;p>An example of the global folding technique applied to an arbitrary quantum circuit can be seen in the above figure. For
a given collection of gates denotes by \(G\), we increase the effective length of the overall circuit by create \(G
G^{\dagger} G\).&lt;/p>
&lt;h4 id="quantum-circuit-unoptimization">Quantum circuit unoptimization&lt;/h4>
&lt;p>In a nutshell, quantum circuit unoptimization is a procedure applied to a quantum circuit that makes it more complicated
by increasing the depth and gates of the circuit, but keeping the overall output of the circuit the same. That is, if
you run something through the original circuit and run the same thing through the unoptimized circuit, the result in
both cases will be unitarily equivalent.&lt;/p>
&lt;p>Why would anyone want to do this&amp;mdash;aren&amp;rsquo;t people are concerned with &lt;em>optimizing&lt;/em> a quantum circuit? Well, yes, usually
this is the case. However, one primary reason to do this is to check how good quantum hardware compilers are at
simplifying garbled circuits.&lt;/p>
&lt;p>In our instance, we are interested in techniques that can effectively increase the noise of a quantum circuit in a
deliberate and controlled manner. Quantum circuit unoptimization gives us one way of doing that.&lt;/p>
&lt;p>So what is the process of unoptimizing a quantum circuit? Well, as described by the authors in
&lt;a href="https://arxiv.org/abs/2311.03805">arXiv:2311.03805&lt;/a>, it can be done by following a specific &lt;em>recipe&lt;/em> that consists of
four steps, namely:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Insert&lt;/strong>: Insert a two-qubit gate \(A\) and its Hermitian conjugate \(A^{\dagger}\) between two gates in the circuit
labeled as \(B_1\) and \(B_2\).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Swap&lt;/strong>: Swap the \(B_1\) gate with the \(A^{\dagger}\) gate in the circuit, replacing \(A^{\dagger}\) with
\(\widetilde{A^\dagger}\).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Decompose&lt;/strong>: Decompose multi-qubit unitary gates into elementary gates.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Synthesize&lt;/strong>: Apply quantum circuit synthesis.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>For a given quantum circuit, you apply the four steps of the recipe. At the end, the quantum circuit cake that you&amp;rsquo;ve
baked is a much more complicated quantum circuit. You can apply this recipe as many times as you like. Each time you do
so, the circuit will end up being longer and more complicated. Importantly, however, the output of the final circuit
remains unitarily equivalent to the output of the initial circuit.&lt;/p>
&lt;p>We implemented this process in Python using Qiskit quantum circuits and released this as companion software for our
paper (&lt;a href="https://github.com/unitaryfund/circuit-unoptimization">GitHub&lt;/a>). As an example, consider the following arbitrary
quantum circuit:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> qiskit &lt;span style="color:#f92672">import&lt;/span> QuantumCircuit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a 4-qubit fully connected graph state.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>num_qubits &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qc &lt;span style="color:#f92672">=&lt;/span> QuantumCircuit(num_qubits)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">for&lt;/span> qubit &lt;span style="color:#f92672">in&lt;/span> range(num_qubits):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> qc&lt;span style="color:#f92672">.&lt;/span>h(qubit)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">for&lt;/span> i &lt;span style="color:#f92672">in&lt;/span> range(num_qubits):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> j &lt;span style="color:#f92672">in&lt;/span> range(i &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>, num_qubits):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> qc&lt;span style="color:#f92672">.&lt;/span>cz(i, j)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This is just an arbitrary circuit consisting of one and two-qubit gates that in this case represents a 4-qubit fully
connected &lt;a href="https://en.wikipedia.org/wiki/Graph_state">graph state&lt;/a> (for the sake of example).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(qc)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">┌───┐&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_0: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> H &lt;span style="color:#960050;background-color:#1e0010">├─■──■──■──────────&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">├───┤&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_1: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> H &lt;span style="color:#960050;background-color:#1e0010">├─■──┼──┼──■──■────&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">├───┤&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_2: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> H &lt;span style="color:#960050;background-color:#1e0010">├────■──┼──■──┼──■─&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">├───┤&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_3: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> H &lt;span style="color:#960050;background-color:#1e0010">├───────■─────■──■─&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">└───┘&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>We can use the &lt;code>unoptimize_circuit&lt;/code> function from our software package on this circuit and apply as many rounds of the
unoptimization recipe as we would like. For the sake of not giving you carpal tunnel syndrome from having to scroll
such a large circuit, let&amp;rsquo;s just apply a single iteration of the recipe.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> unopt.recipe &lt;span style="color:#f92672">import&lt;/span> unoptimize_circuit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> unoptimize_circuit(qc, iterations&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">global&lt;/span> phase: &lt;span style="color:#ae81ff">2.0949&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌──────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌──────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_0: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.0356&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.1618&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──■────────┤&lt;/span> U3(π,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───────■──┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.2421&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1.84&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1.2786&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──■──────────────────────■──┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.83219&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.5782&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──■──»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">└──┬──────────────────┬──┘┌─┴─┐┌─────┴────────────────┴────┐┌─┴─┐├──────────────────────────┤&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└──────────────────────────┘┌─┴─┐»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_1: &lt;span style="color:#960050;background-color:#1e0010">───┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.1322&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.7549&lt;/span>,&lt;span style="color:#ae81ff">2.0217&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.3363&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.1386&lt;/span>,&lt;span style="color:#ae81ff">1.7574&lt;/span>,&lt;span style="color:#ae81ff">1.3842&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──┼──────────────────────┼──────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">┌─┴──────────────────┴┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘└───────────────────────────┘└───┘└──────────────────────────┘┌─┴─┐┌────────────────┐┌─┴─┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌──────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_2: &lt;span style="color:#960050;background-color:#1e0010">─┤&lt;/span> U3(π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0.062179&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π) &lt;span style="color:#960050;background-color:#1e0010">├─────────────────────────────────────────────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#ae81ff">1.0704&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├────┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.68791&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π,&lt;span style="color:#ae81ff">0&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├─────────»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">└─────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘└────────────────┘└───┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└──────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>q_3: &lt;span style="color:#960050;background-color:#1e0010">──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌───────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌───────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌──────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_0: &lt;span style="color:#960050;background-color:#1e0010">──────┤&lt;/span> U3(π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├────────■─────┤&lt;/span> U3(&lt;span style="color:#ae81ff">3.0151&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──────────────────────────────────────■────────┤&lt;/span> U3(π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├────────■───────┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.132&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.51688&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───────■──»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─────┴───────────────┴─────┐┌─┴─┐┌──┴────────────────────┴─┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌───────────────────────────┐┌─┴─┐┌─────┴───────────────┴─────┐┌─┴─┐┌────┴──────────────────────┴────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_1: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.0383&lt;/span>,&lt;span style="color:#ae81ff">2.2097&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.8185&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.5857&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.9553&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──■──┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.56249&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.81816&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.0383&lt;/span>,&lt;span style="color:#ae81ff">2.2097&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.8185&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.039343&lt;/span>,&lt;span style="color:#ae81ff">0.031289&lt;/span>,&lt;span style="color:#ae81ff">0.031289&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──┼──»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───────────────────────────┘└───┘└─────────────────────────┘┌─┴─┐└─┬───────────────────────┬─┘└───┘└───────────────────────────┘└───┘└────────────────────────────────┘┌─┴─┐»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_2: &lt;span style="color:#960050;background-color:#1e0010">─────────────────────────────────────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├──┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.0967&lt;/span>,&lt;span style="color:#ae81ff">0.40856&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π) &lt;span style="color:#960050;background-color:#1e0010">├───────────────────────────────────────────────────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_3: &lt;span style="color:#960050;background-color:#1e0010">─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─────────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌───────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_0: &lt;span style="color:#960050;background-color:#1e0010">─────────────────────■──┤&lt;/span> U3(π,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.51538&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.51538&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───■────────┤&lt;/span> U3(π,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───────■──┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.2152&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.15561&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1.6024&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──■───┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.40369&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├────■──»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└─────────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─┴─┐┌─────┴────────────────┴────┐┌─┴─┐└───┬─────────────────────┬───┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_1: &lt;span style="color:#960050;background-color:#1e0010">─────────────────────┼──────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.7231&lt;/span>,&lt;span style="color:#ae81ff">1.9856&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.2664&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├────┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.1322&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──────┼────────────────────────────────┼──»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─────────────────┐┌─┴─┐┌──────────────────────────┐└───┘└───────────────────────────┘└───┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└─────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─┴─┐┌──────────────────────────┐┌─┴─┐»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_2: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> U3(&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1.3608&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.8527&lt;/span>,&lt;span style="color:#ae81ff">1.8089&lt;/span>,&lt;span style="color:#ae81ff">1.6118&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──────────────────────────────────────────────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">2.1223&lt;/span>,&lt;span style="color:#ae81ff">3.0309&lt;/span>,&lt;span style="color:#ae81ff">1.3617&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└─────────────────┘└───┘└──────────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘└──────────────────────────┘└───┘»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_3: &lt;span style="color:#960050;background-color:#1e0010">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌──────────────────────────────┐&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_0: &lt;span style="color:#960050;background-color:#1e0010">────┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.29827&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├──────■──┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.9596&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.96632&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">0.54303&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├───────■──────────────────────────────────────────&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└──────────────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_1: &lt;span style="color:#960050;background-color:#1e0010">────────────────────────────────┼────────────────────────────────────■────┼───────────────────■──────────────────────&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌────────────────────────────┐┌─┴─┐┌─────────────────────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─┴─┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">┌─────────────┐&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">│&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_2: &lt;span style="color:#960050;background-color:#1e0010">┤&lt;/span> U3(&lt;span style="color:#ae81ff">1.1033&lt;/span>,&lt;span style="color:#ae81ff">0.32306&lt;/span>,&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">2.2097&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(&lt;span style="color:#ae81ff">0.23528&lt;/span>,&lt;span style="color:#ae81ff">0.096677&lt;/span>,&lt;span style="color:#ae81ff">2.2331&lt;/span>) &lt;span style="color:#960050;background-color:#1e0010">├─┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├──┼──┤&lt;/span> U3(π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,π) &lt;span style="color:#960050;background-color:#1e0010">├──┼────■─────────────────&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└────────────────────────────┘└───┘└─────────────────────────────┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘┌─┴─┐└─────────────┘┌─┴─┐┌─┴─┐┌─────────────┐&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span>q_3: &lt;span style="color:#960050;background-color:#1e0010">────────────────────────────────────────────────────────────────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├───────────────┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> X &lt;span style="color:#960050;background-color:#1e0010">├┤&lt;/span> U3(π&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,π) &lt;span style="color:#960050;background-color:#1e0010">├&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">«&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">└───┘└───┘└─────────────┘&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>From a cursory visual inspection, this circuit looks wildly different than the original one. The more iterations you
subsequently apply, the larger and more garbled the circuit will become. However, it will remain unitarily equivalent to
the original circuit (even if it looks quite a bit different). You can confirm this by doing a sanity check:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> qiskit.quantum_info &lt;span style="color:#f92672">import&lt;/span> Operator
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>unopt_qc &lt;span style="color:#f92672">=&lt;/span> unoptimize_circuit(qc, iterations&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>original_unitary &lt;span style="color:#f92672">=&lt;/span> Operator(qc)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>unopt_unitary &lt;span style="color:#f92672">=&lt;/span> Operator(unopt_qc)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>unitaries_are_equal &lt;span style="color:#f92672">=&lt;/span> original_unitary&lt;span style="color:#f92672">.&lt;/span>equiv(unopt_unitary)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Indeed, we can see that the original and unoptimized circuit are unitarily equivalent:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Are the circuits functionally equivalent? &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>unitaries_are_equal&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Are the circuits functionally equivalent&lt;span style="color:#960050;background-color:#1e0010">?&lt;/span> &lt;span style="color:#66d9ef">True&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can continually bump up the number of &lt;code>iterations&lt;/code>, and the circuits will remain unitarily equivalent.&lt;/p>
&lt;h3 id="unoptimization-and-zne">Unoptimization and ZNE&lt;/h3>
&lt;p>Like unitary folding, we can use the technique of circuit unoptimization to progressively increase the noise and
extrapolate to the zero-noise limit. In our paper, (&lt;a href="https://arxiv.org/abs/2503.06341">arXiv:2503.06341&lt;/a>), we considered
this on two classes of circuits that people find interesting for various reasons; quantum volume (QV) and Quantum
Approximate Optimization Algorithm (QAOA) circuits.&lt;/p>
&lt;p>I&amp;rsquo;ll leave the detailed analyses of how quantum circuit unoptimization can be used for those classes of circuits to the
paper. However, we can take a more general look at how one can apply unoptimization as a noise-scaling technique for
ZNE. Furthermore, we can also compare how this noise-scaling does in comparison to the ideal (noiseless) case, the
unmitigated case (i.e. running the circuit in a noisy setting with no error mitigation), and the case where ZNE is used
but some type of unitary folding is applied for the noise-scaling.&lt;/p>
&lt;p>We can perform comparative benchmarks for ZNE with unoptimization as a scaling technique against the ideal, unmitigated,
and ZNE with folding&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> unopt.benchmark &lt;span style="color:#f92672">import&lt;/span> bench
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Averages Across All Trials:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Ideal Value: &lt;span style="color:#ae81ff">0.06250000000000006&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Unmitigated Value: &lt;span style="color:#ae81ff">0.003799999999999956&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Fold Value: &lt;span style="color:#ae81ff">0.00037500000000005443&lt;/span> (Error: &lt;span style="color:#ae81ff">0.062125&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Unopt Value: &lt;span style="color:#ae81ff">0.008441716269841373&lt;/span> (Error: &lt;span style="color:#ae81ff">0.05405828373015868&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Percent Improvement (Unmit): &lt;span style="color:#ae81ff">8.59&lt;/span>&lt;span style="color:#f92672">%&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Percent Improvement (ZNE &lt;span style="color:#f92672">+&lt;/span> Fold): &lt;span style="color:#ae81ff">14.92&lt;/span>&lt;span style="color:#f92672">%&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Original Circuit Depth: &lt;span style="color:#ae81ff">6&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Avg Folded Depths: [&lt;span style="color:#ae81ff">6.0&lt;/span>, &lt;span style="color:#ae81ff">18.0&lt;/span>, &lt;span style="color:#ae81ff">30.0&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Avg Unoptimized Depths: [&lt;span style="color:#ae81ff">37.0&lt;/span>, &lt;span style="color:#ae81ff">65.0&lt;/span>, &lt;span style="color:#ae81ff">101.0&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Trial Details:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Trial &lt;span style="color:#ae81ff">1&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Ideal Value: &lt;span style="color:#ae81ff">0.06250000000000006&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Unmitigated Value: &lt;span style="color:#ae81ff">0.003799999999999956&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Fold Value: &lt;span style="color:#ae81ff">0.00037500000000005443&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Fold Depths: [&lt;span style="color:#ae81ff">6&lt;/span>, &lt;span style="color:#ae81ff">18&lt;/span>, &lt;span style="color:#ae81ff">30&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Unopt Value: &lt;span style="color:#ae81ff">0.008441716269841373&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ZNE &lt;span style="color:#f92672">+&lt;/span> Unopt Depths: [&lt;span style="color:#ae81ff">37&lt;/span>, &lt;span style="color:#ae81ff">65&lt;/span>, &lt;span style="color:#ae81ff">101&lt;/span>]
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Note that for certain circuits and runs, you may obtain different results as there is a randomized component to the
circuit unoptimization and extrapolation.&lt;/p>
&lt;h2 id="further-reading">Further reading&lt;/h2>
&lt;p>This post is just a high-level overview of the ideas elaborated on in more detail in the paper, so for further
information, examples, etc., please check out both the arXiv preprint
(&lt;a href="https://arxiv.org/abs/2503.06341">arXiv:2503.06341&lt;/a>) as well as the software
(&lt;a href="https://github.com/unitaryfund/circuit-unoptimization">GitHub&lt;/a>).&lt;/p></content></item></channel></rss>