|
31 | 31 | "# limitations under the License." |
32 | 32 | ] |
33 | 33 | }, |
| 34 | + { |
| 35 | + "cell_type": "markdown", |
| 36 | + "metadata": { |
| 37 | + "id": "b5cbe21a91f4" |
| 38 | + }, |
| 39 | + "source": [ |
| 40 | + "# Coherent vs Incoherent Error with XEB" |
| 41 | + ] |
| 42 | + }, |
34 | 43 | { |
35 | 44 | "cell_type": "markdown", |
36 | 45 | "metadata": { |
|
39 | 48 | "source": [ |
40 | 49 | "<table class=\"tfo-notebook-buttons\" align=\"left\">\n", |
41 | 50 | " <td>\n", |
42 | | - " <a target=\"_blank\" href=\"https://quantumai.google/cirq/qcvv/coherent_vs_incoherent_xeb>\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n", |
| 51 | + " <a target=\"_blank\" href=\"https://quantumai.google/cirq/noise/qcvv/coherent_vs_incoherent_xeb>\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n", |
43 | 52 | " </td>\n", |
44 | 53 | " <td>\n", |
45 | | - " <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n", |
| 54 | + " <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/noise/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n", |
46 | 55 | " </td>\n", |
47 | 56 | " <td>\n", |
48 | | - " <a target=\"_blank\" href=\"https://github.com/quantumlib/Cirq/blob/master/docs/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/github_logo_1x.png\" />View source on GitHub</a>\n", |
| 57 | + " <a target=\"_blank\" href=\"https://github.com/quantumlib/Cirq/blob/master/docs/noise/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/github_logo_1x.png\" />View source on GitHub</a>\n", |
49 | 58 | " </td>\n", |
50 | 59 | " <td>\n", |
51 | | - " <a href=\"https://storage.googleapis.com/tensorflow_docs/Cirq/docs/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/download_icon_1x.png\" />Download notebook</a>\n", |
| 60 | + " <a href=\"https://storage.googleapis.com/tensorflow_docs/Cirq/docs/noise/qcvv/coherent_vs_incoherent_xeb.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/download_icon_1x.png\" />Download notebook</a>\n", |
52 | 61 | " </td>\n", |
53 | 62 | "</table>" |
54 | 63 | ] |
|
61 | 70 | "source": [ |
62 | 71 | "This notebook demonstrates how to use Cross Entropy Benchmarking (XEB) end-to-end to compare coherent gate parameter error and incoherent depolarization error. It will mimic a small device graph of `cirq.GridQubit` pairs and simulate two-qubit XEB benchmarking circuits on them with noise models that introduce coherent and incoherent error before visualizing and comparing the results.\n", |
63 | 72 | "\n", |
64 | | - "For more information on types of error, see [Average, Pauli and Incoherent Error](../google/calibration.md#average-pauli-and-incoherent_error). \n", |
| 73 | + "For more information on types of error, see [Average, Pauli and Incoherent Error](/cirq/noise/calibration.md#average-pauli-and-incoherent_error). \n", |
65 | 74 | "\n", |
66 | | - "For more information on noise and noise models, see [Noise](../noise.ipynb).\n", |
| 75 | + "For more information on noise and noise models, see [Noise](/cirq/noise).\n", |
67 | 76 | "\n", |
68 | | - "For more information on how XEB works in detail, see [XEB Theory](./xeb_theory.ipynb) notebook." |
| 77 | + "For more information on how XEB works in detail, see [XEB Theory](/cirq/noise/qcvv/xeb_theory) notebook." |
69 | 78 | ] |
70 | 79 | }, |
71 | 80 | { |
|
74 | 83 | "id": "57flCRpJpup3" |
75 | 84 | }, |
76 | 85 | "source": [ |
77 | | - "# Noisy Sampler Setup" |
| 86 | + "## Setup" |
78 | 87 | ] |
79 | 88 | }, |
80 | 89 | { |
|
135 | 144 | "source": [ |
136 | 145 | "## Prepare Noise Models\n", |
137 | 146 | "\n", |
138 | | - "To compare coherent and incoherent error, use two different noise models, which introduce coherent and incoherent error respectively. Also included are a noiseless model and a \"fused\" model that combines both coherent and incoherent error, for comparison. See [Noise](../noise.ipynb) for the difference between coherent and incoherent error. \n", |
| 147 | + "To compare coherent and incoherent error, use two different noise models, which introduce coherent and incoherent error respectively. Also included are a noiseless model and a \"fused\" model that combines both coherent and incoherent error, for comparison. See [Noise](/cirq/noise) for the difference between coherent and incoherent error. \n", |
139 | 148 | "\n", |
140 | 149 | "The coherent noise model is represented by a perturbed `SQRT_ISWAP` gate, which implements a slightly different unitary than a true `SQRT_ISWAP`. Perturbed gates are caused by hardware losing its calibrated tuning, which typically occurres naturally over time between device calibrations. \n", |
141 | 150 | "\n", |
|
355 | 364 | "id": "423f56a942f6" |
356 | 365 | }, |
357 | 366 | "source": [ |
358 | | - "# Fidelity Data Collection\n", |
359 | | - "## Sample Circuits\n", |
| 367 | + "## Fidelity Data Collection\n", |
| 368 | + "### Sample Circuits\n", |
360 | 369 | "\n", |
361 | 370 | "The following call will zip together the `circuit_library` circuits according to `combs_by_layer` into larger circuits that evaluate multiple qubit pairs in parallel, before sampling them. Remember that `samplers` contains coherent and incoherent noise samplers, an errorless sampler, and a fused sampler. Mapping `sample_2q_xeb_circuits` to the list of samplers produces sampled data, generated with identical parameters except for the difference in noise model. " |
362 | 371 | ] |
|
442 | 451 | "id": "QDPtNQlPz3BL" |
443 | 452 | }, |
444 | 453 | "source": [ |
445 | | - "# Visualizing Fidelity by Noise Model\n", |
| 454 | + "## Visualizing Fidelity by Noise Model\n", |
446 | 455 | "\n", |
447 | | - "## Qubit Pair Heatmaps\n", |
| 456 | + "### Qubit Pair Heatmaps\n", |
448 | 457 | "The following cell visualizes the by-cycle fidelity error in qubit pair heatmaps." |
449 | 458 | ] |
450 | 459 | }, |
|
495 | 504 | "id": "c47ti1_uKnLs" |
496 | 505 | }, |
497 | 506 | "source": [ |
498 | | - "## Circuit Fidelity by Cycle\n", |
| 507 | + "### Circuit Fidelity by Cycle\n", |
499 | 508 | "The qubit pair heatmaps are good, but summarize the fidelity data too much to reveal meaningful patterns. To rectify this, graph the circuit fidelity by cycle, alongside an exponential decay curve from the by-cycle fidelity estimation. For reference, an exponential decay associated with the original depolarization chance of `5e-3` is included. \n", |
500 | 509 | "\n", |
501 | 510 | "First some graphing utilities:\n" |
|
656 | 665 | "id": "6025a292d19b" |
657 | 666 | }, |
658 | 667 | "source": [ |
659 | | - "# Characterize Gate Parameters\n", |
| 668 | + "## Characterize Gate Parameters\n", |
660 | 669 | "\n", |
661 | 670 | "A classical optimizer can be used to approximate the two-qubit gate parameters that were actually used from the fidelity data. Here, the parameter of interest is the `phi` parameter, which is the one used to perturb `SQRT_ISWAP`. To characterize `phi`, flag it in the `SqrtISwapXEBOptions` object. Don't characterize the others parameters, for runtime reasons. This object, once passed into the optimizer wrapper `characterize_phased_fsim_parameters_with_xeb_by_pair`, denotes that the optimizer expects the two-qubit entangling gate used to be a `SQRT_ISWAP`, and that it will look for parameters to that gate (or the PhasedFSim version of it) which most closely replicate the observed fidelity data. \n", |
662 | 671 | "\n", |
|
780 | 789 | "id": "qvXyscaYfpUv" |
781 | 790 | }, |
782 | 791 | "source": [ |
783 | | - "# Visualizing Refitted Fidelities by Noise Model\n", |
| 792 | + "## Visualizing Refitted Fidelities by Noise Model\n", |
784 | 793 | "\n", |
785 | 794 | "Finally, plot the original and refit circuit fidelities by cycle, with exponential decay curves, for each of the available datasets. " |
786 | 795 | ] |
|
813 | 822 | "id": "E4xIRDi9gBnu" |
814 | 823 | }, |
815 | 824 | "source": [ |
816 | | - "In the coherent error case, the optimization was able to refit the fidelities very well. The new curves of the refit data almost perfectly match the horizontal line at `1.0` fidelity. The success of this refit means that the estimated parameters for this case are very likely to represent the actual parameters of the gate operation used, which was seen in the fact that the optimization re-discovered the `phi` value that was originally used to perturb `SQRT_ISWAP`. In the real hardware case, identifying these parameters means identifying what unitary the gate control hardware actually implemented. If this unitary is far from the intended one, hardware re-calibration or [compensation](../tutorials/google/calibration_api.ipynb) must be performed in order to improve circuit fidelity. \n", |
| 825 | + "In the coherent error case, the optimization was able to refit the fidelities very well. The new curves of the refit data almost perfectly match the horizontal line at `1.0` fidelity. The success of this refit means that the estimated parameters for this case are very likely to represent the actual parameters of the gate operation used, which was seen in the fact that the optimization re-discovered the `phi` value that was originally used to perturb `SQRT_ISWAP`. In the real hardware case, identifying these parameters means identifying what unitary the gate control hardware actually implemented. If this unitary is far from the intended one, hardware re-calibration or [compensation](/cirq/noise/calibration_api) must be performed in order to improve circuit fidelity. \n", |
817 | 826 | "\n", |
818 | 827 | "In constrast, the optimizer was completely unable to refit the circuit fidelities in the incoherent error case. The refit fidelities find no meaningful fidelity improvement, instead following the same, expected `5e-3` exponential decay as the original fidelities. Unsurprisingly, the optimizer was unable to find any coherent error in the incoherent-only fidelity data. \n", |
819 | 828 | "\n", |
|
866 | 875 | "id": "E8BdVyNGLGnm" |
867 | 876 | }, |
868 | 877 | "source": [ |
869 | | - "# Conclusion\n", |
| 878 | + "## Conclusion\n", |
870 | 879 | "\n", |
871 | 880 | "Cross Entropy Benchmarking and optimizer refitting has been shown here to effectively characterize patterns of coherent error, to find the (parameters of the) true unitary operation used on individual qubit pairs. Importantly, this is effective even in the case where incoherent error is also acting on the system, but with noticeably reduced accuracy. In a real hardware system, with many interacting sources of error, XEB can still be useful to identify consistent coherent error, but it's important to remember that other error can confound these results. " |
872 | 881 | ] |
|
877 | 886 | "id": "wxvZ2plRMB-l" |
878 | 887 | }, |
879 | 888 | "source": [ |
880 | | - "# What's Next?\n", |
| 889 | + "## What's Next?\n", |
881 | 890 | "\n", |
882 | 891 | "Now that you've identified coherent error, what can you do about it? \n", |
883 | | - "- Depending on the parameter(s) identified to be out of tune, you may be able to change the circuits you want to run to compensate for that change. Read [Calibration API](../tutorials/google/calibration_api.ipynb) for further information.\n", |
| 892 | + "- Depending on the parameter(s) identified to be out of tune, you may be able to change the circuits you want to run to compensate for that change. Read [Calibration API](/cirq/noise/calibration_api) for further information.\n", |
884 | 893 | "- In the real hardware case, the device may need to be re-calibrated in order to fix the tuning of particular gate operations on particular qubits. Reach out to your google contact to let us know!" |
885 | 894 | ] |
886 | 895 | } |
|
0 commit comments