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.
concepts
-
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. -
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.
-
Article Summarizer
Paste an article (or pick a built-in sample) and get both a
performance: 'fast'and aperformance: 'quality'summary in parallel. Timings are shown so you can weigh the latency/quality trade-off for real. -
Quality vs Speed Benchmark
Run the same text through all three
performancePreferencemodes 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. -
Format Selector
Pick
format(plain-text or markdown),length(short / medium / long), andtype(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. -
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.
-
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.
-
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 ↗