Transformers
Summarization
Generate concise summaries from long text.
Generate concise summaries from long text using abstractive summarization models.
For full API reference (summarize(), summarizeMany(), options, result types, and custom providers), see the Core Summarization guide.
See it in action
Try Text Summarizer and Meeting Assistant for working demos.
Recommended Models
| Model | Size | Speed | Use Case |
|---|---|---|---|
Xenova/distilbart-cnn-6-6 | ~300MB | ⚡⚡ | General-purpose summarization |
Xenova/distilbart-cnn-12-6 | ~400MB | ⚡ | Higher quality summaries |
Configurable Length
Based on the Text Summarizer showcase app:
import { transformers } from '@localmode/transformers';
import { summarize } from '@localmode/core';
const model = transformers.summarizer('Xenova/distilbart-cnn-6-6');
// Short summary
const { summary: brief } = await summarize({
model,
text: longDocument,
maxLength: 60,
minLength: 20,
});
// Medium summary
const { summary: medium } = await summarize({
model,
text: longDocument,
maxLength: 150,
minLength: 60,
});
// Detailed summary
const { summary: detailed } = await summarize({
model,
text: longDocument,
maxLength: 300,
minLength: 100,
});Meeting Notes Example
Based on the Meeting Assistant showcase app — combine speech-to-text with summarization:
import { transcribe, summarize } from '@localmode/core';
// First transcribe the meeting audio
const { text: transcript } = await transcribe({
model: speechModel,
audio: meetingAudio,
});
// Then summarize the transcript
const { summary } = await summarize({
model: summarizerModel,
text: transcript,
maxLength: 200,
minLength: 60,
});Best Practices
Summarization Tips
- Set length constraints — Use
maxLengthandminLengthto control summary size - Input length matters — Models have a max input length; very long texts may need chunking
- Abstractive output — Summaries are generated text, not extracted sentences
- Use AbortSignal — Summarization can take several seconds; support cancellation
Showcase Apps
| App | Description | Links |
|---|---|---|
| Text Summarizer | Summarize articles and long-form content | Demo · Source |
| Meeting Assistant | Transcribe and summarize meeting recordings | Demo · Source |
| Smart Writer | Summarize and rewrite content for different audiences | Demo · Source |