#2888·ragas

BleuScore evaluates only the first sentence (corpus_bleu reference structure bug)

Author: feiiiiii5Created Jul 25, 2026Updated Sep 23, 2026

Description

BleuScore._single_turn_ascore passes an incorrectly structured references argument to sacrebleu.corpus_bleu. It creates N reference streams of 1 segment each instead of 1 stream of N segments:

python
reference = [[reference] for reference in reference_sentences]  # WRONG: N streams × 1 seg

sacrebleu internally uses zip(hypotheses, *references). With N streams each containing 1 element, zip truncates at length 1 → only the first sentence is ever evaluated, all subsequent sentences are silently discarded.

Reproduction

python
from sacrebleu import corpus_bleu
ref = "The cat sat on the mat. It was a sunny day."
resp = "The cat sat on the mat. Dogs barked."  # only 1st sent matches

# BUG: score = 1.0 (only first sentence evaluated!)
ref_sents = ref.split(". ")
resp_sents = resp.split(". ")
corpus_bleu(resp_sents, [[r] for r in ref_sents]).score  # 100.0

# FIX: score ≈ 36 (full text evaluated correctly)
corpus_bleu([resp], [[ref]]).score  # 35.8

Fix

Remove the sentence-splitting logic and pass the full text as a single segment (consistent with ChrfScore in the same codebase):

python
score = self.corpus_bleu([response], [[reference]], **self.kwargs).score / 100

Applied to both src/ragas/metrics/_bleu_score.py and src/ragas/metrics/collections/_bleu_score.py.