A row that errors leaves the denominator, so the reported score rises as the system degrades
Author: shaurya416Created Sep 23, 2026Updated Sep 29, 2026
Four locations, each reasonable in isolation:
src/ragas/metrics/_faithfulness.py:210-211—if statements == []: return np.nan(duplicated at:261-262inFaithfulnesswithHHEM)src/ragas/utils.py:51-52—if np.isnan(arr_numpy).all(): return np.nan/return float(np.nanmean(arr_numpy))src/ragas/dataset_schema.py:445—value = safe_nanmean(self._scores_dict[metric_name]), the numberevaluate()reportssrc/ragas/executor.py:71-84—except Exception ... return counter, np.nan, withraise_exceptions: bool = Falsedefaulted atsrc/ragas/evaluation.py:70
Measured
Fresh clone, fresh stub judge:
faithful -> 1.0
unfaithful -> 0.0
empty -> nan
System A (attempts both rows) scores [1.0, 0.0] -> reported 0.5
System B (drops the hard one) scores [1.0, nan] -> reported 1.0
real Executor per-row results: [1.0, nan] (RuntimeError on row 2)
safe_nanmean of those: 1.0Consequence
Any API error, rate limit, JSON parse failure or ValueError guard converts a row to NaN, which
nanmean then removes from the denominator. The headline faithfulness number goes up as more
rows fail.
Two things I want to correct up front
I had initially believed two stronger claims. Both are wrong and I am not making them:
- "Nothing in the returned
EvaluationResultshows how many rows were dropped" — false.EvaluationResult.scoresis public, and__getitem__(dataset_schema.py:459-460) andto_pandas()(:485-501) expose the per-row NaNs. Only__repr__hides them. - "Refusing raises your score from 0.5 to 1.0" — unverified and probably false. It requires
the statement generator to return
[]for a refusal, but the prompt at_faithfulness.py:37would plausibly decompose "I can't help with that" into one statement scoring 0.0.
The error/empty path needs neither assumption, which is why it is the one I am reporting.
evaluation.py:398-400 documents the per-row NaN. What is documented nowhere is that the NaN row
then leaves the denominator.
Suggested fix
Report a coverage count alongside every aggregate, and divide by rows attempted rather than rows that survived.
Source: vibrantlabsai/ragas