arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2604.22758cs.IRcs.AIcs.CL
收藏

RedParrot:通过查询语义缓存加速业务分析中的自然语言到DSL转换

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

State Key Laboratory of Blockchain and Data Security(区块链与数据安全国家重点实验室)

Tong Wang, Yongqin Xu, Jianfeng Zhang, Lingxi Cui, Wenqing Wei, Suzhou Chen, Huan Li, Ke Chen, Lidan Shou

AI总结:

RedParrot通过语义缓存加速自然语言到领域特定语言的转换,提升业务分析效率与准确性,实验显示在六个真实企业数据集上平均提速3.6倍,准确率提升8.26%。

摘要:

近年来,小红书电子商务和广告的快速增长需求实时业务分析的高精度和低延迟。为满足这一需求,系统通常依赖将自然语言查询转换为领域特定语言(DSL)以确保语义一致性、验证和可移植性。然而,现有多阶段LLM管道在NL-to-DSL任务中存在 prohibitive latency、高成本和错误传播的问题,使其不适合企业级部署。本文提出RedParrot,一种新的NL-to-DSL框架,通过语义缓存加速推理。观察到用户查询的高重复性和稳定的结构性模式,RedParrot通过匹配新请求与缓存的“查询骨架”(标准化的结构性模式)并适应其对应的DSL。我们的核心技术贡献包括(1)离线骨架构建策略,(2)通过对比学习训练的在线、实体无关嵌入模型以实现稳健匹配,(3)一种异构检索增强生成(RAG)方法,整合多种知识源以处理未见过的实体。在六个真实企业数据集上的实验表明,RedParrot在平均提速3.6倍和准确率提升8.26%。此外,在从Spider和BIRD改编的公共基准测试上,其准确率提升34.8%,显著优于标准上下文学习基线。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