Add kernel block encoding benchmark#96
Conversation
🤖 AI Code Review (gemini-3-flash-preview)🇬🇧 English Analysis1. Executive Summary
2. AI Content Analysis
3. Engineering & Economic Assessment
4. Quality Assurance
5. Security & Privacy Check
🇨🇳 中文分析1. 摘要
2. AI 成分分析
3. 工程与经济评估
4. 质量保证
5. 安全与隐私检查
|
There was a problem hiding this comment.
Thank you for contributing KernelBlockEncoding! Quantum circuit construction is a valuable engineering direction. The overall implementation quality is high — the baseline data is included, the evaluator's independent reconstruction mechanism is solid, and the documentation is thorough.
The following issues should be addressed before merging:
1. Per-workload error isolation is insufficient
The current evaluate() workload loop lacks try/except isolation. If workload 3 fails during candidate execution or certificate validation, the exception propagates directly to the outer except Exception, terminating the entire evaluation. As a result:
- The agent cannot determine which workload failed or why.
- Even if 5 out of 6 workloads succeed, the 6th failure causes
valid=0with no partial results retained. - The agent receives no partial feedback to guide the next iteration.
Suggestion: wrap each workload in a try/except block, record a workload-level error field, and continue evaluating the remaining workloads. Successfully completed workloads should retain their scores and contribute to the combined score.
2. limited_exec.py lacks an RLIMIT_NPROC constraint
The current implementation sets RLIMIT_AS, RLIMIT_CPU, RLIMIT_FSIZE, and other resource limits, but does not restrict process creation. A candidate program can fork child processes without limit within the evaluation window, posing a risk of exhausting system resources. Suggestion:
try:
resource.setrlimit(resource.RLIMIT_NPROC, (64, 64))
except (ValueError, OSError):
passNon-blocking suggestions:
3. Add an end-to-end evaluator regression test
The current 4 unit tests cover the correctness of the mathematical transforms, but none of them call the full evaluate(scripts/init.cpp) pipeline to verify that the baseline returns valid=1.0 and combined_score=1.0. Suggestion:
def test_baseline_evaluates_to_valid_one(self) -> None:
metrics, artifacts = evaluator.evaluate(
evaluator.TASK_DIR / "scripts" / "init.cpp"
)
self.assertEqual(metrics["valid"], 1.0)
self.assertAlmostEqual(metrics["combined_score"], 1.0)(Note: this test requires g++ in the environment, but the README already lists g++ as a prerequisite, so this is reasonable.)
4. frontier_eval/artifact_files.txt format may not work with the framework
The current content is a single comment line:
# metrics.json and artifacts.json are collected by UnifiedTask directly.
The UnifiedTask documentation and implementation do not indicate support for # comment lines. If the framework parses each line as a file path, the comment line would be interpreted as a filename — specifically, "# metrics.json and artifacts.json are collected by UnifiedTask directly." — which does not exist. This could cause both metrics.json and artifacts.json to be skipped by the framework's artifact collection, meaning the evaluation runs successfully but the results are never persisted, effectively breaking the experiment pipeline.
Suggestion: replace the comment with explicit filenames matching the convention used by all other benchmarks:
metrics.json
artifacts.json
The overall direction is sound. Once the four items above are addressed, the PR is ready to merge.
🤖 AI Code Review (gemini-3-flash-preview)🤖 LLM 调用失败: HTTPSConnectionPool(host='litellm-dev.vida.app', port=443): Read timed out. (read timeout=120) |
Thank you for the detailed review. I addressed the feedback in commit
Additional validation included strict C++17 compilation, JSON and shell checks, |
|
Final Review — KernelBlockEncoding (PR #96) Thank you for the timely updates! All issues raised in the previous review have been addressed:
All items verified. I believe this is ready to merge. |
Summary
KernelBlockEncodingquantum-computing benchmark for optimizing partial-Hadamard basis selection, block-encoding normalization, and sparse quantized FABLE rotationsMotivation and impact
Dense kernel block encodings often hide data-loading and normalization costs behind an oracle assumption. This task makes those choices directly optimizable and independently measurable without relying on a state-vector simulator or candidate-reported metrics.
The scored path needs only Python's standard library and
g++. It runs on one CPU core in under 1 GiB and evaluates the frozen starter in about 2.7 seconds on the current AMD EPYC host. An exploratory policy that was not included in the starter reached a 2.7177 combined score, confirming meaningful optimization headroom.Validation
clang-format --dry-run --Werroron all C++ sourcesg++ -std=c++17 -O2 -Wall -Wextra -Wpedanticstarter compilationvalid=1.0,combined_score=1.0, 6 scenarios, 8,448 checked matrix entriesvalid=1.0,combined_score=1.0, including read-only path checksbash -nandgit diff --check