Skip to content

Add a model-agnostic evaluation harness for the QA/MCQ/RRB benchmarks#10

Open
Gazzara-lab wants to merge 2 commits into
SAP:mainfrom
Gazzara-lab:add-evaluation-harness
Open

Add a model-agnostic evaluation harness for the QA/MCQ/RRB benchmarks#10
Gazzara-lab wants to merge 2 commits into
SAP:mainfrom
Gazzara-lab:add-evaluation-harness

Conversation

@Gazzara-lab

Copy link
Copy Markdown

What this adds

The repo ships benchmark generation + the three diagnostic datasets, but no turnkey way to score a model on them. This PR adds an evaluate/ package: eval-qa / eval-mcq / eval-rrb CLIs + metrics (accuracy, Recall@k / hit@k / MRR / nDCG@k by tier) with 95% bootstrap confidence intervals, robust answer parsing with unparseable-response counting, a no-API --dry-run path, 27 unit tests, and docs (README "Evaluation" + REPRODUCTION.md).

Scope

Inference-only / in-context; not a reproduction of the paper's trained-ToolGen Rc@50. Reports --tool-ref name|description|none so the tool-knowledge lift over a hidden-identity control is measurable (and here, significant).

Example run

google/gemma-3-12b-it, full datasets, 0 unparseable; accuracy rises none < name < description (lift CIs exclude 0) and retrieval degrades easy → hard. CIs in the result cards; full table in REPRODUCTION.md. These are illustrative temperature=0 numbers, reproducible up to model/provider nondeterminism.

Testing

pytest evaluate/tests (27 pass); eval-* --dry-run runs end-to-end with no API calls.

Notes

Apache-2.0; DCO signed-off. Written with AI assistance (Claude) and reviewed/verified by me; original code (standard metrics from scratch, no third-party code copied), consistent with SAP's AI-generated code guidelines.

Closes #9.

The repo ships benchmark generation plus the three diagnostic datasets, but no
turnkey way to score a model on them. This adds an `evaluate/` package:

- `eval-qa` / `eval-mcq` / `eval-rrb` CLIs and metrics (accuracy, Recall@k,
  hit@k, MRR, nDCG@k) with 95% bootstrap confidence intervals, robust answer
  parsing, and unparseable-response counting so non-compliant output is visible
  rather than silently mis-scored.
- A `--dry-run` stub path that runs end-to-end with no API calls (CI-friendly,
  standard-library only) and 27 known-answer unit tests for the metrics/parsers.
- A README "Evaluation" section with a no-full-install quickstart (the evaluator
  needs only the standard library plus a model client), an optional `eval` extra,
  and REPRODUCTION.md (scope notes, offline dataset-integrity facts, and an example
  run with google/gemma-3-12b-it).

This is an inference-only, in-context evaluation; it is not a reproduction of
the paper's trained-ToolGen Rc@50, as documented in REPRODUCTION.md.

Closes SAP#9.

Signed-off-by: Franco A. Gazzara <287811783+Gazzara-lab@users.noreply.github.com>
@cla-assistant

cla-assistant Bot commented Jun 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI 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.

Pull request overview

Adds a new evaluate/ Python package that provides a model-agnostic scoring harness for the repo’s three shipped diagnostic datasets (QA, MCQ, RRB), including CLI entry points, core metrics (with bootstrap CIs), robust response parsing, and offline unit tests. This fills the current gap where the repo provides dataset generation + data, but not a turnkey scorer for downstream users.

Changes:

  • Introduces eval-qa, eval-mcq, and eval-rrb CLIs with deterministic shuffles, parsing, metrics, and results-card output.
  • Implements standard classification/ranking metrics plus percentile-bootstrap confidence intervals and paired bootstrap lift CIs.
  • Adds documentation (README Evaluation section + REPRODUCTION.md) and unit tests for metrics/parsers.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
REPRODUCTION.md Adds detailed evaluation-scope and reproducibility notes plus example results and dataset-integrity facts.
README.md Documents evaluation quickstart, CLI usage, and example outputs.
pyproject.toml Adds eval-* console scripts, an eval optional dependency, and includes evaluate/ in wheels.
evaluate/init.py Package-level documentation and exports for the evaluation harness.
evaluate/common.py Shared JSONL IO, deterministic shuffling, tool referent rendering, and robust response parsers + mocks.
evaluate/metrics.py Implements accuracy/ranking metrics and bootstrap confidence intervals.
evaluate/model_client.py Adds a lightweight model client mirroring the repo’s proxy-vs-direct call pattern.
evaluate/eval_qa.py CLI to score QA (yes/no) with parsing, accuracy, bootstrap CI, and artifact writing.
evaluate/eval_mcq.py CLI to score MCQ with deterministic option shuffle, parsing, accuracy, bootstrap CI, and artifacts.
evaluate/eval_rrb.py CLI to score RRB rankings with Recall@k/hit@k/MRR/nDCG@k, tier breakdowns, and artifacts.
evaluate/tests/init.py Initializes the evaluation test package.
evaluate/tests/test_metrics.py Adds known-answer unit tests for metrics and parsing robustness/determinism.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread evaluate/common.py Outdated
Comment thread toolsense_eval/tests/test_metrics.py
Comment thread evaluate/eval_qa.py Outdated
Comment thread evaluate/eval_mcq.py Outdated
Comment thread toolsense_eval/eval_rrb.py
Comment thread toolsense_eval/model_client.py
Comment thread evaluate/eval_rrb.py Outdated
Comment thread pyproject.toml Outdated
Comment thread evaluate/__init__.py Outdated
Resolves the 9 findings from the PR SAP#10 automated review:

- parse_choice_letter: normalize a case-insensitively matched decision
  letter to uppercase (+ regression test) so answers like "Final answer: c"
  are scored against the uppercase gold labels.
- Persist the full raw model response in the QA/MCQ prediction artifacts
  (was truncated to 200 chars) and add raw + n_parsed to the RRB artifacts,
  keeping runs auditable and re-parseable as the docs promise.
- Guard model_client.complete against max_retries < 1 (previously raised None).
- Derive the RRB results-card candidate-pool size from the data instead of
  a hard-coded literal.
- Rename package evaluate -> toolsense_eval to avoid shadowing the HuggingFace
  evaluate distribution; update imports, console-script targets, wheel
  include/exclude, and docs.
- Fix the module docstring to describe the dual client path (OpenAI-compatible
  proxy when LITELLM_BASE_URL is set, else litellm directly).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Add a model-agnostic evaluation harness for the QA/MCQ/RRB benchmarks

2 participants