Skip to content

fix(eval): pass cases that meet the pass@k threshold - #8414

Open
WeiLiuu wants to merge 1 commit into
google:mainfrom
WeiLiuu:fix/pass-at-k-threshold
Open

WeiLiuu wants to merge 1 commit into
google:mainfrom
WeiLiuu:fix/pass-at-k-threshold

Conversation

@WeiLiuu

@WeiLiuu WeiLiuu commented Nov 27, 2026

Copy link
Copy Markdown

Link to Issue or Description of Change

With one passing run out of five, pass@1 returns 0.19999999999999996. A threshold of 0.2 then fails the whole case. Count the subsets that contain a pass using integer subtraction and divide once, as the neighboring pass^k implementation does for its subset count.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

The new regression checks the probability, the criterion status and the final case status. It failed on 03725e8. Both multi-run aggregation test modules pass with the change (139 tests on each of Python 3.11 to 3.14). Full tox passed on all four versions (26,557 / 26,548 / 26,548 / 26,550 passed). All 14 pre-commit hooks passed.

Manual End-to-End (E2E) Tests:

Install the checkout with evaluation dependencies (python -m pip install -e ".[eval]"). From the directory containing the input files below, run a single case with reference answer yes. Have a local agent answer yes once and no four times. Set the response match threshold to 0.5 and use pass_rate with a 0.2 threshold for cross-run metric scoring.

adk eval fixed_answers boundary.evalset.json --config_file_path config.json --parallelism 1
Before (exit 1)
one_in_five  FAILED  PFFFF  1/5 (20%)  pass@1=0.20 (FAILED)

After (exit 0)
one_in_five  PASSED  PFFFF  1/5 (20%)  pass@1=0.20 (PASSED)
CLI input files

fixed_answers/__init__.py

from . import agent

fixed_answers/agent.py

from google.adk.agents import BaseAgent
from google.adk.events import Event
from google.genai import types

answers = iter(["yes", "no", "no", "no", "no"])

class FixedAnswers(BaseAgent):
    async def _run_async_impl(self, ctx):
        yield Event(author=self.name, content=types.Content(
            role="model", parts=[types.Part(text=next(answers))]
        ))

root_agent = FixedAnswers(name="fixed_answers")

boundary.evalset.json

{"eval_set_id":"boundary","eval_cases":[{"eval_id":"one_in_five","conversation":[{"user_content":{"role":"user","parts":[{"text":"Answer yes."}]},"final_response":{"role":"model","parts":[{"text":"yes"}]}}],"session_input":{"app_name":"fixed_answers","user_id":"tester","state":{}}}]}

config.json

{
  "criteria": {
    "response_match_score": 0.5
  },
  "multi_run_config": {
    "num_runs": 5,
    "cross_run_criteria": [
      {
        "method": "pass_at_k",
        "k": 1,
        "threshold": 0.2
      }
    ],
    "cross_run_scoring": {
      "method": "pass_rate",
      "threshold": 0.2
    }
  }
}

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

The CLI prints both scores to two decimal places. The saved eval result shows the change from 0.19999999999999996 to 0.2.

Count subsets containing a pass before dividing so pass@1 meets the
threshold when one of five runs passes.
@google-cla

google-cla Bot commented Nov 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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