Add PrimerDesignOptimization benchmark for PCR primer design#84
Conversation
- Medal Score: peer-relative gold/silver/bronze podium (normalized to [0,1]), reported on v1 (47 tasks) and the v1-lite subset (10 tasks). READMEs now lead with Medal Score; average rank stays on the website leaderboard. - leaderboard/: ship the frozen podium baselines (medal_podium.csv), published leaderboard (medal_leaderboard.csv), raw score table (exp1_models_raw.csv), a submission scorer (score_submission.py), and an example submission. Un-ignore leaderboard/*.csv. - v1-lite: add frontier_eval/conf/batch/v1_lite.yaml (10-task subset across all five categories, distinct families, gradual-improvement tasks). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 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. 安全与隐私检查
|
f9aafac to
7c61ef6
Compare
wrh-human
left a comment
There was a problem hiding this comment.
Review — PrimerDesignOptimization (PR #84)
Thank you for contributing this benchmark! PCR primer design is a genuine bioinformatics problem, the thermodynamic model is well-chosen, and the hard gate system is comprehensive. After a line-by-line review of all code and files, several issues were identified that need to be addressed before merging.
Evaluation by dimension
1. Domain, Economic Value, and Frontier-Eng Fit ✅
PCR primer design is a critical step in real molecular biology workflows — primer quality directly affects PCR amplification specificity and success rate. The task uses the nearest-neighbor thermodynamic model (Breslauer parameters + SantaLucia salt correction), which is the industry standard for primer design. Optimizing primer design directly improves experimental success rates, giving the task clear economic value.
2. Not purely numerical ✅
The agent modifies the primer design algorithm logic (sequence generation, thermodynamic computation, constraint screening), not numerical parameters.
3. Search space ✅
Primer length is 18-25 bp, with a theoretical search space of 4^18 to 4^25 possibilities (approximately 6.9×10^10 to 1.1×10^15), making brute-force search infeasible.
4. Evaluator and engineering verification ✅
10 hard gates cover character validity, length, GC content, Tm, GC clamp, complementarity, hairpin structure, homopolymer runs, alignment, and product length. The thermodynamic computation is correctly implemented (nearest-neighbor model + SantaLucia salt correction). The evaluator runs the candidate in a subprocess with a timeout.
5. Constraint enforcement ✅
The 10 hard gates are checked incrementally in run_hard_gates(). Violating any single gate returns valid=False and final_score=0.0. Coverage is comprehensive.
6. Baseline experiment ❌ Needs improvement
baseline/solution.py (486 lines, GA algorithm) is included, but there is no baseline/result_log.json and no test file.
7. Scoring system
Each of the 10 quality metrics is normalized to [0, 1], with a weighted average clipped to [0, 1]. The weight distribution is reasonable (Tm highest at 1.0, product length lowest at 0.2).
Issues to address
Issue 1 (most critical): EVOLVE-BLOCK wraps the entire file — no read-only shell
In scripts/init.py, EVOLVE-BLOCK-START is at line 1 and EVOLVE-BLOCK-END is at line 459, wrapping the entire file — including import statements, the load_config() configuration loader, the compute_tm() thermodynamic computation function, and all other helper functions marked "DO NOT MODIFY". There is no read-only shell. grep -c "EVOLVE" on the evaluator returns 0 — it never validates EVOLVE-BLOCK boundaries.
The "DO NOT MODIFY" comments inside the file have no machine-enforceable mechanism — an agent could modify load_config() to return fake configuration values, or modify compute_tm() to return fake melting temperatures, thereby bypassing the hard gate constraint checks without detection by the evaluator.
Suggestion:
- Move read-only helper functions (config loader, thermodynamic computation, complementarity checks, etc.) outside the EVOLVE-BLOCK
- Restrict the EVOLVE-BLOCK to only wrap
design_primers() - Add EVOLVE-BLOCK boundary validation to the evaluator
Issue 2 (most critical): Single template only — no generalization test
Only one template (120bp synthetic DNA fragment) is provided. There are no hidden/validation templates. An agent could hardcode primers for this specific sequence without building a general primer design algorithm.
Suggestion: add at least 3-5 hidden test templates covering different sequence lengths, GC content ranges, and complexity levels.
Issue 3 (most critical): frontier_eval/run_eval.py path resolution error — cannot load the evaluator
run_eval.py line 66 locates the evaluator via Path(__file__).with_name("evaluator.py"), which resolves to frontier_eval/evaluator.py. However, the actual evaluator is at verification/evaluator.py. The file frontier_eval/evaluator.py does not exist, so spec_from_file_location() returns None and _load_local_evaluator() raises a RuntimeError, making unified evaluation completely non-functional.
Suggestion: change the path to Path(__file__).resolve().parent.parent / "verification" / "evaluator.py", or modify eval_command.txt to point directly to verification/evaluator.py (as other benchmarks do).
Issue 4: Baseline uses random without setting a random seed
The genetic algorithm in baseline/solution.py uses random.randint, random.random, random.choice, and random.randrange, but no random.seed() is set. Each run produces different primer results, making the baseline score non-reproducible.
Suggestion: add random.seed(42) at the entry point of design_primers() (or read the seed from primer_config.json), and add a determinism check in the evaluator for the candidate as well.
Issue 5: Missing baseline validation (no test file, no baseline run results)
There are no test files (test_evaluator.py) and no baseline/result_log.json. It is not possible to verify that the baseline's genetic algorithm can consistently produce primers that pass all 10 hard gates under the current configuration.
Suggestion: add test_evaluator.py (at minimum covering run_hard_gates() for each gate and an end-to-end test of the baseline), and create baseline/result_log.json recording the baseline run results.
Issue 6: Candidate subprocess lacks resource limits
subprocess.run() does not set a preexec_fn, and lacks RLIMIT_NPROC, RLIMIT_AS, RLIMIT_CPU, or other resource limits. The 120-second timeout is the only protection.
Suggestion: add preexec_fn with appropriate resource limits.
Non-blocking suggestions
-
Score clipping at [0, 1] compresses top-end discrimination: The final score is clipped to [0, 1]. The score gap between the baseline and excellent candidates may be compressed. Consider removing the cap or using a wider dynamic range.
-
120-second timeout is generous: For a primer design task, consider reducing the timeout to 30-60 seconds.
-
Random module inconsistency between
scripts/init.pyandbaseline/solution.py:init.pyimportsnumpy, whilesolution.pyusesrandomwithout importingnumpy. Consider unifying the random source and maintaining import consistency between the two files. -
Duplicate thermodynamic computation: Both
scripts/init.pyandverification/evaluator.pyimplement the full nearest-neighbor thermodynamic computation independently. While this is a reasonable requirement for evaluator independence, maintaining two copies of the same logic carries a risk of future divergence. Consider adding a comment explicitly noting that the two implementations must be kept in sync.
The direction — PCR primer design — is sound, and the hard gate system and thermodynamic model are well-designed. Issues 1 (EVOLVE-BLOCK wrapping the entire file), 2 (single template), and 3 (run_eval.py path resolution error breaking framework integration) are the highest-priority items, with Issue 3 being a bug that directly prevents unified evaluation from working. The review can proceed once the above issues are addressed.
Summary
This PR adds a new unified benchmark:
Features
Verification
Tested successfully:
Both commands execute successfully.
Notes
This benchmark evaluates PCR primer design under practical biological constraints using nearest-neighbor thermodynamic models.