heading_entity_recall / article_entity_recall return a perfect 1.0 for an empty golden entity set regardless of the candidate
eval/metrics.py:73-78 (heading_entity_recall) and the byte-identical block at eval/metrics.py:100-105 (article_entity_recall), branch NAACL-2024-code-backup:
def heading_entity_recall(golden_entities=None, predicted_entities=None,
golden_headings=None, predicted_headings=None):
...
g = set(golden_entities)
p = set(predicted_entities)
if len(g) == 0:
return 1
else:
return len(g.intersection(p)) / len(g)Both call sites feed this real ground truth, not synthetic data:
eval/eval_outline_quality.py:43—heading_entity_recall(golden_headings=gt_sections, predicted_headings=pred_sections)on human-written Wikipedia section headings such as "History" or "Overview," which commonly extract zero named entities via flair NER.eval/eval_article_quality.py:119-122—article_entity_recall(golden_entities=golden_answer_json['flair_entities'], predicted_article=llm_output)on a precomputed ground-truth entity list that can likewise be empty for a given article.
Whenever the golden entity set is empty, the function returns 1 before it ever inspects the predicted set — an empty reference vacuously passes any candidate, including an empty string.
What happens (reproduced on the real module)
On branch NAACL-2024-code-backup, heading_entity_recall (eval/metrics.py:73-78) and article_entity_recall (eval/metrics.py:100-105) return a vacuous 1.0 whenever the golden entity/heading set is empty, without checking whether the predicted set is also empty. The sibling heading_soft_recall in the same file guards on the predicted side and returns 0 when the predicted set is empty.
Both real call sites feed this unguarded:
eval_outline_quality.py:43passes raw Wikipedia section headings.eval_article_quality.py:119-122passes precomputed flair entity lists.
Both average the per-topic score straight into the reported aggregate, so any dataset with entity-sparse ground truth silently inflates the composite entity-recall number.
eval_article_quality.py's main loop also contains a leftover pdb.set_trace() breakpoint. The PR would remove it alongside the guard fix.
Happy to open the PR.
Source: stanford-oval/storm