liveBook · Manning

Abstractive summarization

As explained in Retrieval Augmented Generation, The Foundational Ideas

Abstractive synthesis generates a shorter novel representation by integrating and rewording information from source documents.

Abstractive summarization generates a new, shorter document by integrating and rewording related source chunks instead of selecting representative sentences. In recursive retrieval, it creates synthetic documents that capture a cluster's shared theme. Use temperature 0.0 during indexing so identical inputs produce stable summaries and embeddings; reserve higher temperatures for query-time generation. section 10.4.3

Apply the technique with explicit production safeguards:

  • Prompt for grounded synthesis that preserves specific entities, numerical values, and causal relationships. section 10.4.3
  • Parallelize independent cluster summaries with ainvoke, asyncio.gather, or a ThreadPoolExecutor to reduce indexing latency. section 10.4.3
  • Prefer extractive compression for factual recall or cited spans; choose abstractive synthesis for summarization and multi-hop reasoning. section 13.7 section 13.9
  • Tune compression rather than fixing one ratio: moderate compression can remove distractors, while excessive compression causes semantic loss and over-pruning. section 13.7 section 13.9

Choosing the compression style

A legal-contract system should retain quoted clauses with extractive compression. A medical-diagnostic system may need an abstractive patient-history summary that combines information across documents, while accepting the additional hallucination surface. section 13.4.1

Listing 10.4 The summarization service.
from providers import get_chat_model
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
 
class SummarizationEngine:
    def __init__(self, model_name="gpt-4o"):
        self.llm = get_chat_model(  #A
            model_name, temperature=0.0)
 
        self.prompt = ChatPromptTemplate.from_template(  #B
            "You are a sophisticated technical analyst. "
            "Synthesize the text chunks into one summary. "
            "Preserve specific entities, numerical values, "
            "and causal relationships. The summary should be "
            "abstractive but grounded in the details given.\n\n"
            "Text Chunks:\n{context}\n\n"
            "Comprehensive Summary:"
        )
 
    def summarize_cluster(self, texts: List[str]) -> str:
        """Generates a summary for a list of text chunks."""
        combined_text = "\n\n".join(texts)
        chain = self.prompt | self.llm | StrOutputParser()
        return chain.invoke({"context": combined_text})  #C
 

Inspect a compact LangChain implementation that configures a zero-temperature chat model, requests grounded cluster synthesis, and returns a summary string. section 10.4.3

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Descends from definition to prompts, deterministic indexing, parallel execution, hallucination risk, and compression-ratio tuning.
Examples
Uses clustered retrieval chunks, legal clauses, medical histories, and a LangChain summarization service as examples.
What it assumes
Assumes source chunks and an LLM pipeline, while teaching the extractive–abstractive choice and its hallucination tradeoff.
What you can do after
Apply it via a grounded LLM compressor, parallelize indexing, and evaluate accuracy while tuning the compression ratio.
How it connects
Connects abstractive compression with extractive compression, retrieval, embeddings, hallucination, and multi-hop reasoning.

Also explained in

Compare how 2 books explain abstractive summarization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.