Skip to content

Add paired answer-quality A/B evaluation - #4

Merged
AronAxe merged 1 commit into
mainfrom
feat/quality-ab-eval
Aug 26, 2026
Merged

Add paired answer-quality A/B evaluation#4
AronAxe merged 1 commit into
mainfrom
feat/quality-ab-eval

Conversation

@AronAxe

@AronAxe AronAxe commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Objective

Measure whether Token Terminator preserves answer quality versus off mode when the exact same prompts and evidence are sent to the same Hermes model/provider/reasoning configuration. Answer quality is the primary metric; token savings are secondary and cannot compensate for a quality loss.

Stage 1 experiment

  • 12 synthetic, easily degradable task classes with 310,082 characters of evidence
  • 3 repetitions per task: 36 matched pairs / 72 answer runs
  • randomized adjacent arm order stable under the 3-to-6 repetition extension
  • fresh session and isolated workspace per arm; full process-tree timeout cleanup
  • strict deterministic grading of factual, numerical, diagnostic, recency, and completeness quality
  • 80% minimum control pass rate to prove assay sensitivity
  • Stage 1 reports answer-quality results as a checkpoint, not a final victory
  • predeclared decision-grade extension remains 72 matched pairs; existing results resume without rerunning Stage 1
  • contaminated arms automatically retry; latest clean replacements win in analysis
  • provider/model drift, timeout, malformed output, and missing usage receipts are contamination, not hidden failures

Methodological defects fixed

  • switched to hermes chat --query-file so reasoning/rule-isolation flags are honoured and Windows prompt limits are avoided
  • canonical state.db accounting keyed by emitted session id
  • task-clustered bootstrap intervals rather than treating repetitions as independent tasks
  • assay-sensitivity floor prevents both arms failing from passing non-inferiority
  • corrected PCI-DSS and Envoy regex fixture ambiguity
  • stable pair-level randomization across extension
  • graceful Hermes run budget ends before the outer process timeout
  • documented session-total token-accounting limitations

Verification

  • 156 passed, 2 skipped
  • Ruff lint and format checks passed
  • suite validation: 12 tasks, 36 pairs, 72 answer runs, 72-pair final decision threshold
  • Twine and release-containment verification passed on clean Windows staging
  • AGY fixture and implementation audits: APPROVE
  • external Claude Code reviews identified the methodological defects above; all are now covered by implementation and regression tests

Run cost

No experiment provider calls were made by this PR. Stage 1 uses 72 OpenAI Codex OAuth answer calls with expected /usr/bin/bash marginal API cost while consuming account quota and wall-clock time.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 507769928f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/quality_ab.py Outdated
Comment on lines +402 to +403
"--usage-file",
str(usage_path),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make usage paths absolute before launching Hermes

With the documented relative --results .quality-ab/results.jsonl, this passes a relative usage path to a subprocess whose cwd is the disposable evidence workspace. Hermes therefore writes—or attempts to write—the receipt beneath that workspace rather than the repository-level .quality-ab/usage directory, and the workspace is deleted before usage_path is read. Every successful trial is consequently marked missing_usage, preventing the experiment from producing eligible pairs; resolve the receipt path before launching the subprocess.

Useful? React with 👍 / 👎.

Comment thread scripts/quality_ab.py Outdated
Comment on lines +696 to +699
existing = _load_results(args.results)
completed = {
(str(row.get("pair_id")), str(row.get("arm"))) for row in existing
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retry contaminated arms instead of marking them complete

When any arm times out, fails, lacks usage, or reports route drift, its contaminated row is still added to completed. Subsequent run invocations permanently skip that arm, while analyze requires all 72 pairs to be uncontaminated, so one transient failure leaves the documented resumable experiment stuck in collecting unless the user manually edits the JSONL file. Only valid rows should satisfy completion, or contaminated rows must be replaceable on retry.

Useful? React with 👍 / 👎.

Comment thread scripts/quality_ab.py
Comment on lines +515 to +520
pairs, duplicates = _paired_rows(rows)
eligible = [
(control, treatment)
for control, treatment in pairs
if not control.get("contaminated") and not treatment.get("contaminated")
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject rows from a different experiment configuration

Eligibility checks only the row-controlled contaminated flag and never verifies expected pair IDs, experiment ID, prompt hash, arm mode, or consistent model/provider/reasoning. If a results file is reused after changing the suite or route, its previously valid rows remain uncontaminated and can be combined into a complete non-inferiority decision attributed to the current suite, despite violating the matched fixed-configuration design. Validate every pair against the current plan and reject mixed run configurations before computing statistics.

Useful? React with 👍 / 👎.

@AronAxe
AronAxe force-pushed the feat/quality-ab-eval branch 3 times, most recently from 66b78e1 to f583a8d Compare August 25, 2026 23:48
@AronAxe
AronAxe force-pushed the feat/quality-ab-eval branch from f583a8d to 33fc3fa Compare August 26, 2026 02:42
@AronAxe
AronAxe merged commit c010abe into main Aug 26, 2026
6 checks passed
@AronAxe
AronAxe deleted the feat/quality-ab-eval branch August 26, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant