Add dynamic edge service replica placement benchmark - #108
bingxinli0607 wants to merge 2 commits into
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.
🟡 Changes recommended
The tiny oracle hard-codes a scoring reference that the production scorer derives from config, making the “independent transcription” brittle and prone to drift as configuration evolves.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new unified ComputerSystems/EdgeServiceReplicaPlacement benchmark that evaluates dynamic edge-service replica placement and traffic routing policies via a deterministic simulator, isolated candidate runtime, and comprehensive verification suite. This extends the repository’s benchmark taxonomy and provides an end-to-end, CPU-only evaluation loop suitable for unified runs.
Changes:
- Register the new
EdgeServiceReplicaPlacementbenchmark in the repository task listings andComputerSystemsREADME docs (EN + zh-CN). - Introduce the benchmark package: task interface docs, deterministic simulator + evaluator, candidate process runtime, calibration policies, and Frontier Eval metadata.
- Add a verification suite (unit + adversarial tests) plus a multi-timestep tiny oracle and supporting documentation.
File summaries
| File | Description |
|---|---|
| TASK_DETAILS.md | Adds the new benchmark to the top-level task taxonomy table. |
| TASK_DETAILS_zh-CN.md | Adds the new benchmark to the Chinese task taxonomy table. |
| benchmarks/ComputerSystems/README.md | Documents the benchmark under the ComputerSystems domain list. |
| benchmarks/ComputerSystems/README_zh-CN.md | Documents the benchmark under the ComputerSystems domain list (zh-CN). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/README.md | Benchmark overview, how to validate, and editable boundary description. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/README_zh-CN.md | Benchmark overview (zh-CN). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/Task.md | Defines candidate observation/action schema and validity rules (EN). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/Task_zh-CN.md | Defines candidate observation/action schema and validity rules (zh-CN). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/scripts/init.py | Provides the “reasonable” baseline policy inside the EVOLVE-BLOCK. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/references/config.json | Declares the task’s fixed topology, service params, and score budgets. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/references/design_notes.md | Records model scope and reduced-order assumptions. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/simulator.py | Implements the deterministic state machine, action validation, and metrics. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/evaluator.py | Runs isolated candidates across scenarios and computes the combined score + artifacts. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/policy_runtime.py | Parent-side process runtime (timeouts, bounded I/O, process-tree cleanup). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/policy_worker.py | Worker-side JSON-lines RPC wrapper around candidate code. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/tiny_oracle.py | Adds a brute-force multi-timestep oracle for a tiny enumerable control case. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/test_simulator.py | Tests determinism, action validation, and a dimensional link/capacity check. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/test_policy_runtime.py | Tests runtime isolation, timeout handling, protocol robustness, stderr draining. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/test_evaluator.py | Tests scoring properties and baseline validity/determinism. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/test_tiny_oracle.py | Ensures tiny oracle matches production simulator/scoring exactly. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/verification/requirements.txt | Declares stdlib-only evaluator dependency intent. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/docs/parameter_assumptions.md | Documents parameter provenance, units, and calibration/maintainer decisions. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/docs/scoring-calibration-report.md | Documents scoring normalization/cap fixes and sensitivity analysis. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/docs/tiny_oracle.md | Explains the oracle case and the exact-match verification approach. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/docs/evaluator-threat-model.md | Documents reliability/isolation threats and defenses (non-OS-sandbox statement). |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/calibration/weak.py | Provides a weak static calibration policy for scoring comparisons. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/calibration/strong.py | Provides a stronger calibration policy for score spread calibration. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/calibration/analyze_scoring.py | Reproduces score pipeline, extreme policies, and weight sensitivity checks. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/run_eval.sh | Frontier Eval wrapper hook for running the evaluator. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/eval_command.txt | Declares the unified evaluation command template. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/initial_program.txt | Declares the initial editable program path. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/constraints.txt | Declares agent-edit constraints and runtime limits for unified runs. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/copy_files.txt | Declares which files are copied into the unified runtime. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/readonly_files.txt | Declares which files must be mounted readonly in unified runs. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/agent_files.txt | Declares which files are exposed to agents in unified runs. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/artifact_files.txt | Declares which artifacts are emitted by the benchmark. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/frontier_eval/candidate_destination.txt | Declares where edited candidates are written for evaluation. |
| benchmarks/ComputerSystems/EdgeServiceReplicaPlacement/baseline/result_log.txt | Captures baseline calibration/validation results and reproducibility notes. |
Review details
- Files reviewed: 38/38 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| budgets = load_config()["score_budgets"] | ||
|
|
||
| def ratio(value: float, budget: float, maximum: float = 3.0) -> float: | ||
| return min(maximum, max(0.0, value) / max(budget, 1e-12)) | ||
|
|
||
| latency_reference_ms = 180.0 # median P99 SLO in the production task configuration |
| | Compute price | 0.02 | abstract cost units/active-replica-period | compute cost | arbitrary placeholder requiring maintainer feedback | A relative cost coefficient only; it is not USD or a provider price. | | ||
| | Pending-replica price factor | 0.5 | multiplier | compute cost during cold start | arbitrary placeholder requiring maintainer feedback | Represents partial resource consumption before readiness. | | ||
| | Cross-region price | 0.08 | abstract cost units/gigabyte | cross-region cost | arbitrary placeholder requiring maintainer feedback | A relative coefficient only; it must not be described as a cloud-provider tariff. | | ||
| | Decimal GB conversion | 1024 MB/GB in current code | MB/GB conversion | cross-region cost | engineering simplification | The implementation uses 1024 for consistency with its current configuration; terminology should be clarified before merge. | |
Summary
This adds
EdgeServiceReplicaPlacement, a CPU-only unified benchmark underComputerSystems. A candidate implements a dynamic replica-placement and routing policy; an independent deterministic simulator evaluates it across workload, failure, and link conditions.I placed this benchmark under
ComputerSystemsbased on the current repository taxonomy; I am happy to move it if maintainers prefer another category.Engineering problem
The benchmark models capacity headroom, failure-domain placement, traffic steering, cold starts, recovery, compute usage, and cross-region traffic in a deliberately small edge topology. It is a reduced-order engineering benchmark, not a production cloud or Kubernetes model.
Candidate policy
Candidates implement
decide(observation: dict) -> dictinside the EVOLVE-BLOCK. The observation contains current and recent workload, live nodes, active/pending replicas, RTT, and link limits. The action specifies desired replica counts and route fractions. Candidates cannot submit their own metrics or score.Simulator and scenarios
The action changes pending/active state and later costs, so this is not a one-shot placement or static combinatorial optimization problem.
Verification
The candidate runs in a separate worker process with bounded JSON-lines I/O, per-decision and per-scenario timeouts, stderr draining, process-tree cleanup, and strict schema/type/range checks.
The evaluator independently recomputes every metric and rejects non-finite values, bool-as-int counts, unknown or duplicate IDs, over-capacity placements, illegal route sums, and routes to pending or failed nodes.
This process boundary is reliability isolation, not an OS-level security sandbox.
The verification suite contains 36 tests. A separate three-period tiny oracle enumerates all 723 feasible trajectories and exactly matches production raw metrics, normalized components, and final score.
Scoring
Each scenario reports availability, request-weighted P95/P99 latency, P99 SLO violation, compute cost, cross-region traffic/cost, and recovery.
Dimensionless capped loss components are combined as
100 * exp(-loss); the final score combines the mean and P20 across ten scenarios.Tail latency is normalized continuously by the median configured service P99 SLO. Compute and bandwidth retain feedback through three reference-budget units.
All weights, references, caps, parameter provenance, and sensitivity results are documented.
Relative weight perturbations of -5%, -2%, +2%, and +5% found no severe numerical fragility or obvious high-score extreme-policy exploit.
Baselines and optimization headroom
The labels do not impose a required ordering. Weak slightly exceeds the initial policy because it spends no cross-region bandwidth while accepting worse reliability/SLA metrics.
The handwritten strong policy is 0.5195 points above initial. The evolved best is 0.7229 points above initial.
Agent optimization sanity check
A 10-iteration OpenEvolve run with an OpenAI-compatible LLM backend was used as a generative-optimization sanity check.
The best candidate improved availability, tail latency, SLA violations, compute cost, and cross-region cost rather than exploiting the scoring function.
This is a limited sanity check, not a broad claim about model performance. The benchmark itself does not depend on the provider used for the experiment, and no provider-specific compatibility code or prompt is included in this task.
Validation
pytest: 36 passedfrontier_eval/run_eval.sh: valid, score 73.9434Runtime and dependencies
The benchmark is CPU-only and its evaluator uses the Python standard library.
No GPU, cluster, external service, or downloaded dataset is required.
Known simplifications
Reproduction