Skip to content

perf(review): compare a grounding arm and a lens arm in group analysis #4831

Open

Description

@dan-petty

Problem or Motivation

Group analysis rejected 415 of 646 groups. 535 of 543 rejection reasons are quote grounding, so a persona lens may not help. The accept rate depends on the producer: mypy 126 of 505, semgrep 44 of 76. A review spends 16,317 prompt tokens for each accepted group.

The owner asked on 2026-11-11 (#4780) for a measure that shows that the persona selection improves the result.

Proposed Solution & Architectural Design

  • Set a baseline with devops ai runs baseline set on the generic group-analysis prompt.
  • Run an A/A set (k=3) to find the noise floor.
  • Run arm G (a producer grounding section) and arm L (the lens section of feat(ai): choose a persona lens from evidence with a rule table #4830), each with k=3, and compare them with devops ai runs baseline compare.
  • An arm becomes the default only when:
    • its G10 accept rate is above the floor for mypy and semgrep;
    • no producer drops;
    • the prompt tokens for each accepted group increase by 10 % or less.
  • Else, delete the section.
  • Run the same protocol for the question resolver on the 58 gold answers, with a lens and with no lens.
  • Record the result in docs/SELF_IMPROVEMENT.md.

Target Subsystem

AI & Agentic Review Pipeline (review group analysis, run store).

Existing Tool Considered

The run store arms and devops ai runs baseline. No new tool. Cost to build: about 60,000 tokens and 2 hours. Run cost: 12 group-analysis runs of about 3.8M prompt tokens each, about 5 USD or less.

Acceptance Criteria

  • The run store holds the 4 arm sets, each with k=3.
  • docs/SELF_IMPROVEMENT.md records the floor, the deltas and the decision.
  • The same pull request deletes a section that loses.

Dependencies

Source: #4780

Alternatives check of 2026-11-14: not-applicable.
Class: perf, no search.
Tool: none found.

Proposed design

Problem statement

Group analysis rejected 415 of 646 groups, and 535 of 543 rejection reasons are quote grounding, so a persona lens may not help. The owner asked on 2026-11-11 for a measure that shows that the persona selection improves the result (#4780). The issue sets an A/A noise floor and compares two arms, G with a producer grounding section and L with the lens section of #4830. This change records the protocol and its keep-or-delete rule in the loop document and guards the section and its commands with a test; the 12 model runs and the question-resolver comparison are deferred.

Acceptance criteria

Requirement: Group-analysis arm protocol in the loop document

docs/SELF_IMPROVEMENT.md SHALL hold a group-analysis arm comparison section under Prompt Benchmarking.

Scenario: Protocol section present

  • WHEN A test reads the Prompt Benchmarking section of docs/SELF_IMPROVEMENT.md.
  • THEN The text names the baseline and A/A sets, arm G with a producer grounding section, arm L with the lens section of feat(ai): choose a persona lens from evidence with a rule table #4830, k = 3, and the commands devops ai runs baseline set and devops ai runs compare, and it names no devops ai runs baseline compare.

Requirement: Keep-or-delete rule for an arm

The section SHALL state the three conditions that an arm meets before it becomes the default.

Scenario: Thresholds stated

  • WHEN A test reads the keep-or-delete rule of the section.
  • THEN The rule states a G10 accept rate above the A/A floor for mypy and semgrep, no producer drop, and at most 10 % more prompt tokens for each accepted group.

Requirement: Deletion of a losing section

The section SHALL state that the pull request which records a losing arm deletes that arm's section.

Scenario: Deletion duty stated

  • WHEN A test reads the rule for an arm that fails one condition.
  • THEN The text says that the pull request deletes that arm's section.

Requirement: Pinned model for each arm

The section SHALL state that both arms read one shared DEVOPS_CLI_CONFIG that pins the analysis model to a single-model gateway group.

Scenario: Model pinning stated

  • WHEN A test reads the setup of the section.
  • THEN The setup names DEVOPS_CLI_CONFIG and states that a group of more than one model reports not model-pinned and is not compared.

Requirement: Check that guards the protocol

A test SHALL fail when the protocol section or one of its thresholds is absent from docs/SELF_IMPROVEMENT.md.

Scenario: Threshold removed

  • WHEN A threshold sentence or an arm name is removed from the document.
  • THEN The test fails and names the missing text.

Requirement: Check that parses the protocol's commands

A test SHALL fail when a devops ai runs command in the protocol section does not parse with the Typer app.

Scenario: Wrong baseline command

  • WHEN The section names devops ai runs baseline compare in place of devops ai runs compare.
  • THEN The test fails and names the token the Typer app refuses.

Existing Tool Considered

No new tool. The run store covers the arm comparison: devops ai runs baseline set writes a BaselineRecord (src/devops_cli/ai/run_store.py:469), and devops ai runs compare compares a run with its subject's baseline and reports each metric's mean and range (src/devops_cli/ai/run_store.py:742, docs/SELF_IMPROVEMENT.md:851). It lacks a runner and a decision record: a person starts each arm's reviews (docs/SELF_IMPROVEMENT.md:873), and the run store records no keep-or-delete decision. The alternatives check of 2026-11-14 gave not-applicable for a perf item and found no tool. Written cost from the issue: about 60,000 tokens and 2 hours to build, and 12 runs of about 3.8M prompt tokens each, about 5 USD or less.

Key questions

  • Which open, maintained tool covers the arm comparison?: The run store and its commands cover the comparison: devops ai runs baseline set writes a BaselineRecord (src/devops_cli/ai/run_store.py:469), and devops ai runs compare reports each metric's mean and range against the subject baseline (src/devops_cli/ai/run_store.py:742, docs/SELF_IMPROVEMENT.md:851). The change builds no new tool. (best practice) [sources: docs/SELF_IMPROVEMENT.md:851, src/devops_cli/ai/run_store.py:469, src/devops_cli/ai/run_store.py:742]
    • Chosen: Run store arms with devops ai runs baseline set and devops ai runs compare. The document already compares two arms this way, and the run store already holds each arm's runs.
    • Rejected: A new benchmark harness. The issue states a cost of about 60,000 tokens and 2 hours, and the run store already holds the arms.
    • Rejected: An external evaluation framework. The alternatives check of 2026-11-14 gave not-applicable for a perf item and found no tool.
  • Where does the protocol and its recorded result go?: In docs/SELF_IMPROVEMENT.md, section 4, under Prompt Benchmarking (docs/SELF_IMPROVEMENT.md:578, docs/SELF_IMPROVEMENT.md:826). [sources: docs/SELF_IMPROVEMENT.md:578, docs/SELF_IMPROVEMENT.md:826]
  • Which command compares two arms?: devops ai runs baseline set <A> saves the baseline, and devops ai runs compare <B> compares a run with its subject's baseline (src/devops_cli/commands/ai_runs.py:515). The baseline app has set, list and show only (src/devops_cli/commands/ai_runs.py:584), so the issue body's devops ai runs baseline compare is not a command. [sources: docs/SELF_IMPROVEMENT.md:851, src/devops_cli/commands/ai_runs.py:515, src/devops_cli/commands/ai_runs.py:584]
  • How does a k = 3 comparison give a noise floor?: The base prompt runs as two arms, the baseline set and the A/A set, each with k = 3; the ranges of those two identical arms are the noise floor a change is read against (docs/SELF_IMPROVEMENT.md:858). Each arm's range is its [min, max] across its k runs (docs/SELF_IMPROVEMENT.md:839), and the table says whether the ranges overlaps or are apart; with k = 3 the document runs no significance test (docs/SELF_IMPROVEMENT.md:853). [sources: docs/SELF_IMPROVEMENT.md:839, docs/SELF_IMPROVEMENT.md:853, docs/SELF_IMPROVEMENT.md:858]
  • Which model configuration do the arms read?: Both arms read one shared DEVOPS_CLI_CONFIG that pins the analysis model to a single-model gateway group (docs/SELF_IMPROVEMENT.md:856). A group that serves more than one model reports not model-pinned, and the arms are not compared (docs/SELF_IMPROVEMENT.md:847). (best practice) [sources: docs/SELF_IMPROVEMENT.md:847, docs/SELF_IMPROVEMENT.md:856]
    • Chosen: One shared DEVOPS_CLI_CONFIG with one pinned group. The document says both arms must read one configuration file, and a group of more than one model reports not model-pinned.
    • Rejected: Each arm's own configuration. A different model in each arm is not a comparison of prompts.
    • Rejected: A pool of several models. The report then says not model-pinned, so the arms are not compared.
  • In which order do the runs go?: Run the baseline and the A/A set first, then interleave arm G and arm L, three runs each (docs/SELF_IMPROVEMENT.md:858, docs/SELF_IMPROVEMENT.md:893). (best practice) [sources: docs/SELF_IMPROVEMENT.md:858, docs/SELF_IMPROVEMENT.md:893]
    • Chosen: Interleave the arms. The document alternates the arms, so a warming response cache does not favour one arm.
    • Rejected: Run all of one arm, then all of the other. The later arm would run on a warm cache, and the cache is the difference.
  • Which rule decides that an arm becomes the default?: An arm becomes the default only when its G10 accept rate is above the A/A floor for mypy and semgrep, no producer drops, and its prompt tokens for each accepted group rise by 10 % or less; else its section is deleted. The G10 accept rate is the share of group replies that pass every G10 check (src/devops_cli/review/analysis.py:956). The run store's regression tolerance for a token increase defaults to 20 % (src/devops_cli/ai/run_store.py:777), so the 10 % rule is stricter and the section states it. (best practice) [sources: docs/SELF_IMPROVEMENT.md:851, docs/SELF_IMPROVEMENT.md:853, src/devops_cli/ai/run_store.py:777, src/devops_cli/review/analysis.py:956]
    • Chosen: The three-part rule of the issue. The rule reads each arm against the floor, and it holds a cost limit and a producer guard.
    • Rejected: Accept on the mean alone. With k = 3 the document runs no significance test, and it compares ranges.
    • Rejected: Accept on the G10 rate alone. It would take an arm that costs more tokens for each accepted group, or that drops a producer.
    • Rejected: Use the run store's 20 % token tolerance. The issue sets 10 % for each accepted group, and 20 % is the default of the regression check, not of the arm comparison.
  • Which dependencies does the remaining work need?: None for this issue: the protocol section and its test read only docs/SELF_IMPROVEMENT.md and the test tree. The deferred measurement carries feat(ai): choose a persona lens from evidence with a rule table #4830 (the lens section) in its body, and the deferred question-resolver comparison carries feat(ai): choose a persona lens from evidence with a rule table #4830 and feat(roadmap): the question resolver answers with verified sources #4808. fix(ai): the review prompt digest leaves out the chat persona prompts #4829 is closed (CHANGELOG.md:210), so it no longer blocks. (best practice) [sources: openspec/specs/roadmap-refine/deferred-parts/spec.md:24, docs/roadmap/refine.md:93, CHANGELOG.md:210, docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md:119]
  • Does the project want a check that guards a document rule?: Yes. Each struggle gets a check that fails when the problem returns, and a document holds a rule only when no check is possible (AGENTS.md:17, docs/SELF_IMPROVEMENT.md:165). The review loop's document already has such a check (tests/ai/review/test_docs_review_loop.py:119), but it parses only devops review and devops ai review commands (tests/ai/review/test_docs_review_loop.py:55), so the new section's devops ai runs commands need the check extended. [sources: AGENTS.md:17, docs/SELF_IMPROVEMENT.md:165, tests/ai/review/test_docs_review_loop.py:55, tests/ai/review/test_docs_review_loop.py:119]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/infra
    scope/review
    status/new
    value/medium
    on Nov 11, 2026
  3. added
    effort/low
    on Nov 11, 2026
  4. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. The experiment informs a prompt decision and is not urgent. It costs about 2 hours and 5 USD.
    • Value: Medium. The result shows if a prompt section improves the accept rate for each producer.
    • Effort: Low. The work uses the existing run store and baseline commands. It needs about 2 hours and 12 runs.
    • Related: feat(ai): choose a persona lens from evidence with a rule table #4830, which asks for a different change. Both items address the persona lens and the owner request #4780. #4830 adds the lens rule table, and the candidate measures the lens against a grounding arm.
  5. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The perf prefix of the title gives the type.
    • Scope: scope/review. The (review) scope of the title gives the scope.
    • Priority: P2-Medium. The owner requested this measure, but it does not block a release or fix a defect.
    • Value: Medium. The result decides which prompt section ships, directly affecting review accept rate.
    • Effort: Low. The body states about 2 hours of build work and 12 runs of about 3.8M tokens each.
    • Related: feat(ai): model-in-the-loop prompt benchmarking #413, which asks for a different change. Both measure prompt quality for review, but #413 builds the benchmarking tool while the candidate runs a specific arm comparison with existing tools.
  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: perf. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  8. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at e5dfddb (see proposed design in issue body).

    Moved to new items: #5820, #5821.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/reviewsource/agentstatus/readytype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions