Skip to content

apps: extend benchmarks compare with --focus indexer ranking-policy arms (P1-S3) - #891

Draft
fake0fan wants to merge 5 commits into
InferMatrixLab:mainfrom
fake0fan:p1-s3-indexer-compare-arms
Draft

fake0fan wants to merge 5 commits into
InferMatrixLab:mainfrom
fake0fan:p1-s3-indexer-compare-arms

Conversation

@fake0fan

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #867
Refs #460

  • Accepted scope / delegation: P1 slice S3 (Paired real-task comparison wiring: benchmarks compare --focus indexer) under #867, following the RFC rfc: Harness²-style rule improvement loop — abstract module rules first, start with the Indexer #460 owner decision (7275079865) and S3 claim (7282828908).
  • Anchors touched: none (keeps Benchmark pure with parameterized arms under A1/A4/A5; Apps composes paired session start benchmark handoffs reusing P0 S3 --ranking-policy-file).
  • Stacked prerequisite: currently stacked on P0 S3 (harness: freeze and resume unregistered candidate ranking rules #770), P0 S4 (knowledge: replay a retained Find ranking from its frozen rule #771), P1 S1 (benchmark: add CPU Indexer ranking comparison evaluator (P1-S1) #869) and P1 S2 (harness: add bounded P1 Indexer Evolver loop, delivery-boundary and recovery checks (P1-S2) #888); kept as Draft until upstream slices merge into main, then will be rebased cleanly onto main before requesting independent review.
  • What this PR delivers:
    • src/inferrsi/benchmark/comparison.py & src/inferrsi/benchmark/summary.py: parameterize summarize and comparison with arms: tuple[str, str] = ("on", "off"), keeping existing knowledge on/off outputs byte-for-byte identical while enabling ("candidate", "baseline") for --focus indexer.
    • src/inferrsi/apps/workflows/benchmark_compare.py & src/inferrsi/apps/cli/arguments.py: add --focus indexer with --baseline-ranking-policy[-file], --candidate-ranking-policy[-file] and optional --evolution-report:
      • Keeps the full knowledge/data/ corpus in BOTH trial runtimes (varying only the frozen Indexer ranking policy);
      • Freezes unregistered candidate policy JSON files into the candidate workspace (ranking_policy.json with SHA-256 re-checked on status/load/retry), passing --ranking-policy-file into child session start benchmark commands (reusing P0 S3 harness: freeze and resume unregistered candidate ranking rules #770);
      • Enforces #509's frozen knowledge_delivery precondition and child ranking_policy / ranking_policy_source receipt verification on BOTH arms during collection and report reverification;
      • Records optional Evolver search overhead from indexer-evolve separately in experiment.json and comparison-result.json / report.md / report.html (rfc: Harness²-style rule improvement loop — abstract module rules first, start with the Indexer #460 §4.4; unavailable token counts stay null).
    • src/inferrsi/apps/views/comparison_report.py & docs/guides/operations.md: render Indexer ranking comparison titles, Candidate median / Baseline median headers, and separate Evolver search overhead table when focus == "indexer".
    • tests/benchmark/test_benchmark_compare_indexer.py: end-to-end paired subprocess comparison test (prepare -> dispatch -> bind -> child sessions -> diagnose -> round -> final -> record -> collect -> report with --evolution-report), wrong child ranking-policy detection, tampered ranking_policy.json detection, and negative CLI option tests.
  • What it does not deliver: any real-model or NPU/GPU pilot execution (belongs in a separate frozen P1 pilot acceptance issue), any change to repository default ranking weights, or any end-to-end task/service PASS claim.

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "670354f4c6558c537c82aa4c7ce7502558ff3664",
  "human_only": false,
  "material_ai_authors": [
    {
      "tool": "Antigravity",
      "model_id": "gemini-4-neon",
      "effort": "xhigh",
      "role": "author"
    },
    {
      "tool": "Antigravity",
      "model_id": "claude-opus-5-5",
      "effort": "high",
      "role": "author"
    }
  ]
}

(Note: claude-opus-5-5 appears only in the stacked P0 S3/S4 commits while this PR is Draft; P1-S1 4fc53ff2, P1-S2 b66bf08c and P1-S3 670354f4 are authored with Antigravity / gemini-4-neon [effort=xhigh]. None of the changed files are in protected_paths.)

Changed artifacts and evidence

Requirement Actual change Check / evidence and result Remaining gap
Parameterized Benchmark comparison & summary arms src/inferrsi/benchmark/comparison.py, src/inferrsi/benchmark/summary.py Existing test_comparison_rules.py & test_comparison_report.py green + new test_benchmark_compare_indexer.py green Rebase onto main after #770/#771/#869/#888 merge
Paired benchmarks compare --focus indexer, #509 delivery precondition, child ranking-policy verification & Evolver overhead src/inferrsi/apps/workflows/benchmark_compare.py, src/inferrsi/apps/views/comparison_report.py, src/inferrsi/apps/cli/arguments.py, docs/guides/operations.md, tests/benchmark/test_benchmark_compare_indexer.py 3/3 new end-to-end/negative tests passed + existing test_benchmark_compare.py regression suite green + repository import-gate & boundary tests green; ruff check src tests tools clean Independent review after rebase

Checks and dependencies

  • Checks actually run (result and tested scope):
    • ruff check src tests tools — passed (0 errors)
    • pytest tests/benchmark/test_comparison_rules.py tests/benchmark/test_comparison_report.py tests/benchmark/test_benchmark_compare_indexer.py — 57 passed, 0 failed
    • pytest tests/repository/test_target_module_import_gate.py tests/repository/test_module_boundaries.py tests/repository/test_first_wave_isolation_policy.py tests/repository/test_package_root_inventory.py tests/repository/test_architecture_anchors.py — 193 passed, 0 failed
  • Failed, skipped, timed-out or not-run checks (if applicable):
    • Full pytest suite not run locally (host Git 2.34 lacks Git >= 2.45 flags used by unrelated repo tests); CI will be authoritative once rebased onto main and marked ready.
  • Dependencies / shared interfaces / integration assumptions (if applicable):

Remaining work and Issue closure

Managed sessions accept a candidate ranking configuration through --ranking-policy-file, mutually exclusive with --ranking-policy. Ordinary plans freeze the full receipt (with config_sha256) and ranking_policy_source: configuration; service-reuse plans pin the full configuration by value (no digest key, preserving service_io.no_fingerprints) and ranking_policy_source: configuration in both plan.json and campaign.json, cross-checked on load and delivery projection. Resume, Find and Read rebuild the rule from the frozen configuration through the injected resolver instead of the registry, so every search and read receipt carries the candidate. Candidate IDs cannot reuse registered names, named-policy plans keep their registry check, and tamper/mismatch cases fail with zero session writes.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Agent-assisted-by: Antigravity / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Add ranking_replay: replay_binding records the query, limit, filters, byte budget, frozen rule, scoring version and corpus digest of one Find and delivery; verify_replay reproduces the returned, delivered and omitted order and reports reproduced only for the identical corpus and scoring version. Archival capture verification stays a separate check. Regression tests replay default and unregistered candidate captures over the frozen ranking corpus, report their delivery difference, show a changed corpus is not reported as reproduced while the old capture still verifies, and reject missing bindings and a changed rule.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Add pure CPU comparison and descriptive scoring rules for two Indexer RankingPolicy arms in benchmark.indexer_comparison (no cross-core imports) and assemble the workflow and CLI subcommand benchmarks indexer-compare in Apps. The workflow reuses frozen RankingPolicy/RankingSpace validation and ranking_replay corpus digests, replay bindings and delivery differences, enforces heldout split isolation and zero-write refusal on invalid or out-of-space inputs, and reports offline CPU retrieval/delivery metrics only.

Agent-assisted-by: Antigravity / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
…ry-boundary and recovery checks

Add pure Benchmark proposal, selection, rerun, held-out gate and deterministic coordinate-control rules in benchmark.indexer_evolution; add the durable bounded Harness controller in harness.manager.search.indexer_evolution with development-session trace and knowledge-capture ingestion (verifying plan_digest, captures, optimization_trace steps, timing and held-out exclusion), verified delivery-boundary packing, Evolver calls routed through _agent_sessions.py with hard budget reservations on interrupted calls, non-duplicating reconciliation, mandatory rerun and an exclusive single-use held-out claim; and assemble the workflow and CLI subcommand benchmarks indexer-evolve (--dev-session, --mode deterministic|provider) in Apps. Cover delivery-boundary omission refusal, tampered/redacted/held-out leakage refusal, session trace ingestion, interrupted-call restart recovery and budget reservation, out-of-range edits, inconclusive/rerun failure retention of H0, and end-to-end CPU workflow runs.

Agent-assisted-by: Antigravity / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Extend benchmark.comparison.summarize and benchmark.summary.comparison with parameterized treatment/reference arm labels (defaulting to on/off for full backward compatibility), update comparison_report rendering for focus=indexer with optional separate Evolver search-overhead accounting, and add --focus indexer to benchmarks compare (--baseline-ranking-policy[-file], --candidate-ranking-policy[-file], --evolution-report). Both arms retain the full knowledge corpus, enforce the frozen knowledge_delivery precondition and frozen ranking policy receipt on child sessions, verify the frozen candidate policy file against tampering, and keep existing knowledge on/off behavior unchanged.

Agent-assisted-by: Antigravity / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
@Dong1017 Dong1017 added area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters area:benchmark Benchmark line: preparation ports, metric contracts, validators, and isolated workers labels Nov 30, 2026

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666.

Draft feedback on the S3 increment at 670354f4, not a vote. The comparison correctly keeps Knowledge on in both arms. One evidence-accounting gap is inline. Withholding the total while this PR is stacked on unmerged prerequisites.

"evolver_mode": evo_doc.get("evolver_mode"),
"status": evo_doc.get("status"),
"rounds_attempted": evo_doc.get("rounds_attempted"),
"selected_rule": evo_doc.get("selected_rule"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This records the Evolver’s selected rule and budget, but never checks that the selected receipt matches cand_meta["receipt"]. A report from another search can then be shown as the overhead for this comparison, even when both child runs correctly use the pinned policies. Could we reject a mismatched receipt before creating the plan and add a test with the wrong Evolver report?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters area:benchmark Benchmark line: preparation ports, metric contracts, validators, and isolated workers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants