Introduction
In conversational AI, "frictions"—errors in speech recognition or natural language understanding—often lead to user frustration. Query Rewriting (QR) serves as a critical safety net, mapping erroneous or ambiguous queries into successful ones. Traditional QR systems typically rely on retrieval-based pipelines that perform similarity searches against massive indices of historical utterances. However, these systems often suffer from coarse modeling and high resource requirements.
The Shift to Constrained Generation
A recent study from Amazon Alexa AI and LinkedIn introduces the Constrained Generation Framework (CGF). This framework shifts the paradigm from searching a static index to a generative approach using a fine-tuned BART model. Unlike standard generative models that may "hallucinate" non-existent entities, CGF is strictly governed by a prefix tree (trie) built from millions of successful historical utterances.
Methods
CGF treats query rewriting as a sequence-to-sequence (Seq2Seq) task. The model utilizes a bidirectional encoder to process the current query along with previous dialogue turns, providing essential context for disambiguation.
The "secret sauce" of CGF is Constrained Decoding. During the autoregressive generation process, the model is only permitted to produce tokens that form a valid path within a global prefix tree. If a proposed token does not exist as a valid next step in the trie, its probability is masked to zero. This ensures that every generated rewrite corresponds to a known, successful interaction.
Datasets and Scale
The model was trained on 6.5 million machine-annotated pairs derived from user logs. The global trie was constructed from 27 million unique, defect-free utterances extracted from anonymized user interactions. For personalized rewriting, the system can swap the global trie for a user-specific one based on individual history.
Key Results
CGF demonstrates significant improvements over traditional retrieval-based systems like Dense Passage Retrieval (DPR). In offline evaluations, CGF achieved a 36.62% increase in precision and a 275.23% increase in trigger rate.
Online A/B testing further validated these results, showing a 28.97% relative reduction in defect rates, effectively fixing an additional one million queries per week. Furthermore, the memory footprint was reduced by over 97%, dropping from approximately 36GB-89GB for a standard FAISS index to just 856MB for the CGF trie.
Limitations and Future Work
While highly effective, CGF is a "closed world" system; it cannot generate rewrites that are not present in its trie. To address this, the authors plan to implement daily trie updates. Additionally, the autoregressive nature of the model introduces a 1.5x latency overhead compared to retrieval systems. Future research will explore non-autoregressive generation and partial constraints to improve speed and flexibility.
Summary updated