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

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

7 Mar 2026arXiv:2604.22758added by Syntology

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

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

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.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2604.22758")

Code

Syntology Ran 10 of 17 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 10 ran with no contract checked.

By repository: found in paper text by Syntology: 17 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

TommyIsNotHere/RedParrot found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 10 ran; 0 honoured the contract we drafted; 7 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

10ran
7unverified

Licence: 17 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from TommyIsNotHere/RedParrot. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

build_prompt_v_0_0_3 TommyIsNotHere/RedParrot/hybrid_rewrite/prompt.py found in paper text by Syntology ran no licence file found · pointer only · f2161cf75856ea7b · report
build_prompt_v_0_0_4 TommyIsNotHere/RedParrot/hybrid_rewrite/prompt.py found in paper text by Syntology ran no licence file found · pointer only · 9ba5d11e26da96c8 · report
call_diff_api TommyIsNotHere/RedParrot/hybrid_rewrite/rewrite.py found in paper text by Syntology ran no licence file found · pointer only · 6c2ee19e26c1db0e · report
contrastive_more_negative_sample TommyIsNotHere/RedParrot/entity_agnostic_embedding_model/contrastive_learning.py found in paper text by Syntology ran no licence file found · pointer only · 6c175d3f4158fe2d · report
contrastive_nerfarneg_sample TommyIsNotHere/RedParrot/entity_agnostic_embedding_model/contrastive_learning.py found in paper text by Syntology ran no licence file found · pointer only · dd469e716ed27d7d · report
create_custom_experiments TommyIsNotHere/RedParrot/multithread.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · 61b8f146d32faefe · report
get_timeit_raw TommyIsNotHere/RedParrot/utils.py found in paper text by Syntology ran no licence file found · pointer only · 521378e23f10375f · report
judge_json TommyIsNotHere/RedParrot/hybrid_rewrite/util.py found in paper text by Syntology ran no licence file found · pointer only · 2d24d9f7bd676191 · report
load_split TommyIsNotHere/RedParrot/hybrid_rewrite/bird_rewrite.py found in paper text by Syntology ran no licence file found · pointer only · 8f99e23252478861 · report
load_split TommyIsNotHere/RedParrot/hybrid_rewrite/rewrite.py found in paper text by Syntology ran no licence file found · pointer only · 7fc3e226730be9d1 · report
contrastive_sample TommyIsNotHere/RedParrot/entity_agnostic_embedding_model/contrastive_learning.py found in paper text by Syntology unverified no licence file found · pointer only · bbcc0eb6e856f44b · report
dict_schema_subset TommyIsNotHere/RedParrot/hybrid_rewrite/util.py found in paper text by Syntology unverified no licence file found · pointer only · 2252b6dbb92ab081 · report
get_prompt TommyIsNotHere/RedParrot/hybrid_rewrite/prompt.py found in paper text by Syntology unverified no licence file found · pointer only · 1bd873161388cd83 · report
get_spider_schema TommyIsNotHere/RedParrot/hybrid_rewrite/bird_rewrite.py found in paper text by Syntology unverified no licence file found · pointer only · a3b7094364a5d6ac · report
same_dict_schema TommyIsNotHere/RedParrot/hybrid_rewrite/util.py found in paper text by Syntology unverified no licence file found · pointer only · f044a970d45cc4e1 · report
summarize_timeit TommyIsNotHere/RedParrot/utils.py found in paper text by Syntology unverified no licence file found · pointer only · e0b045ec215628a3 · report
timeit TommyIsNotHere/RedParrot/utils.py found in paper text by Syntology unverified no licence file found · pointer only · ddd8f811e9edb7a3 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2604.22758, was issued in April 2026, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections