Skip to content

Commit

Permalink
draft 1
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Nov 26, 2024
1 parent 79b5dfe commit 8b2c48d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Binary file added public/images/lre_workflow_steps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions src/content/blog/2024_lre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Adding Layerwise Richardson Extrapolation in Mitiq"
author:
day: 28
month: 11
year: 2024
tags:
- Mitiq
-
---

Layerwise Richardson Extrapolation (LRE) [^1] is a multivariate extension of Zero Noise Extrapolation (ZNE)
where the noise of each layer is treated as an independent variable.

![](/images/lre_workflow_steps.png)

The general workflow of LRE comprises of creating multiple layerwise noise scaled circuits that are executed on a backend and then
extrapolated independently. ZNE allows a choice of which layer to scale based on the chosen scale factor while the
noise scaled circuits in LRE are created in a specific pattern dependent on factors like the number of layers in the input circuit,
degree of the multivariate extrapolating polynomial and the fold multiplier as the scale factor to control how many layers are inserted
via unitary folding.

The mitiq module `mitiq.lre` can be used in two ways.

- [`execute_with_lre`](https://mitiq.readthedocs.io/en/stable/apidoc.html#mitiq.lre.lre.execute_with_lre) can be used directly to get the error-mitigated expectation value.

```py

# Get the error mitigated expectation value directly
mitigated = execute_with_lre(
circuit,
execute,
degree=degree,
fold_multiplier=fold_multiplier,
)

```

- To allow more control over the process, use [`multivariate_layer_scaling`](https://mitiq.readthedocs.io/en/stable/apidoc.html#mitiq.lre.multivariate_scaling.layerwise_folding.multivariate_layer_scaling) to create the intermediary noise scaled circuits and [`multivariate_richardson_coefficients`](https://mitiq.readthedocs.io/en/stable/apidoc.html#mitiq.lre.inference.multivariate_richardson.multivariate_richardson_coefficients) to get the coefficients of linear combination used by multivariate extrapolation. The latter are combined with the noise scaled expectation values to estimate the error-mitigated value through LRE.

```py
# Step by step application
# noise scaled circuits
noise_scaled_circuits = multivariate_layer_scaling(circuit, degree, fold_multiplier)

# noise scaled expectation values
noise_scaled_exp_values = [execute(circuit) for circuit in noise_scaled_circuits]

# combine the results
mitigated = sum(
exp_val * coeff
for exp_val, coeff in zip(noise_scaled_exp_values, coefficients)
)

```

Additional information is available in the [LRE User Guide](https://mitiq.readthedocs.io/en/stable/guide/lre.html) in Mitiq's documentation.

------------------------------------------------------
[^1]: Russo, Vincent and Mari, Andrea, _Quantum error mitigation by layerwise Richardson extrapolation_ (2024) [arXiv:2402.04000](https://arxiv.org/abs/2402.04000).

0 comments on commit 8b2c48d

Please sign in to comment.