fix(nli): return 1.0 for empty claims in score_faithfulness#208
Open
syf2211 wants to merge 1 commit into
Open
Conversation
Align EvidenceFinder.score_faithfulness() with the Faithfulness metric wrapper: an empty claims list is vacuously faithful (score 1.0), not unfaithful (score 0.0). Fixes OpenAgentHQ#76
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.
Description
Align
EvidenceFinder.score_faithfulness()with theFaithfulnessmetric wrapper: when the claims list is empty, return a score of1.0(vacuously faithful) instead of0.0.Type of Change
Related Issues
Fixes #76
How Has This Been Tested?
pytest tests/unit/test_metrics/test_nli.py)ruff checkon changed files — pre-existing warnings only)uv run mypy openagent_eval/)Test output
Checklist
Additional Notes
The
Faithfulnessmetric already short-circuits on empty extracted claims and returnsscore=1.0before callingscore_faithfulness(). This fix ensures direct callers ofEvidenceFinder.score_faithfulness([], contexts)get the same semantics.Summary: One-line behavioral fix + corresponding unit test assertion update.
Motivation: Inconsistent API — direct NLI module usage returned
0.0for empty claims while the Faithfulness wrapper returned1.0.Changes:
evidence_finder.py:return 0.0, []→return 1.0, []for empty claimstest_nli.py: updatetest_score_faithfulness_empty_claimsexpectationRisk: Low — only affects direct
score_faithfulness([])callers; no existing code depends on the old0.0behavior.