ConceptioArchivearXiv CS
arXiv CSopen access

LASER: A Data-Centric Method for Low-Cost and Efficient SQL Rewriting based on SQL-GRPO

Unknown · 2026 · arxiv_cs
arXiv CS · Papers · License: Open Access · 2026
Open Source ↗Direct PDF ↓
databasesdatamanagementsqlstorage
databases, sql, data management, storage

LASER: A Data-Centric Method for Low-Cost and Efficient SQL Rewriting based on SQL-GRPO Jiahui Li

Tongwang Wu

Yuren Mao∗

Zhejiang University [email protected]

Zhejiang University [email protected]

Zhejiang University [email protected]

Rong Kang

Tieying Zhang∗

Yunjun Gao

ByteDance Inc [email protected]

ByteDance Inc [email protected]

Zhejiang University [email protected]

ABSTRACT Query rewriting, the process of transforming queries into semantically equivalent yet more efficient variants, is crucial for database optimization. Existing solutions predominantly rely on either rulebased heuristics or Large Language Models (LLMs). However, traditional rule-based methods lack adaptability, while LLM-based approaches incur prohibitive inference costs and privacy risks. In contrast, Small Language Models (SLMs) present a compelling middle ground, potentially offering both flexibility and efficiency. However, the development of such compact models is severely bottlenecked by the scarcity of high-quality, domain-specific training data. To bridge this gap, we introduce LASER, a data-centric framework designed to empower small models for robust SQL optimization. First, to address the scarcity of existing benchmarks and the limited optimization headroom of generic synthetic queries, we construct SQL-MCTS, a large-scale corpus of complex slow queries. We employ an MCTS-based hybrid expansion strategy that combines rule-guided anti-patterns with LLM mutations to evolve structurally expressive seeds into execution-verified slow variants. Second, to enable the model to autonomously discover latency-aware rewriting patterns, we propose SQL-GRPO, a specialized alignment strategy adapted from Group Relative Policy Optimization. By integrating Anchored Group Advantage to refine advantage estimation and Complexity-Adaptive Dynamic Rollout to efficiently allocate exploration budgets, this approach effectively empowers compact models to master execution-based optimization logic. Implemented on Qwen3 models, LASER significantly outperforms rule-based systems and LLMs in execution efficiency, while exhibiting robust zero-shot transferability with minimal overhead. PVLDB Reference Format: Jiahui Li, Tongwang Wu, Yuren Mao∗ , Rong Kang, Tieying Zhang∗ , and Yunjun Gao. LASER: A Data-Centric Method for Low-Cost and Efficient SQL Rewriting based on SQL-GRPO. PVLDB, 14(1): XXX-XXX, 2020. doi:XX.XX/XXX.XX This work is licensed under the Creative Commons BY-NC-ND 4.0 International License. Visit https://creativecommons.org/licenses/by-nc-nd/4.0/ to view a copy of this license. For any use beyond those covered by this license, obtain permission by emailing [email protected]. Copyright is held by the owner/author(s). Publication rights licensed to the VLDB Endowment. Proceedings of the VLDB Endowment, Vol. 14, No. 1 ISSN 2150-8097. doi:XX.XX/XXX.XX ∗ Yuren Mao and Tieying Zhang is the corresponding author.

PVLDB Artifact Availability: The source code, data, and/or other artifacts have been made available at https://github.com/LJHzju/LASER.

1

INTRODUCTION

With the rapid growth of data, SQL query optimization has become one of the key techniques for improving the performance of Database Management Systems (DBMS). In modern database applications, the efficiency of SQL queries directly impacts system response times and resource consumption. Therefore, SQL query rewriting has emerged as a crucial optimization method, widely employed to enhance query execution efficiency. However, the task of rewriting queries is inherently challenging. The complexity arises from the need to transform a query into an equivalent form while improving its execution performance. Previous works broadly fall into two categories: (1) rule-based methods, which rely on predefined transformation rules to rewrite queries, and (2) LLM-based methods, which leverage large language models to generate new query formulations. However, existing methods face significant practical challenges, ranging from heavy data dependence to prohibitive costs and low execution efficiency. Data Dependence and Poor Transferability. Several existing rewriting methods rely heavily on large quantities of data tailored to a specific database or benchmark. For example, LearnedRewrite [49] depends on a learned cost model trained on workload execution traces to guide its rule selection. Similarly, LLM-R2 [22] requires a substantial pool of SQL pairs for rule selection, while E3 -Rewrite [41] trains its rewrite model on a large corpus of SQL queries. In practice, these datasets are typically synthesized from template-based benchmarks such as TPC-H [29], and DSB [13]. The resulting workloads exhibit limited structural and semantic diversity, and the overlap between training and evaluation templates creates a high risk of data leakage. Models tuned in this way tend to overfit benchmark-style patterns, struggling to transfer to unseen schemas or real-world queries [46]. High Cost and Privacy Risks. Most prior systems depend on proprietary, large-scale LLM APIs in the rewrite loop. LLM-R2 [22] and R-Bot [38] invoke closed-source models to select or rank rewrite rules, whereas QUITE [37] and GenRewrite [24] directly call such APIs to generate rewritten queries. This design incurs substantial monetary cost when serving many queries, since each rewrite may require multiple long-prompt API calls. More importantly, shipping production SQL, schema information, and sometimes execution feedback to external services raises serious privacy and compliance

Our contributions are summarized as follows:

concerns, making these approaches difficult to deploy in settings with strict data governance or regulatory constraints. Low Rewriting Efficiency. LLM-based methods also tend to have low end-to-end rewrite efficiency. Systems such as R-Bot [38] perform multiple rounds of LLM inference to explore candidate rule sequences, and then rely on engines like Apache Calcite [8] to apply the selected rules, resulting in substantial per-query overhead. QUITE [37] adopts a multi-step, agent-style workflow in which LLM agents iteratively analyze, plan, and refine query rewrites. Across these designs, repeatedly querying large models, orchestrating multi-stage tool calls, and executing validation passes can make the latency of a single rewrite orders of magnitude higher than that of native optimizer decisions. This low efficiency becomes a critical bottleneck for real-time or interactive scenarios. Given these limitations, specialized Small Language Models offer a compelling solution to the trilemma of adaptability, efficiency, and privacy. Local deployment mitigates the latency and privacy risks of LLMs API-dependent workflows while maintaining reasoning capabilities. Crucially, Chinchilla Scaling Laws [17] suggest that performance depends more on data quality than on parameter count alone. This implies that compact models can achieve expert-level SQL optimization when aligned with high-quality, domain-specific data. However, realizing this potential faces two primary hurdles. First, current training data resources are bottlenecked by the scarcity of public benchmarks and the limited optimization headroom of generic synthetic queries, which lack the structural complexity to capture the causal mapping between rewriting and latency reduction. Second, Reinforcement Learning (RL) is theoretically ideal for optimization tasks by leveraging execution feedback [12, 25, 44]. In particular, Group Relative Policy Optimization offers a compelling low-cost avenue for policy alignment, having been widely adopted in mathematical and reasoning domains [15, 30, 35]. However, directly applying standard GRPO to SQL rewriting proves ineffective, as it typically suffers from misleading advantage estimation caused by invalid candidates and inefficient exploration budget allocation, preventing the model from autonomously mastering latency-aware patterns. To overcome these challenges, we propose LASER, a data-centric method for Low-cost and Efficient SQL Rewriting. LASER implements a unified framework that synergizes high-quality data synthesis with policy optimization. In the first stage, to address the scarcity and triviality of existing data, we construct SQL-MCTS. Starting from structurally expressive seed queries, the framework employs an MCTS-based hybrid expansion strategy that combines rule-guided anti-patterns with LLM mutations to evolve these seeds into execution-verified slow variants, thereby capturing the causal mapping between structural degradation and latency to provide necessary optimization headroom. In the second stage, we perform SQL-GRPO, a specialized alignment framework. Specifically, this strategy incorporates Anchored Group Advantage to rectify false-positive signals by grounding relative rewards against absolute baselines, and employs Complexity-Adaptive Dynamic Rollout to dynamically concentrate exploration resources on queries with higher structural difficulty. By combining this with an SFT cold-start and Verification-Driven Self-Correction, LASER yields a compact model that achieves strong optimization performance at low inference cost and can be transferred across databases.

• We propose LASER, a data-centric framework for low-cost and efficient SQL rewriting that synergizes automated slow query generation with a specialized training pipeline to empower compact models with robust optimization capabilities (Section 3). • We construct SQL-MCTS, a slow-query dataset on the TPC-DS schema containing 11,675 generated queries. These queries exhibit superior structural complexity compared to existing benchmarks, providing a rich and challenging foundation for training SQL rewrite models (Section 4). • We develop a specialized optimization pipeline centered on SQLGRPO, a novel alignment strategy that incorporates Anchored Group Advantage and Complexity-Adaptive Dynamic Rollout. This enables compact models to autonomously master executionbased optimization logic beyond static supervision (Section 5). • Extensive experiments demonstrate that LASER achieves superior rewrite performance across diverse benchmarks, while exhibiting robust zero-shot transferability. Crucially, it achieves these results locally with minimal inference latency, validating its suitability for privacy-sensitive and resource-constrained deployments (Section 6).

2 RELATED WORK 2.1 Query Rewrite SQL query rewrite refers to the process of transforming a given SQL query into an equivalent form that executes more efficiently. Query rewrite is a critical step in modern Database Management Systems (DBMSs), as it can significantly improve the performance of complex queries without altering the underlying semantics. Existing query rewrite techniques can be broadly divided into two categories: rulebased query rewrite and LLM-based query rewrite. 2.1.1 Rule-based Query Rewrite. Rule-based query rewrite methods [22, 38, 39, 49] rely on a set of predefined transformation rules (e.g., predicate pushdown [42] and elimination of redundant operators) to improve execution efficiency. These rules are often implemented in an algebraic framework such as Apache Calcite [8] and are repeatedly applied until no further improvements are detected. For example, WeTune [39] automatically generates and verifies logical plan transformations with a Cost-Based Optimizer (CBO), exploring alternative plans by composing algebraic equivalences. However, its search space is constrained to specific operator types and equivalence patterns, which limits its ability to capture richer rewrite opportunities. LearnedRewrite [49] combines Monte Carlo Tree Search (MCTS) with a learned cost model to explore rule applications, but its effectiveness heavily depends on the accuracy of the cost model. More recently, LLM-R2 [22] and R-Bot [38] integrate large language models into rule-based frameworks while still executing concrete transformations through predefined rules. LLM-R2 uses an LLM to guide rule selection, while R-Bot retrieves structural and semantic evidence from historical queries to assist in rule ordering and application. Despite their advances, these methods remain constrained by the expressiveness of the rule set. The rules are typically designed to cover common query patterns and standard relational operators. 2

As a result, they are difficult to generalize to novel or highly complex query structures, such as intricate Common Table Expressions (CTEs) and deeply nested subqueries.

directly for scalar feedback signals that reflect diverse task-specific quality criteria. A prominent line of work employs RL to align LLMs with human or automated preferences, often referred to as Reinforcement Learning from Human Feedback (RLHF) [28] and its variants [5, 33, 48]. These methods typically rely on Actor-Critic algorithms [7] to update the policy based on rewards derived from preference models. However, this paradigm incurs significant memory and computational overhead due to the necessity of maintaining a separate value network (Critic) alongside the policy model. This high resource cost becomes a critical bottleneck when deploying efficient, low-latency training pipelines for specialized tasks. To mitigate these costs, recent work introduces Group Relative Policy Optimization [35], which eliminates the critic model by estimating baselines from the group-wise mean of generated outputs. While GRPO significantly improves training efficiency, its standard formulation assumes uniform sample difficulty and relies on relative scoring within a group. This poses unique challenges for SQL optimization, where workload heterogeneity leads to resource misallocation, and relative advantages can erroneously reward slow queries simply for being valid amidst a group of syntax errors.

2.1.2 LLM-based Query Rewrite. LLM-based query rewrite methods [24, 37, 41] leverage the capabilities of LLMs to directly rewrite SQL queries. For example, GenRewrite [24] introduces Natural Language Rewrite Rules (NLR2s) to provide a textual explanation of the rewrite process, and employs an iterative process to rewrite and correct queries based on feedback loops. However, this process can be computationally expensive and requires multiple rounds of rewriting and validation to ensure correctness and efficiency. QUITE [37] enhances LLM-based query rewriting by introducing a multi-agent framework controlled by a finite state machine (FSM). However, the system’s reliance on a multi-agent architecture and closed-source APIs can introduce scalability challenges, limiting its applicability in certain environments. E3 -Rewrite [41] utilizes Reinforcement Learning (RL) with open-source models to optimize queries for executability, equivalence, and efficiency. But due to the absence of a dedicated training dataset, it constructs training data from templates of the evaluation benchmarks, thus limiting its ability to generalize to other novel or complex queries [46].

2.2

3

SQL Generation

Effective training for SQL query rewriting requires diverse and high-quality datasets, but generating such datasets remains a significant challenge due to the lack of specialized training data. While benchmark datasets such as TPC-DS [26] and TPC-H [29] offer predefined templates for SQL queries, these datasets fall short in terms of diversity and complexity, which limits their utility in training models for real-world applications. To address these shortcomings, alternative methods such as OmniSQL [20] and SQL-Factory [21] have been developed to automatically synthesize large-scale SQL queries. These approaches enhance query diversity by leveraging schema-aware generation techniques and more flexible query construction methods. However, despite the improvements in query variety, they still face limitations in capturing the full structural complexity required for comprehensive query rewriting tasks. In practice, a considerable portion of the generated queries exhibit shallow join depth, few predicates, and limited use of nested subqueries or advanced operators, leaving little room for meaningful logical or physical rewrites. Moreover, these generators are primarily designed for workload coverage and diversity rather than for systematically constructing suboptimal or slow queries. As a result, many synthesized queries already resemble well-structured, near-optimal workloads and thus lack sufficient optimization headroom for training rewrite models.

2.3

SYSTEM OVERVIEW

This section presents LASER, a data-centric method for Low-cost and Efficient SQL Rewriting that enables lightweight models to perform effective SQL optimization. As illustrated in Figure 1, LASER comprises two synergistic modules: (1) a Slow Query Generator that constructs the SQL-MCTS dataset via MCTS-based evolution of complexity-aware seed queries, and (2) a GRPO-Enhanced Query Rewriter that leverages our specialized SQL-GRPO algorithm to train the model to produce execution-efficient SQL rewrites.

3.1

Slow Query Generator

To support training and evaluation of our data-centric SQL rewriting method, we design a comprehensive framework for generating semantically equivalent but progressively slower SQL queries. While existing SQL generation systems (e.g., SQL-Factory [21], OmniSQL [20]) provide broad syntactic diversity, their outputs often lack the structural richness required for controlled performance degradation. Queries with shallow join structures or simplistic predicates offer limited opportunities for cost-increasing transformations, causing search-based rewriting approaches to stagnate prematurely. This limitation motivates the development of a specialized slow query generation module capable of producing structurally expressive seeds and guiding their evolution toward performance-inefficient variants. Our framework, as shown in the left panel of Figure 1, is composed of two major components: Complexity-Aware Seed Initialization and MCTS-Driven Slow Query Generation. Each component plays a distinct and complementary role in constructing SQL-MCTS, a slow-query corpus specifically tailored for model training. Complexity-Aware Seed Initialization. This component focuses on producing structurally expressive seed queries that serve as the foundation for subsequent slow-down exploration. By injecting rigorous constraints into the SQL-Factory [21] framework, we explicitly steer the synthesis toward queries featuring high-density

Reinforcement Learning in LLMs

In domains such as query optimization and program synthesis, tasks often do not admit a single canonical ground-truth answer. For these tasks, supervision from paired data is either unavailable or too coarse to capture fine-grained preferences over alternative outputs, such as latency, resource consumption, or readability [19, 44, 45]. Consequently, Reinforcement Learning has become a natural complement to supervised fine-tuning, enabling models to be optimized 3

Slow Query Generator

GRPO-Enhanced Query Rewriter SQL-GRPO

Rewrite Schema

SQL-Factory

Rewrite

Supervised Fine-Tuning

Fixed Budget

Seed Queries

Complexity Instruction

Adaptive Budget Sample 1

Sample 2

Qwen-SFT

Calculate Reward

Sample 1 Syntax Error

... Sample n

Sample 2

Sample 1

Sample 2

... Sample n

Calculate Reward

... Sample n

Calculate Complexity

Target Query

Sample 1

Sample 2

... Sample n

Rewrite Score

Rule-Guided

Merge

Valid Node Invalid Node

Leaf queries

Complexity-Adaptive Dynamic Rollout

Syntax Check ( EXPLAIN )

SQL-MTCS

Sample 1

Sample 2

...

Sample n

Calculate Advantage Rewrite

Meaningful Filter Slowdown Filter

Variance

Candidate Query

Free-Form Not Equi.

Entropy

Anchored Group Advantage

Rewritten Query

Update Relative Advantage

Absolute Advantage

Figure 1: An overview of LASER framework. predicates, deep nesting, and multi-table joins. This ensures that the generated seeds possess sufficient relational interdependence to support extensive cost-increasing transformations. Furthermore, an execution-based validation layer filters out invalid or empty-result candidates, guaranteeing that the subsequent MCTS exploration begins with a robust and logically meaningful foundation. MCTS-Driven Slow Query Generation. This component transforms seed queries into slower yet semantically equivalent variants. It employs a Monte Carlo Tree Search framework augmented with a hybrid expansion strategy and execution-based evaluation. To synergize the targeted exploitation of known optimizer weaknesses with the open-ended exploration of novel structures, the search process expands nodes through either rule-guided transformations derived from a library of anti-patterns based on Calcite, or freeform mutations produced directly by an LLM. Furthermore, all generated variants are executed to verify semantic correctness and benchmark performance, using this feedback to directly drive reward computation. Consequently, the MCTS procedure refines its policy to progressively discover severe performance regressions. To ensure the integrity of the final corpus, the raw variants undergo a rigorous consolidation phase involving latency-based filtering and model-based validity audits. The final collection of samples resulting from this pipeline constitutes the SQL-MCTS dataset.

3.2

As depicted in the right panel of Figure 1, our training pipeline comprises two sequential phases: Supervised Fine-Tuning. This phase addresses the cold-start problem inherent in reinforcement learning, where training from scratch is sample-inefficient and unstable. To mitigate this, we employ Supervised Fine-Tuning to distill the expert reasoning capabilities of DeepSeek-R1 into our target model. Specifically, we prompt the teacher model with the generated slow queries to autonomously synthesize dual-output trajectories comprising the optimized SQL rewrites and their corresponding Chain-of-Thought (CoT) [40] rationales. These rationales explicate the underlying optimization logic, including techniques such as subquery decorrelation [34] and predicate pushdown [42]. Fine-tuning on these reasoning-augmented samples equips the model with a foundational understanding of SQL equivalence and optimization heuristics, establishing a robust initial policy for subsequent exploration [31]. SQL-GRPO. This phase transforms the initialized policy from a static imitator into an active explorer. We leverage Group Relative Policy Optimization to optimize directly for execution latency and correctness. However, standard GRPO struggles with the heterogeneity of SQL workloads, often leading to resource misallocation [6, 47] and inappropriate advantage estimation. To address these limitations, we introduce SQL-GRPO, a specialized alignment framework featuring two novel mechanisms: (1) Complexity-Adaptive Dynamic Rollout. Recognizing the extreme heterogeneity in SQL rewriting, this mechanism surpasses uniform sampling by dynamically reallocating the rollout budget. It prioritizes instances where the model exhibits high uncertainty or struggles to bypass validity filters, ensuring sufficient exploration to discover sparse valid rewrites for complex queries while eliminating computational redundancy on early-saturating instances. (2) Anchored Group Advantage. Standard GRPO computes advantages relative to the group mean, which creates a critical flaw when applied to SQL generation. Specifically, a slow and mediocre rewrite can receive an inflated positive advantage simply by outperforming a batch of invalid candidates that failed syntax checks. To rectify

GRPO-Enhanced Query Rewriter

Following the construction of the slow query dataset, the core objective of our system is to train a specialized rewrite model capable of autonomously discovering high-performance SQL variants. While large reasoning models like DeepSeek-R1 demonstrate general-purpose coding proficiency, deploying them directly for latency-sensitive optimization is hindered by prohibitive inference costs and a disconnect from physical execution contexts. This necessitates a coarse-to-fine training paradigm, where we first distill semantic optimization knowledge into a compact local model and subsequently align its policy with concrete execution feedback. 4

this, we propose an anchored advantage estimator that incorporates an absolute performance baseline into the advantage computation. This mechanism effectively suppresses such false positive signals, ensuring that high advantages are assigned only to rewrites that achieve genuine latency reduction rather than those that merely avoid execution failure. Through this synergistic approach, our system integrates the broad semantic reasoning distilled from large models with the precise, feedback-driven optimization enabled by our SQL-GRPO framework. Additionally, a verification-driven self-correction mechanism serves as the final safeguard for executability, collectively achieving robust and reliable performance gains in SQL rewriting.

4

Expansion, Simulation, and Backpropagation, as visually detailed in Figure 2. Selection. Starting from the root seed query, the algorithm recursively traverses the tree to select the most promising child node. At each step, given a parent node 𝑣, we choose the child 𝑣𝑖 from the set of valid children C(𝑣) that maximizes the Upper Confidence Bound for Tree (UCT) [18] score: √︄ (︄ )︄ 𝑄 (𝑣𝑖 ) 2 ln 𝑁 (𝑣) ∗ 𝑣 = arg max +𝑐 , (1) 𝑁 (𝑣𝑖 ) 𝑁 (𝑣𝑖 ) 𝑣𝑖 ∈ C (𝑣) where 𝑄 (·) is the cumulative reward, 𝑁 (·) is the visit count, and 𝑐 is the exploration constant. The first term prioritizes exploitation by favoring high-reward nodes, while the second term drives exploration by probing less-visited branches. Selection continues until a leaf node is reached. Expansion. The algorithm expands each selected leaf node into multiple child nodes. For each new node, the system randomly selects a transformation strategy, applying either a targeted rulebased pattern or a free-form mutation. (1) Rule-Guided Expansion. In this mode, we maintain a curated library of Slowdown Causes, extracted by an LLM from Calcite rewrite rules by abstracting their inverse performance implications. Conceptually, this process operates as a Reverse Query Optimizer. While traditional optimizers (e.g., Calcite) utilize equivalence rules to transform inefficient patterns into efficient joins, our approach inverts this logic to systematically identify the anti-patterns that optimizers aim to eliminate. For instance, we explicitly invert decorrelation logic, transforming standard Equi-Joins into correlated subqueries to impede set-oriented processing. This ensures the generated slowness is structurally inherent and optimization-solvable. To execute this, we employ a history-aware filter that selects only unused strategies along the current path, converting each chosen strategy into a structural prompt for the LLM. (2) Free-Form Expansion. Alternatively, to capture long-tail performance anti-patterns outside the defined rules, the LLM is also allowed to freely introduce inefficiencies such as unnecessary nesting, redundant filters, or deeply wrapped subqueries. This mode increases transformation diversity beyond what rule-based approaches can explicitly enumerate. Execution Dispatch. To facilitate the ground-truth evaluation required by our framework, each generated variant is immediately submitted for asynchronous execution against a representative database instance. We utilize standard benchmark generation tools to create a scaled-down database that preserves the original schema and data distributions to balance evaluation fidelity with runtime efficiency. This non-blocking dispatch strategy pre-populates the result cache, ensuring that the subsequent Simulation phase can retrieve execution latency and correctness metrics without stalling the search pipeline. Simulation. Unlike standard MCTS formulations that rely on stochastic rollouts, our framework evaluates query utility via concrete execution on the target DBMS. Leveraging the asynchronous dispatch, this phase simply retrieves the finalized latency and correctness metrics from the result cache. Upon retrieval, we assess the quality of node 𝑣 relative to the seed node 𝑣 0 based on execution latency 𝑇𝑣 and the result-set hash

SLOW QUERY GENERATOR

In this section, we detail the methodology for constructing SQLMCTS, a large-scale corpus of high-quality slow queries that serves as the foundation for training our query rewriter. As illustrated in Figure 1, the generation pipeline comprises two components: (1) Complexity-Aware Seed Initialization, which synthesizes structurally expressive seeds to ensure sufficient optimization headroom, and (2) MCTS-Driven Slow Query Generation, which systematically evolves these seeds into progressively slower variants via controlled performance degradation. Finally, we describe the dataset construction process to produce the final SQL-MCTS corpus.

4.1

Complexity-Aware Seed Initialization

A fundamental bottleneck in constructing a robust slow-query dataset is the structural simplicity of queries produced by generic generators like SQL-Factory [21] and OmniSQL [20]. Default configurations often yield queries with narrow projections and sparse predicates, limiting the search space for subsequent cost-increasing mutations. To overcome this, we intervene in the Generation Team component of the SQL-Factory framework by injecting rigorous, complexity-driven constraints directly into its generation prompt. Specifically, these constraints mandate the synthesis of queries characterized by high-density predicate logic and relational interdependence. Departing from open-ended generation that favors simplistic patterns, the generator is explicitly steered to construct deeply nested subqueries and multi-table joins filtered by diverse logical operators. This ensures that the initial seeds possess sufficient structural complexity to support extensive rewriting, acting as robust anchors that allow the subsequent MCTS process to explore a non-trivial space of performance-degrading transformations. Finally, to guarantee the applicability of these seeds, we employ an execution-based validation step to filter out invalid queries or those yielding empty result sets, ensuring that the initial corpus consists solely of executable and logically meaningful SQL statements.

4.2

MCTS-Driven Slow Query Generation

Given the complexity-aware seed pool, we employ a Monte Carlo Tree Search framework to systematically evolve each seed query into semantically equivalent but increasingly slower variants. Each SQL instance is treated as a node in the search tree, with edges representing cost-increasing transformations. Our procedure follows the classical four-phase MCTS [9] loop consisting of Selection, 5

Free-Form Expansion

Selection

Rule-Guided Expansion

Expansion

Invalid Node

Simulation

slow down the query

Backpropagation

Reward Calculator Check Validity

avoid decomposing correlated subqueries

Compare Exec Time

use complex aggregates directly

Execute

Valid Node

Calculate Similarity

Executability, Execution Time, Excution Result

Child num: Total Reward:

Figure 2: The workflow of MCTS-Driven Slow Query Generation Backpropagation. The reward obtained from simulation is propagated upward from the evaluated node to the root. Each node along the path updates its visit count and cumulative score via standard MCTS rules. High-reward transformations thus gain more influence on future traversal decisions, progressively steering the search toward regions of the space that yield substantial slowdowns. Through repeated execution of these phases, the MCTS procedure converges toward structurally diverse, semantically preserved, and heavily degraded SQL variants, forming the core of our slowquery dataset.

𝐻 (𝑣). To ensure deterministic verification, we define 𝐻 (·) as the aggregate of row-level hash values computed after a mandatory in-memory sort of the result set. This sorting phase eliminates variations caused by non-deterministic row ordering under parallel execution, ensuring that the hash comparison reflects only semantic consistency of the result. Consequently, we define the query validity of node 𝑣 via the indicator function Φ(𝑣): [︁ ]︁ [︁ ]︁ Φ(𝑣) = I ExecSuccess(𝑞 𝑣 ) · I 𝐻 (𝑞 𝑣 ) = 𝐻 0 , (2) where 𝐻 (𝑞 𝑣 ) = 𝐻 0 and ExecSuccess(·) indicates successful execution without runtime errors (excluding timeouts). To quantify structural novelty, we assess the AST-level divergence. Let AST(𝑞) denote the Abstract Syntax Tree (AST) of query 𝑞, and |AST(𝑞)| represent the total number of nodes in the tree. We define the normalized structural distance Δ(𝑞, 𝑞 ′ ) as: Δ(𝑞, 𝑞 ′ ) =

TED(AST(𝑞), AST(𝑞 ′ )) , max(|AST(𝑞)|, |AST(𝑞 ′ )|)

4.3

Dataset Construction

Following the generation of candidate queries via MCTS, we consolidate the valid leaf nodes into a unified training corpus termed SQL-MCTS. This construction process filters and refines the raw search results through two rigorous stages: Latency-Based Filtering and Structural Validity Audit. Identification of Slow Queries. From the leaf nodes of the MCTS tree, we strictly retain queries whose execution time is at least twice that of the original query. We classify these as slow queries. This filtering criterion effectively eliminates trivial modifications that create negligible performance variance, ensuring that every sample in SQL-MCTS represents a genuine performance deterioration suitable for learning optimization logic. Slow Query Validity Check. To further guarantee the quality and relevance of the identified slow queries, we employ the DeepSeekV3 model to audit the validity of the rewrites. The objective is to verify that the performance degradation stems from structural complexity, such as increased logical depth, rather than syntactic noise. This step effectively removes low-quality queries containing redundant or artificial operations, such as superfluous ORDER BY clauses or unnecessary subqueries, which contribute to latency without adding logical value. Through this pipeline, we constructed the final SQL-MCTS dataset, comprising 11,675 high-quality slow queries evolved from 3,000 initial seeds on the TPC-DS [26] benchmark schema. The entire construction process spanned approximately 6.3 days.

(3)

where TED(·) measures the tree edit distance using SQLGlot [3]. The structural score 𝑅𝑠 (𝑣) averages the divergence from both the parent 𝑣 𝑝 and the seed 𝑣 0 , defined as: ]︁ 1 [︁ Δ(𝑞 𝑣 , 𝑞 𝑣𝑝 ) + Δ(𝑞 𝑣 , 𝑞 𝑣0 ) . (4) 2 Finally, we unify the reward assignment into a piecewise function to robustly handle execution failures, timeouts, and valid performance degradations. Specifically, let 𝑇max be the DBMS timeout limit, the total reward 𝑅(𝑣) is defined as: 𝑅𝑠 (𝑣) =

⎧ ⎪ 𝜌, if Φ(𝑣) = 0, ⎪ ⎪ ⎨ ⎪ if 𝑇𝑣 ≥ 𝑇max, 𝑅(𝑣) = 𝛾, (5) (︂ )︂ ⎪ ⎪ 𝑇𝑣 ⎪ ⎪𝜆𝑡 tanh 𝛼 log 𝑇0 + 𝜆𝑠 𝑅𝑠 (𝑣), otherwise, ⎩ where 𝜌 penalizes invalid states. Crucially, since result equivalence cannot be verified for timed-out queries, we assign a static saturation reward 𝛾. We set 𝛾 = 𝜆𝑡 to acknowledge their high latency potential while withholding the structural bonus 𝜆𝑠 as a penalty for semantic uncertainty. This configuration encourages the exploration of performance boundaries while preventing the search from converging solely on unverifiable variants. For verifiable executions, the reward combines the logarithmic slowdown factor and structural novelty, balanced by coefficients 𝜆𝑡 and 𝜆𝑠 .

5

GRPO-ENHANCED QUERY REWRITER

In this section, we present the methodology for our GRPO-Enhanced Query Rewriting framework. Our approach follows a progressive 6

3

5.1

Maximum Reward Achieved

three-stage pipeline: initializing the model via Supervised FineTuning, optimizing execution performance using our specialized SQL-GRPO algorithm, and finally ensuring executability through an Inference with Verification-Driven Self-Correction mechanism.

Supervised Fine-Tuning

We initiate the training pipeline with Supervised Fine-Tuning to establish the model’s foundational reasoning capabilities and SQL synthesis proficiency. This phase is crucial for aligning the policy with syntactic constraints and logical structures, providing a warmstart for the subsequent RL stage. To construct the SFT corpus, we sample 30% of the instances from our SQL-MCTS dataset, and leverage the reasoning capabilities of DeepSeek-R1 [16] to distill expert-level optimization trajectories. The training inputs comprise the database schema, the original slow query, and its execution plan (retrieved via EXPLAIN), while the targets represent the reasoning trace and the optimized SQL output. We fine-tune the Qwen3 model using the standard nexttoken prediction objective [32]: 1 ∑︂ log 𝑝𝜃 (𝑦𝑡 |𝑥, 𝑦 <𝑡 ), 𝑇 𝑡 =1

Wasted Compute

0 −1 Missed Opportunity if stopped at N=8

−2

Simple Query Medium Query Complex Query

2

4

6

8

10

12

14

16

Number of Rollouts

Figure 3: Impact of Rollout Budget on Optimization Discovery. Simple queries (Green) saturate early, causing compute waste, whereas complex queries (Red) require extended exploration budgets to discover valid optimization paths. This parallelization allows database execution to proceed concurrently with policy rollout, significantly offsetting the execution latency against the generation time of subsequent samples. Let 𝑞 0 be the seed query with baseline latency 𝑇0 , and 𝑞 ′ be the SQL rewrite candidate extracted from the model response. The reward function 𝑅(𝑞 ′ ) imposes a strict validity hierarchy:

(6)

where 𝜃 denotes the model parameters, 𝑥 and 𝑦 represent the input and corresponding output sequences. Specifically, 𝑦𝑡 is the 𝑡-th token in the output, and 𝑦 <𝑡 represents the tokens predicted before time step 𝑡. This phase equips the model with essential structural knowledge, ensuring that the initial policy generates logically valid SQL queries before performance optimization begins.

5.2

1

−3

𝑇

L𝑆𝐹𝑇 (𝜃 ) = −

Standard GRPO Budget (N=8)

2

𝑅(𝑞 ′ ) =

⎧ 𝜌 fmt, ⎪ ⎪ ⎪ ⎪𝜌 , ⎨ ⎪ exe

⎪ 𝜌 sem, ⎪ ⎪ ⎪ ⎪ F (𝑇 ′ ,𝑇 ), 0 𝑞 ⎩

if ExtractionFail(𝑞 ′ ), if ExecError(𝑞 ′ ), if ¬Equiv(𝑞 ′, 𝑞 0 ), if Success(𝑞 ′ ).

(7)

We set 𝜌 fmt < 𝜌 exe < 𝜌 sem < 0 to penalize failures according to their severity. Specifically, ExtractionFail(𝑞 ′ ) indicates cases where the model fails to generate a recognizable SQL block (i.e., 𝑞 ′ is empty or null), while ExecError(𝑞 ′ ) captures valid SQL strings that fail execution (e.g., syntax errors). For valid rewrites, the performance gain is quantified by an asymmetric scaling function F : {︄ 𝜂 · tanh(log(𝑇0 /𝑇𝑞 ′ )), if 𝑇𝑞 ′ < 𝑇0, F (𝑇𝑞 ′ ,𝑇0 ) = (8) tanh(log(𝑇0 /𝑇𝑞 ′ )), otherwise.

SQL-GRPO

While SFT ensures syntactic correctness, it primarily imitates reasoning patterns rather than directly optimizing for latency. To explicitly align the model with performance objectives, we employ Group Relative Policy Optimization [35]. By estimating baselines from the mean reward of group-wise outputs, GRPO efficiently eliminates the need for a separate value network. However, standard GRPO assumes uniform sample difficulty and scale-invariant advantages. These assumptions fail in SQL rewriting, which is characterized by strict validity constraints and significant performance variance. To address these challenges, we propose SQL-GRPO, which introduces a Performance-Driven Hierarchical Reward function alongside two architectural modifications: Complexity-Adaptive Dynamic Rollout and Anchored Group Advantage. Performance-Driven Hierarchical Reward. Unlike general text generation tasks, SQL rewriting is governed by strict validity constraints where syntactically invalid SQL queries yield zero functional utility. To address this, we design a piecewise, hierarchical reward function that establishes an implicit curriculum. This structure encourages the model to prioritize the mastery of syntactic correctness and semantic equivalence before attempting the more challenging objective of latency optimization. Crucially, we derive the reward signal from physical execution latency rather than theoretical optimizer cost estimates, which are prone to significant cardinality estimation errors in complex queries [11]. To mitigate runtime overhead, we adopt the asynchronous execution strategy utilized in the MCTS phase (Section 4.2).

Here, 𝜂 > 1 acts as an incentive factor to amplify gradients for positive speedups, encouraging aggressive optimization over conservative equivalence. Complexity-Adaptive Dynamic Rollout. Standard GRPO allocates a fixed rollout budget 𝑁 to every prompt. However, this uniform approach lacks flexibility given the significant heterogeneity in SQL query complexity. As illustrated in Figure 3, simple queries tend to saturate rewards early, resulting in significant computational waste. Conversely, highly complex queries often fail to produce a single valid rewrite under a limited budget, requiring extended exploration to satisfy validity constraints and discover effective optimization paths. To optimize resource allocation, we propose a two-stage budgeting mechanism termed Complexity-Adaptive Dynamic Rollout. In the initial pilot phase, we assign a minimal budget 𝑘 pilot to all prompts to gather performance statistics. Based on these metrics, we determine the allocation weight 𝑊𝑖 for each prompt 𝑖 via: 𝑊𝑖 = 𝛼 · I[max(𝑅pilot ) < 𝜌 sem ] + 𝛽 · H̃(𝜋) + 𝛾 · 𝜎˜ 𝑅2 . 7

(9)

2

3

3

0

−1

Advantage Score

4

1

2 1 0

−1 −2

S1

S2

S3

...

S8

a) Raw Rewards Distribution

Table 1: Overall statistics across different benchmarks.

Scenario B: Optimization Breakthrough

4

Advantage Score

Reward Value

Scenario A: Mediocre Outcome 3

Benchmark

1 0

−1

S1

S2

S3

...

S8

b) Standard GRPO Advantage

# Templates

# Tokens

# Predicates

# SubQueries

TPC-DS [26] TPC-H [29] DSB [13] Calcite [8] SQL-Factory [21]

103 22 37 793 50k

390.18 148.23 433.11 87.38 76.18

15.94 7.55 21.19 2.42 2.23

1.63 0.68 1.35 1.56 0.04

SQL-MCTS

11.7k

334.47

11.24

1.89

2

S1

S2

S3

...

S8

c) Anchored Group Advantage (Ours)

Figure 4: Comparison of Advantage Estimation. Standard normalization (b) creates a false equivalence between the mediocre survivor in Scenario A and the genuine breakthrough in Scenario B. Our Anchored Group Advantage (c) uses absolute anchors to suppress this inflated signal while correctly amplifying the optimization success.

component dominates to suppress misleading relative signal. The final centering step maintains the zero-sum property required for stable policy gradient updates. Optimization Objective. Our training objective integrates the Anchored Group Advantage into the GRPO framework, incorporating a KL divergence penalty to constrain the policy within the linguistic distribution of the reference model 𝜋ref (i.e., the SFT model). The final loss function is defined as: [︁ ]︁ L (𝜃 ) = −E𝑞∼𝑃 (𝑄 ),𝑜∼𝜋𝜃 (𝑞) 𝑟𝑡 (𝜃 )𝐴ˆ − 𝜎𝐷 𝐾𝐿 (𝜋𝜃 ||𝜋ref ) , (11)

