Basics · Exact C4 Prefix Grammar vs Casual Instructions · Beam 1 vs 2 vs 4 Diff · Apache-2.0

Inside T5-Small: Prefix Grammar Ablation & Beam Search

Unlike instruction-tuned Flan-T5, base google-t5/t5-small (Xenova/t5-small, 78.07 MB WASM q8) was never fine-tuned on free-form chat instructions. Compare the exact C4/WMT prefix against casual instruction wording and a missing prefix, then inspect a live Beam 1 vs Beam 2 vs Beam 4 word-diff sweep.

1. Prefix Grammar Ablation (Exact vs Casual vs Missing)

Choose a test sentence or write your own English clause:

Exact C4 prefix triggers WMT translation; casual phrasing or missing prefix often echoes or degrades.
Total sweep latency–
Exact prefix ms–
Beam 1 vs 4 changes–
NaN check–

Awaiting ablation run

Initialise T5-Small above to compare exact C4 prefix vs casual instruction vs missing prefix.

2. Beam Search Comparison (Beam 1 Greedy vs Beam 2 vs Beam 4)

Every row runs the exact canonical prefix with num_beams = 1, 2, and 4. Word differences relative to Beam 1 greedy decoding highlight where wider search alters phrasing, gender/agreement, or punctuation.

Beam width 1, 2, and 4 comparison with word-level diffs
Beam Width Decoded Translation Word Diff vs Beam 1 Out Tokens Speed Latency
Run the ablation sweep above to compare Beam 1 vs Beam 2 vs Beam 4.

3. Inspect Ablation & Word-Diff Source

Show the code — worker.js ablatePrefix() C4 vs casual vs missing prefix sweep
Show the code — t5-core.mjs computeWordDiff() LCS word-level beam diff