Skip to content

Add Readout noise channel support#40

Open
volodymyr-hq wants to merge 4 commits into
unitaryfoundation:masterfrom
volodymyr-hq:readout_noise_channel
Open

Add Readout noise channel support#40
volodymyr-hq wants to merge 4 commits into
unitaryfoundation:masterfrom
volodymyr-hq:readout_noise_channel

Conversation

@volodymyr-hq

Copy link
Copy Markdown

Adds a readout_noise_prob device kwarg to qrack.simulator that applies a symmetric per-bit Bernoulli flip to measurement outputs. Covers Sample, Counts, and Probs paths so the effective noise channel is the same regardless of which measurement process is used.

This PR is related to Haiqu's work on adding Readout Error Mitigation (REM) support into Catalyst. Since no other device currently supported in Catalyst has readout noise channels, we decided to introduce it into pennylane-qrack to verify correctness of our REM implementation. See PennyLaneAI/catalyst#2985 for more details.

Changes

  • pennylane_qrack/qrack_device.py: parse readout_noise_prob and stringify it into device_kwargs.
  • pennylane_qrack/qrack_device.cpp:
    • Adds an std::mt19937 member seeded from std::random_device and parses the new kwarg.
    • _SampleBody and _CountsBody: per-shot XOR before binning.
    • _apply_readout_noise_to_probs: mixes the analytic (2^n) probability vector via per-bit 2x2 kronecker product.
    • when readout noise probability is zero, skips the noise channel.
  • pennylane_qrack/QrackDeviceConfig.toml: drop the "analytic" restriction on ProbabilityMP.
  • bumped Catalyst version.

On newer versions of Catalyst, `QuantumDevice.hpp` declared pure-virual
`NamedOperation` member function with 7 parameters, while
`qrack_device.cpp` overrides it with only 6 parameters, `optional_params`
is missing. This difference in function signature causes the compiler to
treat it as a brand new function, while the 7-parameter
`NamedOperation` function declared in Catalyst remains uninherited.
This leads to a compilation error (abstract class can't be constructed).

This commit addresses that issue by adding the parameter to match the
base class signature, although it is still unused.
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.

1 participant