Skip to content

Conversation

@rileyjmurray
Copy link
Contributor

@rileyjmurray rileyjmurray commented Oct 8, 2025

EDIT: closing this PR since its scope got too large. Moving preliminary changes into a new PR.

I made this branch to resolve issue #652. While working on that I made various improvements to gauge optimization.

  1. Fixed bugs in definitions of subspace-restricted Frobenius norm objective. There was no meaningful impact to the bug as far as gates were concerned. There was an impact in how POVMs contributed to the objective. That hadn't showed up before since leakage-aware gauge optimization placed zero weight on SPAM.
  2. Changed the definition of fidelity as a gauge optimization objective. It's now defined in such a way that if two models exhibit no relational errors with respect to one another, then it's possible to drive the fidelity-based loss function to zero even if the models are not gauge-equivalent.
  3. Added the ability to separately weight state prep and POVMs differently by introducing a parameter called prepWeight. The spamWeight option is used as the default for prepWeight. I'm open to rolling this change back since I'm not actually using it.

I made incidental changes to objectivefns.py. The default values that various objective classes use for "min_prob_clip" (or similarly named variables) are now controlled by module-wide or class-wide constants that can be changed at runtime, rather than being hard-coded to defaults of 1e-4.

Changes to gst.py:

  1. Removed unused functions _load_dataset and _load_model that were not referenced anywhere in the pyGSTi repo.
  2. Refactored _compute_wildcard_budget_1d_model and _compute_1d_reference_values_and_name to eliminate nesting and code duplication.
  3. Modified _compute_1d_reference_values_and_name to use subspace-restricted diamond distance if the provided gauge optimization suite includes the flag n_leak=1.
  4. Modified _add_param_preserving_gauge_opt to also call _add_bad_fit_estimates.

Other leakage-related changes:

  1. Moved several function definitions from report/reportables.py to tools/leakage.py.
  2. Changed leakage gauge optimization suite to have two stages. I'll edit this comment with an explanation of the second stage later.
  3. Changed add_lago_models so that it works even if the provided estimate has no model called "stdgaugeopt".

…s from reportables.py into pygsti/tools/leakage.py. Bugfix for qubit label assumption in leaky_qubit_model_from_pspec.
…last commit just applied a fix to linear operators). Also, make it possible to use different weights on state prep vs `spam` writ-large in gauge optimization
…t` from their gopparameters member. Update lagoified_gopparams_dict so the gauge optimization step that `stdgaugeopt` does over the unitary group is REPLACED by gauge optimization over the target models default_gauge_group (when that default exists). Update leaky_qubit_model_from_pspec to handle idle gates in a more robust way and to set the default gauge group to a direct sum unitary group that preserves separation between computational subspace and leakage space.
…d the values of what are currently magic numbers hard-coded to 1e-4.
@rileyjmurray rileyjmurray requested review from a team as code owners October 8, 2025 17:15
@rileyjmurray rileyjmurray requested a review from sserita October 8, 2025 17:15
* Lots of docs.
* New function called “subspace_projector”
* rename functions only introduced in this PR (leakage_profile, seepage_profile —> gate_leakage_profile, gate_seepage_profile).
* rename std_lago_gopsuite to std_lago_gaugeopt_params. This makes sense because each dict in a list-of-dicts representation of a gauge optimization suite is supposed to be passable to gaugeopt_to_target entirely as kwargs. One could argue that this is a breaking change, but it's for a function that should have had low-exposure in 0.9.14.

updates to gst.py and gaugeopt.py to incorporate the subspace_projector function.

updates to reportables.py to reflect the renames of leakage_profile / seepage_profile.
… functions. Rename subspace_projector to superop_subspace_projector.
@rileyjmurray
Copy link
Contributor Author

rileyjmurray commented Oct 10, 2025

Testing TODOs:

Leakage-specific

  • leakage-aware gauge optimization suite will nail down leakage rates before trying to resolve discrepancies on the computational subspace.
  • methods for constructing leakage-aware gauge optimization suites work as claimed in the documentation (e.g. if a ModelEstimateResults has no gauge optimization suite, or nothing that's stdgaugeopt).
  • add_lago_models works without CVXPY being installed.

General

  • gauge optimization w.r.t. fidelity can find perfect gauges for models that differ only by intrinsic errors.
  • matrixtools.py:is_projector.

@sserita sserita added this to the 0.9.14.2 milestone Oct 14, 2025
…ion that should work for arbitrary constructions of the computational subspace. Comitting to share code and get feedback before devising the clean-up and testing plan
@rileyjmurray rileyjmurray requested a review from a team as a code owner October 17, 2025 04:19
@rileyjmurray
Copy link
Contributor Author

Closing this PR since its scope got too large. Moving preliminary changes into a new PR.

@rileyjmurray
Copy link
Contributor Author

rileyjmurray commented Oct 17, 2025

Splitting into ...

  • a PR targeting develop Refactoring gaugeopt.py: maintainability and fidelity as an objective #669. The scope includes a heavy refactor of gaugeopt.py, the introduction of eigenvalue_fidelity, a change in the mathematical meaning of fidelity as a gauge optimization objective, and new ways of setting default floating point values in objectivefns.py. These changes are backward-compatible, so PR 669 could target bugfix instead of develop. Can consider also making a change to eigenvalue_entanglement_infidelity; click here and scroll down through reportables.py to see the proposed change.
  • a PR targeting bugfix Leakage modeling: bugfixes for wildcard error and gauge optimization #671: wildcard analysis with leakage models; fixes to LAGO (two-stage, where a second stage uses a direct sum gauge group).
  • a PR targeting develop: general leakage modeling by making inferences from basis.ellookup['I']. This includes some backward compatible enhancements to the Basis class. The changes for leakage will NOT be backward compatible. This branch (resolve-issue-652) which I've abandoned, shows how messy it would be to make these changes backward compatible.

@rileyjmurray
Copy link
Contributor Author

rileyjmurray commented Oct 17, 2025

I'm waiting to determine the fate of #669 and #671 before opening the PR with general leakage modeling. That functionality is on the streamline-leakage-modeling branch. I'll have to manually pull the relevant changes out of that branch and apply them to a new branch before opening that PR.

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.

2 participants