Here, the indicator function I[·] acts as a failure detector, explicitly prioritizing instances that fail to yield valid SQL rewrites during the pilot phase. To quantify exploration value, we incorporate normalized policy entropy H̃(𝜋) and reward variance 𝜎˜ 𝑅2 as proxies for model uncertainty and optimization potential. Specifically, the policy entropy H(𝜋) measures the token-level average entropy, capturing the model’s confidence in its rewrite trajectory [10, 14]. High entropy suggests the model is oscillating between multiple rewrite paths, indicating a complex landscape that warrants further exploration. Similarly, the reward variance 𝜎˜ 𝑅2 captures the sensitivity of the query to minor structural changes. Instances with high variance indicates a rugged solution space, justifying a larger rollout budget to stabilize gradient estimation. Finally, the remaining computational budget is allocated proportionally to 𝑊𝑖 , directing resources toward long-tail instances that demand intensive search. Anchored Group Advantage. Standard GRPO computes advantages using intra-group Z-score normalization. However, in the context of SQL optimization, this strict relative scoring ignores the absolute quality of the rewrites. This limitation often leads to false equivalence in advantage assignment. As illustrated in Figure 4, standard normalization induces a misleading parity. Specifically, it assigns a similarly high advantage score to a mediocre survivor in a low-quality group (Scenario A), comparable to that of a genuine optimization breakthrough in a high-performing group (Scenario B). Consequently, within a group dominated by syntax errors, a valid yet slow rewrite receives a high positive advantage merely for being executable. This behavior erroneously reinforces performance deterioration, as the model is rewarded for producing suboptimal SQL simply because it outperforms catastrophic failures rather than achieving genuine optimization. To rectify this, we propose Anchored Group Advantage, which fuses relative rank with absolute performance anchors: 𝑟𝑖 − 𝜇𝐺 𝑟𝑖 − 𝑏 √ (𝑖 ) 𝐴anchor = (1 − 𝜆) 𝐺, +𝜆 𝜎𝐺 + 𝜖 𝑆 ⏞ˉˉ⏟⏟ˉˉ⏞ ⏞ˉˉˉˉˉ⏟⏟ˉˉˉˉˉ⏞ Absolute Relative (10) 𝐺 ∑︂ 1 (𝑖 ) 𝐴ˆ (𝑖 ) = 𝐴anchor − 𝐴(𝑗 ) . 𝐺 𝑗=1 anchor

𝜋 (𝑜 |𝑞)

where 𝑟𝑡 (𝜃 ) = 𝜋 𝜃 (𝑜 |𝑞) denotes the probability ratio between the 𝜃 old

current policy 𝜋𝜃 and the old policy 𝜋𝜃 old . The term 𝐴ˆ represents the Anchored Group Advantage calculated in Eq. 10. The hyperparameter 𝜎 serves as the coefficient for the KL divergence penalty, balancing reward optimization with generation diversity.

5.3

Verification-Driven Self-Correction

To guarantee the practical executability of generated rewrites, we implement a verification-driven self-correction mechanism that integrates database diagnostics directly into the inference loop. Upon generating a candidate rewrite, we first subject it to the DBMS’s EXPLAIN command. This utility acts as a zero-cost syntax filter, validating the structural integrity of the query without triggering the high latency associated with actual data retrieval. If the candidate passes this check, it is finalized immediately. In cases where EXPLAIN returns an error, we trigger a regenerative repair process. We construct an augmented context containing the original slow query, the invalid candidate, and the specific error message returned by the DBMS. This diagnostic feedback allows the model to pinpoint syntactic faults (e.g., keyword misuse or column ambiguity) and perform self-correction. This closed-loop approach significantly enhances robustness, ensuring that the system recovers from parsing failures autonomously.

6

EXPERIMENTS

In this section, we conduct extensive experiments to demonstrate the efficiency of our rewrite models from multiple perspectives, including detailed analysis of query execution latency on several benchmarks, rewrite cost, data-aware analysis and ablation study.

6.1

Experiment Setup

6.1.1 Environment. The experiments are conducted on a PostgreSQL 13 server hosted on the VolcEngine platform [4], featuring a configuration with 2 cores and 4GB of RAM. For model training, we utilize a GPU server equipped with 8 NVIDIA A800-SXM4-80GB GPUs and an Intel(R) Xeon(R) Platinum 8336C CPU.

The absolute term incorporates a global √ baseline 𝑏 and a reward scaling factor 𝑆, explicitly weighted by 𝐺 to match the magnitude of the Z-score normalized relative term. This mechanism ensures that when a group performs poorly overall, the negative absolute 8

Table 2: Human evaluation across different benchmarks. Benchmark

Opt. Non-Triviality

Struct. Complexity

Sem. Coherence

TPC-DS [26] TPC-H [29] DSB [13] Calcite [8] SQL-Factory [21]

4.25 3.54 4.29 3.10 3.46

3.42 2.77 3.78 1.81 2.07

4.96 5.00 5.00 3.37 4.70

SQL-MCTS (All) SQL-MCTS (Top 70%)

4.26 4.74

2.93 3.36

4.92 4.97

𝜌 sem = −1.5. For rewritten queries that achieve positive latency improvement while preserving equivalence, we provide a high bonus 𝜂 = 3. Accordingly, the scaling factor 𝑆 in Eq. 10 is set to 3 to align with the reward range. Crucially, we set the global baseline 𝑏 = 0 to enforce absolute correctness constraints. All remaining aggregation coefficients, including 𝛼, 𝛽, 𝛾, and 𝜆, are set to equal weights. The entire training process, including both SFT and GRPO phases, was completed in approximately 34.9 hours.

6.2

6.1.2 Benchmarks. We evaluate the performance of our query rewrite model using four typical database benchmarks. (1) TPCDS [26] is an industry-standard benchmark designed for decision support systems, consisting of 24 tables and 103 queries. (2) TPCH [29] is also a well-known benchmark with 8 tables and 22 query templates. (3) DSB [13] is adapted from TPC-DS,featuring a complex data distribution and challenging query templates, with a total of 37 query templates. (4) Calcite [8] is a real-world benchmark mainly used to evaluate rewrite rules, comprising 6 tables and a total of 793 queries, from which we randomly select 50 queries. We used the official tools of these four benchmarks to generate 10GB of data for experimentation.

Quality Evaluation of SQL-MCTS

To demonstrate the superior quality of SQL-MCTS, we compare it against established benchmarks and the query generation framework SQL-Factory [21]. As presented in Table 1, our analysis focuses on key complexity metrics including the number of templates, token count, predicates, and subqueries. The analysis reveals that SQL-MCTS strikes a distinct balance between query diversity and structural complexity. While SQL-Factory generates a vast number of templates, they are notably simplistic with only 76.18 tokens and 0.04 subqueries. In contrast, SQL-MCTS maintains high complexity across 11.7k templates. Although TPC-DS exhibits slightly higher token counts, it is limited to a narrow set of 103 templates. By combining structural depth with extensive scale, SQL-MCTS provides a challenging environment for training SQL rewrite models. To further strictly validate that these statistical metrics translate into genuine optimization challenges, we conducted a blind human evaluation. We randomly sampled 100 queries from the SQL-MCTS and SQL-Factory and compared them against all benchmarks. Three PhD-level STEM students with SQL experience evaluated these anonymized queries on a 5-point scale across three dimensions. Specifically, we defined Optimization Non-Triviality as the extent to which a query necessitates high-level architectural refactoring rather than trivial syntactic cleanup. Structural Complexity isolates logical depth, such as rigid join topologies and deep nesting, from mere physical resource consumption. Finally, Semantic Coherence measures the plausibility of the business logic to ensure the generated SQL is not random syntactic noise. First, as shown in Table 2, the full SQL-MCTS dataset (All) already demonstrates high quality, achieving an Optimization Non-Triviality score of 4.26. This performance is statistically on par with the industry-standard TPC-DS (4.25) and significantly outperforms other baselines. To further ensure a rigorous comparison against the most challenging workloads, we isolated the Refined Subset (Top 70% by complexity), filtering out structurally simpler instances reserved for distributional regularization during training. The evaluation results confirm that this subset presents a significantly harder optimization landscape. Specifically, the Refined Subset achieves an Optimization Non-Triviality score of 4.74, surpassing all benchmarks. Crucially, it maintains a Semantic Coherence score of 4.97, which is indistinguishable from expertcrafted benchmarks, ensuring that the increased complexity does not compromise logical validity.

6.1.3 Baseline. We compare our trained query rewrite model with both rule-based and LLM-based approaches. Rule-based Methods. We compare three existing rule-based methods. (1) LearnedRewrite [49] utilizes a MCTS algorithm coupled with a learned cost estimation model to explore the space of rewrite rule orders. (2) LLM-R2 [22] employs LLM with In-Context Learning ability to select rewrite rules. (3) R-Bot [38] implements a retrievalaugmented generation (RAG) approach to select rewrite rules. LLM-based methods. We also compare our model against naive LLM, such as DeepSeek-R1 [16] and GPT-4o [27]. These models directly generate query rewrites without the use of rewrite rules. Additionally, we include a baseline trained using a naive GRPO method to represent the E3 -Rewrite [41] approach. We chose not to compare with QUITE [37], as its complex agent-based architecture and lack of open-source availability prevent a fair comparison. 6.1.4 Evaluation Metrics. (1) Query Latency. The time taken to execute a query, measured as average, median, 75th, and 95th percentile latencies. To ensure stability, each query undergoes one warm-up run followed by three executions and recording the mean latency. Besides, queries exceeding 300 seconds are considered timeouts. (2) Equivalence Rate. The proportion of rewritten queries that are semantically equivalent to the original queries, verified by executing both queries and comparing whether their results are identical. 6.1.5 Implementation Details. We use DeepSeek-V3 [23] to generate slow queries within the Monte Carlo Tree Search. For the base model, we utilize the Qwen3 [43] series, including Qwen38B and Qwen3-14B. The models are trained using the Verl [36] framework, with both SFT and GRPO learning rates set to 3𝑒 −6 , a batch size of 256, and 1 epoch. Other configurations are maintained according to the Verl setup. For the GRPO training phase, we set the temperature to 1.0 to encourage diverse exploration. For all other inference tasks, we set the temperature to 0.0 to ensure output stability. Additionally, in the reward function of SQL-GRPO, we assign additional negative rewards 𝜌 fmt = −3, 𝜌 exe = −2.5, and

