Skip to content

Update kqd tutorial - #5539

Open
snow0369 wants to merge 6 commits into
Qiskit:mainfrom
snow0369:update_kqd
Open

Update kqd tutorial#5539
snow0369 wants to merge 6 commits into
Qiskit:mainfrom
snow0369:update_kqd

Conversation

@snow0369

Copy link
Copy Markdown

No description provided.

@snow0369
snow0369 requested a review from a team August 20, 2026 07:37
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@qiskit-bot

Copy link
Copy Markdown
Contributor

Thanks for contributing to Qiskit documentation!

Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌

One or more of the following people are relevant to this code:

  • @nathanearnestnoble

@CLAassistant

CLAassistant commented Aug 20, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ henryzou50
❌ snow0369
You have signed the CLA already but the status is still pending? Let us recheck it.

- Run tox -e fix: extract embedded PNG outputs to avif, ruff-format code cells, normalize kernelspec metadata (984 KB -> 124 KB)
- Fix ruff E402 by moving warnings.filterwarnings below the imports in the Setup cell
- Add cspell:ignore comment for terms used in the tutorial
- Delete stale images no longer referenced after the rewrite (old
  extracted outputs and krylov-subspace-diagonalization figures)
qpuSeconds: 4200 matches the 70-minute usage estimate in the header; hours: 2 covers working through the full notebook. Adjust after the final hardware run if the estimate changes.

@henryzou50 henryzou50 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @snow0369, thanks for the great work on this! The extended-swap-test construction, the shifting technique, and the spectral-filter appendix are all well-motivated! Below is a summary of what I already fixed on the branch, plus some suggestions to address before merge.

What I already pushed (CI fixes, no action needed)

I fixed the CI blockers directly, so please pull the branch before making changes:

  • Ran the repo tooling (tox -e fix): extracted the embedded PNG outputs to .avif files, ruff-formatted the code cells, and normalized notebook metadata
  • Moved warnings.filterwarnings("ignore") below the imports in the Setup cell (ruff E402).
  • Added the {/* cspell:ignore ... */} comment and deleted the stale images from the old tutorial version.
  • Added notebook metadata for the usage estimate

Suggested changes before merge

Template conformance (comparing against the recently revised tutorials, e.g. multi-product-formula, nishimori-phase-transition)

  • Requirements section: the Qiskit pin should be v2.3 or later, not v2.0 -- CommutativeOptimization doesn't exist before 2.3 (I confirmed it fails to import on 2.2.3). Also add the "with visualization support" clause -- draw("mpl") fails on a bare pip install qiskit without pylatexenc.
  • Citations: the in-text citations were changed from linked ([\[1\]](#references)) to plain [1], please restore the linked form so they're clickable on the platform (your source notebook had this right).
  • Job tags: use a single underscore-style tag per repo convention (e.g. TUT_KQD). Also drop "ManualQEM", which looks like a leftover from the development runs.
  • Section order: the revised tutorials end with ... -> Next steps -> References; this notebook has References before Next steps.
  • Headings: "Reference State", "Time Evolution", "Extended Swap Test Circuit" are bold Title-Case text used as headings, make them real sentence-case headings (#### Reference state, etc.). Also "Step 2: Optimize the problem..." -> "Optimize problem..." to match the standardized step titles, and "may vary" -> "might vary" in the usage estimate (style guide avoids "may").

Narrative vs. code suggestions

  • Step 3 text says we measure X⊗H and Y⊗H, but the code (correctly) measures the shifted X⊗(H−T), Y⊗(H−T) per the shifting subsection. Please update the text to match.
  • The printed "Estimated first row of H" in the small-scale Step 4 is actually the shifted H̃ row as it starts with 0.+0.j even though H₀₀ = ⟨ψ₀|H|ψ₀⟩ = 7, which could look like a bug to a eader. Relatedly, the small-scale section solves the shifted GEVP and adds τ back to the eigenvalue, while the large-scale section reconstructs H = H̃ + τS as the text promises. Both are equivalent, but please either make the small-scale cell reconstruct H like the large-scale one, or add a sentence explaining the shortcut.
  • The ordering-comparison conclusion overstates its own table: "we clearly observe that even-odd edge-grouped ordering offers the lowest depth, two-qubit count, and infidelity", but in the table the two-qubit count is identical (33) for all three orderings, depth ties with even-then-odd (6), and the infidelities are 0.9999 vs 0.9998 (all ≈ 1). The real story the data supports: even/odd ordering collapses depth 15 → 6, and edge-grouping additionally reduces Trotter error. Please restate accordingly (the same applies to the earlier claim that edge-grouping "gives a shallower circuit after synthesis and transpilation").

Copyedits

  • Present tense throughout: "we are going to build/present/implement" -> "we build", "here is", etc.
  • There's a stray comma after \end{equation*} in the shifting subsection (renders as a floating comma), and the $T'$ prime notation is introduced once and never reused; the surrounding sentence is also a comma splice.
  • "Other parameters such as Krylov dimension and the number of Trotter steps are determined." reads unfinished. We should state the chosen values and why.
  • "Because of commutation relation" -> "Because all powers of H commute" (or similar); "noncommuting terms in neighbor" -> "next to each other"; "the number of 1 in the state" -> "the excitation number".
  • Delete the leftover commented-out debug lines in the small-scale Step 4 (# pub_obs..., # assert...), and the unused retained_dim parameter of solve_thresholded_gevp.

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants