Skip to content

feat(QuantumComputing): add task_04_quantum_error_decoder benchmark - #114

Open
y-ji24 wants to merge 1 commit into
Einsia:mainfrom
y-ji24:feat/QuantumComputing/QuantumErrorDecoder
Open

y-ji24 wants to merge 1 commit into
Einsia:mainfrom
y-ji24:feat/QuantumComputing/QuantumErrorDecoder

Conversation

@y-ji24

@y-ji24 y-ji24 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new unified benchmark: QuantumComputing/task_04_quantum_error_decoder — a classical
decoder for a rotated surface-code memory experiment, scored against minimum-weight perfect
matching (MWPM).

The candidate implements decode(problem, detection_events) and must turn a graphlike detector
error model plus a syndrome batch into logical-observable predictions. Per regime:

score = ( log L_trivial - log L_candidate ) / ( log L_trivial - log L_mwpm )

so ignoring the syndrome scores 0.0, matching MWPM scores 1.0, and beating it scores above
1.0 (uncapped). combined_score is the mean over four development regimes; two further regimes
at unseen noise strengths are reported as robustness_score and never enter combined_score.

Source

Ported from the optimization branch of ScientistsLastExam
(benchmarks/Physics/QuantumErrorDecoder), where it is a flagship/T3 task under the domain
QuantumErrorCorrection. The circuit-level scoring design, the difficulty ladder and the
calibration points come from that implementation; the evaluator here is a re-implementation
against the Frontier-Eng unified contract. Provenance and the upstream-measured calibration
numbers are recorded in references/known_best.md.

Why this is a real engineering problem: in a fault-tolerant quantum computer the decoder runs in
the control loop and sets the logical error rate, hence the physical-qubit overhead of any useful
algorithm. MWPM is the community reference, not the optimum — it discards the X/Z correlations
that circuit-level depolarizing noise creates — so the anchor is a documented baseline and the
open-ended region above 1.0 is live research.

Files

New task under benchmarks/QuantumComputing/task_04_quantum_error_decoder/:

  • baseline/solution.py: evolve entrypoint with EVOLVE-BLOCK markers. Shipped baseline never
    predicts a flip, so it scores 0.0 by construction.
  • verification/evaluate.py: builds and samples the regimes with Stim, recomputes the MWPM
    anchor on the same shots, and scores the candidate.
  • verification/candidate_runner.py: loads the candidate in a separate interpreter that
    receives only the error model and the syndromes, and refuses stim/pymatching imports.
  • verification/requirements.txt: pinned evaluator dependencies (stim==1.13.0,
    pymatching==2.4.0, numpy>=1.24,<2).
  • frontier_eval/: the nine unified metadata files plus run_eval.sh.
  • README.md, README_zh-CN.md, TASK.md, TASK_zh-CN.md, references/known_best.md.

Updated shared files:

  • benchmarks/QuantumComputing/README*.md: task list now four entries; the domain no longer
    claims all tasks are mqt.bench-based.
  • TASK_DETAILS.md, TASK_DETAILS_zh-CN.md: task row added.
  • scripts/env/specs/frontier-v1-main.json: added this task's verification/requirements.txt.
  • benchmarks/QuantumComputing/.gitignore: ignore the local eval_report.json.

Verification & Testing

task_name: QuantumComputing/task_04_quantum_error_decoder

Dependencies (Stim + PyMatching are not in the default runtimes):

pip install -r benchmarks/QuantumComputing/task_04_quantum_error_decoder/verification/requirements.txt

The pins matter: Stim's seeded sampling stream is not stable across versions, and Stim 1.13
wheels exist for CPython 3.8-3.12. frontier-v1-main is Python 3.12 and now lists this
requirements file, so bash scripts/env/setup_v1_task_envs.sh provisions it.

Single-task evaluator:

cd benchmarks/QuantumComputing/task_04_quantum_error_decoder
python verification/evaluate.py --candidate baseline/solution.py

Framework compatibility:

python -m frontier_eval task=unified \
  task.benchmark=QuantumComputing/task_04_quantum_error_decoder \
  task.runtime.python_path=uv-env:frontier-v1-main \
  algorithm=openevolve algorithm.iterations=0

What was actually run

Executed locally on a Windows host with the pinned versions (CPython 3.11, stim 1.13.0,
pymatching 2.4.0, numpy 1.26.4):

  • python verification/evaluate.py --candidate baseline/solution.py -> combined_score=0.0000,
    valid=1, ~1.2 s.
  • Constraint enforcement: a candidate with a top-level import pymatching is rejected
    (valid=0.0); a candidate returning the wrong shape is rejected with
    feasibility_rate=0.0.
  • Scoring scale probed directly on d5_p0.010 by scoring crafted arrays: trivial -> 0.0000,
    MWPM -> 1.0000, 25/50/75% oracle -> 0.2082 / 0.4684 / 0.9986, truth -> 5.8991. The scale
    is continuous, hits exactly 1.0 at the anchor, and is not clamped above.
  • Missing-dependency path returns exit 2 with an actionable message.
  • Metadata validated through the framework's own loader (load_unified_task_spec): all
    copy_files entries resolve, readonly_files covers verification and
    frontier_eval/run_eval.sh, placeholders render.
  • python scripts/ops/audit_unified_metadata_readonly.py does not flag this task under the
    default (non-strict) mode; under --strict it reports the same "recommended" gaps as the
    existing task_01-03 in this domain (they use evaluate.py, not evaluator.py).

Not run: the end-to-end python -m frontier_eval ... invocation and the bash wrapper itself.
This machine has no uv-built .venvs/ and no bash (no WSL distro), so the unified path could
not be exercised here. run_eval.sh mirrors the established pattern from task_01-03 in this
domain; please run the unified command above on Linux to confirm.

Measured anchors

references/known_best.md records the re-measured anchors for this port, e.g. d3_p0.005
trivial 0.105333 / MWPM 0.014833 and sealed_d7_p0.008 trivial 0.426750 / MWPM 0.059250. The
upstream task reports slightly different absolute rates on its own host (a few percent), which is
Stim's seeded samplers not being bit-identical across platforms; scores stay self-consistent
because the anchor is recomputed from the same shots within one run.

Known limitations

Stated in README.md as well, because they bound what a score means here:

  • Throughput is part of the score: the candidate runs inside a wall-clock budget, so a correct
    but unvectorized decoder times out and scores nothing.
  • The 0 -> 1 range is largely reproduction of a documented baseline; only > 1.0 is frontier.
  • Seeds are injectable (QEC_DEV_SEED, QEC_SEALED_SEED) so an operator can run a genuinely
    sealed evaluation against an unpredictable shot set.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🤖 AI Code Review (gemini-3-flash-preview)

🇬🇧 English Analysis

1. Executive Summary

  • Core Purpose: This PR introduces a new engineering benchmark task, task_04_quantum_error_decoder, to the QuantumComputing category. The task focuses on developing a classical decoder for a rotated surface-code quantum memory experiment, requiring the prediction of logical observable flips from syndrome data.
  • Modified File Structure & Modifications:
    • TASK_DETAILS.md & TASK_DETAILS_zh-CN.md: Updated the task registry table to include the new QEC decoder task.
    • benchmarks/QuantumComputing/README.md & README_zh-CN.md: Updated the benchmark overview and environment setup instructions to include Task 04 and its specific dependencies (Stim, PyMatching).
    • benchmarks/QuantumComputing/.gitignore: Added eval_report.json to prevent tracking local evaluation results.
    • benchmarks/QuantumComputing/task_04_quantum_error_decoder/: Created a new task directory containing:
      • TASK.md & TASK_zh-CN.md: Detailed technical specifications, scoring logic (normalized against MWPM), and constraints.
      • baseline/solution.py: The entry point for the agent, containing a "no-flip" baseline stub.
      • verification/: Contains evaluation logic, including evaluate.py and candidate_runner.py for isolated execution.
      • frontier_eval/: Metadata files (agent_files.txt, constraints.txt, etc.) for integration with the evaluation framework.

2. AI Content Analysis

  • Estimated AI Component: 10%
  • Reasoning & Evidence: The PR exhibits a very high degree of domain-specific expertise in Quantum Error Correction (QEC). Concepts like "rotated surface-code," "graphlike detector error models," "syndrome bitstrings," and "Minimum-Weight Perfect Matching (MWPM)" are used with technical precision. The code structure follows a pre-existing organizational template (boilerplate comments like EVOLVE-BLOCK-START), which might be AI-assisted or script-generated, but the core logic and documentation are clearly authored by a subject matter expert.

3. Engineering & Economic Assessment

  • Engineering Reality Check: Production-grade. This is not a "toy example." QEC decoding is a critical bottleneck in fault-tolerant quantum computing. The task explicitly addresses real-world engineering constraints such as:
    • Throughput/Latency: The scoring includes a wall-clock timeout, forcing the developer to consider vectorization and algorithmic efficiency.
    • Isolation: The use of a separate interpreter for the candidate prevents "cheating" via library imports (stim/pymatching).
    • Robustness: Evaluation includes "sealed" regimes with noise parameters not seen during development.
  • Economic Value: High. Efficient decoding algorithms directly reduce the physical-to-logical qubit overhead. Improvements in this area are fundamental to making quantum computers commercially viable and reducing the massive infrastructure costs associated with qubit scaling.

4. Quality Assurance

  • Verification & Testing:
    • frontier_eval Integration: Yes.
    • task_name: quantum_error_decoder (referenced as QuantumComputing/task_04_quantum_error_decoder in execution commands).
    • Execution & Dependencies: The README.md and TASK.md files provide explicit pip install commands for stim and pymatching and clear frontier_eval execution strings.
  • Documentation Quality: Excellent. The documentation is bilingual, technically rigorous, and provides clear guidance on scoring metrics (logarithmic error rate normalization). It explicitly warns about cross-platform drift and throughput requirements.
  • Organizational Structure: Logical and Scalable. The task follows the established "Unified Per-Task Structure" of the repository, making it easy for existing contributors to navigate.

5. Security & Privacy Check

  • Sensitive Files: Clean. No .env, API keys, or IDE-specific configurations were detected. The .gitignore was correctly updated to exclude local evaluation artifacts.
  • Absolute Paths: None detected. All file references and execution commands use relative paths or module-based invocation.

🇨🇳 中文分析

1. 摘要

  • 核心目的: 此 PR 在 QuantumComputing 类别中新增了一个工程基准测试任务 task_04_quantum_error_decoder。该任务旨在为旋转表面码(rotated surface-code)量子存储实验开发经典解码器,要求根据校验子(syndrome)数据预测逻辑观测量翻转。
  • 修改的文件结构与变更摘要:
    • TASK_DETAILS.md & TASK_DETAILS_zh-CN.md: 更新任务注册表,包含新的 QEC 解码器任务。
    • benchmarks/QuantumComputing/README.md & README_zh-CN.md: 更新基准测试概览和环境配置说明,包含任务 04 及其特定依赖(Stim, PyMatching)。
    • benchmarks/QuantumComputing/.gitignore: 增加 eval_report.json 以避免追踪本地评测结果。
    • benchmarks/QuantumComputing/task_04_quantum_error_decoder/: 创建了新的任务目录,包含:
      • TASK.md & TASK_zh-CN.md: 详细的技术规范、评分逻辑(以 MWPM 为基准归一化)和约束条件。
      • baseline/solution.py: Agent 的入口文件,包含一个“永不翻转”的基准存根。
      • verification/: 包含评测逻辑,如 evaluate.py 和用于隔离运行的 candidate_runner.py。
      • frontier_eval/: 用于集成到评测框架的元数据文件(agent_files.txt, constraints.txt 等)。

2. AI 成分分析

  • 预估 AI 含量: 10%
  • 判断依据与证据: 该 PR 在量子纠错(QEC)领域表现出极高的专业性。“旋转表面码”、“图状检测器错误模型”、“校验子比特串”和“最小权完美匹配 (MWPM)”等概念的使用非常精准。代码结构遵循了仓库既有的组织模板(如 EVOLVE-BLOCK-START 等模板化注释),这部分可能由 AI 辅助或脚本生成,但核心逻辑和文档显然由该领域的专家编写。

3. 工程与经济评估

  • 工程现实检验: 生产级别。 这不是一个“玩具示例”。QEC 解码是容错量子计算的关键瓶颈。该任务明确解决了实际工程约束,例如:
    • 吞吐量/延迟: 评分机制包含墙钟时间限制,迫使开发者考虑向量化和算法效率。
    • 隔离性: 使用独立的解释器运行候选代码,防止通过导入库(stim/pymatching)进行“作弊”。
    • 鲁棒性: 评测包含“密封”机制,使用开发阶段未见的噪声参数进行测试。
  • 经济价值: 高。 高效的解码算法直接降低了物理比特到逻辑比特的开销。该领域的改进对于实现量子计算机的商业化、降低与比特扩展相关的巨额基础设施成本至关重要。

4. 质量保证

  • 验证与测试:
    • frontier_eval 集成: 是。
    • task_name: quantum_error_decoder(在运行命令中称为 QuantumComputing/task_04_quantum_error_decoder)。
    • 运行与依赖: README.md 和 TASK.md 提供了明确的 stim 和 pymatching 安装命令,以及清晰的 frontier_eval 运行指令。
  • 文档质量: 优秀。 文档提供中英双语,技术严谨,并对评分指标(对数错误率归一化)提供了清晰指导。明确警告了跨平台漂移和吞吐量要求。
  • 组织结构: 逻辑清晰且具备可扩展性。 任务遵循仓库既有的“统一任务结构”,便于现有贡献者理解和维护。

5. 安全与隐私检查

  • 敏感文件: 未发现异常。 未检测到 .env、API 密钥或 IDE 特定配置。.gitignore 已正确更新以排除本地评测产物。
  • 绝对路径: 未检测到。 所有文件引用和执行命令均使用相对路径或基于模块的调用。

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