Bird
Raised Fist0
NLPml~8 mins

Extractive summarization in NLP - Model Metrics & Evaluation

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Metrics & Evaluation - Extractive summarization
Which metric matters for extractive summarization and WHY

For extractive summarization, ROUGE scores are the most important metrics. ROUGE compares the overlap of words or phrases between the model's summary and a human-written summary. It tells us how much the model's output matches the important parts of the original text.

Specifically, ROUGE-1 measures overlap of single words, ROUGE-2 measures overlap of two-word pairs, and ROUGE-L measures longest common subsequence. These help us see if the summary captures key content accurately.

Accuracy or precision alone are less useful because summarization is about content coverage and relevance, not just classification correctness.

Confusion matrix or equivalent visualization

Extractive summarization does not use a confusion matrix like classification. Instead, we visualize overlap with ROUGE scores.

Reference summary: "The cat sat on the mat."
Model summary:     "Cat sat on mat."

ROUGE-1 (unigram overlap): 4/5 words matched = 0.8
ROUGE-2 (bigram overlap): 3/4 pairs matched = 0.75
ROUGE-L (longest common subsequence): 4 words = 0.8
    

This shows how much the model summary matches the reference in simple terms.

Precision vs Recall tradeoff with examples

In extractive summarization, precision means how many words in the model summary are actually important (found in the reference). Recall means how many important words from the reference summary the model captured.

High precision but low recall means the summary is very accurate but misses many key points (too short or incomplete). High recall but low precision means the summary covers many key points but also includes irrelevant info (too long or noisy).

Example:

  • High precision, low recall: Model summary "Cat sat." (only important words, but misses "on the mat")
  • High recall, low precision: Model summary "The cat sat on the mat and played." (covers all key words but adds extra)

Good summaries balance precision and recall for clear, concise, and complete content.

What "good" vs "bad" metric values look like for extractive summarization

Good ROUGE scores are typically above 0.5 for ROUGE-1 and ROUGE-L in simple datasets, showing strong overlap with human summaries.

Bad scores are below 0.3, indicating poor content coverage or irrelevant summaries.

Example:

  • Good: ROUGE-1 = 0.65, ROUGE-2 = 0.55, ROUGE-L = 0.60
  • Bad: ROUGE-1 = 0.25, ROUGE-2 = 0.10, ROUGE-L = 0.20

Higher scores mean the summary better matches important content from the original text.

Common pitfalls in metrics for extractive summarization
  • Overfitting: Model memorizes training summaries, scoring high on ROUGE but failing on new texts.
  • Data leakage: Using test summaries during training inflates ROUGE scores falsely.
  • Ignoring summary length: Very short summaries can get high precision but miss content (low recall).
  • ROUGE limitations: ROUGE measures overlap but not readability or coherence.
  • Accuracy paradox: High accuracy on trivial summaries doesn't mean good summarization.
Self-check question

Your extractive summarization model has a ROUGE-1 score of 0.85 but a ROUGE-2 score of 0.30. Is this good? Why or why not?

Answer: This means the model captures many important single words (high ROUGE-1) but struggles with word pairs or phrase structure (low ROUGE-2). It may produce summaries with correct words but poor flow or missing key phrases. So, it is partially good but needs improvement in capturing meaningful word sequences.

Key Result
ROUGE scores (especially ROUGE-1 and ROUGE-2) best measure extractive summarization quality by showing word and phrase overlap with human summaries.

Practice

(1/5)
1. What is the main goal of extractive summarization in NLP?
easy
A. To translate the text into another language
B. To rewrite the text using simpler words
C. To select important sentences from the original text to create a summary
D. To generate new sentences that explain the text

Solution

  1. Step 1: Understand extractive summarization

    Extractive summarization picks key sentences directly from the original text without changing them.
  2. Step 2: Compare options

    Only To select important sentences from the original text to create a summary describes selecting important sentences from the original text, which matches extractive summarization.
  3. Final Answer:

    To select important sentences from the original text to create a summary -> Option C
  4. Quick Check:

    Extractive summarization = selecting key sentences [OK]
Hint: Extractive means picking from original text directly [OK]
Common Mistakes:
  • Confusing extractive with abstractive summarization
  • Thinking it rewrites or translates text
  • Assuming it generates new sentences
2. Which of the following is a common technique used in extractive summarization?
easy
A. Neural machine translation
B. Text generation with GPT
C. Part-of-speech tagging
D. TF-IDF scoring of sentences

