[QRE] Automatic error analysis for empty resource estimates - #3659
Merged
Conversation
Dima Fedoriaka (fedimser)
requested review from
Mathias Soeken (msoeken)
and
a lite review from Copilot
August 26, 2026 23:50
Dima Fedoriaka (fedimser)
marked this pull request as ready for review
August 26, 2026 23:52
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the QRE “zero results” experience by adding structured diagnostics to EstimationCollection (error-budget rejection counts, minimum attainable error, and missing required instruction IDs) and surfacing those diagnostics through the Python bindings, along with updated tests and a sample notebook demonstrating common failure modes.
Changes:
- Added structured diagnostic fields to
EstimationCollectionand populated them in both direct parallel estimation and provenance-graph estimation paths. - Reworked Python-side “zero results” messaging to use structured diagnostics (instead of parsing error strings) and updated Python/Rust tests accordingly.
- Added a new
zero_estimates.ipynbsample that demonstrates error-budget exclusion and transform incompatibility due to missing instructions.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| source/qre/src/trace/tests.rs | Adds Rust tests validating missing-instruction reporting and exact-min-error diagnostics. |
| source/qre/src/trace/estimation.rs | Implements diagnostic collection (missing instructions, max-error rejections, min successful error) across both estimation paths, including conditional “no cutoff” diagnostic passes. |
| source/qre/src/result.rs | Extends EstimationCollection with new diagnostic fields and accessors. |
| source/qre/src/isa/provenance.rs | Adds ProvenanceGraph::nodes() iterator to support diagnostic enumeration. |
| source/qdk_package/tests/qre/test_estimation.py | Adds Python tests for the new structured zero-results warning behavior. |
| source/qdk_package/src/qre.rs | Exposes new diagnostics through Python bindings (sorted missing-instruction IDs). |
| source/qdk_package/qdk/qre/_qre.pyi | Updates Python type stubs with the new EstimationCollection properties. |
| source/qdk_package/qdk/qre/_estimation.py | Implements structured zero-results warning construction and updates estimation flow to print it. |
| samples/qre/zero_estimates.ipynb | Adds a notebook demonstrating the new diagnostics for common “zero estimates” scenarios. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Mathias Soeken (msoeken)
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve diagnostics when QRE returns an empty
EstimationTable, so users can understand why no estimates were retained and which parameters or transforms require attention.Changes
EstimationCollection:max_errormax_error._qre.pyi.zero_estimates.ipynb, demonstrating:LATTICE_SURGERYinstructionERROR_ANALYSIS_SPEC.mddescribing the intended behavior and constraints.Example Diagnostics
For an error budget that excludes all estimates:
For incompatible transforms: