quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.23k stars 1.01k forks source link

Factor out XEB fidelity estimator out of XEB experiment code #2113

Open viathor opened 4 years ago

viathor commented 4 years ago

XEB experiment code is monolithic. In particular, it tightly couples generation of random circuits and fidelity estimation. The latter is potentially useful on its own (e.g. when RQCs have been generated and executed offline), so should be factored out for re-use.

Also, there is more than one formula for estimating fidelity, e.g. on a few qubits one can compute cross-entropies directly while on many qubits one has to resort to formulas based on some assumptions about the shape of the output distribution. Therefore, it makes sense to implement fidelity estimation separate from RQC generation and overall XEB orchestration.

mpharrigan commented 3 years ago

See https://github.com/quantumlib/ReCirq/issues/85

MichaelBroughton commented 2 years ago

Is this still an issue @viathor, @mpharrigan ? Is there a plan here ?

augustehirth commented 2 years ago

Misunderstood the question the first time...

Noted in the existing XEB tutorials are separate library call wrappers from cirq.experiments.random_quantum_circuit_generation, cirq.experiments.xeb_sampling, and cirq.experiments.xeb_fitting which seem to already divide generation and fidelity estimation.

However, these functions seem to be designed to be pipelined: the input data structures to each subsequent function is expected to be the output of the previous. It may be good to make these interface data structures simpler in order to make each function/component more usable in other situations.