Skip to content

[docs](notebooks) Review / update pulse efficient transpilation tutorial#46

Open
beckykd wants to merge 19 commits intoqiskit-community:mainfrom
beckykd:bd-pulse-efficient-transpilation
Open

[docs](notebooks) Review / update pulse efficient transpilation tutorial#46
beckykd wants to merge 19 commits intoqiskit-community:mainfrom
beckykd:bd-pulse-efficient-transpilation

Conversation

@beckykd
Copy link
Copy Markdown

@beckykd beckykd commented Apr 30, 2024

Updating this tutorial for publication readiness.

FYI @pedrorrivero and @haimeng-zhang

@beckykd
Copy link
Copy Markdown
Author

beckykd commented Apr 30, 2024

Started some initial editing for consistency with other tutorials and added some questions / comments in-text

Copy link
Copy Markdown
Contributor

@haimeng-zhang haimeng-zhang left a comment

Choose a reason for hiding this comment

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

Hi @beckykd, thank you for the edits. Please find my response to your comments below.

  1. Can we add some background? What is a pulse circuit? Why/when would you want to do this?
    For the first question, I do not think the term 'pulse circuit' is explicitly used in the notebook, so I wrote a paragraph to explain what a pulse gate is instead)
    What is a pulse gate? A quantum gate is an abstraction for the operation applied to qubits. In superconducting qubit architecture, its physical implementation typically involves applying microwave pulses - these are electromagnetic waves at specific frequencies with certain amplitudes and durations, to interact with qubits and control the qubit states. Those microwave pulses are pre-calibrated to implement a desired operation and serve as one of the standard native gates. Using the OpenPulse feature, the pulse-level control is exposed to users so they can use pulse gates - gates that are specified by pulse schedules.
    Why/When would you want to do this:
    Pulse gates provide more flexibility in defining and fine-tuning qubit operations and could potentially be used to construct gates that have higher fidelities. In this notebook, we show that it is particularly true when translating circuits for quantum simulation with small trotterization time steps.

  2. Can we add some more explanation? Is it obvious to those who know what pulse gates are why this would serve as a native gate set?
    The 'RZXGate' with an arbitrary rotation angle $\theta$ is implemented by turning on the two-qubit $Z\otimes X$ interaction by applying echoed cross-resonance pulses with varying duration, hence serving as a continuous gate set. It is a gate that is native to the hardware because its implementation does not require any further decomposition - it is implemented by directly specifying the pulse-level instruction schedule of the gate.

  3. is this a different technique, or the same technique described above?
    It is the same technique as described above.

  4. the current implementation of what? The way it's implemented in this notebook?
    Yes, the way it is implemented in this notebook.

  5. ...KAK decomposition. can we link to a source?
    An Introduction to Cartan's KAK Decomposition for QC Programmers

  6. Some code seems to be missing
    The code that is missing is

from qiskit.visualization import plot_circuit_layout
plot_circuit_layout(cx_circ, backend, view='physical')

I deleted it since I was having some issue with plotting with graphviz within the virtual environment. You could either add this code back and display the circuit layout or choose to delete the paragraph "The transpiled circuit's layout information is stored, and we can visualize it by calling plot_circuit_layout. Below, we see our original circuit qc on a 1D spin chain is mapped to the backend, and the physical qubits used are marked in black."

  1. Is 21 qubits big enough to show utility?
    The largest example I have run so far is twenty-one qubits. If this notebook is valuable to our users and they would like to adopt it for their utility-scale work, we can consider prioritizing rerunning it on larger systems.

  2. Finally, a small typo in line 128: Cecompose -> Decompose

@beckykd
Copy link
Copy Markdown
Author

beckykd commented May 15, 2024

from qiskit.visualization import plot_circuit_layout
plot_circuit_layout(cx_circ, backend, view='physical')

Thanks for all that information - it's very helpful ! In the above code, it complains that cx_circ isn't defined. I'll try to find it in your old PRs -- I replaced it with "ecr_circ"

@beckykd
Copy link
Copy Markdown
Author

beckykd commented May 15, 2024

from qiskit.visualization import plot_circuit_layout
plot_circuit_layout(cx_circ, backend, view='physical')

Thanks for all that information - it's very helpful ! In the above code, it complains that cx_circ isn't defined. I'll try to find it in your old PRs -- I replaced it with "ecr_circ"

I couldn't get the plot to work because graphviz library is required and installing it on Windows seems to be quite a process. Since it was already removed previously, I think it's OK to remove for now. I'll investigate installing it later. :)

@beckykd beckykd requested a review from haimeng-zhang May 16, 2024 20:55
@beckykd beckykd marked this pull request as ready for review May 16, 2024 20:55
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Copy link
Copy Markdown
Contributor

@haimeng-zhang haimeng-zhang left a comment

Choose a reason for hiding this comment

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

Hi @beckykd, thank you for another round of edits! I think the tutorial reads a lot clearer! My main concern is regarding the final output of the notebook from the hardware run since it does not clearly show the advantage of this pulse-efficient method. I suggest we double-check if we have done the transpilation correctly, and if we have picked the right circuit parameters - let's rerun the notebook and see if we can show, similar to the older version of the notebook, that the RZX method produces an expectation value closer to the exact compared with the standard ECR method.

Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
haimeng-zhang
haimeng-zhang previously approved these changes May 28, 2024
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 9274940166

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 8897788516: 0.0%
Covered Lines: 290
Relevant Lines: 290

💛 - Coveralls

Copy link
Copy Markdown

@javabster javabster left a comment

Choose a reason for hiding this comment

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

This is looking nice! left a few comments

Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
"cell_type": "markdown",
"metadata": {},
"source": [
"The pulse-efficient transpilation has been shown to give more accurate results in the quantum approximate optimization algorithm applied to MAXCUT (see reference [here](https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.3.043088)). This notebook demonstrate how to implement the described technique to transpile a relevant circuit in simulating quantum dynamics. The result from the hardware suggests that the `RZXGate` type of transpilation produces more accurate results."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"The pulse-efficient transpilation has been shown to give more accurate results in the quantum approximate optimization algorithm applied to MAXCUT (see reference [here](https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.3.043088)). This notebook demonstrate how to implement the described technique to transpile a relevant circuit in simulating quantum dynamics. The result from the hardware suggests that the `RZXGate` type of transpilation produces more accurate results."
"The pulse-efficient transpilation has been shown to give more accurate results in the quantum approximate optimization algorithm applied to MAXCUT (see reference [here](https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.3.043088)). This tutorial demonstrates how to implement the described technique to transpile a relevant circuit in simulating quantum dynamics. The result from the hardware suggests that the `RZXGate` type of transpilation produces more accurate results."

In general could we use the term "tutorial" for consistency. For people just reading this tutorial in the website it might not be clear that this is a jupyter notebook.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also in this section, is there any way we can mention more explicitly how this is useful for utility scale work?

Comment thread docs/notebooks/pulse-efficient-transpilation.ipynb Outdated
"\n",
"### A larger example\n",
"Let's extend our example to a 1D spin chain of $N=21$ qubits. We follow the same steps to transpile into a basis gate set that includes either an `ecr` or a `rzx` gate. This is what the trotterized evolution circuit looks like."
"\n",
"Extend the example to a one-dimensional spin chain of $N=21$ qubits. Follow the previously described steps to transpile into a basis gate set that includes either an `ECR` or an `RZX` gate. This is what the Trotterized evolution circuit looks like:"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is there any way to increase N even more? or is 21 the limit?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Asking @haimeng-zhang about this.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 28, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants