Summarizing documents
In this section, we will discuss two ways of summarizing long documents. The first way uses traditional MapReduce patterns to summarize documents across multiple LLM calls, while the second makes use of the long-context windows and multimodal capabilities of the latest LLMs to create summaries more efficiently. We will also quickly cover loaders to get documents into your chain, and then go deep into MapReduce patterns to give you a good understanding of what is going on under the hood.
Summarizing text
We’ll start by summarizing text. Since most advanced modern LLMs have a long-context window, we can just put the whole text in the model’s context and wrap it with additional instructions about what kind of summary we aim for. In practice, we use zero-shot learning for summarization tasks since examples are typically long. We can achieve better domain adaptation with fine-tuning (as mentioned previously) or with more complex pipelines with a...