Keyphrase generation is a sequence-to-sequence (seq2seq) modeling task that predicts a set of salient phrases—both present keyphrases (verbatim spans) and absent keyphrases (conceptual labels not in the text)—from a source document. Unlike extraction-only methods, it formulates the problem as conditional natural language generation, often using Transformer-based encoder-decoder architectures trained on large-scale datasets like KP20k.
Glossary
Keyphrase Generation

What is Keyphrase Generation?
Keyphrase generation is the task of automatically producing a set of concise phrases that summarize a document's core topics, including both phrases present in the text and those that are absent but conceptually relevant.
The model learns to attend to the source context and generate a delimited sequence of keyphrases, addressing the one-to-many mapping between a document and its topics. This approach inherently handles synonym generation and abstraction, evaluating output quality using metrics like F1@K and Mean Reciprocal Rank (MRR) against author-assigned gold standards.
Core Characteristics of Keyphrase Generation
Keyphrase generation is a sequence-to-sequence modeling task that produces both present and absent keyphrases, moving beyond extraction to synthesize novel, highly relevant terms for a source text.
Sequence-to-Sequence Architecture
The foundational architecture for keyphrase generation is the encoder-decoder framework. The encoder (e.g., a Transformer) reads the source document and compresses it into a dense context vector. The decoder then autoregressively generates a sequence of keyphrases, one token at a time, often separated by a delimiter.
- One2Seq: A seminal model that generates multiple keyphrases in a single sequence.
- Copy Mechanism: Allows the decoder to copy rare or out-of-vocabulary words directly from the source text, crucial for generating present keyphrases accurately.
- Target: NLP Engineers building custom generation pipelines.
Present vs. Absent Keyphrase Generation
A key distinction in generation is the model's ability to produce two types of keyphrases. Present keyphrases appear verbatim in the source text, while absent keyphrases are semantically relevant but do not exist as contiguous spans.
- Present Generation: Relies heavily on a copy mechanism to point to tokens in the source.
- Absent Generation: Requires the model to synthesize new phrases from its learned vocabulary, demanding a deeper semantic understanding of the text.
- Evaluation: Models are often benchmarked on F1@K for both present and absent subsets separately.
One2Set Training Paradigm
Traditional Seq2Seq models impose an artificial order on the target keyphrase set, which is inherently unordered. The One2Set paradigm addresses this by removing the order bias.
- Set Loss: Uses a loss function like the K-step target assignment loss that is permutation-invariant, aligning predicted phrases with the most similar ground-truth phrases.
- Control Codes: Models like CatSeq use control codes to indicate the presence or absence of a keyphrase, guiding the decoder's generation mode.
- Benefit: Prevents the model from learning spurious sequential correlations between unrelated keyphrases.
Hierarchical Decoding
To capture the structural relationship between a document and its keyphrases, hierarchical models process text at multiple granularities. A hierarchical encoder first builds sentence-level representations, then aggregates them into a document-level vector.
- Hierarchical Attention: The decoder can attend to both word-level and sentence-level context, improving the relevance of generated phrases.
- Title Guidance: Some architectures encode the document title separately and use it as an additional signal to the decoder, as titles often contain the most salient concepts.
- Use Case: Highly effective for long-form scientific documents where keyphrases summarize distinct sections.
Reinforcement Learning for Keyphrase Diversity
A common failure mode is generating repetitive or near-duplicate keyphrases. Reinforcement Learning (RL) can be used to directly optimize for diversity and coverage.
- Self-Critical Sequence Training (SCST): Uses the model's own output as a baseline to reduce variance during RL training.
- Reward Shaping: Combines F1 score (relevance) with a repetition penalty or semantic diversity metric to encourage a varied set of keyphrases.
- Result: Produces a more comprehensive set of keyphrases that covers different facets of the document.
Evaluation Metrics
Keyphrase generation is evaluated against a gold-standard set of author-assigned or expert-curated keyphrases. The primary metrics are precision, recall, and F1-score computed on the top-K predictions.
- F1@5 / F1@10: The harmonic mean of precision and recall for the top 5 or 10 generated keyphrases. This is the standard benchmark.
- Mean Reciprocal Rank (MRR): Measures the rank of the first correct keyphrase, useful when the order of generation matters.
- Stemming/Levenshtein: Exact match is too strict; evaluation often uses Porter Stemming or a Levenshtein distance threshold to count near-matches as correct.
Keyphrase Generation vs. Keyphrase Extraction
A technical comparison of generative sequence-to-sequence models against traditional extraction methods for identifying document keyphrases.
| Feature | Keyphrase Generation | Keyphrase Extraction |
|---|---|---|
Core Mechanism | Sequence-to-sequence generation | Ranking and selection from candidate set |
Produces Absent Keyphrases | ||
Produces Present Keyphrases | ||
Requires Candidate Generation Step | ||
Output Format | Free-text sequences | Spans from source text |
Training Data Requirement | Parallel text-keyphrase pairs | Labeled spans or unsupervised |
Primary Architecture | Transformer encoder-decoder | Graph ranking or embedding similarity |
Typical Evaluation Metric | F1@K, MRR | F1@K, MRR |
Frequently Asked Questions
Explore the mechanics of sequence-to-sequence models that produce both present and absent keyphrases, moving beyond extraction to true generation.
Keyphrase generation is a sequence-to-sequence (seq2seq) task where a model produces a set of keyphrases—both present keyphrases that appear verbatim in the source text and absent keyphrases that do not—that capture the document's core topics. Unlike keyphrase extraction, which is limited to selecting contiguous spans from the input, generation models can synthesize novel, abstractive phrases. This is typically framed as a conditional text generation problem: given a source document x, the model learns to predict a target sequence y consisting of delimited keyphrases. Architectures like BART, T5, and Pegasus are fine-tuned on datasets such as KP20k to perform this task. The critical distinction lies in the model's ability to reason about the document's semantics and produce multi-word expressions that are conceptually relevant but lexically absent, such as generating 'neural network optimization' when the text only mentions 'backpropagation' and 'gradient descent'.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core concepts that distinguish generative keyphrase models from extractive methods, and the architectures that power them.
Absent Keyphrase Extraction
The core task of predicting relevant keyphrases that do not appear as contiguous spans in the source text. This requires a generative model capable of reading the document and synthesizing new, abstractive labels. It is fundamentally a sequence-to-sequence problem, often tackled with models like BART or T5 fine-tuned on scientific corpora.
Present Keyphrase Extraction
The process of identifying keyphrases that exist verbatim within the document. While often solved with sequence labeling or ranking, generative models can also be trained to copy spans via a pointer-generator mechanism. This hybrid approach allows a single model to handle both extraction and generation by switching between copying from the source and generating from the vocabulary.
One2Seq Architecture
A deep learning framework where the input is a single source document and the output is a sequence of keyphrases. Unlike One2One models that predict one phrase at a time, One2Seq generates the entire set autoregressively, often separated by delimiter tokens. This captures inter-keyphrase dependencies, preventing redundant predictions and ensuring topical coverage.
One2One Architecture
A simpler generative paradigm that predicts a single keyphrase per forward pass. To generate a set, the model is run multiple times, often conditioned on the document and previously generated phrases. While less efficient, it allows for fine-grained control and is easily combined with diverse beam search to maximize the variety of the output set.
KP20k Benchmark
The standard large-scale dataset for training and evaluating keyphrase generation models. It aggregates over 20,000 scientific article abstracts from computer science, each paired with author-assigned keyphrases. A significant portion of these gold-standard keyphrases are absent from the abstract, making it the primary benchmark for testing a model's abstractive generation capability.
F1@K Evaluation
The primary metric for keyphrase generation, computing the harmonic mean of precision and recall for the top-K predicted keyphrases against the gold-standard set. For generative models, K is typically set to 5 or 10. Stemming or lemmatization is applied before matching to ensure morphological variants are correctly identified as true positives.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us