Abstract
Intent detection in data analysis systems faces a "combinatorial explosion" due to the vast number of possible metric and dimension combinations. Traditional classification and standard Retrieval-Augmented Generation (RAG) approaches often fall short in accuracy and efficiency when dealing with millions of potential intents. We present DSRAG, a Double-Stream Retrieval-Augmented Generation framework that combines a Query-to-Query (Q2Q) stream for high-speed template matching and a Query-to-Metadata (Q2M) stream for dynamic LLM-based intent selection. Our evaluation demonstrates that DSRAG, particularly when paired with fine-tuned open-source models, improves intent detection accuracy from a baseline of 24.7% to over 90.3%.
Introduction
In real-world data analysis systems, such as those utilized at Tencent, an "intent" is defined by a combination of metrics (e.g., Daily Active Users) and dimensions (e.g., gender, region, device). This structure leads to a "combinatorial explosion," where the number of possible intents far exceeds the capacity of fixed-label classifiers or the context windows of standard Large Language Models (LLMs). Standard RAG systems often struggle with the nuances of these combinations, leading to hallucinations or failures in retrieving the specific metadata required for accurate data visualization.
The DSRAG Framework
To address these challenges, we propose the Double-Stream Retrieval-Augmented Generation (DSRAG) framework. DSRAG utilizes two parallel processing paths to ensure both high recall and precision in intent detection.
Query-to-Query (Q2Q) Stream
The Q2Q stream leverages a massive repository of 43.25 million synthetic queries generated from 132 templates and 1.65 million meta-sample combinations. When a user query is received, the system performs a semantic search for a "professionalized" match within this database. High-confidence matches are returned instantly, providing a low-latency (~12ms) path for common or well-structured requests.
Query-to-Metadata (Q2M) Stream
When the Q2Q stream fails to find a high-confidence match, the system falls back to the Q2M stream. This path retrieves the top 100 most relevant metrics and dimensions from raw metadata using BM25 and a Cross-Encoder reranker. An LLM then acts as a selector to identify the correct intent from this filtered context.
Experimental Results
We evaluated DSRAG using a dataset of 1,592 real-world user queries from the video domain. Our experiments compared standard prompt engineering with GPT-3.5-Turbo against the DSRAG framework using both closed-source and fine-tuned open-source models (Llama3-8B and Qwen2-7B).
The results indicate that the double-stream approach significantly outperforms baseline RAG. While prompt engineering achieved only 24.7% accuracy, DSRAG with GPT-3.5-Turbo reached 78.7%. The highest performance was achieved by fine-tuning open-source models using Low-Rank Adaptation (LoRA), with Llama3-8B reaching 90.3% accuracy.
Key Insights
- Handling "No Answer": A critical factor in performance was training models to recognize when a query cannot be answered by the available metadata, reducing hallucinations.
- Efficiency: The tiered architecture ensures that common queries are handled rapidly by the Q2Q stream, while more complex queries are processed by the Q2M stream in approximately one second.
- Instruction Tuning: Domain-specific instruction tuning is essential for teaching models the relationship between colloquial language and structured metadata schemas.
Conclusion and Future Work
DSRAG effectively mitigates the combinatorial explosion in intent detection. Future work will focus on improving the initial retrieval bottleneck in the Q2M stream and incorporating Chain-of-Thought (CoT) explanations to enhance system transparency and debuggability.
Summary updated