RedParrot: Accelerating NL-to-DSL for Business Analytics via Query Semantic Caching
RedParrot caches query skeletons to bypass costly LLM pipelines, boosting accuracy 8.26%.
Researchers from Xiaohongshu have published a paper introducing RedParrot, a novel framework that accelerates natural language to domain-specific language (NL-to-DSL) conversion for business analytics. The system addresses a critical bottleneck: existing multi-stage LLM pipelines for this task suffer from high latency, cost, and error propagation, making them unsuitable for real-time enterprise use at scale. RedParrot's core innovation is a semantic cache that stores 'query skeletons'—normalized structural patterns derived from frequent user queries. When a new request arrives, the system matches it against these skeletons and adapts their corresponding DSL outputs, bypassing the expensive LLM pipeline entirely.
RedParrot's technical contributions include an offline skeleton construction strategy, an entity-agnostic embedding model trained via contrastive learning for robust matching, and a heterogeneous Retrieval-Augmented Generation (RAG) method that integrates diverse knowledge sources to handle unseen entities. Tested on six real enterprise datasets from Xiaohongshu, RedParrot delivered an average 3.6x speedup and an 8.26% accuracy improvement over baseline pipelines. On public benchmarks adapted from Spider and BIRD, accuracy jumped 34.8%, substantially outperforming standard in-context learning baselines. The framework is designed for high-repetition, stable-pattern workloads common in e-commerce and advertising analytics, offering a practical path to low-latency, cost-effective business intelligence.
- RedParrot uses a semantic cache of 'query skeletons' to bypass multi-stage LLM pipelines, achieving 3.6x average speedup.
- On six real Xiaohongshu datasets, accuracy improved 8.26%; on public benchmarks (Spider, BIRD), accuracy jumped 34.8%.
- Techniques include offline skeleton construction, contrastive learning for entity-agnostic embeddings, and heterogeneous RAG for unseen entities.
Why It Matters
RedParrot makes real-time NL-driven business analytics viable at scale, cutting latency and cost while boosting accuracy.