6.3

Performance Comparison

Query Execution Latency. The first comparison focuses on query latency across TPC-DS, DSB, and our generated SQL-MCTS benchmarks, all utilizing the same schema. As shown in Table 3, the performance of our LASER model shows significant improvements 9

Table 3: Comparison of Query Latency across TPC-DS schema-based benchmarks. SQL-MCTS (10G)

Method

TPC-DS (10G)

DSB (10G)

Mean

Median

75th

95th

Equi.

Mean

Median

75th

95th

Equi.

Mean

Median

75th

95th

Original

69.73

29.19

69.14

300.00

-

49.00

10.60

36.57

300.00

-

44.88

11.42

20.75

300.00

-

LearnedRewrite LLM-R2 (DeepSeek-R1) LLM-R2 (GPT-4o) R-Bot (DeepSeek-R1) R-Bot (GPT-4o)

67.03 67.96 68.08 58.79 51.09

29.89 27.08 27.11 22.05 23.61

68.69 69.20 66.43 68.48 53.79

297.16 300.00 300.00 297.16 191.32

70% 50% 50% 46% 38%

46.72 46.05 49.11 44.66 42.40

11.49 11.05 10.71 10.87 10.34

35.69 33.10 41.35 37.92 33.92

300.00 300.00 300.00 297.35 293.49

71% 66% 69% 69% 69%

38.22 14.33 29.21 21.45 20.37

10.92 10.20 10.03 12.44 10.42

20.72 16.54 17.57 21.18 21.08

300.00 50.47 126.20 81.76 69.64

43% 83% 70% 94% 91%

DeepSeek-R1 GPT-4o Qwen3-8B Qwen3-14B

13.40 25.36 38.72 38.13

9.05 8.98 9.13 9.02

12.63 13.43 26.80 24.40

31.17 107.53 270.20 263.69

86% 85% 65% 65%

26.87 33.31 34.92 35.77

9.57 9.91 9.67 9.56

20.96 26.02 27.35 24.88

106.58 225.21 255.07 293.49

72% 51% 46% 46%

19.03 19.72 35.58 19.75

8.80 9.57 9.52 9.28

16.42 15.78 17.75 17.02

45.21 67.37 300.00 67.37

86% 48% 37% 62%

LASER-8B LASER-14B

15.12 13.03

7.95 8.98

12.30 12.09

34.31 31.63

85% 90%

28.03 27.16

9.55 9.53

24.38 21.06

112.52 104.24

64% 77%

10.56 10.33

9.04 7.84

16.91 15.78

37.30 25.88

72% 83%

Table 4: Cost analysis on DSB benchmark (10GB scale). Method

Times (s)

Cost ($)

Memory (GB)

Localizable

LLM-R2 (DeepSeek-R1) LLM-R2 (GPT-4o) R-Bot (DeepSeek-R1) R-Bot (GPT-4o) DeepSeek-R1 GPT-4o

100.5 43.9 982.3 169.8 130.2 18.5

23.7 60.0 243.9 2075.5 31.2 167.7

>1000 >1000 >1000 -

× × × × × ×

LASER-8B LASER-14B

24.6 28.8

5.92 15.6

32 40

✓ ✓

Equi.

server rental costs [1, 4], scaled to 10,000 queries for better clarity. Memory indicates the minimum required VRAM for inference, and Localizable denotes the feasibility of performing inference locally. The analysis demonstrates that despite achieving high performance, LASER models exhibit significantly faster rewrite times. This is especially notable compared to R-Bot, which requires a stepwise recommendation of rule applications. Moreover, the compact scale of LASER enables efficient deployment on local machines with minimal VRAM requirements. This efficiency not only reduces inference time but also minimizes GPU operational costs. Additionally, the ability to run our models locally without relying on external APIs means that there are no hidden costs associated with data uploads, and privacy concerns are mitigated.

after training, achieving remarkable reductions in query latency while maintaining high query equivalence. Specifically, the complexity of SQL-MCTS results in difficulties for all rule-based methods, as their limited set of rules cannot effectively handle such complex queries. This limitation leads to low query efficiency and equivalence for these methods. Similarly, the original Qwen3 model struggles to manage these complex queries. However, after training with our approach, the performance of the LASER model has drastically improved. The 8B model now performs at the level of larger models like DeepSeek-R1 and GPT-4o, while the 14B model even surpasses DeepSeek-R1. For example, the average execution time for LASER-14B was optimized from 69.73 seconds to 13.03 seconds, achieving 90% equivalence. Besides, our model reduces the average query time from 49.00 seconds to 27.16 seconds on TPC-DS and from 44.88 seconds to 10.33 seconds on DSB. These improvements are substantial, and our method achieves a state-of-the-art in terms of performance, far surpassing the existing rule-based methods. Furthermore, the performance of our LASER model exceeds the capabilities of API-based solutions, which typically struggle to provide similar reductions in execution time while maintaining high equivalence. This performance improvement demonstrates that with proper training using high quality training datasets, even the 8B and 14B models can outperform larger, more complex systems, making them highly efficient for complex query rewrite tasks. Cost Analysis. To provide a fair comparison, we focus on the DSB Benchmark to further analyze the inference costs associated with these methods. As shown in Table 4, Time represents the average query rewrite time, Cost includes both the API call costs and GPU

6.4

Transferability Across Benchmarks

Due to our SQL-MCTS dataset being generated using the TPC-DS schema, we also evaluate the transferability of our LASER models on other benchmarks, including TPC-H and Calcite, which were not part of the training process. This allows us to assess how well our model generalizes to new, unseen database schemas. As shown in Table 5, our LASER-8B and LASER-14B models demonstrate excellent performance on both the TPC-H and Calcite benchmarks. In particular, the LASER-14B model achieves the best results across all metrics, with a mean query execution time of 31.78 seconds on TPC-H and 9.98 seconds on Calcite, both of which represent significant improvements compared to traditional rule-based methods. Additionally, LASER-8B also performs well, making it a competitive option even compared to larger models. This demonstrates the transferability of our approach, where our model not only performs well on the benchmark with the schema it was trained on but also generalizes effectively to other schema benchmarks. The LASER models are thus highly adaptable and capable of achieving state-of-the-art performance across a variety of database schemas, without needing extensive retraining.

6.5

Data-aware Analysis

In this experiment, we further evaluate the performance of our LASER models on the DSB dataset at three different scales: 1G, 10G, and 50G, which represent small, medium, and large database 10

Table 5: Comparison of Query Latency on Unseen Schema Benchmarks (TPC-H and Calcite). TPC-H (10G)

Method

Calcite (10G)

Mean

Median

75th

95th

Equi.

Mean

Median

75th

95th

Equi.

Original

77.43

30.59

50.59

300.00

-

32.59

7.06

16.01

300.00

-

LearnedRewrite LLM-R2 (DeepSeek-R1) LLM-R2 (GPT-4o) R-Bot (DeepSeek-R1) R-Bot (GPT-4o)

65.98 68.19 64.11 41.90 42.25

31.47 30.67 27.41 30.22 30.18

41.57 52.22 40.27 38.90 39.59

300.00 300.00 300.00 74.64 74.23

68% 95% 90% 90% 95%

32.67 33.79 26.97 23.71 17.68

8.45 8.35 6.92 7.49 5.29

18.94 19.68 14.97 17.23 14.62

300.00 300.00 113.96 76.80 75.32

75% 81% 72% 79% 81%

DeepSeek-R1 GPT-4o Qwen3-8B Qwen3-14B

38.70 41.17 52.13 40.45

27.73 29.65 29.68 27.90

32.83 40.88 57.77 39.78

52.65 77.29 288.74 73.18

86% 90% 90% 90%

13.00 14.21 20.63 17.60

6.92 5.50 6.53 7.41

12.08 12.43 12.42 12.59

24.88 50.22 76.33 75.90

89% 51% 62% 62%

LASER-8B LASER-14B

34.61 31.78

28.63 26.73

44.98 38.14

71.36 70.50

90% 100%

11.90 9.98

6.62 5.68

11.87 11.33

39.95 24.11

65% 75%

Table 6: Data-Aware Analysis on DSB Benchmark. DSB (1G)

Method

DSB (10G)

DSB (50G)

Mean

Median

75th

95th

Mean

Median

75th

95th

Mean

Median

75th

95th

Original

8.64

0.27

0.69

24.67

44.88

11.42

20.75

300.00

82.05

15.52

111.14

300.00

DeepSeek-R1 GPT-4o Qwen3-8B Qwen3-14B

0.62 0.41 5.96 1.37

0.22 0.17 0.24 0.23

0.54 0.36 0.63 0.58

1.91 1.46 3.10 1.23

19.03 19.72 35.58 19.75

8.80 9.57 9.52 9.28

16.42 15.78 17.75 17.02

45.21 67.37 300.00 67.37

46.34 63.72 71.11 57.54

20.48 12.32 14.76 13.19

56.44 40.02 46.06 41.00

300.00 300.00 300.00 300.00

LASER-8B LASER-14B

0.34 0.33

0.21 0.16

0.46 0.34

1.02 0.95

10.56 10.33

9.04 7.84

16.91 15.78

37.30 25.88

50.05 39.63

11.89 10.76

39.26 33.55

300.00 185.29

sizes. The results, shown in Table 6, demonstrate that our models maintain high performance even as the dataset size increases. For example, on DSB (50G), the LASER-14B model achieves a mean execution time of 39.6 seconds, significantly faster than other methods. These results show that our LASER models are highly effective in handling increasing data volumes, making them suitable for large-scale database environments.

6.6

