sshleifer/distilbart-xsum-12-6
Xenova/distilbart-xsum-12-6
summarization
1. Live Extreme 1-Sentence Headline Desk
Pick an article preset, drop or upload a document (.txt/.md/.csv/.json), paste (Ctrl/Cmd+V),
or enter up to 1,024 BPE tokens:
.txt, .md, .csv, or .json file here, or press
Ctrl/Cmd+V anywhere outside editable fields. Runs off-main-thread in a Web Worker.
See Inside · Novel N-Gram Abstractiveness vs CNN/DM
XSum headlines average ~35.8% novel bigrams vs ~16.0% for CNN/DM extractive leads.
See Inside · Novel vs Grounded Tokens & Entity Risk
Blue tokens are novel abstractive words; red tokens flag ungrounded entities or figures.
Live Per-Token Decode Cadence (measured via TextStreamer at
num_beams = 1)
2. Why 12-Encoder / 6-Decoder XSum Matters
In sequence-to-sequence distillation, keeping all 12 encoder layers preserves full-document
reading comprehension while halving the autoregressive decoder from 12 to 6 layers cuts
token-by-token WASM latency roughly in half. Paired with XSum's single-sentence BBC objective
(length_penalty: 0.5), it turns multi-paragraph briefs into punchy headlines — though extreme
compression also amplifies entity hallucination, which we audit in Wild and
Multi-model.
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";
const summarizer = await pipeline(
"summarization",
"Xenova/distilbart-xsum-12-6",
{ device: "wasm", dtype: "q8" }
);
const [{ summary_text }] = await summarizer(article, {
min_new_tokens: 11,
max_new_tokens: 62,
num_beams: 1,
length_penalty: 0.5,
no_repeat_ngram_size: 3,
});
Show the code · worker.js — runSummarize() (362.32 MB q8 WASM worker)
Show the code · xsum-core.mjs — computeAbstractivenessMetrics()
3. Model Card & References
- Upstream model card: sshleifer/distilbart-xsum-12-6 (Apache-2.0)
- ONNX build for Transformers.js: Xenova/distilbart-xsum-12-6
- Teacher & XSum paper: facebook/bart-large-xsum · Narayan et al. (2018) XSum · Shleifer & Rush (2020) Pre-trained Summarization Distillation