Introduction

In today’s data-driven enterprises, the volume of unstructured documents is growing rapidly. AI powered document summarization improves enterprise efficiency by eliminating the need to go over these documents manually. Large Language Models (LLMs) are powerful tools for summarizing documents, but they face context window limits when dealing with long documents. Furthermore, studies show that as input length increases, LLMs tend to put more attention into the beginning and end while ignoring the critical information that may exist in the middle. Finally, research has shown that longer contexts are more vulnerable to safety attacks. A malicious user could put harmful instructions deep within a long input, making it harder for the model’s safety mechanisms to detect and filter them out [1]. To address these problems, we use a Map & Reduce summarization approach. The document is partitioned into smaller chunks (Map step), each chunk is summarized by the LLM, and then these intermediate summaries are combined into a single final summary (Reduce step). This strategy mitigates the context window and security issues of summarization long documents. The distributed and batch inference capabilities of Heatwave GenAI make it an ideal environment to implement Map & Reduce summarization at scale.

Approach

In the Map & Reduce summarization approach, the input is divided into smaller chucks that the LLM can comfortably ingest. Each chunk then gets summarized by LLM (Map phase). These summaries are merged into a single text and passed to LLM to generate a final summary (Reduce phase). This Map & Reduce summarization thus not only mitigates model limitations but also enable scalable summarization workflows that are ideal for integration with distributed and batch inference capabilities of Heatwave GenAI.

High level diagram explaining Map & Reduce abstractive summarization strategy is shown below:

Abstractive summarization is a summarization technique where an LLM understands the main ideas of a text and generates a concise summary using its own words rather than just copying sentences from the original text.

Step by step Map & Reduce approach with Heatwave GenAI

Use heatwave_load to parse the document

Pass the document as input text to ML_GENERATE with task= “summarization”. ML_GENERATE internally:

  • Step1: Splits the input text into smaller chunks
  • Step2: Computes a summary for each chunk
  • Step3: Merges the summaries into a single text
  • Step4: Repeats Steps 1-3 until we end up with a single summary for the entire document

Example

Call heatwave_load to parse a document located in oci object storage

Use the {“split_by”: “document”} chunking option in heatwave_load to create one segment per document. If a document exceeds 1 million characters, any content beyond this limit will be truncated. In such cases, it is recommended to use alternative split approaches (such as “page” or “paragraph”) and then concatenate the resulting segments to reconstruct the full document.

Select the document from the parsed table

call ML_GENERATE with task=”summarization”

ML_GENERATE_TABLE can be used to summarize multiple documents in parallel using the Heatwave distributed cluster:

Benefits of using Heatwave GenAI for Summarization

HeatWave GenAI abstracts away the complexity of building scalable summarization workflows. It automatically handles tasks such as document parsing, chunking, and distributed inference so you can focus on insights instead of infrastructure.

  • End-to-end automation: HeatWave manages document parsing, chunking, summarization, and result aggregation internally.
  • No external orchestration needed: There’s no need to build your own Map/Reduce logic or use external compute frameworks.
  • In-database efficiency: Since all computation happens inside MySQL HeatWave, you eliminate data movement, improving performance and security.
  • Scalable and fast: The summarization process scales seamlessly across HeatWave’s distributed cluster for batch or large-scale document processing.

Conclusion

By integrating Map & Reduce summarization directly into HeatWave GenAI, enterprises gain a fully managed, in-database solution that scales automatically and eliminates the need for external summarization pipelines. This not only accelerates time-to-insight but also reduces operational overhead, enabling teams to derive key information from large volumes of documents quickly and securely.

Learn More

To explore additional resources and deepen your understanding of MySQL HeatWave and Summarization, visit the following links: