Skip to content

HallucinationDetection fallback scores unsupported word types, not hallucinated claims #283

Description

@Nitjsefnie

Description

HallucinationDetection documents its score as a ratio of hallucinated claims, but its fallback path computes a ratio over unsupported unique word types instead. No claim segmentation happens on that path.

openagent_eval/metrics/generation/hallucination.py:19    — documented as a hallucinated-claims ratio
openagent_eval/metrics/generation/hallucination.py:98-111 — unsupported unique-word-type ratio

So the reported number does not mean what the documentation says it means. A single fabricated sentence made of common words can score lower than a faithful sentence that introduces several ordinary new words, because the unit being counted is vocabulary rather than assertions.

Expected Behavior

Either the fallback segments the answer into claims and scores the proportion unsupported, or the documentation states that the fallback is a lexical-overlap approximation and not a claims ratio. Which one is right is a product decision about the metric's contract, so I have not assumed one.

Discovered During

Found while verifying #281 — a sweep for metrics whose documented behaviour differs from their implementation, prompted by the same class of defect in ExactMatch (#225).

Suggested Fix

Unverified: if the lexical fallback is intentional, saying so in the docstring and in the metric description is the whole fix, and is worth doing regardless — a number labelled "hallucination rate" gets read as a claims rate by anyone comparing runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions