liveBook · Manning

Summarization

As explained in Building Specialized AI Systems

Summarization is the generation of a shorter text that preserves the essential information of a source.

Text summarization generates a shorter text while preserving essential information. In finance, it reduces the burden of extracting investment-relevant insights from lengthy analyst reports. section 2.5

Generic summarization may compress prose, but financial summarization must separate boilerplate from an analyst’s thesis and background from actionable insights. Domain adaptation improves this specialized filtering. section 2.5

A practical fine-tuning workflow uses:

  • A pretrained model that understands financial report conventions, metrics, and logical structure. section 2.5.3
  • Report-summary pairs formatted with a consistent instruction template, using the report as input and a verified summary as the target. section 2.5.3
  • LoRA applied to projection layers, enabling efficient adaptation to report-summarization nuances. section 2.5.3
  • Training settings for sequence length, batching, learning rate, gradient accumulation, and convergence. section 2.5.3

Investment research workflow

An investment firm converts each lengthy analyst report into a prompt containing the instruction “Summarize the following analyst report,” then trains on its verified internal summary. The resulting model targets concise outputs that retain financial reasoning and actionable insights. section 2.5 section 2.5.3

Listing 2.30 Define the prompt template
chat_prompt = """
### Instruction:
Summarize the following analyst report.
 
### Input:
{}
 
### Response:
{}"""
 
EOS_TOKEN = tokenizer.eos_token
 
def formatting_prompts_func(examples):
    inputs = examples["report"]
    outputs = examples["summary"]
    texts = []
    for input, output in zip(inputs, outputs):
        text = chat_prompt.format(input, output) + EOS_TOKEN
        texts.append(text)
    return {"text": texts}

Inspect the prompt template that standardizes report inputs, summary targets, and end-of-sequence formatting. section 2.5.3

How Building Specialized AI Systems covers it

How deep it goes
Explains domain adaptation through dataset formatting, LoRA, sequence limits, and training configuration, but does not detail evaluation.
Examples
Uses investment research reports containing financial metrics, valuation data, narrative reasoning, and verified summaries.
What it assumes
Assumes familiarity with fine-tuning theory and data preparation while relying on a pretrained model with financial-text knowledge.
What you can do after
Build a domain-adapted summarization model by formatting report-summary pairs and fine-tuning a pretrained model with LoRA.
How it connects
Connects summarization with fine-tuning, domain adaptation, supervised fine-tuning, pretrained models, prompt templates, and LoRA.

Also explained in

Compare how 17 books explain summarization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Specialized AI Systems. The section links point to the parts of the book it draws on.