Skip to main content
Natural Language Processing

Text Summarization

Published: 2026-08-16
Level: postgraduate
Audience: Postgraduate students in Natural Language Processing

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • TF-IDF (Term Frequency–Inverse Document Frequency) — covered in Lecture 2 (sections 2.7–2.12). This lecture applies TF-IDF to sentence scoring for extractive summarization.
  • Cosine Similarity — covered in Lecture 2 (section 2.9). Used extensively in this lecture for measuring sentence similarity in PageRank and MMR.
  • Word Embeddings and Semantic Vectors — covered in Lectures 2–4. Sentence transformers build on these to produce sentence-level embeddings for summarization.

15.1 Introduction to Text Summarization

15.1.1 What Is Text Summarization

Imagine waking up to 150 unread emails, a 60-page industry report, and transcripts from three meetings you missed. You need the core facts, the main arguments, and the final decisions — and you need them now. That is the TL;DR (Too Long; Didn't Read) problem that text summarization solves.

Text summarization is the process of producing an abridged (shortened) version of a text while strictly retaining the key, relevant information. It is one of the most practically impactful applications of NLP because it directly addresses information overload — the situation where the volume of available text far exceeds what a person can read in the available time.

The challenge, though it appears simple at first glance, is substantial for machines. Humans read a 400-page novel and can explain the plot to a friend in three minutes — we naturally identify what matters and discard the rest. For a computer, automatically identifying the most important information in a text and expressing it in a coherent, concise format requires solving several hard problems simultaneously: understanding what the text is about, judging what a reader would consider important, and generating (or selecting) language that captures that importance concisely.

Think of text summarization like being a movie critic. A critic watches a two-hour film and writes a 200-word review that captures the plot, the performances, and whether it is worth watching. They must decide what to keep (the main storyline), what to drop (the irrelevant side plots), and how to express it all in a way that is both accurate and readable. Text summarization automates this exact skill.

Text summarization has wide-ranging real-world applications:

  • Email summarization condenses long email threads into the key points and action items, saving professionals from reading dozens of back-and-forth messages.
  • Minutes-of-meeting summarization captures action items and decisions from lengthy discussions that might last hours.
  • Research paper summarization helps researchers quickly assess whether a paper is relevant to their work, often by generating a short abstract or title.
  • Customer complaint summarization extracts the core issues from batches of feedback, helping support teams prioritize and respond.
  • Search engine snippets — when you search on Google, the short 26-word description under each result is itself a tiny extractive summary of the target page.
  • News aggregation — apps that condense daily news into a 5-minute digest are performing multi-document summarization.

The professor emphasized that these examples span healthcare, finance, search, and many other domains, making text summarization a universally relevant NLP task.

Scope: Text summarization is not the same as keyword extraction or topic modeling. Keyword extraction pulls out important terms (e.g., "climate change, policy, carbon tax") but does not produce readable prose. Topic modeling clusters documents by theme but does not summarize individual documents. Summarization produces coherent, readable text that conveys the essence of the original.

15.1.2 Industry Experience Discussion

During an opening discussion, students shared their real-world experience with text summarization, providing concrete illustrations of the concepts discussed above.

Q: What does text summarization look like in production systems? A: Two students described live production systems. One in healthcare (at Optum) uses a multi-agent workflow to process monitoring alerts: each agent summarizes alerts from its own tool, and a downstream agent consolidates these into a root cause analysis — using GPT-5 via enterprise API. Another in financial asset management converts numerical product performance data into natural language and then summarizes it into one-page reports for salespeople. Both systems face real trade-offs between cost, accuracy, and privacy.

Healthcare alert monitoring: One student described a multi-agent workflow system in the healthcare domain that processes monitoring alerts from multiple tools. Each agent provides a brief summary of its alerts, and a downstream agent consolidates these into a root cause analysis. This system uses OpenAI's GPT-5 via an enterprise license, with data grounded within the organization for privacy. Key challenges include:

  • Cost: Token-based pricing applies even with enterprise licenses, and the volume of alerts can make this expensive.
  • Hallucinations: The system occasionally attributes one tool's alert root cause to another tool — a dangerous error in healthcare monitoring where misdiagnosis of system failures could have real consequences.
  • Accuracy: While imperfect, the system still outperforms the previous manual process in both speed and consistency.

Financial asset management: Another student described working in a domain where numerical performance data across products is converted into natural language and then summarized into one-page reports that salespeople use when meeting clients. The system uses prompt caching for token optimization (reusing cached prompt prefixes across similar queries to reduce API costs) and processes millions of numerical data points into coherent narratives.

Key engineering principle: When designing any NLP system, one must constantly evaluate trade-offs between cost, accuracy, scalability, and efficiency. If an inexpensive method achieves comparable accuracy, organizations will prefer it over expensive LLM-based solutions. This principle — "prefer the simplest method that meets your requirements" — is the guiding theme of this entire lecture.

Real-world domain connection: These student examples illustrate that text summarization is not an academic exercise — it is a production-grade capability deployed in healthcare monitoring (root cause analysis), financial reporting (narrative generation from numerical data), and many other industries. The choice of summarization method (rule-based, extractive, abstractive, or LLM-based) depends on the specific constraints of the domain: privacy requirements, cost budgets, accuracy thresholds, and the nature of the input data (text vs. numerical vs. multimodal).

15.2 Types of Text Summarization

Before building a summarizer, you need to decide what kind of summary you want. The same document could yield very different summaries depending on the choices made along four dimensions: input scope, output style, focus, and learning approach. Understanding this taxonomy is the first step in designing any summarization system.

Text summarization can be classified along several dimensions. Each dimension represents a design choice that affects the algorithm, the data requirements, and the quality of the output.

15.2.1 By Input Scope: Single-Document vs. Multi-Document

Single-document summarization takes a single input — one PDF, one email, one customer review, one research paper — and produces a summary. The output can range from a short abstract of roughly 200 words to a single-sentence heading or title. Generating a good title for a research paper, for instance, is itself a summarization task: the title must capture the key contribution of the paper in very few words. The shorter the required summary, the harder the task, because every word must count.

A surprisingly strong baseline for single-document news summarization is simply extracting the very first sentence — in news writing, the first sentence often contains the most important information (the "inverted pyramid" style).

Multi-document summarization takes a group of documents on the same topic and produces a unified summary. A typical use case: "For all research papers in area X, give me a summary." The system must first identify the top-K relevant documents from the collection, then extract the most important sentences across those documents while managing redundancy — because multiple documents may express the same information using different wording.

Scope: Multi-document summarization is substantially harder than single-document summarization because of three additional challenges: (1) cross-document redundancy removal (the same fact appears in multiple documents with different wording), (2) contradictory information (different documents may give conflicting accounts of the same event), and (3) information ordering (when sentences come from different documents, their original positions are not directly comparable for ordering purposes).

15.2.2 By Output Style: Extractive vs. Abstractive

This is the most important design dimension and the one the professor emphasized most heavily.

The Highlighter vs. The Pen analogy: Extractive summarization is like giving a student a yellow highlighter — they must read a textbook and highlight the most important sentences. The final summary consists only of exact sentences lifted directly from the original text. No new words are invented. Abstractive summarization is like giving a student a blank piece of paper and a pen — they read the textbook, close it, and write down the summary in their own words, potentially using vocabulary that never appeared in the original text.

Extractive summarization selects sentences, phrases, or paragraphs directly from the input text. The system does not generate new language; it identifies and extracts existing content. For example, given a news article about flooding, an extractive summary would reproduce exact sentences like "Several roads were flooded" verbatim from the source.

Abstractive summarization generates new language that may not appear verbatim in the source. Words can be added, deleted, reordered, or paraphrased — much like how a human would describe a movie review using their own words rather than quoting the script. Abstractive summaries read more naturally and can capture information spread across multiple sentences into a single concise expression.

The key trade-offs:

Dimension Extractive Abstractive
Implementation difficulty Significantly easier Substantially harder — must generate coherent prose from scratch
Accuracy / faithfulness Higher — uses exact sentences from source, immune to hallucination Lower risk of generating inaccurate statements not grounded in the source
Fluency Less fluent — may have awkward transitions between extracted sentences More human-like, reads naturally
Sentence ordering Easier — preserves original ordering from source Harder — must generate coherent ordering from scratch
Industry adoption More popularly used for good-enough accuracy with far less complexity Growing with LLMs but requires more computation and cost

A practical strategy that many production systems use combines both: use extractive methods first to identify the most important sentences, then use an LLM to paraphrase and polish those extracted sentences into more fluent abstractive prose. This layered approach gives the reliability of extractive selection with the readability of abstractive generation, though it consumes more computational resources and cost.

15.2.3 By Focus: Query-Focused vs. Generic

Generic summarization summarizes the entire content of a document without any specific user query. "Summarize this research paper" is a generic task — the system must decide what is important across the whole document. This is what most people think of when they hear "text summarization."

Query-focused summarization (also called focused summarization or topic-based summarization) targets a specific topic or question. The summary must capture information relevant to the query keywords, ignoring text that does not answer the prompt. For example: "From my emails, extract all those where students have shown interest in MTech or PhD research" is query-focused — the system must filter for relevance to the specific topic of student interest in research programs.

Similarly, complex question answering over documents — such as asking about the efficacy of a specific medical treatment for a given age group and health condition — is a form of query-focused text summarization. The system acts as a focused answer builder, knitting together relevant text segments into a coherent response.

Both types can combine with single-document or multi-document settings, yielding four possible combinations:

Single-Document Multi-Document
Generic Summarize one paper Summarize all papers on a topic
Query-Focused Answer a question from one document Answer a question from many documents

15.2.4 By Learning Approach: Supervised vs. Unsupervised

Supervised approaches require labeled training data — pairs of (document, summary). The model learns from these pairs to generate summaries for unseen documents. Any supervised method (neural networks, LSTMs, transformers, traditional classification) requires this labeled data. The quality of the summary depends heavily on the quality and quantity of the training data.

Unsupervised approaches work without labeled data. They use only the input document(s) and apply statistical or graph-based techniques to extract important content. These are cheaper to deploy and often competitive with supervised methods for extractive summarization. TF-IDF and PageRank (covered in sections 15.4 and 15.5) are the two primary unsupervised methods discussed in this lecture.

When to pick which: Unsupervised methods are the default starting point for extractive summarization — they require no labeled data, are interpretable, and often perform competitively. Supervised methods are needed when you want abstractive output or when unsupervised performance is inadequate for your domain. LLM-based methods are the simplest to implement but operate as black boxes with higher cost and hallucination risk.

15.3 The Text Summarization Pipeline

Regardless of the specific approach — whether rule-based, machine learning, or agentic AI — text summarization systems typically follow the same three-stage pipeline. Understanding this pipeline is essential because it separates the problem into manageable sub-problems, each of which can be solved independently and improved over time.

The three stages are: Content Selection (what to include), Sentence Ordering (how to arrange it), and Sentence Realization (how to clean it up). The professor described these using a "Three-Act Play" metaphor: Act 1 decides who makes the cut, Act 2 tells a coherent story, and Act 3 polishes the diamond.

15.3.1 Content Selection

Content selection identifies which sentences (or words, phrases, paragraphs) should be part of the summary. This is the most critical step — if the wrong sentences are selected, no amount of post-processing can salvage the summary.

The simplest approach works as follows:

  1. Fragment the document into sentences via sentence tokenization.
  2. Assign each sentence a weight based on relevance to the query (for query-focused summarization) or to the document's overall topic (for generic summarization).
  3. Rank the sentences by weight.
  4. Select the top-K sentences for the summary.

Various techniques exist for computing these weights, ranging from simple TF-IDF scoring (section 15.4) to graph-based PageRank (section 15.5) to supervised classification (section 15.6). The choice of weighting method is the primary differentiator between extractive summarization systems.

The connection to information retrieval (IR) is direct: content selection is fundamentally about retrieving the most relevant textual units from a large pool, which is the same core problem that search engines solve. A search engine retrieves documents; a summarizer retrieves sentences. The mathematical tools — TF-IDF, cosine similarity, ranking — are the same.

The granularity assumption: Most summarization systems treat the sentence as the basic unit of extraction. This is a simplification — sometimes the most important information is a phrase within a sentence, or it spans multiple sentences. But sentence-level extraction is a practical starting point that balances granularity with tractability.

15.3.2 Sentence Ordering

After selecting the best sentences, they must be arranged into a coherent, readable summary. Simply concatenating high-scoring sentences in arbitrary order produces gibberish — imagine a summary that starts with a conclusion, jumps to background context, and ends with a methodology detail.

The professor discussed several ordering strategies:

  • Original position ordering: Sentences occurring earlier in the source document appear earlier in the summary. A sentence from the first paragraph comes first; a sentence from the last paragraph comes last. This is the simplest heuristic and works well for single-document summarization of news articles (which follow the "inverted pyramid" structure where the most important information comes first).
  • Similarity-based clustering: Sentences with similar content are placed adjacent to each other, creating thematic coherence. This uses cosine similarity between sentence embeddings to group related sentences together.
  • Chronological/temporal ordering: If the text contains dates or time references, sentences can be ordered chronologically. This is natural for narrative texts, event timelines, and news coverage.
  • Domain-specific rules: Different domains have different natural orderings. For example, a biography summary should follow a life-chronology (birth → education → career → legacy), while a definition summary should follow genus → species → synonym → subtype. The professor provided a table of domain-specific templates:
Question Type Natural Information Flow
Biography Dates → Nationality → Education → Fame
Definition Genus → Species → Synonym → Subtype
Medical/Drug Population → Problem → Intervention → Outcome
  • Knowledge graph-based ordering: Using knowledge graphs to identify semantically related terms and ensure conceptually linked sentences are placed adjacent to each other.
  • Small language models for ordering: Tiny or edge-deployed language models can be trained specifically for the sentence-ordering task — feed them the selected sentences and let the model output the optimal order. This treats ordering as a separate, simpler sub-problem that a small model can handle, without needing a full LLM.

Scope: Multi-document query-focused summarization makes ordering particularly challenging. If the selected sentences come from five different documents with different original positions, the positional heuristic does not directly apply. Sentence A might appear first in document 1 while sentence B appears last in document 2 — the relative ordering between them is ambiguous without domain knowledge or a learned ordering model.

15.3.3 Sentence Realization (Cleaning)

The final stage cleans the assembled summary to produce polished, readable output. Extracted sentences are often too long, contain broken references, or have redundancies when placed side by side.

The cleaning operations include:

  1. Simplification (pruning): Strip out unnecessary clauses such as appositives, attribution clauses, and initial adverbials.
  • Original: "Rebels agreed to talks with government officials, international observers said Tuesday."
  • Pruned: "Rebels agreed to talks with government officials." (removed attribution clause)
  1. Coreference resolution (anaphora fixes): If an extracted sentence starts with "He" or "She," the reader will not know who is being referred to. The system must replace the pronoun with the full entity name.
  • Original: "He has immunity from prosecution..."
  • Fixed: "Gen. Augusto Pinochet has immunity from prosecution..."
  1. Deduplication: Removing duplicated sentences — even if worded differently, two sentences may convey the same information, and the summary has a length constraint.
  1. Coherence editing: Ensuring smooth transitions between sentences, resolving ordering issues discovered during combination, and performing general readability improvements.

Real-world analogy: Writing a high-quality article involves significant cleaning — rewriting sentences, removing redundancies, reordering paragraphs for better flow. A first draft is never the final draft. The same applies to automated summarization output: the raw extraction needs polishing before it is presentable to the end user.

For complex question-answering pipelines, the realization stage may also include named entity recognition (to ensure key entities are properly represented), regex-based guardrails (increasingly important in agentic AI systems to prevent unintended actions such as agents modifying databases), and rule-based coreference resolution.

15.4 Unsupervised Content Selection: TF-IDF Approach

The first unsupervised approach to content selection uses TF-IDF (Term Frequency–Inverse Document Frequency) to score and rank sentences. This method requires no labeled training data — it works purely from the statistical properties of the words in the document and the corpus. The intuition is simple: sentences that contain many words that are frequent in this document but rare elsewhere are likely to be the most informative.

The TF-IDF approach dates back to Hans Peter Luhn's pioneering work in 1958 at IBM. Luhn's insight was that the frequency of a word in a document, weighted by how rare that word is across the entire collection, is a strong signal of the word's importance. This idea remains one of the most widely used techniques in information retrieval and text summarization today.

15.4.1 Method

The TF-IDF content selection method proceeds in four steps:

  1. Compute TF-IDF for each word: For each word in each document in the corpus, compute its TF-IDF weight.
  2. Score each sentence: For each sentence in each document, compute the sentence weight as the sum of the TF-IDF scores of its constituent words.
  3. Rank all sentences: Sort sentences by their computed weights in descending order.
  4. Select top-K: The top-K scoring sentences form the extractive summary.

Two formulas for IDF:

The professor presented a simplified IDF formula for classroom illustration:

where is the total number of documents in the corpus and is the number of documents containing word .

The standard textbook form (as given in Jurafsky & Martin, eq. 23.10) uses a logarithmic scaling:

The log function compresses the range of IDF values so that extremely rare words do not dominate. The professor's simplified ratio gives integer values that are easier to work with in hand calculations, which is why it was used for the worked example. In practice and in standard textbook treatments, the log version is used. We show both versions in the worked example below.

The full TF-IDF weight for word in document is then:

where is the term frequency of in document (typically a simple count or a normalized count).

For query-focused summarization, the computation focuses only on the query terms: a sentence receives a non-zero score only if it contains query words. For generic summarization, the computation considers all words, and topic words (words appearing in specific documents but not widely across the corpus) naturally receive higher TF-IDF scores.

Q: Why are we computing TF-IDF on words rather than directly on sentences? A: Computing TF-IDF directly on sentences is not practical because words appear in different orders across sentences, making direct sentence-level frequency comparison meaningless. The standard approach is to compute TF-IDF at the word level first, then aggregate up to the sentence level by summing the word scores. Contextual word embeddings (from models like BERT or sentence transformers) can compare sentences directly by capturing semantic similarity rather than lexical overlap, but embeddings give a relative comparison among sentences rather than an absolute importance score for each sentence.

15.4.2 Worked Example: TF-IDF Content Selection

Consider a toy corpus with three documents:

  • Document 1 (D1): Contains three sentences, one of which is "AI improves diagnosis"
  • Document 2 (D2): Contains one sentence: "AI is transforming education"
  • Document 3 (D3): Contains one sentence: "AI is transforming agriculture"

The query is "AI diagnosis".

Step 1: Compute TF for each query word in each document.

The TF here is computed as simple counts (not normalized by document length, for simplicity in this toy example):

Word D1 D2 D3
"AI" 3 1 1
"diagnosis" 1 0 0

Step 2: Compute IDF for each query word.

Using the professor's simplified ratio:

  • "AI": appears in all 3 documents → → IDF = 3/3 = 1
  • "diagnosis": appears in only 1 document → → IDF = 3/1 = 3

Notation note: The standard textbook IDF uses . With log base 10:

  • IDF("AI") =
  • IDF("diagnosis") =

Under the log version, words appearing in every document receive an IDF of 0, meaning they contribute nothing to the sentence score. This is mathematically correct — a word that appears everywhere carries no discriminative power. The professor's simplified ratio avoids the zero-score issue for classroom illustration by using instead of .

Step 3: Compute TF-IDF for each query word in D1.

Using the professor's simplified IDF (ratio form):

  • TF-IDF("AI") in D1 =
  • TF-IDF("diagnosis") in D1 =

Using the standard log-based IDF:

  • TF-IDF("AI") in D1 =
  • TF-IDF("diagnosis") in D1 =

The value 0.48 that was stated in the lecture corresponds to the log-based computation: .

Step 4: Score each sentence.

For each sentence, sum the TF-IDF values of the query words it contains.

Using the professor's simplified form:

  • The sentence "AI improves diagnosis" in D1 contains both "AI" and "diagnosis": score = 3 + 3 = 6 (highest)
  • Sentences in D2 ("AI is transforming education") contain only "AI": score = 1 × 1 = 1
  • Sentences in D3 ("AI is transforming agriculture") contain only "AI": score = 1 × 1 = 1
  • Sentences containing neither query word receive a score of 0.

Using the standard log-based form:

  • "AI improves diagnosis" in D1: score = 0 + 0.48 = 0.48 (highest)
  • Sentences in D2 and D3: score = 1 × 0 = 0

Under both formulations, the ranking is the same: "AI improves diagnosis" ranks first.

Result: The sentence "AI improves diagnosis" is selected as the top-ranked sentence for the summary, since it captures both query terms and has the highest cumulative TF-IDF score.

Key insight from the example: If a generic (non-query-focused) summarization were performed instead, the word "education" in D2 and "agriculture" in D3 are also rare across the corpus (appearing in only one document each), so they would receive high IDF scores similar to "diagnosis." Sentences containing these words would then also rank highly, and the summary might include "AI is transforming education" and "AI is transforming agriculture" alongside "AI improves diagnosis." The query focus naturally narrows the selection by restricting attention to query-relevant terms.

15.4.3 Limitations of TF-IDF for Summarization

Scope and assumptions: TF-IDF has several important limitations that constrain when it is the right tool:

  • TF-IDF operates at the word level and does not capture word order or sentence structure. The sentences "the dog bit the man" and "the man bit the dog" have identical TF-IDF profiles despite having very different meanings.
  • It can miss semantically important sentences that use different vocabulary to express the same idea as the query (the synonymy problem from information retrieval).
  • For generic summarization, TF-IDF may select sentences that contain rare words but are not actually the most informative for the overall document.
  • The method treats all words independently — it cannot capture multi-word expressions or phrases that carry meaning beyond their individual components.

Despite these limitations, TF-IDF remains popular for content selection due to its simplicity, interpretability, zero training cost, and surprisingly competitive performance. It is often the first baseline to try before moving to more complex methods.

15.5 Unsupervised Content Selection: Graph-Based Approach (PageRank)

The second unsupervised approach models the document as a graph and applies the PageRank algorithm — originally designed by Larry Page and Sergey Brin for ranking web pages in internet search (Google, 1998) — to identify the most important sentences. The key insight is that a sentence that is semantically similar to many other sentences in the document is likely to be a "central" or "representative" sentence, and therefore a good candidate for the summary.

The Cocktail Party analogy: Imagine every sentence in a document is a person at a cocktail party. People (sentences) "talk" to each other if they share similar words or ideas. If one person's ideas are agreed with by almost everyone else at the party, that person is the most central figure — the one whose views best represent the group. PageRank identifies exactly this kind of centrality in a network of sentences.

15.5.1 Method

The graph-based approach proceeds through these steps:

  1. Sentence splitting: Fragment the document into individual sentences.
  2. Vector representation: Convert each sentence into a vector representation. This can use sparse TF-IDF vectors or dense contextual word embeddings. For contextual embeddings, a sentence transformer (a neural network that produces a fixed-size vector for any input sentence) computes word embeddings for each word in the sentence and then combines them — typically by averaging across dimensions or taking the element-wise maximum — to produce a single sentence embedding .
  3. Pairwise similarity: Compute the cosine similarity between every pair of sentence vectors. This produces a symmetric similarity matrix where entry represents how similar sentence is to sentence :

The cosine similarity ranges from 0 (no overlap) to 1 (identical). The diagonal entries (self-similarity = 1) are ignored.

  1. Graph construction: Treat each sentence as a node. Create an edge between sentence pairs whose cosine similarity exceeds a chosen threshold (e.g., 0.05). Pairs below the threshold are not connected — this prevents weakly related sentences from influencing each other's PageRank scores.
  2. PageRank computation: Run the PageRank algorithm on the constructed graph to rank sentences by their centrality.
  3. Sentence selection: Select the top-K ranked sentences for the summary.

15.5.2 Worked Example: Graph-Based Summarization

Consider a document with five sentences, each represented as a 5-dimensional sentence embedding vector (in practice, the dimensionality would be much higher; 5 dimensions is used here for illustration).

Step 1: Sentence embeddings — each sentence is represented as a vector in .

Step 2: Cosine similarity matrix — computing cosine similarities between all pairs of sentence vectors yields:

S1 S2 S3 S4 S5
S1 1.00 0.72 0.65 ... ...
S2 0.72 1.00 ... ... 0.01
S3 0.65 ... 1.00 ... ...
S4 ... ... ... 1.00 ...
S5 ... 0.01 ... ... 1.00

The diagonal entries (self-similarity) are ignored. The matrix is symmetric because .

Step 3: Graph construction with threshold — using a threshold of 0.05, any edge with cosine similarity below 0.05 is omitted. For instance, the S2–S5 edge (similarity 0.01) is not created, while the S1–S2 edge (similarity 0.72) is retained. This threshold controls the graph's connectivity: a lower threshold creates more edges (denser graph); a higher threshold creates fewer edges (sparser graph).

Step 4: PageRank computation — with a standard damping factor of , and initial equal PageRank scores of 0.2 for each of the five sentences, the algorithm iterates until convergence. After convergence, sentence S3 achieves the highest PageRank score because it is connected to the most other sentences by high-similarity edges, making it the most "central" sentence in the document's semantic graph.

Result: S3 is selected as the top-ranked sentence for the summary. If K=2, the two highest-scoring sentences are selected. The generated summary is sensible and non-redundant because the PageRank approach inherently favors sentences that are broadly representative of the document's content.

15.5.3 Understanding the PageRank Formula

Q: Can you explain the PageRank formula? How is the PageRank calculated? A: The standard PageRank formula uses a damping factor. Initially, all sentences have equal PageRank scores. With 5 sentences, each starts at 0.2. The formula applies the damping factor and computes contributions from linked neighbors using edge weights. For S1 connected to S2 and S3, you substitute the damping factor and edge weights. For S2 connected to S1, S3, and S4, you do the same with those edges. Each iteration updates all scores simultaneously. You can stop after a fixed number of iterations (3 or 4) or when values converge and stop changing, similar to gradient descent.

The standard (unweighted) PageRank formula:

where:

  • is the damping factor (the probability that a random walker follows an edge rather than jumping to a random node)
  • is the set of sentences that have edges pointing to
  • is the number of edges going out from (the out-degree)
  • is the PageRank score of sentence from the previous iteration

The damping factor means that at each step, there is an 85% chance the algorithm follows the graph structure and a 15% chance it "teleports" to a random sentence. This prevents the algorithm from getting trapped in dead-end nodes or cycles.

The professor's weighted variant:

The professor described a version where edge weights (cosine similarities) are incorporated directly into the formula:

where is the cosine similarity (edge weight) between sentences and .

In this weighted variant, the denominator normalization can be handled in different ways. The professor's verbal description — "you take the page rank value, apply the damping factor, take the weight values WJI for whatever edges are connected, compute the total in the denominator" — suggests a formula where the weighted contributions are normalized by the sum of outgoing edge weights from :

This normalization ensures that the contributions from each node sum to 1 (after weighting), preserving the probabilistic interpretation. In the unweighted case, is simply the count of outgoing edges; in the weighted case, the denominator becomes the sum of outgoing edge weights.

Initialization: All sentences start with equal PageRank scores. With 5 sentences, the initial score for each is:

Iteration 1: For each sentence , the new PageRank is computed by summing contributions from linked neighbors. For example, S1 is connected to S2 and S3 (but not S4 or S5). The computation uses only the edges that exist — if S1 is not linked to S5 and S4, those contributions are zero.

Subsequent iterations: Each iteration updates all PageRank scores simultaneously using the previous iteration's values. Convergence is reached when scores stabilize (change less than a threshold, e.g., ) or after a fixed number of iterations — analogous to the stopping condition in gradient descent.

15.5.4 Trade-offs of Graph-Based Summarization

Scope — When graph-based summarization works well and when it does not:

Advantages:

  • Fully unsupervised — no labeled training data is required, eliminating labeling costs entirely.
  • No expensive LLM calls, reducing both financial cost and carbon footprint.
  • Works well for domain-specific or query-focused summarization of small to moderate document collections.
  • Captures document-level semantic structure that word-frequency methods like TF-IDF miss.

Limitations:

  • May not generalize well across diverse domains — performance can degrade on out-of-domain data where the similarity threshold may need retuning.
  • For large-scale, domain-agnostic summarization, more advanced models may be needed.
  • The threshold for graph construction is a hyperparameter that affects the graph structure and, consequently, the results. Too low a threshold connects everything; too high a threshold isolates sentences.
  • Cosine similarity between TF-IDF vectors does not capture synonymy — two sentences using different words for the same concept will appear dissimilar.

Pedagogical observation: The PageRank algorithm was originally a simple ranking algorithm for internet search engines — it ranked web pages by how many other pages linked to them. Its application to text summarization (often called LexRank) demonstrates how fundamental algorithms can be repurposed effectively for different real-world applications. The underlying math is identical; only the meaning of "nodes" and "edges" changes from web pages and hyperlinks to sentences and semantic similarity.

15.6 Supervised Content Selection

Supervised methods for content selection require labeled training data — pairs of (document, summary) — from which the model learns to identify which sentences belong in a summary. The professor posed this as an open discussion to the class, eliciting several approaches that span the spectrum from classical machine learning to modern LLMs.

15.6.1 Discussion: How Would You Implement Supervised Summarization?

Q: How would you implement supervised summarization using a sequence model? A: You can use an LSTM-based encoder-decoder model, analogous to machine translation. The encoder reads the source document and produces a fixed-size hidden representation (a "thought vector" that compresses the document's meaning). The decoder generates the summary token by token, using attention to focus on relevant parts of the source at each step. This requires labeled (document, summary) pairs for training and teacher forcing during training (feeding the correct previous token to the decoder at each step rather than its own prediction, to stabilize learning).

Q: If you train an encoder-decoder on medical data, will it work on legal data? A: No. Domain adaptation requires fine-tuning or retraining some parameters for the target domain. A model trained on medical data learns the vocabulary, sentence structure, and importance patterns specific to medical texts. It will not automatically generalize to legal data, which has different terminology, different document structures, and different criteria for what is important. This is a fundamental limitation of supervised approaches: they are only as good as the domain they were trained on.

Q: How would you do text summarization using LLMs? A: You can directly send the text to an LLM and ask it to summarize via prompting. The professor compared this to using a calculator — you get the answer but do not see the internal computation. The advantage is ease of use; the disadvantage is lack of interpretability (you cannot explain why certain information was included or excluded), high cost (token-based pricing), and risk of hallucination (the LLM might generate statements not grounded in the source document).

Q: Can you use classification algorithms for text summarization? A: Yes. A classical ML approach frames summarization as a binary classification problem: for each sentence in the document, predict whether it should be included in the summary (yes/no) based on a set of extracted features. This is one of the most well-studied approaches in the summarization literature.

The features used for binary classification include:

  • Position in the document: First sentences are often important (in news articles, the most extract-worthy sentence is typically the title, followed by the first sentence of paragraph 2, then paragraph 3).
  • Length of the sentence: Very short sentences (fewer than 5 words) are rarely useful in a summary.
  • Amount of information carried: Measured by TF-IDF weight or log-likelihood ratio score — sentences with more "salient" words carry more information.
  • Degree of redundancy with other sentences: A sentence that is highly similar to already-selected sentences contributes less new information.
  • Whether the sentence contains key entities or topic words: Named entities (people, organizations, locations) and topic-specific terms are strong signals of importance.

During training, the model learns from labeled data which feature patterns correspond to "include in summary." During testing, each sentence's features are evaluated and the model outputs a binary decision (include or exclude).

RAG (Retrieval-Augmented Generation): One student suggested using RAG — creating abstracts of internal documents, building a knowledge tree of high-ranked branches, and feeding these to a small LLM with self-attention for text generation. The professor noted this was an interesting idea worth exploring but acknowledged uncertainty about how RAG would generate the relevant sentences for summarization specifically. A possible combination involves using knowledge graphs for abstractive summarization to generate coherent summaries related to the query, combined with RAG-based chunk retrieval, though this approach would be expensive.

15.6.2 Challenges of Supervised Approaches

Scope — When supervised summarization is viable and when it is not:

  1. Labeling cost: Creating high-quality (document, summary) pairs is expensive and time-consuming. For LLMs, training from scratch requires millions of tokens and billions of parameters (e.g., 175 billion parameters for GPT-scale models), necessitating massive GPU infrastructure (H100, H200, A100, or AMD servers) costing crores of investment.
  1. Alignment difficulty: The training data must not only contain documents and summaries but also alignment information — which sentences in the document correspond to which parts of the summary. Automatically generating this alignment is itself a challenging problem. The system must determine, for each sentence in the human-written summary, which sentence(s) in the source document it was derived from.
  1. Feature engineering: Classical ML approaches require manually engineered features (position, length, information content, redundancy). Deep learning approaches (transformers, LSTMs) capture these features implicitly through attention mechanisms, reducing the need for manual feature design.
  1. Competitive unsupervised performance: Unsupervised methods (TF-IDF, PageRank) often achieve performance at par with supervised approaches for extractive summarization. Given the cost and complexity advantages, unsupervised methods are frequently preferred in practical settings.

15.6.3 Industry Perspective on Classical ML vs. Deep Learning

A practical insight from industry: traditional ML models are still widely used in production for text summarization and other NLP tasks, even in the era of LLMs. The professor emphasized this point — it is not always the case that the most complex model is the best choice.

Why classical ML persists in industry:

  • Interpretability and explainability: Classical models (decision trees, logistic regression) make their decision criteria visible. A decision tree can show exactly which features led to a sentence being included in the summary. This visibility is critical in regulated industries (healthcare, finance) where decisions must be auditable.
  • Return on investment (ROI): For many applications, the marginal accuracy gain from deep learning does not justify the orders-of-magnitude increase in cost. If a TF-IDF-based system achieves 85% of the accuracy of an LLM-based system at 1% of the cost, the TF-IDF system is the rational choice.
  • Data privacy and security: Smaller models can be deployed on-premise without sending data to external APIs. This is essential for healthcare, defense, and financial applications where data cannot leave the organization's infrastructure.
  • Data efficiency: Classical models can work with smaller datasets, while LLMs require massive training corpora and fine-tuning infrastructure.

Professor's decision framework: When selecting any approach — whether for a company project or a research endeavor — one must systematically evaluate: What data is available? What is the end goal? What are the available options? What is the most cost-effective option? Does the cost-effective solution meet the accuracy requirements (especially critical in medical and finance domains)? How do you balance cost and quality? This structured evaluation prevents teams from defaulting to the most complex (and expensive) solution when a simpler one would suffice.

15.7 Handling Redundancy: Maximal Marginal Relevance (MMR)

Whether using extractive or abstractive, supervised or unsupervised methods, redundancy is a pervasive challenge in text summarization. Imagine summarizing multiple articles about J.K. Rowling winning a lawsuit. Article 1 says "Author J.K. Rowling won her legal battle to ban an unofficial encyclopedia." Article 2 says "A US judge ruled in favor of J.K. Rowling against the encyclopedia's publication." Both sentences are highly relevant — but including both in a short summary wastes precious space saying the same thing twice. Summaries have length constraints, so every sentence must contribute unique information.

Maximal Marginal Relevance (MMR) is the most popularly used measure for balancing relevance against redundancy, particularly in query-focused summarization. It was originally proposed by Jaime Carbonell and Jade Goldstein in 1998.

15.7.1 The MMR Concept

MMR addresses two simultaneous objectives:

  1. Informativeness (relevance): Selected sentences must be highly relevant to the user's query.
  2. Non-redundancy: Selected sentences must not duplicate information already captured in the summary.

The core idea is iterative greedy selection: at each step, select the sentence (or document) that is most relevant to the query while being least redundant with already-selected items. Think of it like packing a suitcase for a trip — you want to bring the most useful items (relevance), but you would not pack three identical white shirts (redundancy). Each new item should add something the others do not have.

The two forces in MMR:

  • The relevance term pulls toward the query — it says "pick sentences that answer the question."
  • The redundancy term pushes away from already-selected items — it says "do not pick sentences that say what we already have."
  • The parameter controls the balance between these two forces.

15.7.2 The MMR Formula

where:

  • is the candidate document (or sentence) being evaluated
  • is the user's query
  • is the relevance — the cosine similarity between the candidate and the query (how well it answers the question)
  • is the redundancy — the maximum similarity between the candidate and any already-selected item (how much it overlaps with what we already have)
  • is a tunable parameter balancing relevance vs. redundancy

The first term rewards relevance — the more similar is to the query, the higher the score. The second term penalizes redundancy — the more similar is to an already-selected item, the more the score is reduced.

The role of :

  • (default): Equal weighting of relevance and redundancy.
  • : Prioritize relevance over diversity. Use this when missing a key fact is costly (e.g., medical or legal domains where a missed detail could have serious consequences).
  • : Prioritize diversity over relevance. Use this when exploration and breadth of coverage matter more (e.g., exploratory search, brainstorming).

15.7.3 Worked Example: MMR for Document Selection

Consider a collection of 5 documents (D1–D5) and a query . The similarity values between documents and between each document and the query are given. The parameters are: maximum number of documents to extract , .

The similarity values (from cosine similarity of document embeddings) are:

Pair Similarity
Q–D1 0.91
Q–D2 0.90
Q–D3 0.50
Q–D4 0.06
Q–D5 0.63
D1–D2 0.11
D1–D3 0.23
D1–D4 0.76
D1–D5 0.25
D2–D3 0.29
D2–D4 0.57
D2–D5 0.51

Iteration 1: Select the first document.

No documents have been selected yet, so the redundancy term cannot be computed (the set of selected documents is empty). The selection is based purely on relevance (similarity to query):

  • D1: Sim(Q, D1) = 0.91 (highest)
  • D2: Sim(Q, D2) = 0.90
  • D5: Sim(Q, D5) = 0.63
  • D3: Sim(Q, D3) = 0.50
  • D4: Sim(Q, D4) = 0.06

D1 is selected (highest relevance = 0.91). Selected set = {D1}.

Iteration 2: Select the second document.

Now compute MMR for each remaining document against D1 (the only selected document):

D2:

D3:

Q: How do we compute the MMR for D3 in the second iteration? A: For D3 in the second iteration, D1 is the only extracted document. So the MMR is: . We compare D3's similarity only against D1 since D2 is not yet extracted. The redundancy term uses the maximum similarity to any already-selected document — and D1 is the only one in the selected set.

D4:

D4 has a negative MMR score because it is highly similar to D1 (similarity 0.76) while having very low relevance to the query (0.06). This demonstrates MMR's ability to strongly penalize redundant documents — even though D4 exists in the collection, its content overlaps so heavily with D1 that including it would waste summary space.

D5:

Ranking by MMR score: D2 (0.395) > D5 (0.19) > D3 (0.135) > D4 (−0.35).

D2 is selected (highest MMR = 0.395). Selected set = {D1, D2}.

Iteration 3: Select the third document.

Now compute MMR for D3, D4, D5 against both D1 and D2 (both selected). For each candidate, the redundancy term uses the maximum similarity to either D1 or D2 — whichever is higher.

Q: In iteration 3, since both D1 and D2 are extracted, do we compare against both? A: Yes, for each remaining candidate (D3, D4, D5), we find the maximum similarity to any already-selected document — either D1 or D2. The redundancy term uses whichever similarity is higher. For example, D3 is more similar to D2 (0.29) than to D1 (0.23), so we use 0.29 as the redundancy value. We take the maximum because even a high overlap with one selected document is enough to make a candidate redundant.

D3: First, identify the maximum similarity of D3 to any selected document: max(Sim(D3, D1), Sim(D3, D2)) = max(0.23, 0.29) = 0.29 (D3 is more similar to D2).

D4: Maximum similarity of D4 to any selected document: max(Sim(D4, D1), Sim(D4, D2)) = max(0.76, 0.57) = 0.76 (D4 is more similar to D1).

D5: Maximum similarity of D5 to any selected document: max(Sim(D5, D1), Sim(D5, D2)) = max(0.25, 0.51) = 0.51 (D5 is more similar to D2).

Ranking by MMR score: D3 (0.105) > D5 (0.06) > D4 (−0.35).

D3 is selected (highest MMR = 0.105). Selected set = {D1, D2, D3}. K = 3 reached — algorithm stops.

Final selected documents: D1, D2, D3.

Key insight: D4 is never selected despite appearing in the collection, because its content overlaps heavily with D1 (76% similarity) while contributing little relevance to the query (0.06). MMR successfully prevents redundancy — the same information is not repeated in the summary. This is exactly the behavior we want: the summary covers different aspects of the query rather than saying the same thing three different ways.

15.7.4 Edge Case: Identical MMR Scores

Q: What happens if two documents have identical MMR scores? A: If two documents have identical MMR scores, the algorithm could stop, as it would indicate an arbitrary tie with no principled way to break it. In practice, identical scores are extremely unlikely when using real word embeddings with full floating-point precision — even scores that match to two decimal places will differ at the 7th or 8th decimal place (differences on the order of to ). Ties are a theoretical concern, not a practical one.

15.7.5 MMR Applied to Sentence Selection

The MMR concept, originally demonstrated above for document selection, applies identically to sentences. In the sentence-level variant:

  • Replace each with a sentence from the corpus.
  • Compute cosine similarity between all pairs of sentence embeddings (using sentence transformers from Hugging Face, which compute word embeddings for each word using contextual word embedding algorithms and then combine them by averaging or taking the element-wise maximum to produce a single vector for the entire sentence).
  • Select sentences iteratively using the same MMR formula.
  • Stop when K sentences have been selected (where K is the desired summary length in sentences).

The process is identical: first select the sentence with the highest relevance to the query, then iteratively add sentences that maximize MMR (balancing relevance against redundancy with all previously selected sentences).

15.7.6 MMR as the Standard for Query-Focused Summarization

MMR is the most commonly used measure for query-focused text summarization. Its greedy approach is not globally optimal — it makes locally optimal choices at each step, which means the final set of K documents may not be the best possible set of K documents overall. However, the globally optimal solution would require evaluating all possible subsets of size K, which is combinatorially infeasible for large collections. MMR provides a good practical balance between quality and computational cost. The algorithm naturally handles the dual requirements of any good summary: being relevant to what was asked, and being non-repetitive in what it includes.

15.8 Sentence Ordering

After content selection (and redundancy removal via MMR), the selected sentences must be ordered into a coherent summary. This is the second stage of the summarization pipeline — and one that is often underappreciated. A summary with perfectly selected but randomly ordered sentences reads like a ransom note: each piece is meaningful on its own, but the combination is incoherent.

15.8.1 Ordering Strategies

Six ordering strategies were discussed, ranging from simple heuristics to learned models:

Original position ordering: Assign each selected sentence its original position in the source document. Sentences from the first paragraph/section appear first in the summary; sentences from the last section appear last. This is the simplest heuristic and works well for news articles (which follow the inverted pyramid structure) and single-document summarization. It is the default strategy in many extractive systems.

Similarity-based ordering: Group sentences with high mutual cosine similarity adjacent to each other. This creates thematic clusters within the summary — sentences about the same subtopic appear together, making the summary easier to follow. The algorithm computes pairwise cosine similarities between the selected sentences and arranges them to maximize local coherence (neighboring sentences should be similar).

Chronological ordering: If the text contains dates, timestamps, or temporal references, use these for ordering. This is natural for event timelines, news coverage of developing stories, and biographical texts. A summary of a multi-day event should present Day 1 events before Day 2 events.

Domain-specific ordering rules: Different output types have different natural orderings. The professor provided specific templates:

Query Type Natural Information Flow
Biography Dates → Nationality → Education → Fame
Definition Genus → Species → Synonym → Subtype
Medical/Drug Population → Problem → Intervention → Outcome

These templates can be hand-crafted for specific domains and provide reliable ordering when the summary type is known in advance.

Knowledge graph ordering: Use knowledge graphs to identify semantically related terms and ensure conceptually connected sentences are placed adjacent to each other. This goes beyond simple word overlap by leveraging structured knowledge about how concepts relate.

Small language model ordering: Tiny or edge-deployed language models can be specifically trained for the sentence-ordering task. The selected sentences are fed as input, and the model outputs the optimal order. This treats ordering as a separate, simpler sub-problem that a small model can handle, without needing a full LLM. The model learns ordering patterns from training data — for example, that background information typically precedes results, which preced conclusions.

Pitfall: Do not assume that one ordering strategy works for all domains. Position-based ordering fails for multi-document summarization (where sentences come from different documents with different structures). Chronological ordering fails when the text has no temporal references. Domain-specific rules require manual crafting for each new domain. The choice of ordering strategy should match the nature of the input data and the intended output format.

15.8.2 Multi-Document Ordering Challenges

When sentences come from multiple source documents, their original positions are not directly comparable. If sentence A appears first in document 1 and sentence B appears last in document 2, the relative ordering is ambiguous — neither sentence has a natural claim to being "earlier" in the summary.

This is one of the key challenges in multi-document query-focused summarization. Solutions include:

  • Chronological anchoring: If the source documents have publication dates, use those to establish a temporal ordering.
  • Thematic clustering with transitions: Group sentences by subtopic, order the groups logically, and add transitional phrases between groups.
  • Learned ordering models: Train a model on multi-document summaries with known orderings to learn the patterns.

15.9 Neural Text Summarization

Beyond classical unsupervised and supervised approaches, neural network architectures can perform text summarization end-to-end — reading the full document and generating a summary in new language, without explicitly separating content selection, ordering, and realization into distinct stages. This section covers the progression from RNN-based models to modern LLMs.

15.9.1 LSTM Encoder-Decoder with Attention

A bidirectional LSTM encoder-decoder with attention mechanism can be trained for text summarization, using the same architecture as sequence-to-sequence models for machine translation. The architecture works as follows:

  • Encoder: A bidirectional LSTM reads the source document word by word (in both forward and backward directions) and produces a sequence of hidden representations that encode the document's content.
  • Decoder: Another LSTM generates the summary token by token, producing one word at a time conditioned on the previously generated words.
  • Attention mechanism: At each decoding step, the attention mechanism computes a weighted combination of the encoder hidden states, allowing the decoder to "look back" at the most relevant parts of the source document when generating each summary word. This acts as a spotlight — the decoder focuses on different parts of the input as it writes different parts of the output.

Training data generation: This architecture requires labeled (document, summary) training data. One practical approach is to generate this labeled data using unsupervised techniques (e.g., TF-IDF or PageRank-based extractive summaries as training targets) and then train the neural model to learn abstractive summarization from those extractive labels. This is sometimes called "distant supervision" — the extractive summaries are imperfect proxies for ideal abstractive summaries, but they are sufficient for the model to learn useful patterns.

The padding problem: LSTMs require all input sequences to be of the same length (because the recurrent computation proceeds step by step, and the GPU processes batches in parallel). If training examples vary in length — one summary is 5 lines and another is 500 lines — the shorter one must be padded with zeros to match the longest. This consumes tokens unnecessarily and inflates computational cost. The longer the maximum sequence length in the training set, the more wasted computation on padding tokens.

Scope: LSTM encoder-decoders struggle with long documents because the fixed-size hidden state must compress the entire document's meaning. As the document grows longer, the encoder's representation becomes increasingly lossy — it cannot capture all the nuances of a 10-page paper in a single vector. This is the fundamental limitation that motivated the shift to transformer-based models.

15.9.2 Transformer-Based Models

Transformer models (including T5, GPT, Qwen, Llama, and others) can be used for text summarization. These models have varying parameter counts — from 1 billion to 700 billion parameters — and can be fine-tuned on domain-specific summarization data.

The transformer architecture addresses the LSTM's long-range dependency problem through self-attention, which allows every token in the input to attend directly to every other token, regardless of distance. This means the model can capture relationships between the first and last sentence of a document just as easily as between adjacent sentences.

During training for summarization, the data is typically structured as: ARTICLE TEXT <EOS> SUMMARY <EOS> <pad>. The model calculates loss only when predicting the summary portion — it learns to "read" the article and then "write" the summary. The same padding concerns apply for RNN-based variants, though transformer architectures handle variable-length inputs more naturally through positional encoding (each token's position is encoded as a vector that is added to its embedding, allowing the model to distinguish word order without sequential processing).

15.9.3 LLM-Based Summarization

Modern LLMs (Large Language Models) can perform text summarization through prompting — sending the document with an instruction to summarize. This is the simplest approach from an implementation perspective:

"Please summarize the following article in 3 sentences: [article text]"

The calculator analogy: The professor compared LLM-based summarization to using a calculator — you get the answer but do not see the internal computation. The advantage is ease of use (no training data, no feature engineering, no pipeline design). The disadvantage is lack of interpretability (you cannot explain why certain information was included or excluded), high computational cost (token-based pricing for API calls, or massive GPU infrastructure for self-hosted models), and risk of hallucination (the LLM might generate plausible-sounding statements not grounded in the source document).

For production use in cost-sensitive or accuracy-critical environments, explainable pipeline approaches (content selection → ordering → realization) are preferred because they offer:

  • Interpretability: You can trace exactly which sentences were selected and why.
  • Lower hallucination rates: Extractive methods only use text from the source document.
  • Controllability: You can adjust each stage independently (e.g., change the ordering strategy without retraining the content selector).

15.9.4 The Cost-Quality-Scalability Triangle

Every summarization approach must be evaluated along three axes:

Axis Unsupervised (TF-IDF, PageRank) Supervised (Classical ML) Neural (LSTM, Transformer) LLM-Based (GPT, Llama)
Cost Cheapest — no training, fast inference Moderate — requires labeled data High — GPU training and inference Highest — massive models or API costs
Quality Reliable but less fluent Good for extractive; limited for abstractive Most fluent; may hallucinate Most fluent; highest hallucination risk
Scalability Scales well computationally Scales with data availability Requires GPU infrastructure Requires massive infrastructure

The engineering principle is clear: always prefer the simplest method that meets your requirements. If TF-IDF-based extractive summarization delivers adequate accuracy for your domain, there is no justification for deploying a 70-billion-parameter LLM. This principle echoes the professor's emphasis from the opening discussion: evaluate cost, accuracy, scalability, and efficiency systematically.

15.10 Evaluation: ROUGE Score

15.10.1 What ROUGE Measures

ROUGE (Recall-Oriented Understudy for Gisting Evaluation) is the most popularly used evaluation measure for text summarization quality, used even in state-of-the-art agentic AI approaches. ROUGE measures the overlap between the automatically generated summary and one or more human-written reference summaries.

The name captures its purpose: it is an "understudy" (a stand-in evaluator) for human judgment of "gisting" (capturing the gist of a document).

ROUGE works by computing n-gram overlap — counting how many word sequences of length appear in both the machine-generated summary and the human reference summary. The most common variants are:

  • ROUGE-1: Unigram (single word) overlap — measures whether the summary uses the same individual words as the reference.
  • ROUGE-2: Bigram (two-word phrase) overlap — measures whether the summary uses the same phrases as the reference. This is a stricter measure than ROUGE-1 because matching two consecutive words is harder than matching individual words.
  • ROUGE-L: Longest common subsequence — measures the longest sequence of words that appears in both the summary and the reference, allowing for gaps.

The professor indicated that ROUGE would be covered in detail in the next session (the end-semester review/recap session), as the current session ran out of time. The exam is expected to include simple numerical problems on ROUGE computation.

Scope: ROUGE has a known limitation — it struggles to reward valid synonyms in abstractive summaries. If a human writes "The treatment was effective" and the machine writes "The therapy worked well," ROUGE would score this as low overlap despite the meaning being identical. This is why ROUGE is better suited for evaluating extractive summaries (where exact word overlap is expected) than abstractive summaries (where paraphrasing is a feature, not a bug). Despite this limitation, ROUGE remains the industry standard for rapid evaluation of summarization models.

15.11 Exam Guidance Summary

15.11.1 Expected Exam Questions

Exam note: The upcoming end-semester exam covers text summarization as the last topic in the post-midsem content. The following are the key expectations:

  • Numerical problems are expected on:
  • MMR computation — the full iterative process with worked examples (3 iterations, 5 documents, computing MMR scores at each step). This is the most likely numerical question type.
  • TF-IDF calculation and sentence scoring — computing IDF for words in a corpus, computing TF-IDF per word per document, and scoring sentences to select the top-K.
  • IDF computation — understanding the formula or and applying it to a given corpus.
  • ROUGE score — a simple numerical problem. This will be covered in the review session.
  • Conceptual questions on:
  • Extractive vs. abstractive summarization (trade-offs, when to use which)
  • Unsupervised vs. supervised approaches (advantages, disadvantages, when each is preferred)
  • The text summarization pipeline stages (content selection, ordering, realization)
  • The trade-offs between different methods (cost, quality, scalability)
  • Application-oriented questions: Given a specific application scenario, recommend and justify an approach (e.g., "For this application, which method would you use and why?"). These questions test the ability to apply the cost-quality-scalability framework to novel situations.

Exam note — Open book format: Formulas are provided in the exam — students do not need to memorize them. Focus on understanding the computation process and being able to apply formulas to concrete examples. The professor specifically advised against memorizing formulas; instead, practice working through numerical examples step by step until the process is comfortable.

Study focus: The numerical computations (MMR, TF-IDF, IDF) and the conceptual framework (types of summarization, pipeline stages, trade-offs) are the primary study targets for this module.

End-sem review session: A recap session covering post-midsem content from the end-semester perspective is planned. This will cover ROUGE in detail and provide an opportunity to clarify doubts.

15.12 Key Industry Applications

15.12.1 Industry Examples

These industry examples, drawn from the professor's discussion and student contributions, illustrate that text summarization is not an academic exercise — it is a production-grade capability deployed across healthcare, finance, search, and enterprise systems. Each example highlights different architectural choices and trade-offs.

  • Healthcare alert monitoring (Optum): A multi-agent workflow system that processes monitoring alerts from multiple tools, generates per-alert summaries, and consolidates them into root cause analysis. Uses GPT-5 via enterprise API with data grounding for privacy. Key challenges: cost (token-based pricing), hallucination across tool boundaries (the system occasionally attributes one tool's alert to another), and accuracy that, while imperfect, outperforms the previous manual process. This is an example of multi-document query-focused abstractive summarization using LLMs.
  • Financial asset management: Converting numerical product performance data into natural language summaries for sales presentations. Processes millions of data points into one-page client reports. Uses prompt caching for optimization. This is an example of structured-data-to-text summarization — the input is numerical, and the output is a narrative summary.
  • Email summarization: Condensing long email threads into key points and action items. Single-document or multi-document (depending on thread length), typically extractive or hybrid.
  • Minutes of meetings: Automatic generation of meeting summaries and action items from meeting recordings. This involves speech-to-text preprocessing followed by multi-document summarization.
  • Research paper summarization: Generating abstracts, titles, or topic-specific summaries from research papers. Single-document generic summarization; a strong baseline is simply extracting the first sentence.
  • Customer complaint analysis: Extracting core issues from batches of customer feedback. Multi-document query-focused summarization where the implicit query is "what are the main problems?"
  • Google search and ChatGPT: Query-focused text summarization in everyday use — when users ask questions, the system produces concise answers from large document collections. Google search is noted as having less carbon footprint per query compared to LLM-based approaches, because it uses lightweight extractive snippets rather than generating full abstractive answers.
  • Agentic AI systems: Text summarization as a component in larger agent workflows, where multiple specialized agents handle different aspects of the summarization pipeline (one agent selects content, another orders it, a third cleans it up).
  • Guardrails in agentic systems: Rule-based filtering using regular expressions to prevent unintended actions (e.g., blocking update queries, preventing agents from modifying databases). Coreference resolution and named entity recognition as part of the summarization realization stage. These guardrails are essential for production safety — without them, an autonomous agent summarizing a customer email might accidentally trigger database modifications.

NLP Lecture 15 notes · Text Summarization

Natural Language Processing· postgraduate· 2026-08-16

Sections Breakdown

1Introduction to Text Summarization

Definition, real-world applications, and industry examples of text summarization

2Types of Text Summarization

Classification by input scope, output style, focus, and learning approach

3The Text Summarization Pipeline

Three stages: content selection, sentence ordering, and sentence realization

4Unsupervised Content Selection: TF-IDF Approach

TF-IDF scoring for sentence selection with worked example

5Unsupervised Content Selection: Graph-Based Approach (PageRank)

PageRank algorithm for sentence centrality with worked example

6Supervised Content Selection

LSTM encoder-decoder, binary classification, and LLM prompting approaches

7Handling Redundancy: Maximal Marginal Relevance (MMR)

MMR formula and iterative document selection worked example

8Sentence Ordering

Six ordering strategies for coherent summary generation

9Neural Text Summarization

Progression from LSTM to Transformer to LLM-based summarization

10Evaluation: ROUGE Score

ROUGE-1, ROUGE-2, and ROUGE-L metrics for summary evaluation

11Exam Guidance Summary

Expected exam questions and study focus for text summarization

12Key Industry Applications

Production examples from healthcare, finance, and search

Postgraduate students in Natural Language Processing

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Introduction to Text Summarization

Must-know: Text summarization produces abridged text retaining key information; real systems trade off cost, accuracy, scalability, and efficiency

⚠️ Top pitfall: Confusing summarization with keyword extraction or topic modeling — summarization produces coherent readable prose, not just terms or clusters

Self-check: Name two industry applications of text summarization discussed in the lecture.

Connects to: 15.2, 15.3

Types of Text Summarization

Must-know: Four classification dimensions; extractive vs. abstractive trade-offs (accuracy vs. fluency); query-focused narrows selection to query-relevant content

⚠️ Top pitfall: Assuming abstractive is always better — extractive is preferred in industry for faithfulness and simplicity

Self-check: What are the four dimensions along which text summarization systems are classified?

Connects to: 15.1, 15.3, 15.4, 15.7

The Text Summarization Pipeline

Must-know: Three pipeline stages: content selection, sentence ordering, sentence realization. Content selection is most critical. Domain-specific ordering templates (biography, definition, medical).

⚠️ Top pitfall: Assuming content selection alone produces a good summary — ordering and realization are also necessary for coherence and readability

Self-check: What are the three stages of the text summarization pipeline, and which is the most critical?

Connects to: 15.2, 15.4, 15.5, 15.8

Unsupervised Content Selection: TF-IDF Approach

Must-know: TF-IDF sentence scoring: sum word TF-IDF weights per sentence, rank, select top-K. Professor uses N/N_k (simplified); standard is log(N/N_k). The 0.48 value is log10(3).

⚠️ Top pitfall: Confusing the professor's simplified IDF (N/N_k) with the standard log form log(N/N_k) — know which one is being used in a given problem

Self-check: Compute TF-IDF for the word 'diagnosis' appearing once in a 3-document corpus where it appears in 1 document. Use both the simplified and log-based IDF.

Connects to: 15.5, 15.7

Unsupervised Content Selection: Graph-Based Approach (PageRank)

Must-know: PageRank on sentence graph: build similarity matrix, threshold for edges, iterate with d=0.85 until convergence. Most central sentence (highest PR) is selected first. Weighted variant uses cosine similarities as edge weights.

⚠️ Top pitfall: Forgetting that the threshold hyperparameter controls graph connectivity — too low connects everything (no discrimination), too high isolates sentences

Self-check: Explain why sentence S3 achieves the highest PageRank in the worked example.

Connects to: 15.4, 15.7

Supervised Content Selection

Must-know: Supervised approaches: encoder-decoder, binary classification features (position, length, TF-IDF, redundancy), LLM prompting. Challenges: labeling cost, alignment, domain adaptation. Classical ML still preferred in industry for interpretability and ROI.

⚠️ Top pitfall: Assuming LLMs always outperform classical methods — unsupervised methods often match supervised for extractive summarization at far lower cost

Self-check: What are the four reasons classical ML models are still widely used in industry for text summarization?

Connects to: 15.4, 15.5, 15.9

Handling Redundancy: Maximal Marginal Relevance (MMR)

Must-know: MMR iterative computation: select first by pure relevance, then by lambda*relevance - (1-lambda)*max redundancy. Full 3-iteration worked example with 5 documents. D4 negative score shows redundancy penalty. Lambda tuning: >0.5 for relevance-critical domains, <0.5 for diversity.

⚠️ Top pitfall: Using only the most recently selected document for redundancy — must compare against ALL selected documents and take the maximum similarity

Self-check: In the MMR worked example, why is D4 never selected? Compute its MMR score in iteration 2.

Connects to: 15.4, 15.5, 15.8

Sentence Ordering

Must-know: Six ordering strategies and when each applies. Domain-specific templates for biography, definition, medical queries. Multi-document ordering is harder due to incomparable original positions.

⚠️ Top pitfall: Assuming position-based ordering works for multi-document summarization — it does not, because sentences from different documents have no shared positional frame

Self-check: What ordering strategy would you use for a summary of a biographical query about a historical figure?

Connects to: 15.3, 15.7

Neural Text Summarization

Must-know: Progression: LSTM encoder-decoder → Transformer → LLM prompting. LSTM limitation: fixed-size hidden state loses long-document information. Transformers use self-attention for direct long-range connections. LLMs are simplest but risk hallucination. Always prefer the simplest method that meets requirements.

⚠️ Top pitfall: Assuming LLMs are always the best choice — for cost-sensitive or accuracy-critical domains, extractive pipelines with interpretable stages are preferred

Self-check: What is the fundamental limitation of LSTM encoder-decoders for long documents, and how do transformers address it?

Connects to: 15.6, 15.3

Evaluation: ROUGE Score

Must-know: ROUGE measures n-gram overlap with human reference summaries. ROUGE-1 (unigrams), ROUGE-2 (bigrams), ROUGE-L (longest common subsequence). Limitation: penalizes synonym use in abstractive summaries. A simple numerical on ROUGE is expected in the exam.

⚠️ Top pitfall: Confusing ROUGE-1 with ROUGE-2 — ROUGE-2 is stricter because it requires matching two-word phrases, not just individual words

Self-check: What does ROUGE-2 measure, and why is it stricter than ROUGE-1?

Connects to: 15.3

Exam Guidance Summary

Must-know: MMR numerical (3 iterations), TF-IDF/IDF numerical, ROUGE simple numerical. Conceptual: extractive vs abstractive, supervised vs unsupervised, pipeline stages. Open book — practice computation, not memorization.

⚠️ Top pitfall: Memorizing formulas instead of understanding computation flow — the exam is open book, so formulas are provided

Self-check: What are the three main types of exam questions expected for this module?

Connects to: 15.7, 15.4, 15.10

Key Industry Applications

Must-know: Healthcare (Optum multi-agent, GPT-5, hallucination), financial (numerical-to-narrative, prompt caching), search (Google snippets as extractive summaries). Each maps to a different summarization type from the taxonomy.

⚠️ Top pitfall: Assuming all industry summarization uses LLMs — many production systems use classical extractive methods for cost and interpretability

Self-check: Give an industry example of multi-document query-focused abstractive summarization.

Connects to: 15.1, 15.2, 15.9

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.