Skip to content

Update tutorials on calibration #4258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 25, 2021

Conversation

rmlarose
Copy link
Contributor

Closes #3933 and updates calibration tutorials.

  • 825d29a repurposes the old "advanced calibration tutorial" to an example only using XEB calibration.
  • 31df17a updates the Floquet calibration tutorial.
  • 1e0c941 adds an overview tutorial on calibration, showing basic usage for both Floquet and XEB.

Note: This is the same as #4226 but with an easier-to-review commit history as requested in #4226 (comment).

rmlarose added 9 commits June 22, 2021 00:21
commit d006a19
Author: Ryan LaRose <[email protected]>
Date:   Sun Jun 20 21:38:58 2021 -0400

    Format.

commit 4c28929
Author: Ryan LaRose <[email protected]>
Date:   Sun Jun 20 21:23:58 2021 -0400

    Temp remove from book.yaml.

commit 519d0be
Author: Ryan LaRose <[email protected]>
Date:   Sun Jun 20 21:15:04 2021 -0400

    Update advanced calibration tutorial.
@rmlarose rmlarose requested review from cduck, vtomole, wcourtney and a team as code owners June 23, 2021 20:52
@rmlarose rmlarose requested a review from mpharrigan June 23, 2021 20:52
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Jun 23, 2021
@@ -182,14 +182,20 @@ upper_tabs:
- heading: "Google hardware"
- title: "Getting started with QCS"
path: /cirq/tutorials/google/start
- title: "Floquet calibration"
path: /cirq/tutorials/google/floquet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tweeted a link to this page to go along with today's Nature publication. In general, we should be careful about URL backwards compatibility. Would it be possible to give the new "Floquet calibration: Example and benchmark" the /floquet URL? Does docsite have the ability to alias pages from multiple endpoints? @lamberta

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maintaining URL stability is important, particularly when SEO kicks in and you want to move pages.
You can't alias a page to two separate URLs, but you can add a redirect to point to the new page. Add an entry in the _redirects.yaml file located in the root of your docsite server directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed thanks! I'll add a redirect, and, more importantly, I'll like the tweet :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmlarose Did you add the redirect already? I can't see any changes to docs/_redirects.yaml (assuming that's where it's supposed to go).

"id": "Y6Wh1qtGMghL"
},
"outputs": [],
"source": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this inspired me to finally open #4260

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to that.

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"are tools to characterize sqrt(iswap) gates" --> "a family of gates including sqrt(iswap)" The family is represented by cirq.PhasedFSimGate blah blah. sqrt(iswap) corresponds to (-pi/4, 0, 0, 0, 0)

"insertion of Z phases" -> "insertion of Z gates" (or "ZPowGates" or "RzGates")

"decreasing the effects of two sources of coherent errors:"


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Reads a lot better and is more precise, thanks!

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kindof confusing that theta and phi are set to "False" below if we say we can get estimates for all angles except chi.

It could be mildly helpful to put the latin-alphabet-spelling (chi) after the symbol so people can relate it to the code. It looks like an X


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set all to False execpt for chi, + added the latin spelling of chi in the text.

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rz gates


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

classical simulation -> classical processing

"Unlike floquet calibration, XEB requires significant classical processing to characterize angles"


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people are going to complain that this is slow and slows down notebook testing. The other notebooks loosen the tolerance parameters for fitting so the optimization finishes faster. But of course we don't want to set bad defaults that people will blindly copy.

Did @dabacon's scheme to regex replace parameters for notebook testing get merged? If so; we need to have replacement rules for this notebook


Reply via ReviewNB

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did get merged, see the .tst files next to the notebooks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, calibration_api.tst reduces the cycle depths to speed up testing here.

@@ -0,0 +1,609 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can floquet compensate for chi if it can't characterize it??


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name is make_zeta_chi_gamma_compensation_for_moments, which kind of implies that chi can be compensated. So it's a little confusing either way, but I agree your suggestion to say chi cannot be compensated is less confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Also fixed some left headings in the table not being bold.

@@ -39,7 +39,7 @@
"id": "AF-CFuvzPx4x"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't changed in the current PR, but:

this circuit diagram wraps really badly on my machine because of the use of print because you want to set the qubit order. If you just have the circuit as the last thing in the cell, jupyter will print its text representation in a cell with a horizontal scroll bar. I don't know if there's any fix here


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out, I also don't know of a fix. At least it appears nicely on the website with a horizontal scroll bar.

Worth noting: Not specifying a qubit order makes the circuit much harder to understand here, even if it displays nicely.

@@ -0,0 +1,674 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this cell doesn't work as written and requires an actual processor id. We should 1) open a bug to provide mock engine calibrations 2) in the mean time, wrap this in a conditional to skip if processor_id isn't supplied


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on (1). For (2), I think this tutorial will look strange saying "look at calibration and pick good qubits" then not showing any calibration data. Do you think its sufficient to just save outputs for now, then follow-up after being unblocked by (1)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we can open a bug and fix this in a follow-up PR. For now, let's use the saved outputs.

@@ -0,0 +1,674 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work as written without a processor_id. Why not set up sampler to optionally be a coherent-error sampler like in the floquet notebook?


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the first step is looking at calibration to pick qubits - which can't be done with a coherent-error sampler AFAIK - this notebook really requires a processor_id. So the strategy was to just save all outputs.

@@ -0,0 +1,674 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: circ -> circuit. Too confusing with cirq :)


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mpharrigan
Copy link
Collaborator

Very cool stuff! I think the url stability thing is the most important plus some nits

@@ -0,0 +1,674 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #11.        calibration.heatmap(metric).plot(ax=axes[i] if len(metrics) > 1 else axes);

If it's useful here, I think it might be worth showing off the heatmap feature which allows you to specify a different scaling (eg: LogNorm, PowerNorm etc.) for the mapping of colors. For Eg:

heatmap.plot(ax, collection_options = {'norm' : mpl.colors.LogNorm()}) could be useful to have better distinction among qubits with low error rates. This is also something which people use internally (eg: Wojtek had reached out to me asking for this feature).


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % minor nits

  • Please add an entry to _redirects.yaml
  • Please modify the heatmap.plot() call to include log scaling example, which I believe should be useful here.

@mrwojtek
Copy link
Collaborator

I'm happy to see the changes in this PR. All the content seem to be cleaner and more accessible now!

@rmlarose
Copy link
Contributor Author

  • Please add an entry to _redirects.yaml

For posterity: _redirects.yaml lives in internal docs infra, not in this repo.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I added the redirect internally (381528935).

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 25, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 25, 2021
@CirqBot CirqBot merged commit ff230df into quantumlib:master Jun 25, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 25, 2021
@rmlarose
Copy link
Contributor Author

I added the redirect internally (381528935).

Thanks!!

rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Closes quantumlib#3933 and updates calibration tutorials.

- quantumlib@825d29a repurposes the old "advanced calibration tutorial" to an example only using XEB calibration.
- quantumlib@31df17a updates the Floquet calibration tutorial.
- quantumlib@1e0c941 adds an overview tutorial on calibration, showing basic usage for both Floquet and XEB.

Note: This is the same as quantumlib#4226 but with an easier-to-review commit history as requested in quantumlib#4226 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy docs/tutorial/floquet but for XEB
7 participants