概念 · 基于 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.
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
| Metric | It counts | Fits | Reference? |
|---|---|---|---|
| BLEU | Output n-grams found in reference | Translation | Needed |
| ROUGE-N | Reference n-grams found in output | Summaries | Needed |
| ROUGE-L | Longest shared word sequence | Summaries | Needed |
| BERTScore | Token embedding similarity | Any text, paraphrase | Needed |
| Semantic similarity | Whole-text embedding similarity | Any text, paraphrase | Needed |
| Perplexity | How well the model predicts text | Comparing language models | Not needed |
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
| Metric | It counts | Fits | Reference? |
|---|---|---|---|
| BLEU | Output n-grams found in reference | Translation | Needed |
| ROUGE-N | Reference n-grams found in output | Summaries | 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
| Metric | It counts | Fits | Reference? |
|---|---|---|---|
| ROUGE-L | Longest shared word sequence | Summaries | Needed |
| BERTScore | Token embedding similarity | Any text, paraphrase | 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
| Metric | It counts | Fits | Reference? |
|---|---|---|---|
| Semantic similarity | Whole-text embedding similarity | Any text, paraphrase | Needed |
| Perplexity | How well the model predicts text | Comparing language models | Not needed |
- 1Embed the model output.
- 2Embed the reference text.
- 3Compare the two vectors. Close to 1 means similar meaning.
是什么
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.
别和这些弄混
- Evaluating traditional ML modelsPick the metric that matches the cost of a mistake, set the threshold, and split the data so the score is honest.
- LLM-as-a-judge and AI output assessmentChoose the judge model, write the rubric and rating scale, and check the judge against human ratings.
- Amazon Bedrock evaluationsSet up automatic, judge, human and RAG evaluation jobs in Amazon Bedrock, then compare the results.
本任务内容 · 2.3
- Experiment tracking: managed MLflow
- Amazon Bedrock evaluations
- Performance baselines and drift detection
- Shadow variants and A/B tests
- Explaining model outputs
- Debugging model convergence
- Evaluating traditional ML models
- NLP and text-generation metrics
- Human evaluation and human-in-the-loop
- LLM-as-a-judge and AI output assessment
- Evaluating RAG retrieval and answers