Reproducible test flake in parallel_xeb_test.py

Open
#8,477 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start with cirq-core/cirq/experiments/benchmarking/parallel_xeb_test.py, especially test_parallel_two_qubit_xeb_with_device near line 335, and reproduce the failure using the supplied pytest command and seed. Investigate the root cause, including the possible connection to #6916. Done when the test passes reliably across random seeds; the issue also suggests a retry decorator as a fallback.

Written by the indexing model from the issue text.

Description

area/flaky-tests area/testing kind/bug-report kind/health priority/p2 triage/discuss

Describe the issue

A CI failure of test_parallel_two_qubit_xeb_with_device can be locally reproduced by using the same random seed. I suspect there are more random seeds where this test fails resulting in a flaky CI behavior.

pytest --randomly-seed=2045490064 \
  cirq-core/cirq/experiments/benchmarking/parallel_xeb_test.py::test_parallel_two_qubit_xeb_with_device

...
E       AssertionError:
E       Not equal to tolerance rtol=1e-07, atol=0.3
E
E       Mismatched elements: 2 / 6 (33.3%)
E       Mismatch at indices:
E        [4]: 0.3318661144454391 (ACTUAL), 0.9 (DESIRED)
E        [5]: 0.0 (ACTUAL), 0.9 (DESIRED)
E       Max absolute difference among violations: 0.9
E       Max relative difference among violations: 1.
E        ACTUAL: array([0.944047, 0.917741, 0.914741, 0.83415 , 0.331866, 0.      ])
E        DESIRED: array(0.9)

cirq-core/cirq/experiments/benchmarking/parallel_xeb_test.py:335: AssertionError

Tell us the version of Cirq where this happens

1.8.0.dev0 at 75c5cd2b8cc242fd1c9440c9f55ec4a1621138aa

Reproduced in a Python 3.11 virtual environment with numpy-2.4.6.

Proposed solution

Identify and fix the root cause of this test failure (possible similarity with #6916).
If that is too tedious, we can slap on the @cirq.testing.retry_once_with_later_random_values decorator to reduce the flakes.

Dominant language
Python
Stars
5.1k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/Cirq

All issues in quantumlib/Cirq

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.