Repository navigation
NoiseModelFromGoogleNoiseProperties should raise an error when simulations use qubits not on the device or an uncompiled circuit #6608
Description
Activity
- addedkind/bug-reportSomething doesn't seem to work.Something doesn't seem to work.good first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.This issue can be resolved by someone who is not familiar with the codebase. A good starting issue.no QC knowledge neededWant to contribute to Cirq, but don't know quantum computing? This issue is for you.Want to contribute to Cirq, but don't know quantum computing? This issue is for you.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on
on May 20, 2024 NoureldinYosri commented
on Jun 12, 2024 CollaboratorAuthorMore actions@shef4 thanks for offering to help
- Repository owner unassigned
on Aug 12, 2024 Hi @NoureldinYosri Can i take this up
NoureldinYosri commented
on Aug 13, 2024 CollaboratorAuthorMore actions@nivedha1 sure, thanks for offering to help
I was able to implement the first part of the problem "To raise an error when trying to run simulations with qubits not on the device"
But for "A circuit not compiled to a supported gateset" part,
Im unable to figure out a way to get the target gateset from the compiled gateset to check if it is part of supported gateset.
Please Advise
Thanks!
@shef4
One follow up question
How to find the processor id for the underlying quantum device
Thanks!NoureldinYosri commented
on Aug 13, 2024 CollaboratorAuthorMore actionsHi, please check #6607 (comment) for the methods that you will need ... namely
noise_props.qubitsfor qubits andnoise_props.expected_gates()for gates. you don't need to worry about processor_id or anything related to the hardware.This issue isn't about talking to the actualy hardware but about fixing a simulation that tries to mimic the hardware... the mimicing of the hardware happens through the noise model. this issue is about validating that the circuit is consistent with the noise model.
Hello! Is this issue active? Can I take a look at this?
@nivedha1 Thank you for your interest in Cirq. For planning purposes, could you let us know if you are still working on this issue, or planning to?
@Acciaccatura Thank you for your interest. I've reassigned this to you.
hi! so it seems like looking into the cosebase:
SimulatorBaseproduces simulations based on a given noise model, and it injects noise into simulations duringrun()andsimulate()(specifically via_core_iterator()) so this would probably be the best place to check for compatability with circuit hardware?- also, I think
NoisePropertiesis the interface for developers to abstract hardware specifications into a noise model (resulting inNoiseModelFromNoiseProperties). - so, I think we would need to expose property information up through the noise model so that the simulator has access to it, and perform a check in
SimulatorBase._core_iterator()to see if the noise model provided supports the desired gates/qubits. so something like:
def _core_iterator(self, circuit: cirq.AbstractCircuit): ... if isinstance(self.noise, cirq.NoiseModelFromNoiseProperties)`): # <do the checks here and raise necessary exceptions> .. # the rest of the logic
if that all seems correct, I'll go ahead and start implementation :)
A small scoping point that might help the implementation/review:
It may be useful to keep the validation focused on compatibility with the noise model, not compatibility with a live processor.
Possible minimal behavior:
- If a circuit uses qubits outside
noise_props.qubits, raise a clear error listing the unsupported qubits. - If a circuit uses operations whose gate type is not represented in
noise_props.expected_gates(), raise a clear error listing the unsupported operation types. - Make the error message explain that the circuit should be compiled / transformed to the device-compatible gateset before using this realistic noise model.
- Add separate tests for:
- unsupported qubit,
- unsupported gate,
- valid compiled circuit does not raise.
This would avoid tying the fix to processor IDs or live hardware access, and would keep the behavior centered on the information already present in the noise properties.
- If a circuit uses qubits outside
- addedhelp wantedContributions welcome!Contributions welcome!and removedhelp wantedContributions welcome!Contributions welcome!
on Jun 1, 2026 sorry for the radio silence - was really busy this past month! i'm going to go ahead and send a PR out.
Reacted by Michael Hucka
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsWaiting
Description of the issue
Noisy Simulation describes how to run simulations with realistic noise obtained from a real quantum device. however when using that noise model with a gate that is not native to the device the simulation, no noise gets added (e.g. #6607 (comment)). another issue is that when the circtuit uses qubits not on the device a key error is raised with little information explaining why that is.
Proposed Solution
Before (or while) running the simulation validate that the qubits and gets in the circuit uses supported qubits and gates.
How to reproduce the issue
#6607
Cirq version
1.4.0.dev20240419073809