Unify error handling across all evaluators#82
Merged
Conversation
Co-authored-by: Ki-Seki <60967965+Ki-Seki@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unification of errored item handling across evaluators
Unify error handling across all evaluators
Feb 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies error handling across all evaluators (MCQA, PPL, Match, CV) by introducing a centralized filtering helper and standardizing error-related calculations. Previously, each evaluator handled errored items differently using ad-hoc approaches (manual filtering, inline list comprehensions, manual arithmetic), creating maintenance burden and potential for inconsistency.
Changes:
- Added
_filter_non_error_items()helper method to BaseEvaluator for consistent error filtering - Updated
_safe_average()to exclude errored items by default via newexclude_errorsparameter - Refactored all evaluators to use the centralized helper instead of custom filtering logic
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/gimbench/base.py | Added _filter_non_error_items() static helper method and updated _safe_average() with exclude_errors parameter defaulting to True |
| src/gimbench/mcqa/evaluators.py | Replaced manual arithmetic (evaluates - errors) with len(non_error_items) for calibrated accuracy calculation |
| src/gimbench/match/evaluators.py | Replaced inline filtering expressions with centralized _filter_non_error_items() helper for metrics computation |
| src/gimbench/cv/evaluators.py | Replaced manual list comprehension with centralized _filter_non_error_items() helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ki-Seki
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Evaluators handled errored items inconsistently: MCQA manually calculated
corrects / (evaluates - errors), PPL relied on-1sentinels, Match used inline filtering, and CV created manual filtered lists. This created maintenance burden and potential for divergent behavior.Changes
Base evaluator class (
base.py):_filter_non_error_items()helper for consistent error filtering_safe_average()to exclude errored items by default (viaexclude_errors=True)All evaluators (
mcqa,ppl,match,cv):_filter_non_error_items()instead of ad-hoc filteringstr(e)(PPL was usingrepr(e))The
_safe_average()default behavior change (exclude_errors=True) codifies existing implicit behavior—no evaluator was computing averages over errored items.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.