R-Bot: An LLM-based Query Rewrite System
Zhaoyan Sun, Xuanhe Zhou, Guoliang Li, Xiang Yu, Jianhua Feng, Yong Zhang

TL;DR
R-Bot leverages large language models with a systematic evidence-guided approach to improve SQL query rewriting, reducing latency and surpassing existing methods in real-world applications.
Contribution
The paper introduces R-Bot, a novel LLM-based query rewrite system with a multi-source evidence pipeline and hybrid retrieval, addressing hallucination issues and enhancing rewrite quality.
Findings
R-Bot outperforms state-of-the-art query rewrite methods.
Deployment at Huawei shows reduced query latency.
Systematic evidence-guided approach improves rewrite accuracy.
Abstract
Query rewrite is essential for optimizing SQL queries to improve their execution efficiency without changing their results. Traditionally, this task has been tackled through heuristic and learning-based methods, each with its limitations in terms of inferior quality and low robustness. Recent advancements in LLMs offer a new paradigm by leveraging their superior natural language and code comprehension abilities. Despite their potential, directly applying LLMs like GPT-4 has faced challenges due to problems such as hallucinations, where the model might generate inaccurate or irrelevant results. To address this, we propose R-Bot, an LLM-based query rewrite system with a systematic approach. We first design a multi-source rewrite evidence preparation pipeline to generate query rewrite evidences for guiding LLMs to avoid hallucinations. We then propose a hybrid structure-semantics retrieval…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsService-Oriented Architecture and Web Services · Network Security and Intrusion Detection · Advanced Computational Techniques and Applications
MethodsAbsolute Position Encodings · Residual Connection · Adam · Attention Is All You Need · Softmax · Label Smoothing · Dropout · Dense Connections · Layer Normalization · Linear Layer
