To classify, try a trie: Quail runs LLM classification ~1.8x faster than free-text generation

sh_reya · x · 2026-10-13

Shreya Shankar and Charles Frye publish a blog post on how Quail, their AI-SQL engine, executes AI.CLASSIFY 1.8x faster than baselines. Free generation (as in BigQuery/Snowflake classify functions) is wasteful and fragile since decode steps are memory-bound. Quail instead constrains generation to known labels via a trie, stops decoding once one label remains, packs decode steps into other documents' prefill passes, and compares three execution strategies (greedy generation, scoring all labels at once, per-letter scoring) by estimated cost — using Qwen3-4B-fp8 in examples, with an aside on decision models.

Related event: Quail Speeds Up LLM Classification 1.8x with Trie-Constrained Decoding(4 posts)→

Original post →

More from Infra

Infra channel →