← All models

title generation (text2text-generation) · text · WASM · ~80 MB

Headline generation — turn an article into a catchy title

Give it a paragraph or a whole article and this model writes a headline for it — not a summary of every point, a single short line meant to make you click. Because writing a title is generation, there is no one right answer: ask for the one best line and you get beam search; turn on sampling and the same model on the same article proposes a whole set of different candidate headlines to choose from. Nothing leaves your device.

At a glance

Modelldenoue/Title_Generation_T5Small_Model
Task / pipelinetext2text-generation (seq2seq) — article in, headline out
Input conventionthe article text, prepended with T5's summarize: task prefix (this fine-tune's training format)
ArchitectureT5 (encoder–decoder) fine-tuned on the 190k Medium-articles title dataset
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~80 MB (quantized encoder + merged decoder), cached after first load
LicenseMIT
Web APIsWebAssembly, Web Workers — all Baseline widely available

This is title generation, a distinct text-to-text job from summarisation: it emits one short catchy line, not a shrunk-down version of the text. It's also distinct from the instruction-tuned FLAN-T5 and the prefix-driven T5-base demos.

Run it

Paste an article or a paragraph. Pick Best for one beam-search headline, or Candidates to sample several different options with the temperature / top-k controls.

Best headline

See inside — the fed string, the tokens, and the decode

The model never sees your article as words — it sees the exact string below (its summarize: prefix highlighted) split into SentencePiece sub-word tokens. The best headline is then decoded one token at a time; the timeline shows how long each output token took. Sampling doesn't change the input — it changes which token the decoder picks at each step, which is why the candidates above diverge.

Exact string fed to the model (prefix highlighted):

–

Input tokens

Best-headline decode timeline (ms per output token)

Why it matters

Every article, product, email and video needs a title, and a good one is the difference between being read and being scrolled past. A title model turns that from a blank-page problem into a pick-from-a-list problem — generate a handful of options in a tab, on-device, for free, and choose. At ~80 MB it runs entirely in the browser, so a CMS, an email tool, or a note-taking app can offer headline suggestions with no server, no per-call cost, and nothing about the draft ever leaving the writer's machine.

Use cases

Basics

One article in, one headline out — the fundamental article→title job.

Practical

A/B headline generator: sample a batch of candidates a copywriter can choose between.

Wild

Clickbait vs. neutral: contrast low- and high-temperature headlines from the same article.

Multi-model

Summarise a long article first, then headline the summary — a two-model pipeline.

Pairs naturally with the DistilBART summariser for the multi-model summarise-then-title pipeline.

How the API works

It's an ordinary text2text-generation pipeline; the only trick is the training prefix and the choice of decoding strategy:

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

const generate = await pipeline(
  "text2text-generation",
  "ldenoue/Title_Generation_T5Small_Model",
  { device: "wasm", dtype: "q8" },
);

const input = "summarize: " + article;            // this fine-tune's input convention

// One "best" headline — beam search, deterministic:
const [best] = await generate(input, { max_new_tokens: 24, num_beams: 4, no_repeat_ngram_size: 2 });

// A spread of candidates — sampling, different every call:
const [draw] = await generate(input, { max_new_tokens: 24, do_sample: true, temperature: 1.0, top_k: 50 });

All inference runs in a Web Worker so generating a batch of candidates never janks the page. The best headline is streamed token-by-token via a TextStreamer for the decode timeline.

References