Skip to content

Conversation

@rileyjmurray
Copy link
Contributor

@rileyjmurray rileyjmurray commented Oct 17, 2025

This PR is split off from #664. It fixes how wildcard error is computed in leakage modeling. When merged it will resolve #652. It also includes changes to the default leakage-aware gauge optimization suite. The latter changes are needed to prevent gauge optimization from trying to spurriously "spread out" relational errors across available gates.

This PR adds a meaningful correctness test for leakage GST modeling. To reduce the time of the test I used a huge number of shots per circuit in the simulated dataset. This led to errors with "min_prob_clip" constants in objective function evaluation. In order to resolve those errors I replaced hard-coded instances of that constant's default value (1e-4) to values of a module-wide constant; I made similar changes for "radius" constants in objective functions.

(This PR is a superset of the since-closed PR #670, which started from develop instead of bugfix.)

…obust to different labelings of the idenity gate, and make the returned model`s default_gauge_group have a direct sum structure; make the default leakage gaugeopt suite 2-stage, where the second stage is over the default gauge group in the target model)
@rileyjmurray rileyjmurray requested review from a team as code owners October 17, 2025 22:57
@rileyjmurray rileyjmurray requested review from coreyostrove and sserita and removed request for a team October 17, 2025 22:57
…Have lagoified_gopparams_dicts apply the direct sum group by default, since apparently the target model stored in list-of-dicts representation of `stdgaugeopt` suite overrides my attempt at setting the default gauge group
@rileyjmurray rileyjmurray requested a review from a team as a code owner October 24, 2025 17:59
@rileyjmurray
Copy link
Contributor Author

@coreyostrove I believe this is ready for review.

When this guy is merged I can get to work on finalizing #669, which targets develop. Once that guy is merged I'll do the expansion of general leakage modeling functionality. That PR will include an overhaul of some functions in gaugeopt.py to avoid awkward use of ExplicitOpModelCalc.

Copy link
Contributor

@coreyostrove coreyostrove left a comment

Choose a reason for hiding this comment

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

Thanks for all of your hard work, @rileyjmurray! I've left a few comments and questions for you which should hopefully be fairly quick to address.

if transform is not None:
self_mx = self_mx @ transform
if isinstance(inv_transform, _mt.IdentityOperator):
other_mx = other_mx @ transform
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand lines 423 and 424, what do these do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tentatively resolved by refactor in this commit.

vec = transform.T @ vec
return _ot.frobeniusdist_squared(vec, other_spam_vec.to_dense())
if isinstance(inv_transform, _mt.IdentityOperator):
other_vec = transform.T @ other_vec
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tentatively resolved by refactor in this commit.

@coreyostrove
Copy link
Contributor

coreyostrove commented Oct 28, 2025 via email

…ics but no default implementation. I`ve added implementations for State, POVMEffect, and LinearOperator base classes. Using the new semantics of ModelMember._to_transformed_dense I was able to implement ModelMember.residuals in a way that should work for *all* child classes in a way that preserves old behavior. Using the new ModelMember.residuals definition I was able to add implementations of ModelMember.frobeniusdist and ModelMember.frobeniusdist_squared; these functions obviated the need for child classes to have their own implementations.
… account for leakage modeling. Remove wildcard1d_reference instance member from GSTBadFitOptions, and make it a read-only property always equal to "diamond distance".
Copy link
Contributor Author

@rileyjmurray rileyjmurray left a comment

Choose a reason for hiding this comment

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

@coreyostrove this is ready for another round of review

Copy link
Contributor

@coreyostrove coreyostrove left a comment

Choose a reason for hiding this comment

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

Thanks for making the requested changes! Nothing else on my end, this all looks good. Merge at will.

@rileyjmurray rileyjmurray merged commit 117fb15 into bugfix Oct 29, 2025
4 checks passed
rileyjmurray added a commit that referenced this pull request Oct 29, 2025
The auto-merge of #671 from bugfix into develop failed, so this PR is
handling that manually.

Description from bugfix merge below.

> This PR is split off from #664. It fixes how wildcard error is
computed in leakage modeling. When merged it will resolve #652. It also
includes changes to the default leakage-aware gauge optimization suite.
The latter changes are needed to prevent gauge optimization from trying
to spuriously "spread out" relational errors across available gates.
> 
> This PR adds a meaningful correctness test for leakage GST modeling.
To reduce the time of the test I used a huge number of shots per circuit
in the simulated dataset. This led to errors with "min_prob_clip"
constants in objective function evaluation. In order to resolve those
errors I replaced hard-coded instances of that constant's default value
(1e-4) to values of a module-wide constant; I made similar changes for
"radius" constants in objective functions.
> 
> Finally, this PR adds implementations of frobeniusdist,
frobeniusdist_squared, and residual to ModelMember, and removes the
implementation of these functions from all child classes. Removing the
child class implementation become possible because the
ModelMember.residual implementation relies on a new method,
ModelMember._to_transformed_dense(...), that child classes must
implement. The semantics of _to_transformed_dense are documented in
ModelMember. I provided implementations for base classes for POVM
effects, states, and linear operators.
> 
> (This PR is a superset of the since-closed PR #670, which started from
develop instead of bugfix.)
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.

3 participants