Intent Detection in the Age of LLM s (2024)

Abstract: Intent detection is a critical component of task-oriented dialogue systems (TODS) which enables the identification of suitable actions to address user utterances at each dialog turn. Traditional approaches relied on computationally efficient supervised sentence transformer encoder models, which require substantial training data and struggle with out-of-scope (OOS) detection. The emergence of generative large language models (LLMs) with intrinsic world knowledge presents new opportunities to address these challenges.In this work, we adapt SOTA LLMs using adaptive in-context learning and chain-of-thought prompting for intent detection, and compare their performance with contrastively fine-tuned sentence transformer (SetFit) models to highlight prediction quality and latency tradeoff. We propose a hybrid system using uncertainty based routing strategy to combine the two approaches that along with negative data augmentation results in achieving the best of both worlds ( i.e. within 2% of native LLM accuracy with 50% less latency). To better understand LLM OOS detection capabilities, we perform controlled experiments revealing that this capability is significantly influenced by the scope of intent labels and the size of the label space. We also introduce a two-step approach utilizing internal LLM representations, demonstrating empirical gains in OOS detection accuracy and F1-score by >5% for the Mistral-7B model.

## introduction task oriented dialogue systems (tods) have gained significant traction and investment from industry because of their efficiency, accessibility and 24x7 availability to serve customers. automation through tods is expected to save billions of dollars in labor costs by @xcite . intent detection is a vital part of natural language understanding (nlu) layer of tods. tra-* contributed to this work during her internship at amazon ditionally, intent detection has been used to understand and map the user query to a bot action (e.g., respond with a static answer, execute a pre-configured flow etc) @xcite . with increasing use of llms such as chat-gpt (openai, 2022), claude @xcite , mistral @xcite , llama (meta, 2023) as retrieval augmented generators to generate answers to user queries in tods, intent detection is being used to identify the right knowledge sources, apis and tools to call for retrieval augmented generation. this ensures efficient utilization of tools, apis and various other knowledge sources. an intent detection system of a conversational ai service is expected to handle intents anywhere in the spectrum of very-broad to very-specific scopes foot_0 depending upon actionability of intents and bot usecases as shown in fig 1 . they are also expected to accurately reject out-of-scope (oos) queries foot_1 without having access to any training data for such queries as universe of oos queries for any tods is infinitely large. since for a typical conversational ai service, data for intent detection training comes from bot developers who are not experts in ml, intent detection systems have to also deal with imbalanced training datasets. additionally, these systems are expected to work with very few utterances per intent. traditionally, intent detection systems have been built using supervised classification or similarity based models @xcite @xcite . llms, due to their few-shot learning capabilities, world knowledge and impressive performance across multiple nlp tasks @xcite , have the potential to improve intent detection systems in tods. in this work, we explore how llms can be best leveraged for the task of intent detection and assess their ability to handle oos queries and varying scope of intents. contributions. 1. we employ generative llms using adaptive in-context learning (icl) and chain of thought (cot) prompting for the task of intent detection and compare them against contrastively fine-tuned sentence transformer (setfit) models, highlighting performance/latency trade-offs. we evaluate 7 sota llms from claude and mistral families on 3 open-source and 3 internal real world datasets. we intend to also share the three internal datasets after necessary approvals as a community resource and to ensure reproducibility. improving oos detection performance of llms. recent work @xcite fine-tuned llms to improve oos performance which is prohibitive both from development and maintenance perspective for a typical conversational-ai platform which needs to support hundreds of different tods (because fine-tuning and deploying a separate instance of llm for every tods is prohibitively expensive which makes fine-tuning llms impractical). hence, we propose an alternative approach without llm fine-tuning which improves both oos accuracy and overall performance @xmath0. hybrid intent detection system which uses llms. unlike prior work, our focus is not just on evaluation of llms and/or improving oos detection performance of llms, but we also focus on building a deployable intent detection system which can benefit from llms but does not have prohibitive cost and latency, as part of which we propose a hybrid system using uncertainty based routing strategy to combine llms and setfit approaches that along with negative data augmentation results in achieving the best of both worlds ( i.e. within 2% of native llm accuracy with 50% less latency). better understanding of llm's oos detection capabilities. in this work we do controlled experiments to study the effect of scope of labels and size of label space. recent work @xcite also investigated the effect of the size of the label space on llm's oos performance and their findings are inline with our findings. however, our findings on how llm oos detection capabilities are influenced by the scope of intent labels are novel and would inform label space design during development of tods. ## leveraging llms for intent detection in this section we see how llms can be best leveraged for intent detection and propose a hybrid system which leverages llms conditionally, achieving a balance between performance and cost. ## llms and oos detection evaluation results in sec 3.4 showed that llms struggle with oos detection. hence, in this section we do a controlled study to better understand behavior of llm based intent detection with special focus on their oos detection capabilities (sec 4.1) and based on the insights propose a novel methodology for oos detection to improve llms performance (sec 4.2). ## conclusion various idiosyncrasies of intent detection task like varying scope of intents within a dataset, need to reject out of scope queries, imbalanced datasets and low resource regime make it a challenging task. in this work we evaluate multiple open source and closed source sota llms across multiple internal and external datasets for the task of intent detection using adaptive icl and cot prompting, compare them with setfit models and discuss their performance/latency trade-offs. we build a hybrid system which routes queries to llm when needed and achieves balance between performance and cost. we also propose a novel two step methodology which improves overall llm performance @xmath1. we hope our work will be useful for the community to build better tods.