Master text generation techniques from beam search to nucleus sampling, and learn both extractive and abstractive summarization with modern evaluation metrics.
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.
Click any topic to jump in
Select the most important sentences using TextRank graph ranking and positional features.
Generate novel summaries with pointer-generator networks, coverage, and PEGASUS pretraining.
Deterministic beam search vs stochastic sampling strategies
Maintain multiple decoding hypotheses with length normalization and diverse search strategies.
Temperature scaling, top-k, and top-p sampling for diverse and natural text generation.
Steering generation output and evaluating its quality
Steer output with control codes, prompts, constrained decoding, and RLHF.
ROUGE, BERTScore, human evaluation, and faithfulness metrics for generated text.
This chapter is part of PixelBank Premium. Create a free account, then upgrade to read the full lesson — concepts, walkthroughs, and exercises.