← All models

summarization Β· text Β· WASM Β· ~250 MB

DistilBART CNN β€” summarize as it generates

A distilled BART fine-tuned on CNN/DailyMail news, it reads long text and writes a shorter abstractive summary β€” new sentences, not just extracted ones. Paste something below and watch the summary stream in token by token. Nothing leaves your device.

At a glance

ModelXenova/distilbart-cnn-6-6
Task / pipelinesummarization (sequence-to-sequence)
ArchitectureDistilBART β€” 6 encoder + 6 decoder layers, distilled from bart-large-cnn
Trained onCNN/DailyMail β€” so it writes news-style summaries
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~250 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it

Paste any text, set the length budget, and summarize. Greedy decoding streams the summary live and records real per-token timing; turn up the beams for a slower, often tighter result.

Summary

See inside β€” tokens, compression & decode timing

A summarizer is really a compressor. Here's what it actually did: how many tokens went in versus came out, how much shorter that is, and β€” for greedy decoding β€” the real time each output token took to generate. The model emits one token at a time, feeding each back in to pick the next.

Tokens in
–
Tokens out
–
Compression
–
Chars saved
–

Per-token decode timeline (ms per token):

Why it matters

Summarization turns a wall of text into something you can act on in seconds β€” and doing it on-device means you can summarize private, sensitive, or offline content without shipping a word to a server. No API key, no per-call bill, no data-handling agreement.

Use cases

Basics

Summarize a sample article and dial the length up and down to feel the trade-off.

Practical

TL;DR your own doc or meeting notes β€” paragraph or bullet-point mode.

Wild

Recursively summarize a summary until the whole thing collapses to one sentence.

Multi-model

Whisper transcribes a recording, then DistilBART recaps it β€” audio in, TL;DR out.

How the API works

Summarization is one pipeline call; length is controlled with generation parameters:

import { pipeline } from "@huggingface/transformers";

const summarizer = await pipeline(
  "summarization",
  "Xenova/distilbart-cnn-6-6",
); // downloads + caches ~250 MB once

const out = await summarizer(longText, {
  max_new_tokens: 80,
  min_new_tokens: 20,
  num_beams: 1,          // greedy; raise for tighter (slower) output
  no_repeat_ngram_size: 3,
});
// β†’ [{ summary_text: "…a concise abstractive summary…" }]

For the live token stream and the decode timeline, this page passes a TextStreamer so it can timestamp each generated token β€” all inside a Web Worker so the UI never janks.

References