Solution

  1. Step 1: Identify techniques for extractive summarization

    Extractive summarization often uses TF-IDF to score sentences by importance based on word frequency.
  2. Step 2: Eliminate unrelated options

    Neural machine translation and text generation are for other NLP tasks, and POS tagging is not directly used for summarization scoring.
  3. Final Answer:

    TF-IDF scoring of sentences -> Option D
  4. Quick Check:

    TF-IDF = common extractive technique [OK]
Hint: TF-IDF ranks sentence importance in extractive summarization [OK]
Common Mistakes:
  • Confusing summarization with translation or generation
  • Thinking POS tagging directly creates summaries
  • Ignoring TF-IDF's role in scoring
3. Given the following Python code snippet using TF-IDF for extractive summarization, what will be the output?
from sklearn.feature_extraction.text import TfidfVectorizer

texts = ["Cats are great pets.", "Dogs are loyal animals.", "Cats and dogs can live together."]
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(texts)
scores = X.sum(axis=1)
print(scores)
medium
A. [[0.0], [0.0], [0.0]]
B. [[2.0], [2.0], [2.4]]
C. [[2.0], [2.0], [3.0]]
D. [[1.0], [1.0], [1.0]]

Solution

  1. Step 1: Understand TF-IDF vectorization and summing

    The code vectorizes three sentences and sums TF-IDF scores per sentence (row-wise sum).
  2. Step 2: Calculate approximate sums

    Each sentence has TF-IDF scores summing roughly to 2.0, 2.0, and 2.4 respectively due to shared and unique words.
  3. Final Answer:

    [[2.0], [2.0], [2.4]] -> Option B
  4. Quick Check:

    Sum TF-IDF per sentence ≈ [[2.0], [2.0], [2.4]] [OK]
Hint: Sum TF-IDF scores per sentence to get importance [OK]
Common Mistakes:
  • Assuming zero scores for all sentences
  • Confusing sum with average
  • Misunderstanding TF-IDF output shape
4. You have this extractive summarization code snippet:
sentences = ["AI is fascinating.", "It helps solve problems.", "AI can learn from data."]
scores = [0.8, 0.9, 0.85]
summary = []
for i in range(len(sentences)):
    if scores[i] > 0.85:
        summary.append(sentences[i])
print(summary)
What is the output and is there any bug?
medium
A. ['It helps solve problems.'] with no bug
B. ['AI is fascinating.', 'It helps solve problems.', 'AI can learn from data.'] with no bug
C. ['It helps solve problems.', 'AI can learn from data.'] but index error bug
D. [] because scores are not compared correctly

Solution

  1. Step 1: Check score filtering condition

    The code adds sentences with scores > 0.85, so sentences with 0.9 and 0.85 are checked; 0.85 is not > 0.85, so only 0.9 and 0.85 fail or pass accordingly.
  2. Step 2: Determine which sentences are included

    Scores: 0.8 (no), 0.9 (yes), 0.85 (no). So only "It helps solve problems." is included. But 0.85 is not > 0.85, so excluded.
  3. Final Answer:

    ['It helps solve problems.'] -> Option A
  4. Quick Check:

    Scores > 0.85 filter sentences correctly [OK]
Hint: Check strict > vs >= in score filtering [OK]
Common Mistakes:
  • Including sentences with score equal to threshold
  • Expecting index errors where none exist
  • Misreading the comparison operator
5. You want to create an extractive summarizer that picks the top 2 sentences from a document based on TF-IDF scores. Given these sentences and their scores:
sentences = ["Machine learning is fun.", "It allows computers to learn.", "Summarization helps understand text.", "TF-IDF ranks sentence importance."]
scores = [0.7, 0.9, 0.6, 0.8]
Which two sentences should your summarizer select?
hard
A. ["It allows computers to learn.", "TF-IDF ranks sentence importance."]
B. ["Machine learning is fun.", "Summarization helps understand text."]
C. ["Summarization helps understand text.", "TF-IDF ranks sentence importance."]
D. ["Machine learning is fun.", "It allows computers to learn."]

Solution

  1. Step 1: Identify top 2 scores

    The scores are 0.7, 0.9, 0.6, 0.8. The top two are 0.9 and 0.8.
  2. Step 2: Match scores to sentences

    0.9 corresponds to "It allows computers to learn.", 0.8 corresponds to "TF-IDF ranks sentence importance.".
  3. Final Answer:

    ["It allows computers to learn.", "TF-IDF ranks sentence importance."] -> Option A
  4. Quick Check:

    Top 2 scores = 0.9 and 0.8 sentences [OK]
Hint: Pick sentences with highest TF-IDF scores [OK]
Common Mistakes:
  • Choosing sentences with lower scores
  • Mixing up sentence-score pairs
  • Selecting more or fewer than top 2