Introduction
In modern automated customer service, intent classification serves as the foundational engine for query routing. The task involves mapping natural language queries—often ambiguous or informal—to specific categories (e.g., Return/Refund) to ensure they reach the appropriate automated bot or human agent. However, as enterprise operations scale, traditional classification models encounter significant "scaling walls."
Static models, such as those based on BERT or RoBERTa, typically utilize a fixed classification head. This architecture becomes problematic when new products or services are introduced, requiring constant and computationally expensive retraining to accommodate new labels. Furthermore, large organizations often manage heterogeneous taxonomies across different business units (e.g., retail vs. digital devices), making it difficult to maintain a single, unified classifier. To address these challenges, researchers at Amazon have developed REIC (RAG-Enhanced Intent Classification), a framework that reimagines intent classification as a dynamic retrieval task rather than a static labeling problem.
The REIC Framework
REIC replaces traditional classifiers with a Retrieval-Augmented Generation (RAG) pipeline. This approach allows the system to adapt to new intents by simply updating a vector index, eliminating the need for gradient updates or model retraining. The framework operates in three distinct stages:
1. Index Construction
Instead of training a model to memorize a fixed set of labels, REIC constructs a dense vector index of (query, intent) pairs derived from annotated datasets. Each intent is stored with its full hierarchical context, preserving the relationship between broad categories and specific sub-intents.
2. Candidate Retrieval
When a user query is received, a dense retriever (specifically MPNet) searches the index for the top-$k$ most similar examples. This step effectively narrows the search space from thousands of potential intents to a manageable set of candidates, significantly reducing the complexity of the final classification.
3. Intent Probability Calculation and Constrained Decoding
To prevent the hallucinations common in standard Large Language Models (LLMs), REIC employs constrained decoding. The system feeds the query and the retrieved candidates into a fine-tuned Mistral-7B model. Rather than allowing the model to generate free-form text, REIC calculates the exact log-probability for each candidate intent string provided by the retriever. The intent with the highest probability is selected. This ensures the output is always a valid category from the existing taxonomy.
Experimental Results
Performance Metrics
The researchers evaluated REIC against several strong baselines, including fine-tuned RoBERTa models and zero-shot LLMs like Claude 3.5 Sonnet. Using an anonymized internal Amazon dataset consisting of over 52,000 training samples across multiple business verticals, REIC demonstrated superior performance:
- Accuracy: REIC achieved an overall F1-score of 0.572, outperforming fine-tuned RoBERTa (0.516) and RAG-boosted Claude 3.5 Sonnet (0.419).
- Robustness: The model showed significant resilience when handling "unseen" intents—categories present in the test set but absent from the training data—where traditional models typically fail.
Real-World Impact
Upon deployment within Amazon’s internal customer service infrastructure, the REIC framework led to a 3.38% absolute improvement in the positive response rate from customers. This metric indicates that queries were routed more accurately to the correct resolution path compared to the previous dual-model system.
Key Insights and Discussion
- The Importance of Retrieval: The study found that the quality of the retriever is the primary bottleneck. MPNet, utilizing contrastive learning, significantly outperformed keyword-based methods (BM25). If the correct intent is not present in the top-$k$ candidates, the downstream LLM cannot recover it.
- Latency vs. Accuracy: The researchers identified $k=10$ as the optimal balance for candidate retrieval. While increasing $k$ can marginally improve the chances of including the correct intent, it leads to a sharp rise in inference latency, which is critical for real-time customer service applications.
- Dynamic Scalability: The primary advantage of REIC is its "hot-swappable" nature. New intents can be integrated into the system by simply updating the vector index, allowing the model to recognize new categories immediately without downtime or retraining.
Limitations and Future Work
While REIC offers a scalable alternative to traditional classifiers, it introduces higher computational overhead than smaller BERT-style models. Running a 7B-parameter LLM for every query requires significant optimization to meet millisecond-level latency requirements at scale. Future research directions include adaptive retrieval, where the number of candidates ($k$) is adjusted dynamically based on the model's confidence, and further optimization of the retriever to reduce the candidate bottleneck.
Summary updated