v148 · on-device AI

Summarizer API performance preference

Adds a performance option to Summarizer.create(). Sites can ask for a fast lightweight model when they need responsiveness, or a high-quality larger model when output quality matters more.

Heads up The Summarizer API itself is an origin trial. The performance hint is honoured by the UA — it's a request, not a guarantee.

concepts

  1. Fast vs Quality

    Paste an article. Get two summaries side by side: one from performance: "fast", one from "quality". Each card shows duration, length, and the summary itself.

  2. Comment Stream

    The "summarise this comment" motivating use case — a stream of comments arrives, each gets an inline TL;DR badge. Toggle fast/quality and add bursts to see why "fast" is the right pick for high-volume short text.

  3. Article Summarizer

    Paste an article (or pick a built-in sample) and get both a performance: 'fast' and a performance: 'quality' summary in parallel. Timings are shown so you can weigh the latency/quality trade-off for real.

  4. Quality vs Speed Benchmark

    Run the same text through all three performancePreference modes simultaneously — fast, balanced, quality. Compare output text, word count, estimated inference time, and a key-facts faithfulness score side by side. A streaming toggle shows token-by-token output for each mode.

  5. Format Selector

    Pick format (plain-text or markdown), length (short / medium / long), and type (tl;dr / key-points / teaser / headline) from dropdowns, paste any text, and see the word-count reduction for each combination. The result card shows the actual API parameters alongside the summary output.

  6. Local-First Workflow

    A live article-digest feed: add articles (or pick samples), choose fast/balanced/quality mode, and get on-device summaries with latency and word-count reduction shown. Demonstrates the "right tool for the call site" pattern in a realistic feed UI.

  7. Quality Control Panel

    Run all three performance modes on the same text simultaneously and compare latency, compression percentage, and output quality side by side. Includes comment, article, and paper-abstract samples to show how mode choice should vary by content type.

  8. Safety Harness

    12 edge-case tests: API availability, empty and whitespace-only input, invalid performance values, very long text truncation, format/type combinations, concurrent summarisation, model-unavailable recovery, and the advisory nature of the performance hint.

why it exists

Summarisation is a "show me what this is" feature — readers expect it to feel snappy. Squeezing the slowest possible model into a "summarise this comment" call is wasteful; squeezing the fastest model into a "summarise this whitepaper" call is reductive. The performance hint gives the site a single knob to express what trade-off matters for this call site, and lets the UA pick an appropriate model from the on-device model family. Same API surface, two operating modes.

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