to poorly performing samples, negatively impacting the learning process, further demonstrating the importance of this mechanism. When comparing our method to a naive GRPO (E3 -Rewrite) setup, which uses the most basic GRPO strategy, the performance significantly deteriorates. Most notably, the 95th percentile latency spikes to nearly 2.5 times that of LASER-14B. This sharp disparity indicates that standard GRPO struggles to navigate the sparse solution space of structurally complex queries. In contrast, our approach effectively tackles these hard samples, ensuring robust optimization even for the most challenging inputs. Finally, eliminating the Verification-Driven Self-Correction mechanism compromises the system’s robustness. Specifically, the Equivalence Rate declines to 78%, and the mean latency increases to 11.78 seconds. In summary, the ablation study underscores the critical role of each component in the LASER framework. Removing any of these elements leads to a visible decline in performance, both in terms of query execution latency and query equivalence.

Ablation Study

In this ablation study, we evaluate the impact of various components of our LASER approach by progressively removing key elements. The results, as shown in Table 7, highlight the importance of each component in achieving optimal performance. First, without Supervised Fine-Tuning, the model suffers from a lack of a structured initialization, leading to poorer training stability and a lower training ceiling. Specifically, the absence of SFT causes the Equivalence Rate to plummet from 83% to 64%, while the mean execution time concurrently increases to 14.24 seconds. Next, removing the Complexity-Aware Dynamic Rollout leads to inefficiencies in the training process. Without this feature, the model tends to waste training iterations on less important samples while insufficiently exploring challenging ones. This significantly hampers performance on complex queries, as evidenced by the 95th percentile latency rising to 36.86 seconds. The absence of Anchored Group Advantage further exacerbates the issue. Without this component, the model may assign disproportionately high advantages

6.7

Cross-Database Evaluation on MySQL

We also tested the performance of our LASER models on MySQL using the DSB Benchmark, as all prior experiments were conducted on PostgreSQL. The results, shown in Table 8, indicate that our models perform equally well on MySQL, achieving results comparable to DeepSeek-R1. This experiment serves as a crucial validation against a different native query optimizer, confirming that LASER’s optimization capabilities are not overfitted to PostgreSQL’s planner 11

Table 7: Ablation Study on DSB Benchmark. Method

Mean

Median

75th

95th

Equi.

Original LASER-14B

44.88 10.40

11.42 7.84

20.75 15.78

300.00 25.88

83%

w/o SFT w/o Dynamic Rollout w/o Anchored Group Adv. Naive GRPO w/o Self-Correction

14.24 16.57 13.40 18.57 11.78

10.24 9.30 9.01 10.03 8.34

17.75 16.42 18.42 16.81 17.78

45.33 36.86 31.97 53.63 28.08

64% 70% 75% 67% 78%

SELECT ys.product_category, ys.total_sales FROM ( SELECT i.i_category AS product_category, SUM(ss_sales_price * ss_quantity) AS total_sales FROM store_sales ss JOIN item i ON ss_item_sk = i_item_sk JOIN date_dim d ON ss_sold_date_sk = d_date_sk WHERE d_year = 2000 GROUP BY i_category) ys WHERE ys.total_sales > ( Redundant Computation SELECT SUM(total_sales) / COUNT(*) FROM ( SELECT i.i_category AS product_category, SUM(ss_sales_price * ss_quantity) AS total_sales FROM store_sales ss JOIN item i ON ss_item_sk = i_item_sk JOIN date_dim d ON ss_sold_date_sk = d_date_sk WHERE d_year = 2000 GROUP BY i_category) subq) ORDER BY ys.total_sales DESC;

Original Query ( >30s ) SELECT t3.product_category, t3.total_sales FROM ( SELECT t.i_category AS product_category, SUM(t.ss_sales_price*t.ss_quantity) AS total_sales FROM (SELECT * FROM store_sales, item WHERE store_sales.ss_item_sk=item.i_item_sk) t, ( SELECT * FROM date_dim WHERE d_year = 2000) AS t0 WHERE t.ss_sold_date_sk = t0.d_date_sk GROUP BY t.i_category) AS t3 LEFT JOIN (SELECT SUM(t7.total_sales)/COUNT(*) EXPR$0

Table 8: Cross-database evaluation using MySQL on the DSB benchmark (10GB scale). Method

Mean

Median

75th

95th

Equi.

Original

64.87

18.29

69.18

300.00

-

DeepSeek-R1 DeepSeek-V3 GPT-4o Qwen3-8B Qwen3-14B

28.71 48.23 37.98 56.93 38.50

11.07 16.42 15.02 18.29 12.25

35.58 47.14 42.50 67.76 45.55

118.10 184.87 125.92 300.00 144.01

75% 70% 64% 45% 56%

LASER-8B LASER-14B

37.69 30.49

11.84 11.56

44.16 42.24

133.43 105.09

70% 78%

FROM (SELECT SUM(...) total_sales FROM store_sales AS store_sales0 (...) INNER JOIN item AS item0 (...) ON store_sales0.ss_item_sk0 = item0.i_item_sk0 INNER JOIN date_dim AS date_dim0 (...) ON store_sales0.ss_sold_date_sk0=date_dim0.d_date_sk0 WHERE date_dim0.d_year0 = 2000 GROUP BY item0.i_category0) AS t7) AS t9 ON TRUE WHERE t3.total_sales > t9.EXPR$0 ORDER BY t3.total_sales DESC;

Rewritten Query via R-Bot ( >30s )

WITH category_sales AS ( SELECT i_category AS product_category, SUM(ss_sales_price*ss_quantity) AS total_sales FROM store_sales ss JOIN item i ON ss_item_sk = i_item_sk JOIN date_dim d ON ss_sold_date_sk = d_date_sk WHERE d.d_year = 2000 Replace with CTE GROUP BY i.i_category ), avg_total_sales AS ( SELECT AVG(total_sales) AS avg_total FROM category_sales ) SELECT cs.product_category, cs.total_sales FROM category_sales cs CROSS JOIN avg_total_sales avg_ts WHERE cs.total_sales > avg_ts.avg_total ORDER BY cs.total_sales DESC;

Rewritten Query via LASER-14B ( 10s )

Figure 5: An Example of generated slow queries. query structures. This diversity and complexity present a significant advantage for training models.

logic but represent generalized SQL optimization rules. Specifically, the LASER-8B and 14B models show significant improvements over the original queries and exhibit competitive performance against the DeepSeek-R1 model. For example, LASER-14B achieves a mean query execution time of 30.49 seconds, while DeepSeek-R1 performs at 28.71 seconds. The equivalence for LASER-14B is also higher than DeepSeek-R1, demonstrating the robustness and flexibility of our approach across different database systems. These results confirm that LASER is not only effective on PostgreSQL but also generalizes well to other database platforms, making it a versatile solution for various database environments.

6.8

6.9

Deployment at ByteDance

To validate the practical applicability of our approach, we deployed the LASER-14B model within ByteDance’s production environment. We evaluated its effectiveness using several real-world datasets derived from diverse business scenarios, such as E-commerce, Finance, and Video Streaming. This collection encompasses 129 databases and contains approximately 542GB of data. The evaluation workload consisted of 462 actual queries. From this workload, LASER14B identified and rewrote 69 queries that exhibited potential for optimization. Empirical results demonstrate that 73% of these rewritten queries achieved performance gains, yielding an average latency reduction of 23.1% compared to the original execution times. These findings robustly verify the effectiveness and reliability of the LASER framework in handling real-world business scenarios.

Case Study

To demonstrate how LASER optimizes query logic, we analyze a representative case from the SQL-MCTS dataset as shown in Figure 5. The original query suffers from significant computational redundancy because it repeats a complex aggregation involving several tables. This heavy operation is executed once in the main query to retrieve category sales and again within the subquery to calculate the global average threshold, forcing the database to scan the large fact tables twice. Existing rule-based and retrievalaugmented approaches, such as R-Bot [38], struggle to resolve this inefficiency. This is because they depend on predefined transformation rules, limiting their ability to identify duplicated computation patterns dispersed across distant query blocks. In contrast, LASER14B successfully identifies this inefficiency and reconstructs the query using Common Subexpression Elimination. It extracts the repeated logic into a CTE [2], which is computed once and then reused to derive the average value in a subsequent step. This logical refactoring effectively halves the heavy lifting, reducing the execution time from over 30 seconds to approximately 10 seconds. Moreover, our SQL-MCTS dataset contains many such challenging

7

CONCLUSION

In this paper, we introduced LASER, a data-centric approach for low-cost and efficient SQL query rewriting based on SQL-GRPO. By leveraging slow query generation to create high-quality training data, we synthesized over 11,000 complex slow queries, called SQL-MCTS. We then utilized Group Relative Policy Optimization, combined with Complexity-Adaptive Dynamic Rollout and Anchored Group Advantage, to enhance the performance of small models for SQL query rewriting. We demonstrate the effectiveness of LASER by training Qwen3-8B and Qwen3-14B models, and testing them on several public benchmarks. Extensive experiments show that our approach significantly improves model performance, confirming LASER’s ability to enhance the efficiency and accuracy of small models in real-world query optimization scenarios. 12

REFERENCES

