# LEGIT: Live Eligibility Gating over Identifier Tries for Constrained Decoding of Heterogeneous Pages

DevFeed: [LEGIT: Live Eligibility Gating over Identifier Tries for Constrained Decoding of Heterogeneous Pages](<https://devfeed.tech/articles/legit-live-eligibility-gating-over-identifier-tries-for-constrained-decoding-of-heterogeneous-pages-125179.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.10357>)

Author: Felix Fang, Zheng Liu, Robert Saliba

Published: 2026-11-10T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [TensorFlow Recommenders](<https://devfeed.tech/topics/tensorflow-recommenders.md>), [search-engines](<https://devfeed.tech/topics/search-engines.md>), [Model Optimizer](<https://devfeed.tech/topics/model-optimizer.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>)

Tags: [catalog](<https://devfeed.tech/tags/catalog.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [cs-ir](<https://devfeed.tech/tags/cs-ir.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-pf](<https://devfeed.tech/tags/cs-pf.md>), [decoding](<https://devfeed.tech/tags/decoding.md>), [generative](<https://devfeed.tech/tags/generative.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [grammar](<https://devfeed.tech/tags/grammar.md>), [identifier](<https://devfeed.tech/tags/identifier.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [lookup](<https://devfeed.tech/tags/lookup.md>), [model](<https://devfeed.tech/tags/model.md>), [pages](<https://devfeed.tech/tags/pages.md>), [token](<https://devfeed.tech/tags/token.md>), [trie](<https://devfeed.tech/tags/trie.md>)

## AI overview

LEGIT constrains generative recommenders that produce a page of stores and their items in one decoding pass. Each Semantic ID must refer to a real, search-eligible catalog entry, avoid repeating entries, and--when an item is generated--belong to the relevant store. The method numbers trie leaves in depth-first order so these changing rules can be checked as range lookups across store and item tries; generated pages also receive an independent catalog check. On one NVIDIA B200 with one or two requests per decode step, directly walking the trie on the GPU made tokens about five times slower than unconstrained decoding. Across 36 implementations, measurements implicated kernel launches and CPU-GPU waits. The fastest implementation walks the trie on the CPU while the GPU runs the model, requiring no custom kernel; it reduced time per token by 65.9% versus the direct GPU approach, to about 1.7 times unconstrained cost. It was also fastest for a layout that places each item before its store.

## Source excerpt

arXiv:2611.10357v1 Announce Type: cross Abstract: A generative recommender names each candidate with a short token sequence, a Semantic ID, and recommends by generating those tokens. Some generative recommenders, including the Uber Eats search engine we are building, write a whole results page, stores with their menu items, in one decoding pass. Every Semantic ID on such a page must name a real store or item that is eligible for the search, such as a store that delivers to the user's location, and that is not already on the page. Each item must also belong to the store above it. A trie over the catalog keeps identifiers real, but eligibility and repetition change with every request and token, and the grammar-constrained decoder we tried could not enforce these changing rules exactly and quickly. We call this constraint LEGIT, for live eligibility gating over identifier tries. Numbering trie leaves depth first turns each rule into a range lookup over one store trie and one item trie, and every generated page passes an independent catalog check. On one NVIDIA B200 GPU with one or two requests per decode step, a direct implementation that walks the trie on the GPU makes each token about 5 times as slow as unconstrained decoding. Across 36 implementations, hardware counters and ablations are consistent with kernel launches and CPU-GPU waits as the source of this slowdown. Our fastest implementation walks the trie on the CPU while the GPU runs the model, needs no custom kernel, and cuts time per output token by 65.9 percent against the direct GPU implementation, to about 1.7 times the unconstrained cost. This implementation is also the fastest on a page layout that puts each item before its store.