Skip to content

fix(docs): resolve Taylor expansion flakiness in Fermi-Hubbard FQE tutorial (#870) - #1451

Open
akushnarov wants to merge 2 commits into
quantumlib:mainfrom
akushnarov:fix/issue-870-hubbard-notebook-flakiness
Open

fix(docs): resolve Taylor expansion flakiness in Fermi-Hubbard FQE tutorial (#870)#1451
akushnarov wants to merge 2 commits into
quantumlib:mainfrom
akushnarov:fix/issue-870-hubbard-notebook-flakiness

Conversation

@akushnarov

Copy link
Copy Markdown

Summary

Fixes sporadic numerical divergence and flakiness during time evolution in the Fermi-Hubbard tutorial notebook (docs/fqe/tutorials/fermi_hubbard.ipynb).

Fixes #870

Problem & Root Cause

In docs/fqe/tutorials/fermi_hubbard.ipynb, the time evolution demo calls:

true_evolved_fqe = init_wfn.time_evolve(e_time, hubbard)
  1. The initial wavefunction was generated using init_wfn.set_wfn(strategy="random") without an explicit random seed, creating arbitrary initial spectral weights.
  2. An evolution time of e_time = 0.9 resulted in a large Taylor expansion parameter ($t |H| \approx 5.4$), causing the single-step Taylor series to occasionally fail to converge within the required tolerance and triggering CI failures on notebook execution.

Solution & Approach

  • Set a fixed random seed (np.random.seed(0)) before generating the random initial state for deterministic reproducibility.
  • Reduced the single-step evolution parameter to e_time = 0.1 ($t |H| \approx 0.6 \ll 1$), ensuring rapid, monotonic, and unconditional convergence of the Taylor series while preserving the physical demonstration of wavepacket dynamics and the exact fidelity assertion (fidelity == 1.0) against matrix exponentiation.

Validation

  • check/nbformat passed cleanly.
  • Verified deterministic notebook execution.

@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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Fermi-Hubbard tutorial notebook by setting a random seed to ensure reproducibility when initializing the wavefunction randomly, and reducing the time evolution parameter e_time from 0.9 to 0.1. There are no review comments, so no additional feedback is provided.

@akushnarov
akushnarov force-pushed the fix/issue-870-hubbard-notebook-flakiness branch from f1fd3cd to a56c874 Compare September 8, 2026 12:43
@akushnarov
akushnarov force-pushed the fix/issue-870-hubbard-notebook-flakiness branch from a56c874 to 44a9a3d Compare September 8, 2026 12:51
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.

Hubbard model notebook is flaky

1 participant