liveBook · Manning

ROUGE

As explained in LLMs in Production

ROUGE is a family of automatic evaluation metrics that measure lexical overlap between generated text and reference text, commonly for summarization.

Exact string matching is too rigid for generated text: two summaries can express the same idea with different wording or word order. ROUGE instead rewards lexical overlap between a prediction and a reference, making it especially useful for automatic summarization. section 4.2.1

ROUGE provides several overlap views:

  • ROUGE-N compares matching N-grams; larger overlap produces a higher score. section 4.2.1
  • ROUGE-L compares longest common subsequences, while skip-bigram variants preserve word order without requiring adjacency. section 4.2.1
Listing 4.1 Using ROUGE
from rouge_score import rouge_scorer

target = "The game 'The Legend of Zelda' follows the adventures of the \
    hero Link in the magical world of Hyrule."
prediction = "Link embarks on epic quests and battles evil forces to \
    save Princess Zelda and restore peace in the land of Hyrule."

scorer = rouge_scorer.RougeScorer(["rouge1", "rougeL"], use_stemmer=True)   #1
scores = scorer.score(target, prediction)
print(scores)
# {'rouge1': Score(precision=0.28571428, recall=0.31578947, fmeasure=0.3),
# 'rougeL': Score(precision=0.238095238, recall=0.26315789, fmeasure=0.25)}

A short Python example scores Zelda summaries with ROUGE-1 and ROUGE-L, reporting precision, recall, and F-measure. section 4.2.1

How LLMs in Production covers it

How deep it goes
Defines N-gram overlap and names ROUGE-L and skip-bigram variants without detailing their algorithms.
Examples
Uses Zelda summaries to illustrate ROUGE-1 and ROUGE-L precision, recall, and F-measure.
What it assumes
Assumes generated and reference text while motivating why exact equality is inadequate.
What you can do after
Apply it via the rouge_score Python library to score a target and prediction.
How it connects
Connects automatic summarization with N-grams, longest common subsequence, skip-bigrams, and BLEU.

Also explained in

Compare how 2 books explain ROUGE →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.