RedParrot: Accelerating NL-to-DSL for Business Analytics via Query Semantic Caching

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Tong, Xu, Yongqin, Zhang, Jianfeng, Cui, Lingxi, Wei, Wenqing, Chen, Suzhou, Li, Huan, Chen, Ke, Shou, Lidan
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910163569475584
author Wang, Tong
Xu, Yongqin
Zhang, Jianfeng
Cui, Lingxi
Wei, Wenqing
Chen, Suzhou
Li, Huan
Chen, Ke
Shou, Lidan
author_facet Wang, Tong
Xu, Yongqin
Zhang, Jianfeng
Cui, Lingxi
Wei, Wenqing
Chen, Suzhou
Li, Huan
Chen, Ke
Shou, Lidan
contents Recently, at Xiaohongshu, the rapid expansion of e-commerce and advertising demands real-time business analytics with high accuracy and low latency. To meet this demand, systems typically rely on converting natural language (NL) queries into Domain-Specific Languages (DSLs) to ensure semantic consistency, validation, and portability. However, existing multi-stage LLM pipelines for this NL-to-DSL task suffer from prohibitive latency, high cost, and error propagation, rendering them unsuitable for enterprise-scale deployment. In this paper, we propose RedParrot, a novel NL-to-DSL framework that accelerates inference via a semantic cache. Observing the high repetition and stable structural patterns in user queries, RedParrot bypasses the costly pipeline by matching new requests against cached "query skeletons" (normalized structural patterns) and adapting their corresponding DSLs. Our core technical contributions include (1) an offline skeleton construction strategy, (2) an online, entity-agnostic embedding model trained via contrastive learning for robust matching, and (3) a heterogeneous Retrieval-Augmented Generation (RAG) method that integrates diverse knowledge sources to handle unseen entities. Experiments on six real enterprise datasets from Xiaohongshu show RedParrot achieves an average 3.6x speedup and an 8.26% accuracy improvement. Furthermore, on new public benchmarks adapted from Spider and BIRD, it boosts accuracy by 34.8%, substantially outperforming standard in-context learning baselines.
format Preprint
id arxiv_https___arxiv_org_abs_2604_22758
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle RedParrot: Accelerating NL-to-DSL for Business Analytics via Query Semantic Caching
Wang, Tong
Xu, Yongqin
Zhang, Jianfeng
Cui, Lingxi
Wei, Wenqing
Chen, Suzhou
Li, Huan
Chen, Ke
Shou, Lidan
Information Retrieval
Artificial Intelligence
Computation and Language
Recently, at Xiaohongshu, the rapid expansion of e-commerce and advertising demands real-time business analytics with high accuracy and low latency. To meet this demand, systems typically rely on converting natural language (NL) queries into Domain-Specific Languages (DSLs) to ensure semantic consistency, validation, and portability. However, existing multi-stage LLM pipelines for this NL-to-DSL task suffer from prohibitive latency, high cost, and error propagation, rendering them unsuitable for enterprise-scale deployment. In this paper, we propose RedParrot, a novel NL-to-DSL framework that accelerates inference via a semantic cache. Observing the high repetition and stable structural patterns in user queries, RedParrot bypasses the costly pipeline by matching new requests against cached "query skeletons" (normalized structural patterns) and adapting their corresponding DSLs. Our core technical contributions include (1) an offline skeleton construction strategy, (2) an online, entity-agnostic embedding model trained via contrastive learning for robust matching, and (3) a heterogeneous Retrieval-Augmented Generation (RAG) method that integrates diverse knowledge sources to handle unseen entities. Experiments on six real enterprise datasets from Xiaohongshu show RedParrot achieves an average 3.6x speedup and an 8.26% accuracy improvement. Furthermore, on new public benchmarks adapted from Spider and BIRD, it boosts accuracy by 34.8%, substantially outperforming standard in-context learning baselines.
title RedParrot: Accelerating NL-to-DSL for Business Analytics via Query Semantic Caching
topic Information Retrieval
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2604.22758