PIXELBANKv8.2.1
Menu
Back to NLP Study Plan
Week 12

Chapter 12: Text Generation & Summarization

Master text generation techniques from beam search to nucleus sampling, and learn both extractive and abstractive summarization with modern evaluation metrics.

Chapter Overview

Text generation is the task of producing coherent, fluent natural language output conditioned on some input --- a prompt, a source document, a dialogue history, or simply a start token. It underlies virtually every modern NLP application: machine translation generates target-language text, summarization generates condensed versions of documents, dialogue systems generate responses, and large language models generate continuations of arbitrary prompts.

The core challenge in text generation is decoding: given a language model that assigns probabilities to the next token, how do you select tokens to form a complete output? Greedy decoding picks the highest-probability token at each step but often produces repetitive, dull text. Beam search maintains multiple hypotheses to find higher-probability sequences but can still lack diversity. Sampling methods --- top-k, nucleus (top-p), and temperature scaling --- introduce controlled randomness to produce more natural and varied outputs.

Summarization is one of the most important applications of text generation. Extractive summarization selects and concatenates the most informative sentences from the source document. Abstractive summarization generates a novel summary using a seq2seq model, potentially rephrasing, compressing, and synthesizing information. Both approaches require evaluation metrics that capture content overlap and quality --- ROUGE measures n-gram overlap, BERTScore uses contextual embeddings for semantic similarity, and human evaluation remains the gold standard for fluency and faithfulness.

Chapter Roadmap

Click any topic to jump in

1
Extractive Summarization

Select the most important sentences using TextRank graph ranking and positional features.

2
Abstractive Summarization

Generate novel summaries with pointer-generator networks, coverage, and PEGASUS pretraining.

How to decode

Deterministic beam search vs stochastic sampling strategies

3
Beam Search

Maintain multiple decoding hypotheses with length normalization and diverse search strategies.

4
Nucleus Sampling

Temperature scaling, top-k, and top-p sampling for diverse and natural text generation.

Control and measure

Steering generation output and evaluating its quality

5
Controlling Generation

Steer output with control codes, prompts, constrained decoding, and RLHF.

6
Generation Evaluation

ROUGE, BERTScore, human evaluation, and faithfulness metrics for generated text.

Sign up to unlock this chapter

This chapter is part of PixelBank Premium. Create a free account, then upgrade to read the full lesson — concepts, walkthroughs, and exercises.