← All models

text2text-generation · text · paraphrasing · WASM · ~235 MB

Paraphrase generation — same meaning, fresh words

A T5-base model fine-tuned to rewrite a sentence while preserving its meaning. Not a summarizer, not a grammar fixer — a dedicated paraphraser. The encoder reads your sentence, the decoder writes a re-worded version one token at a time. To get variety we run it with sampling several times, so each pass takes a different path and you get genuinely distinct re-wordings side by side. Nothing leaves your device.

At a glance

ModelFelladrin/onnx-chatgpt_paraphraser_on_T5_base (ONNX of humarin/chatgpt_paraphraser_on_T5_base)
Task / pipelinetext2text-generation (sequence-to-sequence)
ArchitectureT5-base encoder-decoder (~223M params) — encoder reads the sentence, decoder generates a paraphrase
TrainingFine-tuned for paraphrasing (rewrite-preserving-meaning), no task prefix — the sentence is the whole input
Quantizationq8 (8-bit) ONNX — encoder + merged decoder
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~235 MB (encoder ~110 MB + decoder ~123 MB), cached after first load
LicenseOpenRAIL (see model card — use-based restrictions apply)
Web APIsWebAssembly, Web Workers, Clipboard — all Baseline widely available

Run it

Type a sentence and generate several paraphrases. Sampling makes each one different; the "lexical overlap" chip shows how much the wording changed (lower = fresher phrasing). It is a surface measure — meaning-preservation is what the model is trained for (measure it directly on the multi-model page).

Decode mode
Original

See inside — sampling, tokens, and the rewrite

There's no hidden prompt: the encoder receives your sentence verbatim (T5 SentencePiece tokens below; a leading · is a word boundary). In sampling mode the decoder picks each next token by drawing from the probability distribution shaped by temperature (higher = more adventurous), top-k, and top-p — which is exactly why re-running yields different re-wordings. The timeline is the real per-token decode cadence of the last paraphrase.

Generate paraphrases to inspect the tokens and decode timeline.

Why it matters

A paraphraser that runs in a tab — no API key, no per-call bill, no text leaving the device — turns "say this differently" into a native browser capability. It's a rewrite engine you can put right next to a text field.

Honest limits: at T5-base size, paraphrases can occasionally drift or add a stray clause — always the writer's call which to keep. It preserves meaning far better than it invents facts; don't use it to rewrite claims you haven't checked.

Use cases

Basics

One sentence in, several re-wordings out — the fundamental rephrase, with variety from sampling.

Practical

Copywriting A/B: generate headline/CTA variants at a chosen "boldness", pick and copy the winner.

Wild

Telephone: feed each paraphrase back in, round after round, and watch meaning drift.

Multi-model

Paraphrase → embed (MiniLM): measure real semantic similarity, not just word overlap.

How the API works

No task prefix — the sentence is the whole input. Sampling gives you variety:

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

const paraphrase = await pipeline(
  "text2text-generation",
  "Felladrin/onnx-chatgpt_paraphraser_on_T5_base",
); // downloads + caches ~235 MB once

// run it a few times with sampling to get DISTINCT re-wordings:
for (let i = 0; i < 4; i++) {
  const out = await paraphrase("Could you explain how this works?", {
    max_new_tokens: 64, do_sample: true, temperature: 0.9, top_k: 60, top_p: 0.95,
  });
  console.log(out[0].generated_text);
  // → "Can you walk me through how this operates?"  (varies each run)
}

This page streams each sampled paraphrase with a TextStreamer and timestamps every token for the decode timeline — all inside a Web Worker so the UI never janks. transformers.js 3.7.5 returns a single sequence per call, so N paraphrases = N calls; a "Diverse beam" mode uses grouped beam search (humarin's recommended setup) for deterministic-but-varied alternatives.

References