[25] Ryan Marcus, Parimarjan Negi, Hongzi Mao, Chi Zhang, Mohammad Alizadeh, Tim Kraska, Olga Papaemmanouil, and Nesime Tatbul. 2019. Neo: a learned query optimizer. Proc. VLDB Endow. 12, 11 (2019), 1705–1718. [26] Raghunath Othayoth Nambiar and Meikel Poess. 2006. The making of TPC-DS. In VLDB. [27] OpenAI. 2024. Hello GPT-4o. https://openai.com/index/hello-gpt-4o/. [28] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. NeurIPS (2022), 27730–27744. [29] Meikel Poess and Chris Floyd. 2000. New TPC benchmarks for decision support and web commerce. ACM SIGMOD Record 29, 4 (2000), 64–71. [30] Mohammadreza Pourreza, Shayan Talaei, Ruoxi Sun, Xingchen Wan, Hailong Li, Azalia Mirhoseini, Amin Saberi, Sercan Arik, et al. 2025. Reasoning-sql: Reinforcement learning with sql tailored partial rewards for reasoning-enhanced text-to-sql. arXiv preprint arXiv:2503.23157 (2025). [31] Suming Qiu, Jing Li, Zhicheng Zhou, Junjie Huang, Linyuan Qiu, and Zhijie Sun. 2025. HES-SQL: Hybrid Reasoning for Efficient Text-to-SQL with Structural Skeleton Guidance. arXiv preprint arXiv:2510.08896 (2025). [32] Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. [n.d.]. Improving language understanding by generative pre-training. ([n. d.]). [33] Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. 2023. Direct preference optimization: Your language model is secretly a reward model. Advances in neural information processing systems (2023), 53728–53741. [34] Praveen Seshadri, Hamid Pirahesh, and TY Cliff Leung. 1996. Complex Query Decorrelation. In ICDE. 450–450. [35] Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, YK Li, et al. 2024. Deepseekmath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300 (2024). [36] Guangming Sheng, Chi Zhang, Zilingfeng Ye, Xibin Wu, Wang Zhang, Ru Zhang, Yanghua Peng, Haibin Lin, and Chuan Wu. 2025. Hybridflow: A flexible and efficient rlhf framework. In EuroSys. 1279–1297. [37] Yuyang Song, Hanxu Yan, Jiale Lao, Yibo Wang, Yufei Li, Yuanchun Zhou, Jianguo Wang, and Mingjie Tang. 2025. QUITE: A Query Rewrite System Beyond Rules with LLM Agents. arXiv preprint arXiv:2506.07675 (2025). [38] Zhaoyan Sun, Xuanhe Zhou, Guoliang Li, Xiang Yu, Jianhua Feng, and Yong Zhang. 2025. R-Bot: An LLM-Based Query Rewrite System. Proc. VLDB Endow. 18, 12 (2025), 5031–5044. [39] Zhaoguo Wang, Zhou Zhou, Yicun Yang, Haoran Ding, Gansen Hu, Ding Ding, Chuzhe Tang, Haibo Chen, and Jinyang Li. 2022. Wetune: Automatic discovery and verification of query rewrite rules. In SIGMOD. 94–107. [40] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. 2022. Chain-of-thought prompting elicits reasoning in large language models. NeurIPS 35 (2022), 24824–24837. [41] Dongjie Xu, Yue Cui, Weijie Shi, Qingzhi Ma, Hanghui Guo, Jiaming Li, Yao Zhao, Ruiyuan Zhang, Shimin Di, Jia Zhu, et al. 2025. E3-rewrite: Learning to rewrite sql for executability, equivalence, and efficiency. arXiv preprint arXiv:2508.09023 (2025). [42] Cong Yan, Yin Lin, and Yeye He. 2023. Predicate pushdown for data science pipelines. SIGMOD 1, 2 (2023), 1–28. [43] An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, et al. 2025. Qwen3 technical report. arXiv preprint arXiv:2505.09388 (2025). [44] Zongheng Yang, Wei-Lin Chiang, Sifei Luan, Gautam Mittal, Michael Luo, and Ion Stoica. 2022. Balsa: Learning a query optimizer without expert demonstrations. In SIGMOD. 931–944. [45] Bohan Zhai, Canwen Xu, Yuxiong He, and Zhewei Yao. 2025. Optimizing Reasoning for Text-to-SQL with Execution Feedback. In ACL. 19206–19218. [46] Yunjia Zhang, Yannis Chronis, Jignesh M Patel, and Theodoros Rekatsinas. 2023. Simple adaptive query processing vs. learned query optimizers: Observations and analysis. Proc. VLDB Endow. 16, 11 (2023), 2962–2975. [47] Haizhong Zheng, Yang Zhou, Brian R Bartoldson, Bhavya Kailkhura, Fan Lai, Jiawei Zhao, and Beidi Chen. 2025. Act Only When It Pays: Efficient Reinforcement Learning for LLM Reasoning via Selective Rollouts. arXiv preprint arXiv:2506.02177 (2025). [48] Han Zhong, Zikang Shan, Guhao Feng, Wei Xiong, Xinle Cheng, Li Zhao, Di He, Jiang Bian, and Liwei Wang. 2024. Dpo meets ppo: Reinforced token optimization for rlhf. arXiv preprint arXiv:2404.18922 (2024). [49] Xuanhe Zhou, Guoliang Li, Chengliang Chai, and Jianhua Feng. 2021. A learned query rewrite system using monte carlo tree search. Proc. VLDB Endow. 15, 1 (2021), 46–58.

[1] [n.d.]. AutoDL. https://www.autodl.com/ [2] [n.d.]. Common Table Expressions. https://www.postgresql.org/docs/current/ queries-with.html [3] [n.d.]. SQLGlot. https://github.com/tobymao/sqlglot [4] [n.d.]. VolcEngine. https://console.volcengine.com [5] Arash Ahmadian, Chris Cremer, Matthias Gallé, Marzieh Fadaee, Julia Kreutzer, Olivier Pietquin, Ahmet Üstün, and Sara Hooker. 2024. Back to Basics: Revisiting REINFORCE-Style Optimization for Learning from Human Feedback in LLMs. ACL, 12248–12267. [6] Udbhav Bamba, Minghao Fang, Yifan Yu, Haizhong Zheng, and Fan Lai. 2025. XRPO: Pushing the limits of GRPO with Targeted Exploration and Exploitation. arXiv preprint arXiv:2510.06672 (2025). [7] Andrew G. Barto, Richard S. Sutton, and Charles W. Anderson. 1983. Neuronlike adaptive elements that can solve difficult learning control problems. IEEE Transactions on Systems, Man, and Cybernetics SMC-13, 5 (1983), 834–846. [8] Edmon Begoli, Jesús Camacho-Rodríguez, Julian Hyde, Michael J. Mior, and Daniel Lemire. 2018. Apache Calcite: A Foundational Framework for Optimized Query Processing Over Heterogeneous Data Sources. SIGMOD, 221–230. [9] Cameron B. Browne, Edward Powley, Daniel Whitehouse, Simon M. Lucas, Peter I. Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. 2012. A Survey of Monte Carlo Tree Search Methods. IEEE Transactions on Computational Intelligence and AI in Games 4, 1 (2012), 1–43. [10] Minghan Chen, Guikun Chen, Wenguan Wang, and Yi Yang. 2025. Seed-grpo: Semantic entropy enhanced grpo for uncertainty-aware policy optimization. arXiv preprint arXiv:2505.12346 (2025). [11] Xu Chen, Zhen Wang, Shuncheng Liu, Yaliang Li, Kai Zeng, Bolin Ding, Jingren Zhou, Han Su, and Kai Zheng. 2023. Base: Bridging the gap between cost and latency for query optimization. Proc. VLDB Endow. 16, 8 (2023), 1958–1966. [12] Tianzhe Chu, Yuexiang Zhai, Jihan Yang, Shengbang Tong, Saining Xie, Dale Schuurmans, Quoc V. Le, Sergey Levine, and Yi Ma. 2025. SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-training. arXiv preprint arXiv:2501.17161 (2025). [13] Bailu Ding, Surajit Chaudhuri, Johannes Gehrke, and Vivek Narasayya. 2021. DSB: A decision support benchmark for workload-driven and traditional database systems. Proc. VLDB Endow. 14, 13 (2021), 3376–3388. [14] Guanting Dong, Hangyu Mao, Kai Ma, Licheng Bao, Yifei Chen, Zhongyuan Wang, Zhongxia Chen, Jiazhen Du, Huiyang Wang, Fuzheng Zhang, et al. 2025. Agentic reinforced policy optimization. arXiv preprint arXiv:2507.19849 (2025). [15] Lishui Fan, Yu Zhang, Mouxiang Chen, and Zhongxin Liu. 2025. Posteriorgrpo: Rewarding reasoning processes in code generation. arXiv preprint arXiv:2508.05170 (2025). [16] Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, Qihao Zhu, Shirong Ma, Peiyi Wang, Xiao Bi, et al. 2025. Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning. arXiv preprint arXiv:2501.12948 (2025). [17] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. 2022. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556 (2022). [18] Levente Kocsis and Csaba Szepesvári. 2006. Bandit based monte-carlo planning. In Proceedings of the 17th European Conference on Machine Learning. 282–293. [19] Atharv Kulkarni and Vivek Srikumar. 2025. Reinforcing Code Generation: Improving Text-to-SQL with Execution-Based Learning. arXiv preprint arXiv:2506.06093 (2025). [20] Haoyang Li, Shang Wu, Xiaokang Zhang, Xinmei Huang, Jing Zhang, Fuxin Jiang, Shuai Wang, Tieying Zhang, Jianjun Chen, Rui Shi, Hong Chen, and Cuiping Li. 2025. OmniSQL: Synthesizing High-Quality Text-to-SQL Data at Scale. Proc. VLDB Endow. (2025), 4695–4709. [21] Jiahui Li, Tongwang Wu, Yuren Mao, Yunjun Gao, Yajie Feng, and Huaizhong Liu. 2025. SQL-Factory: A Multi-Agent Framework for High-Quality and Large-Scale SQL Generation. arXiv preprint arXiv:2504.14837 (2025). [22] Zhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong, and Lidong Bing. 2024. LLM-R2: A Large Language Model Enhanced Rule-Based Rewrite System for Boosting Query Efficiency. Proc. VLDB Endow. 18, 1 (2024), 53–65. [23] Aixin Liu, Bei Feng, Bing Xue, Bingxuan Wang, Bochao Wu, Chengda Lu, Chenggang Zhao, Chengqi Deng, Chenyu Zhang, Chong Ruan, et al. 2024. Deepseek-v3 technical report. arXiv preprint arXiv:2412.19437 (2024). [24] Jie Liu and Barzan Mozafari. 2024. Query rewriting via large language models. arXiv preprint arXiv:2403.09060 (2024).

13

Related documents

Record · ID 2752 · SHA-256 6ce9af4616c4052c
Conceptio Open Knowledge Archive — every document is proof-bundled with source, license, and retrieval metadata.