ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

概念 · 基于 AIF-C01

NLP and text-generation metrics

BLEU, ROUGE, BERTScore, semantic similarity and perplexity: what each compares and which need a reference text.

本课尚未翻译,暂以英文显示。

你在AI Practitioner中已学过

  • ROUGE fits summaries, BLEU fits translation and BERTScore compares meaning.
  • Perplexity needs no reference text, and lower is better.
阅读AI Practitioner课程
  • BLEU

    It counts
    Output n-grams found in reference
    Fits
    Translation
    Reference?
    Needed
  • ROUGE-N

    It counts
    Reference n-grams found in output
    Fits
    Summaries
    Reference?
    Needed
  • ROUGE-L

    It counts
    Longest shared word sequence
    Fits
    Summaries
    Reference?
    Needed
  • BERTScore

    It counts
    Token embedding similarity
    Fits
    Any text, paraphrase
    Reference?
    Needed
  • Semantic similarity

    It counts
    Whole-text embedding similarity
    Fits
    Any text, paraphrase
    Reference?
    Needed
  • Perplexity

    It counts
    How well the model predicts text
    Fits
    Comparing language models
    Reference?
    Not needed
Which metric fits, and whether it needs a reference.

1 / 3

  • BLEU

    It counts
    Output n-grams found in reference
    Fits
    Translation
    Reference?
    Needed
  • ROUGE-N

    It counts
    Reference n-grams found in output
    Fits
    Summaries
    Reference?
    Needed

2 / 3

  • ROUGE-L

    It counts
    Longest shared word sequence
    Fits
    Summaries
    Reference?
    Needed
  • BERTScore

    It counts
    Token embedding similarity
    Fits
    Any text, paraphrase
    Reference?
    Needed

3 / 3

  • Semantic similarity

    It counts
    Whole-text embedding similarity
    Fits
    Any text, paraphrase
    Reference?
    Needed
  • Perplexity

    It counts
    How well the model predicts text
    Fits
    Comparing language models
    Reference?
    Not needed
Which metric fits, and whether it needs a reference.
Model output
Embedding model
Cosine similarity
Reference text
  1. 1Embed the model output.
  2. 2Embed the reference text.
  3. 3Compare the two vectors. Close to 1 means similar meaning.
Semantic similarity embeds both texts and compares the vectors.

是什么

Most text metrics need a reference: a text a person wrote, which the output is compared with. Perplexity is the exception. None of these metrics judges facts, tone or helpfulness. Use a judge model or people for that.

是什么

BLEU is precision-oriented. It counts how many n-grams (groups of 1 to 4 words) of the output also appear in the reference, with a brevity penalty for short outputs. It was made for translation. ROUGE is recall-oriented: how much of the reference shows up in the output. ROUGE-N counts overlapping n-grams (ROUGE-1 single words, ROUGE-2 word pairs). ROUGE-L uses the longest common subsequence, so it rewards the same words in the same order. ROUGE was made for summaries.

是什么

Both reward matching words, so a good paraphrase scores low. BERTScore avoids that: it embeds each token with a BERT model, matches output and reference tokens by cosine similarity, and reports precision, recall and F1. Bedrock automatic evaluation uses BERTScore as the accuracy metric for summarization. Semantic similarity embeds the whole output and reference and takes the cosine similarity: near 1 means near in meaning. It is cheap and handles paraphrase, but can score high when one number or a “not” has changed.

是什么

Perplexity measures how surprised a language model is by a text: lower means it predicts the text better. It needs no reference and compares language models on the same text, but says nothing about whether an answer is right.

要记住

  • BLEU: n-gram precision plus brevity penalty. ROUGE-N: n-gram recall. ROUGE-L: longest common subsequence.
  • BERTScore and semantic similarity credit paraphrase.
  • Reference needed: all except perplexity.

考试中

  • “Score a machine translation against human translations” points to BLEU.
  • “Compare a summary with a reference and respect word order” points to ROUGE-L.
  • “A paraphrase should still score well” points to BERTScore or semantic similarity.
  • “Evaluate a language model with no reference answers” points to perplexity.