Paper deep dive
FINER-SQL: Boosting Small Language Models for Text-to-SQL
Thanh Dat Hoang, Thanh Trung Huynh, Matthias Weidlich, Thanh Tam Nguyen, Tong Chen, Hongzhi Yin, Quoc Viet Hung Nguyen
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 95%
Last extracted: 7/8/2026, 9:34:45 AM
Summary
FINER-SQL is a reinforcement learning framework designed to enhance small language models (SLMs) for Text-to-SQL generation. It addresses the sparse reward problem in conventional RL by introducing dense, interpretable reward functions, including memory and atomic rewards, built on Group Relative Policy Optimization (GRPO). This enables stable, critic-free training, significantly improving execution accuracy on benchmarks like BIRD and Spider while maintaining low latency and privacy.
Entities (13)
Relation Signals (12)
FINER-SQL → solves → Text-to-SQL
confidence 99% · FINER-SQL: Boosting Small Language Models for Text-to-SQL
FINER-SQL → evaluatedon → Spider
confidence 98% · Experiments on the BIRD and Spider benchmarks show that FINER-SQL achieves up to 67.73% and 85% execution accuracy
FINER-SQL → evaluatedon → BIRD
confidence 98% · Experiments on the BIRD and Spider benchmarks show that FINER-SQL achieves up to 67.73% and 85% execution accuracy
FINER-SQL → targets → Small Language Models
confidence 97% · FINER-SQL targets the SLM regime (≤3B), where failures dominate and dense rewards are essential.
FINER-SQL → uses → Group Relative Policy Optimization
confidence 96% · Built on group relative policy optimization, FINER-SQL replaces sparse supervision with dense and interpretable rewards
FINER-SQL → applies → Supervised Fine-Tuning
confidence 95% · We then perform supervised fine-tuning (SFT) on this distilled corpus to transfer structured reasoning and SQL generation ability to the smaller model.
FINER-SQL → introduces → Memory Reward
confidence 95% · It introduces two key reward functions: a memory reward, which aligns reasoning with verified traces for semantic stability
FINER-SQL → introduces →
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Large language models have driven major advances in Text-to-SQL generation. However, they suffer from high computational cost, long latency, and data privacy concerns, which make them impractical for many real-world applications. A natural alternative is to use small language models (SLMs), which enable efficient and private on-premise deployment. Yet, SLMs often struggle with weak reasoning and poor instruction following. Conventional reinforcement learning methods based on sparse binary rewards (0/1) provide little learning signal when the generated SQLs are incorrect, leading to unstable or collapsed training. To overcome these issues, we propose FINER-SQL, a scalable and reusable reinforcement learning framework that enhances SLMs through fine-grained execution feedback. Built on group relative policy optimization, FINER-SQL replaces sparse supervision with dense and interpretable rewards that offer continuous feedback even for incorrect SQLs. It introduces two key reward functions: a memory reward, which aligns reasoning with verified traces for semantic stability, and an atomic reward, which measures operation-level overlap to grant partial credit for structurally correct but incomplete SQLs. This approach transforms discrete correctness into continuous learning, enabling stable, critic-free optimization. Experiments on the BIRD and Spider benchmarks show that FINER-SQL achieves up to 67.73\% and 85\% execution accuracy with a 3B model -- matching much larger LLMs while reducing inference latency to 5.57~s/sample. These results highlight a cost-efficient and privacy-preserving path toward high-performance Text-to-SQL generation. Our code is available at this https URL.
Tags
Links
- Source: https://arxiv.org/abs/2605.03465v1
- Canonical: https://arxiv.org/abs/2605.03465v1
Trouble viewing inline? Open PDF directly →
Full Text
89,043 characters extracted from source content.
Expand or collapse full text
FINER-SQL: Boosting Small Language Models for Text-to-SQL Thanh Dat Hoang1, Thanh Trung Huynh2, Matthias Weidlich3, Thanh Tam Nguyen1, Tong Chen4, Hongzhi Yin4*, Quoc Viet Hung Nguyen1* 1Griffith University (Australia), 2VinUniversity (Vietnam), 3Humboldt-Universitat zu Berlin (Germany), 4The University of Queensland (Australia) *Corresponding authors Abstract Large language models have driven major advances in Text-to-SQL generation. However, they suffer from high computational cost, long latency, and data privacy concerns, which make them impractical for many real-world applications. A natural alternative is to use small language models (SLMs), which enable efficient and private on-premise deployment. Yet, SLMs often struggle with weak reasoning and poor instruction following. Conventional reinforcement learning methods based on sparse binary rewards (0/1) provide little learning signal when the generated SQLs are incorrect, leading to unstable or collapsed training. To overcome these issues, we propose FINER-SQL, a scalable and reusable reinforcement learning framework that enhances SLMs through fine-grained execution feedback. Built on group relative policy optimization, FINER-SQL replaces sparse supervision with dense and interpretable rewards that offer continuous feedback even for incorrect SQLs. It introduces two key reward functions: a memory reward, which aligns reasoning with verified traces for semantic stability, and an atomic reward, which measures operation-level overlap to grant partial credit for structurally correct but incomplete SQLs. This approach transforms discrete correctness into continuous learning, enabling stable, critic-free optimization. Experiments on the BIRD and Spider benchmarks show that FINER-SQL achieves up to 67.73% and 85% execution accuracy with a 3B model – matching much larger LLMs while reducing inference latency to 5.57 s/sample. These results highlight a cost-efficient and privacy-preserving path toward high-performance Text-to-SQL generation. Our code is available at https://github.com/thanhdath/finer-sql. I Introduction Text-to-SQL aims to translate natural language utterances into executable SQL queries, enabling non-experts to interact with databases seamlessly. The task is inherently challenging due to the need for compositional reasoning, schema linking, and handling ambiguous user intents [1, 2, 3, 4, 5, 6]. Recent years have seen remarkable progress driven by large language models (LLMs), which achieve state-of-the-art performance on benchmarks such as Spider and BIRD [7, 8, 9]. Most of these methods rely on large open-source models or proprietary APIs (e.g., GPT-4, Claude), achieving high accuracy through chain-of-thought reasoning and multi-stage pipelines [10, 11, 12, 13, 14]. Figure 1: Execution accuracy (EX%) of FINER-SQL on BIRD dev. Although SLMs are often overlooked due to their perceived weakness in reasoning, our 3B model outperforms many >>14B baselines and even proprietary systems. Despite their success, LLM-based solutions introduce significant practical constraints. First, relying on external APIs poses privacy risks, as sensitive database schemas and user queries must be transmitted to third-party servers, potentially violating confidentiality [15, 16, 17, 18, 19]. Second, the cost of inference at scale can be extremely high. For instance, CHESS-style schema linking consumes over 340K tokens per request (over $850 per 1,000 requests with GPT-4o), even before generating and selecting SQL candidates, as shown in recent analyses [20, 10]. Such expenses are unsustainable for many real-world deployments, motivating the adoption of self-hosted solutions that are both cost-efficient and privacy-preserving [21, 22, 23, 24, 25]. A natural direction is to employ small language models (SLMs, 0.5B–3B parameters), which run efficiently on a single 12–24GB GPU (e.g., RTX 4090). SLMs are appealing for lightweight, on-premise deployment, but applying them to Text-to-SQL remains nontrivial. They suffer from (i) weak reasoning capability, leading to poor SQL generation, and (i) limited instruction-following and formatting, producing invalid or incomplete SQL [26, 27, 28]. As a result, most SQL queries from SLMs are incorrect or unexecutable, leading to very low accuracy. Recent advances in reinforcement learning (RL) have improved the reasoning abilities of LLMs, often using policy optimization methods such as PPO [29] or GRPO [30]. These works typically train models of at least 7B parameters, using execution accuracy as the primary reward—a binary signal that gives 1 for a fully correct query and 0 otherwise [31, 32, 33, 34]. While such sparse rewards can help large models refine their reasoning, they are ineffective for SLMs, where most attempts fail and thus receive zero signal. As a result, reinforcement learning on small models often collapses or stagnates. To be effective, SLMs require fine-grained and informative rewards that can recognize partial correctness and provide continuous feedback even when the final SQL is wrong. In this work, we introduce FINER-SQL [35] (Fine-grained Execution feedback for Reinforcement learning in Text-to-SQL), a reinforcement learning framework tailored for small language models. Unlike prior LLM-heavy approaches that rely on 7B–32B parameter models or external APIs, FINER-SQL targets the SLM regime (≤ 3B), where failures dominate and dense rewards are essential. The model is trained with Group Relative Policy Optimization (GRPO), avoiding a separate value model, and augments standard execution and format rewards with two dense signals: (i) memory rewards compare the model’s reasoning to a bank of verified traces, offering stability even when execution fails; (i) atomic rewards score overlap between predicted and gold queries at the operation level, giving credit to partially aligned SQLs. These signals turn binary correctness into continuous feedback, revealing how far an incorrect query is from the target and which components need refinement. As shown in Fig. 1, despite their compact size, our FINER-SQL 3B variant attains 67.73% execution accuracy on the BIRD dataset, outperforming many open-source models exceeding 14B parameters and even some proprietary systems. We summarize our contributions as follows: • We propose FINER-SQL, a scalable and reusable reinforcement learning framework designed to boost Text-to-SQL performance of small models through fine-grained execution feedback. • We introduce a memory reward mechanism that efficiently evaluates the reasoning traces of SLMs against verified reasoning patterns, enhancing logical consistency and training stability. • We design atomic operation rewards that compute fine-grained structural similarity between generated and gold SQLs, mitigating the sparse reward problem. • Comprehensive experiments on Spider and BIRD show that FINER-SQL significantly improves execution accuracy and generalization of small models, matching much larger LLMs at a fraction of the cost. Our 3B model achieves 67.73% execution accuracy on BIRD Dev with only 5.57s per sample. In the remainder, § I discusses related work. § I formulates the Text-to-SQL problem and RL challenges for SLMs. § IV presents the FINER-SQL framework and its two-stage design. § V reports experimental results and conclusions (§ VI). I Related Work Reinforcement Learning for LLMs. Reinforcement learning has been widely used to enhance the reasoning abilities of large language models (e.g. DeepSeek-R1 [36], OpenAI’s O-series) in mathematics, logic, and code generation via reward-based optimisation. Building on the Reinforcement Learning from Human Feedback (RLHF) paradigm [37], these methods align model behaviour with human preferences using a reward model and Proximal Policy Optimisation (PPO)[29, 38, 39] under a KL constraint. Offline approaches such as Direct Preference Optimisation (DPO)[40] and Odds-Ratio Preference Optimisation (ORPO)[41, 42, 43] eliminate explicit reward models and directly optimise preference pairs for improved stability and lower cost. In contrast, online methods including PPO and Group Relative Policy Optimisation (GRPO)[30] rely on real-time rollouts, with GRPO further removing the value model and estimating advantages via relative candidate scoring. Our work adapts GRPO to train SLMs for Text-to-SQL, improving execution accuracy through feedback-based optimisation without a separate value model. Text-to-SQL. Text-to-SQL research has evolved from early neural models such as Seq2SQL [44] and SQLNet [45] to grammar- and relation-aware systems including IRNet [46], SyntaxSQLNet [47], and RAT-SQL [1], with constrained decoding methods like PICARD [48, 49, 50] improving syntactic validity. The emergence of large pretrained language models shifted the paradigm toward prompting-based and multi-stage pipelines (e.g. SQL-PaLM [51], DIN-SQL [52], CHESS [10, 53, 54, 55]), integrating planning, reranking, and execution feedback but relying heavily on proprietary LLMs. More recently, reinforcement learning approaches such as Arctic-Text-to-SQL-R1 [31], SQL-o1 [56], and Ex-CoT [32] have shown that execution feedback improves compositional generalization, though these methods typically target large (≥ 7B) models and depend on sparse binary rewards, limiting applicability to smaller models [57, 58, 59]. Our FINER-SQL introduces dense, interpretable rewards that provide continuous feedback on reasoning and SQL structure, enabling effective reinforcement learning for small models. I Model and Challenges I-A Problem Formulation Text-to-SQL addresses the task of generating an SQL query Y that corresponds to a given natural language question q. =f(q,S,K∣),Y=f(q,S,K θ), where the function f(⋅∣)f(· θ) represents a generative model (e.g., a neural network) with learnable parameters θ [60, 61]. This query is constructed based on a database schema SS and, optionally, an external knowledge base KK. The database schema SS is defined by a set of tables T1,T2,…,Tm \T_1,T_2,…,T_m \, a set of columns C1,C2,…,Cn \C_1,C_2,…,C_n \, and a set of foreign key relations R1,R2,…,Rk \R_1,R_2,…,R_k \. The optional external knowledge KK provides context for the schema, aiding in generating more accurate SQL in ambiguous situations [62, 63, 64]. I-B Challenges We argue that any reinforcement learning approach applied to SLMs for Text-to-SQL must effectively address the following fundamental challenges: (R1) Weak Reasoning Capability. SLM-based Text-to-SQL systems must address limited reasoning capabilities. Chain-of-thought prompting, effective for large models, is unreliable for SLMs, often yielding illogical reasoning [65] and inaccurate SQL generation on complex schemas [66]. (R2) Low Instruction Following Capability. SLMs struggle with instruction following due to limited size [67] and lack of diverse tuning data like InFoBench [68] and IFEval [69]. Consequently, they generalize poorly to complex instructions and frequently ignore structural constraints (e.g., <<think>> tags), hindering reliable SQL extraction. (R3) Sparse Reward Issue. RL for Text-to-SQL typically uses sparse execution rewards [44, 70], offering no credit for partial correctness (e.g., valid joins) and hindering fine-grained policy learning [71, 72, 73, 30]. Since SLMs often generate invalid initial SQLs, this results in negligible learning signals. Prior work in math and code indicates that process-level rewards improve convergence [71, 74, 72], highlighting the need for shaped, step-level feedback in SLMs. (R4) High Cost of Explicit Reward Modeling. Process Reward Models (PRMs) offer fine-grained feedback [71, 40, 74] but face high costs and adaptation needs [30]. In Text-to-SQL, evaluating schema linking and partial executions adds complexity. Commercial verifiers often yield unreliable judgments [75, 8] and incur prohibitive costs (e.g., $2400 for 10k queries [76]), making them impractical for iterative RL. IV FINER-SQL: Reinforcement Learning with Fine-Grained Execution Feedback Motivated by the challenges identified in § I-B, we propose FINER-SQL, a two-stage framework that enhances Text-to-SQL performance of SLMs through (1) reasoning distillation from large reasoning models and (2) reinforcement learning with fine-grained execution feedback, as illustrated in Fig. 2. Figure 2: Overall training pipeline of FINER-SQL. Step 1: Distillation - Diverse Reasoning Style for SLMs. Teacher models (e.g., GPT-4o, DeepSeek-R1, Qwen-2.5-72B) are prompted with question-schema pairs to produce reasoning traces and SQLs, forming a Reasoning Bank with diverse plan and SQL styles. The SLM is initialized via supervised fine-tuning on this corpus to obtain policy π1 _1 with structured reasoning ability. Step 2: Reinforcement Learning from Execution Feedback. The finetuned policy generates multiple rollouts per query and is optimized using GRPO with dense, interpretable reward signals—including format, memory, execution, and atomic rewards—to improve reasoning faithfulness and SQL accuracy. IV-A Distillation - Diverse Reasoning Style for SLMs Reasoning Bank Construction To address weak reasoning and limited instruction-following capabilities (R1, R2), we first distill diverse reasoning knowledge from a pool of large reasoning models, including DeepSeek-R1, GPT-oss-120B, Qwen-2.5-72B-Instruct, and OpenAI GPT-4o. Given a question-schema pair, each teacher model is prompted with a structured instruction consisting of two messages: a system prompt that defines the response rules and a user prompt that provides the database schema, natural-language question, and optional external knowledge. System Prompt for Teacher Models You are a meticulous SQL expert. Generate a single, correct SQL query for the user question and the provided database schema. Follow this exact response format: <think> Briefly reason about the steps to form the SQL. </think> SQL statement Rules: - Output exactly one SQL statement. - The SQL must be executable on SQLite. - Do not include any explanatory text outside the <think> section. - After </think>, output one SQL statement only. Do not include any extra text, tags. As shown in the system prompt above, the prompt explicitly constrains teachers to output a concise reasoning trace enclosed within <<think>> tags followed by a single executable SQL statement for SQLite3. For reasoning models (e.g., DeepSeek-R1, GPT-oss-120B), the line “Follow this exact response format:” is omitted, since these models natively generate reasoning enclosed within <<think>>…<</think>> and we just need to modify the prompt so that the final SQL is returned without additional instruction. The accompanying user prompt provides the structured task inputs, namely the database schema, the natural-language question, and any optional external knowledge. This design enforces a unified output structure across all teacher models, ensuring that each completion conforms to the canonical form: ⟨q,schema⟩→⟨<think>reasoning</think>SQL⟩ q,schema → <think>reasoning</think>SQL The resulting multi-source reasoning traces are aggregated into a Reasoning Bank, providing the SLM with diverse reasoning styles and compositional strategies across different teacher architectures. We then perform supervised fine-tuning (SFT) on this distilled corpus to transfer structured reasoning and SQL generation ability to the smaller model. This step also enables the SLM to quickly adapt to the required output format, as it learns to generate reasoning traces followed by valid SQL structures from the beginning of training. Importantly, we do not filter out teacher samples with failed executions, since the purpose of this stage is not to achieve execution correctness but to expose the model to a wide variety of reasoning trajectories and compositional patterns. Although the execution accuracy of teacher models on the BIRD training set is around 50–60%, these imperfect yet diverse examples still provide valuable reasoning supervision that helps the SLM develop robust structural understanding. We generated 37.6K distillation samples (4 teachers × BIRD training set) for only ∼ $30. This cost was minimized by employing GRAST-SQL [77], an efficient schema-linking method, to restrict inputs to the top-30 columns instead of the entire large schema. Supervised Fine-Tuning Process Given a Reasoning Bank containing diverse reasoning-SQL pairs distilled from multiple teacher models, we perform supervised fine-tuning to transfer their structured reasoning and compositional knowledge to the smaller model. During fine-tuning, we optimize the SLM only on the completion tokens – i.e., the reasoning and SQL segments – while excluding prompt tokens such as schema descriptions or external context. This ensures that the model learns to reproduce reasoning paths and final SQLs without memorizing database-specific content. The supervised fine-tuning loss is formulated as: ℒcompletion=−∑j=C+1τlogPθ(yj∣y<j,χ).L_completion=- _j=C+1^τ P_θ(y_j y_<j,χ). (1) where C marks the end of the prompt tokens, τ is the total sequence length, yty_t is the target completion token, χ denotes the prompt, and PθP_θ is the model’s predicted probability distribution parameterized by θ. Through this process, the SLM acquires structured reasoning ability, format obedience, and generalization over diverse reasoning patterns—forming a strong initialization for the subsequent reinforcement learning stage. IV-B Reinforcement Learning from Execution Feedback To address the challenges of sparse and costly supervision signals (R3, R4), the distilled SLM is further optimized through reinforcement learning using fine-grained execution feedback. For each training instance, the model samples a group of G rollouts r1,…,rG\r_1,…,r_G\, where each rollout includes a reasoning trace and its corresponding SQL prediction. Instead of relying on a binary execution signal, we design a dense composite reward that reflects different dimensions of SQL quality and reasoning consistency. The reward comprises four complementary components: • Format Reward encourages the model to follow the standardized <<think>>-SQL structure, where the reasoning process and executable SQL are clearly separated for reliable parsing and evaluation. Although the distilled policy π1 _1 from § IV-A often generates correctly formatted outputs, the format reward remains essential during reinforcement learning, as exploration may cause the model to deviate from the expected structure. Formally, Rformat(s)=1,if the output follows the format0,otherwise.R_format(s)= cases1,&if the output follows the format\\[4.0pt] 0,&otherwise. cases • Execution Reward assesses the executable correctness of the generated SQL. Queries that fail to run receive zero reward. If the SQL executes successfully but produces an incorrect result, a base credit of 1.01.0 is assigned for syntactic and runtime validity. When the predicted and ground-truth outputs match exactly, the model receives the maximum reward of 2.02.0: Rexec(s∣q)=0,if the SQL fails to execute;1,if executable without syntax error;2,if results match exactly.R_exec(s q)= cases0,&if the SQL fails to execute;\\ 1,&if executable without syntax error;\\ 2,&if results match exactly. cases • Memory Reward evaluates the semantic alignment of a generated reasoning trace with a set of verified reasoning prototypes, particularly when the SQL execution fails. It assigns a continuous score Rmem∈[0,1]R_mem\!∈[0,1] based on embedding similarity between the generated reasoning and gold reasoning traces retrieved from diverse databases. This reward serves two purposes: (i) it estimates the likelihood that the reasoning path is logically valid, and (i) it regularizes the model to follow the diverse reasoning styles distilled from teacher models rather than generating noisy or unfocused reasoning. A detailed formulation is provided in § IV-C. • Atomic Reward captures structural similarity between the predicted and reference SQLs by decomposing each query into a list of atomic operations—such as FROM, JOIN, and WHERE_PRED—and measuring their overlap. Each SQL is parsed into an operation set, and the reward assigns a continuous score Ratomic∈[0,1]R_atomic\!∈[0,1] proportional to the intersection ratio between the predicted and ground-truth operation sets. This fine-grained feedback provides partial credit for structurally correct components, encouraging the model to progressively assemble a complete and executable query, as detailed in § IV-D. The atomic reward is activated only when the predicted SQL is incorrect. The overall reward for each rollout is defined as the unweighted sum of all components: R=Rformat+Rexec+Ratomic+Rmem,R=R_format+R_exec+R_atomic+R_mem, When an SQL fails to execute, the atomic and memory rewards provide fallback supervision, allowing the policy to continue learning from structurally or semantically meaningful rollouts. For optimization, we employ GRPO [30], which estimates relative advantages across a group of G rollouts for each instance. This approach eliminates the need for a separate critic or reward model, enabling stable policy improvement with reduced computational cost. Reward composition and scaling. To illustrate the behavior and relative range of each reward, Fig. 3 visualizes how rewards accumulate across representative prediction categories—ranging from wrong format to correct execution. The Format Reward (orange) is always computed first and bounded in 0,1\0,1\, acting as a gate that ensures structural validity. Subsequent rewards, Execution (blue), Atomic (yellow), and Memory (gray), expand upon this baseline, demonstrating how partial correctness is progressively credited even before perfect execution is achieved. This scaling visualization highlights the dense nature of our reward design: every stage of improvement, from valid syntax to full correctness, produces a measurable and interpretable reward increase. Figure 3: Reward scaling across prediction quality levels. Each stacked bar shows how individual rewards (Format, Execution, Atomic, Memory) contribute under increasing SQL correctness—from wrong format to fully correct execution. The scaling illustrates that FINER-SQL replaces binary rewards with a smooth, continuous feedback space, ensuring dense and interpretable credit assignment throughout training. IV-C Memory Reward: Reasoning-SQL Semantic Alignment Motivation The output of SLMs consists of a <<think>> reasoning trace followed by the generated SQL, where the SQL quality directly depends on the reasoning. When the SQL fails to execute, evaluating only the final output discards meaningful reasoning progress and destabilizes learning. We therefore propose the Memory Reward, which evaluates the reasoning itself based on its semantic similarity to successful reasoning traces stored in memory. This reward serves two purposes: (1) it promotes reasoning consistency by anchoring updates around coherent and previously verified reasoning patterns, mitigating logical variance among the K sampled candidates to prevent fragmented execution groups, thereby ensuring higher consensus during majority voting; and (2) it acts as a semantic regularizer that concentrates the model’s probability mass on valid structural prototypes, preventing the candidate pool from being diluted by degenerate traces (e.g., excessively short sequences, uninformative content, or malformed XML tags) and directly improving the robustness of the final aggregated prediction. Theoretical Formulation We formulate the Text-to-SQL generation process as a Goal-Augmented Partially Observable Markov Decision Process (POMDP), defined by the tuple ℳ=(,A,,,R,O)M=(S,A,P,G,R,O). The components of this process are defined as follows: • S is the latent state space. • A⊂VLA⊂ V^L represents the action space, where each action is a sequence sampled from the language model’s vocabulary V, with L denoting the maximum length of the generated text. • :×A→P:S× A is the transition function updating the state based on the generated action. • ⊂VNG⊂ V^N denotes the goal space, representing the set of executable SQL queries that satisfy the user intent. • R:×A×→ℝR:S× A×G represents the goal-conditioned reward function. • O is the set of observations o∈Oo∈ O, capturing the visible context (question, schema) available to the model. In this framework, the objective of the policy πθ _θ is to maximize the expected return, i.e., the expected total reward accumulated over a rollout: J(θ)=∼πθ[∑t=1HR(st,at,g)],J(θ)=E_ ξ _θ [ _t=1^HR(s_t,a_t,g) ], where =(s1,a1,…,sH,aH) ξ=(s_1,a_1,…,s_H,a_H) denotes a rollout sampled from πθ _θ, and ∑t=1HR(st,at,g) _t=1^HR(s_t,a_t,g) is the cumulative reward of that rollout. A fundamental challenge in applying reinforcement learning to LLMs is the vastness of the action space A⊂VLA⊂ V^L. The set of valid reasoning paths valid⊂AT_valid⊂ A leading to a goal g∈g is combinatorially large. A policy trained solely on sparse execution signals (Rexec∈0,1R_exec∈\0,1\) tends to explore this space unconstrained, developing high variance. Concretely, given an observation o∈Oo∈ O (i.e., a question–schema prompt), the policy samples a group of rollouts jj=1K\ ξ_j\_j=1^K by stochastic decoding with temperature T, and each rollout is scored by the composite reward. At inference, we follow the same sampling protocol, drawing K candidate generations under temperature T and select the best SQL via majority voting; in practice, diverse reasoning traces often lead to diverse SQL structures, which fragment candidates into more execution groups (i.e., K distinct SQLs) and thus cause vote dilution, where no single group secures a decisive majority. To mitigate this effect, we introduce the Memory Reward (RmemR_mem) as a regularization signal that promotes reasoning consistency: by assigning higher scores to rollouts whose reasoning traces align with verified memory prototypes, the policy shifts probability mass toward a smaller set of coherent reasoning patterns, causing candidates to cluster into fewer execution groups and yielding higher consensus during inference. We define a manifold of verified reasoning prototypes mem⊂validT_mem _valid, representing the high-quality traces stored in memory during the distillation phase. The optimization objective is formulated as: maxθ∼πθ[Rexec()+λRmem()]. _θ\;E_ ξ _θ [R_exec( ξ)+λ R_mem( ξ) ]. Mathematically, RmemR_mem reshapes the policy’s energy landscape by concentrating probability mass on the verified prototypes in memT_mem, thereby constraining the vast search space validT_valid. This significantly reduces policy variance (Var(πmem)≪Var(πsparse)Var( _mem) ( _sparse)), causing sampled candidates to cluster into fewer execution groups and ensuring robust consensus for majority voting. Notably, we assume that the reasoning patterns distilled from our selected teacher models are already high-quality; therefore, RmemR_mem is designed to encourage the SLM to stay close to these verified prototypes rather than exploring entirely new reasoning patterns. Memory construction and management We define a persistent reasoning memory ℳM implemented as a vector database using ChromaDB [78], supporting efficient embedding retrieval and incremental updates of reasoning traces. Each memory entry stores a reasoning embedding, its associated metadata (sample ID, reasoning embedding, and database ID), and is managed by three operators INIT, RETRIEVE, and INSERT, as illustrated in Fig. 4. • INIT: Memory Initialization. The memory ℳM is initialized with high-quality reasoning traces from the teacher model DeepSeek-R1, which often produces diverse reasoning styles for distillation in § IV-A. We first filter samples whose generated SQLs execute correctly, then extract their reasoning content from the <<think>> blocks. Each reasoning trace is embedded into a shared semantic space using Qwen3-Embedding-0.6B [79], and stored in ChromaDB with its metadata. This initialization builds a foundational pool of verified reasoning paths. • RETRIEVE: Cross-Database Semantic Retrieval. During training, for a given reasoning trace t from database d, the RETRIEVE operator searches for top-k semantically similar traces rii=1k\r_i\_i=1^k from other databases (db_id≠ddb\_id≠ d). By calculating the reward based on the centroid of these k embeddings, the system forces the model to align with the average structural pattern rather than overfitting to specific schema tokens. Furthermore, this design does not encourage generic hallucinations, because if the model generates hallucinated schema elements from other databases, this easily leads to a SQL syntax error on the current database, triggering a zero execution reward and penalizing the deviation. • INSERT: Incremental Memory Update. When a reasoning-SQL pair executes successfully, its reasoning trace is embedded and conditionally inserted into ℳM using INSERT. Before insertion, the system applies a quality gate to filter degenerate traces based on three metrics derived from the trace text: (1) Length Heuristics reject traces that are too short (<30<30 tokens) or too long (>2000>2000 tokens); (2) Informativeness ensures schema grounding by requiring a schema density (calculated as the ratio of schema column mentions to total tokens) ≥0.05≥ 0.05 with at least 2 distinct column mentions; and (3) Lexical Diversity prevents repetitive loops by requiring that at least 60% of consecutive word pairs are unique. Valid traces then undergo similarity deduplication: the system skips addition if the cosine similarity with the top-1 existing entry is ≥0.9≥ 0.9, thereby avoiding redundancy and encouraging exploration of new reasoning paths. Over time, ℳM evolves dynamically, continually enriched by successful reasoning produced by the student model. These operators work together to keep the reasoning memory ℳM clean and diverse. The system only stores reasoning traces that are both correct in execution and sufficiently different from what already exists in memory. If a new reasoning is too similar to previous ones, it is skipped. This mechanism helps ℳM grow into a well-balanced repository that contains only effective and varied reasoning paths, guiding the model toward better generalization. Figure 4: The flow of memory reward computation and management. During rollout, the reasoning text is embedded and compared with the centroid of top-k similar reasoning retrieved from different databases. The memory manager executes three key functions—INIT, RETRIEVE, and INSERT—to maintain a diverse set of verified reasoning traces for GRPO optimization. Reward formulation Let ψ(⋅)ψ(·) be the fixed encoder for embedding reasoning paths. Given a question/sample q (with associated database db(q)db(q)) and the reasoning trace t generated by the SLM, we retrieve the top-k verified reasoning paths from other databases ℛ(t;q)=ri∣db_id(ri)≠db(q)i=1k,R(t;q)=\\,r_i db\_id(r_i) (q)\,\_i=1^k, and compute their embeddings E=ψ(ri)i=1kE=\ψ(r_i)\_i=1^k. We then form the centroid embedding c(t;q)=1k∑i=1kψ(ri),c(t;q)= 1k _i=1^kψ(r_i), and normalize the vectors a^=ψ(t)/‖ψ(t)‖2 a=ψ(t)/\|ψ(t)\|_2 and c^=c(t;q)/‖c(t;q)‖2 c=c(t;q)/\|c(t;q)\|_2. Rmem(t∣q)=0,if the output format is invalid;cos(a^,c^),if the SQL executes incorrectly;1,if the SQL executes correctly.R_mem(t q)= cases0,&if the output format is invalid;\\ ( a, c),&if the SQL executes incorrectly;\\ 1,&if the SQL executes correctly. cases This formulation treats the reward as the direct cosine similarity between the current reasoning and the centroid of retrieved successful traces, providing a dense, interpretable signal of reasoning alignment. When execution succeeds, the reward saturates at 1.01.0 and the reasoning trace is stored in the memory bank ℳM via the INSERT operator. This design preserves stable gradients, avoids redundant scaling, and ensures that even partially correct reasoning receives proportional credit. Example Schema (simplified): Employee(EmpID, Name, DeptID, Salary), Department(DeptID, DeptName). Question: “List employees who earn more than the average salary of their own department.” <<think>> 1) Compute the average salary per department. 2) Compare each employee’s salary with the department average. 3) Return those exceeding it. <</think>> SQL: (execution fails) Even though the SQL fails, the reasoning follows a coherent logical pattern—group, aggregate, align, and compare—that aligns with verified traces retrieved from other databases (e.g., comparing students above class average or products above category mean). The high semantic similarity produces a strong memory reward, guiding the model to refine rather than discard this reasoning path. In contrast, when the model produces invalid reasoning patterns, various failure cases can occur, such as empty reasoning traces, hallucinated answers instead of SQL queries, or the generation of XLM/HTML tags without meaningful information. These reasoning traces are semantically distant from the reasoning patterns stored in memory, leading to very low similarity scores and thus minimal memory rewards. Such penalties discourage unstructured or hallucinated reasoning behaviors and steer the model back toward compositional, SQL-oriented reasoning that can yield executable queries. Efficiency and stability The memory module is designed for efficiency and scalability. Each reasoning trace is embedded once and indexed in a vector database, enabling sub-millisecond approximate nearest-neighbor retrieval even at large scale [78, 80]. The vector database not only accelerates retrieval but also ensures consistent and reliable access to reasoning traces during training. Since the reward depends only on embedding similarity rather than SQL execution, it incurs negligible overhead and can be computed in parallel with rollouts. This lightweight mechanism provides dense, cost-effective feedback that stabilizes GRPO optimization and improves reasoning transfer across databases. IV-D Atomic Reward: Operation-Level Structural Feedback Execution-based rewards assess only final correctness and fail to capture structural progress for partially correct or non-executable SQL. To address this, we introduce the Atomic Reward, which decomposes each SQL query into atomic operations (e.g., selections, joins, predicates) and measures overlap with the reference SQL at this level, providing continuous, interpretable feedback that reflects compositional reasoning. Motivation. A Text-to-SQL model may generate SQLs that are semantically close to the ground truth—using correct tables, joins, or filters—but differ in specific clauses. For instance, replacing AVG(Salary) with COUNT(*) or omitting a GROUP BY clause. While token-based or n-gram similarity metrics can capture surface-level overlap, they remain sensitive to textual styling and fail to reflect true structural alignment between SQL components. Execution-based rewards likewise overlook these fine-grained distinctions. By analyzing SQLs through atomic operations, our comparison becomes invariant to formatting and reordering, interpretable in terms of compositional structure, and capable of assigning partial credit to logically aligned fragments—encouraging the model to gradually assemble full correctness. Atomic decomposition. Each SQL query s is parsed into atomic operations following Table I by constructing an abstract syntax tree (AST) and extracting clause-level primitives. Each AST node represents a distinct SQL construct (e.g., projections, predicates, aggregations, joins), enabling semantically meaningful operations independent of token order or formatting. This abstraction yields comparable atomic representations for syntactically different but equivalent SQLs; for deeply nested subqueries, operations are flattened into a single list to ensure efficient and consistent comparison. TABLE I: All defined atomic operations; each represents a meaningful SQL construct for structural comparison. Atomic op Meaning / Example FROM / JOIN FROM(tbl [AS a]) Base relation; FROM(cust AS T1) JOIN(tbl [AS a], type) Join relation; JOIN(orders, INNER) ON_EQ(a.col,b.col) Equality key; ON_EQ(T2.id,T1.id) ON_PRED(op,lhs,rhs) Non-equi join; ON_PRED(>>,T2.qty,VALUE(0)) SELECT projections SELECT_COL(a.col) Column; SELECT_COL(name) SELECT_AGG(agg,a.col) Aggregation; SELECT_AGG(SUM,total) SELECT_EXPR(expr) Scalar expr; SELECT_EXPR(LOWER(name)) DISTINCT Distinct projection WHERE / HAVING WHERE_PRED(op,lhs,rhs) Predicate; WHERE_PRED(=,ct,VALUE(‘AU’)) HAVING_PRED(op,lhs,rhs) Post-group filter Literals / Group / Order / Limit VALUE(v) Literal; VALUE(DATE ‘2024-01-01’) GROUP_BY(a.col) Group key; GROUP_BY(name) ORDER_BY(expr,dir) Ordering; ORDER_BY(rev,DESC) LIMIT(n) Row cap; LIMIT(50) Set ops / CTEs UNION / INTERSECT / EXCEPT Set operation WITH_CTE(name) Declare CTE; WITH_CTE(top_cust) Nested subqueries ENTER_SUBQUERY(role) Enter subquery; ENTER_SUBQUERY(WHERE_SCALAR) EXIT_SUBQUERY Exit subquery scope SUBQ_LAST Refer to last subquery; WHERE_PRED(=,x,SUBQ_LAST) Window / Alias WINDOW(part,order,frame) Window spec SELECT_WIN(func,args) Windowed select ALIAS(kind,from,to) Rename; ALIAS(COLUMN,SUM(total),rev) Reward computation. Given a predicted SQL s generated from a rollout, we parse it into a set of atomic operations (s)A(s) using our Atomic Decomposition module (see the left part of Fig. 5). Each atomic unit captures one structural action such as SELECT_COL, FROM, or WHERE_PRED, enabling direct comparison between queries at the operation level. For each reference SQL gig_i in the ground-truth SQLs set g1,…,gN′\g_1,…,g_N \ (see the reference SQL enrichment process below), we compute a Jaccard similarity between their atomic-operation sets: J(s,gi)=|(s)∩(gi)||(s)∪(gi)|,if |(s)∪(gi)|>0,0,otherwise.J(s,g_i)\;=\; cases |A(s) (g_i)||A(s) (g_i)|,&if |A(s) (g_i)|>0,\\[6.0pt] 0,&otherwise. cases This metric captures the proportion of shared operations (e.g., same SELECT_COL(name), WHERE_PRED(=,…)), normalized by the total number of distinct operations across both queries. As illustrated in the Atomic Operations Comparison part of Fig. 5, each operation in the predicted SQL is aligned with its counterpart in the reference SQLs, where bold elements denote overlapping atomic operations that contribute to the overall Jaccard score. To prevent the atomic score from saturating near 1 for high but imperfect overlaps, we apply a monotone shaping function: ϕ(x)=λx+(1−λ)βxγ,with λ=0.05,β=0.79,γ=0.20.φ(x)=λ\,x+(1-λ)\,β\,x^γ, λ=0.05,\;β=0.79,\;γ=0.20. This compresses the top end of the scale (e.g., ϕ(0.95)<0.95φ(0.95)<0.95), so “almost-right” structures receive slightly less credit than totally matches. The goal is to avoid over-rewarding queries that are structurally very similar yet not fully correct, while still providing smooth credit for partial matches. A fully correct SQL will still be reward 2.0 by the execution reward. We first compute the maximum Jaccard similarity over all reference SQLs: Jmax(s)=maxi∈[1,N′]J(s,gi),J_ (s)= _i∈[1,N ]J(s,g_i), and then apply the shaping function to normalize the reward: Ratomic(s)=ϕ(Jmax(s)).R_atomic(s)=φ(J_ (s)). This formulation enhances robustness to structural variations by selecting the most compatible reference query among all semantically equivalent candidates. As a result, the reward remains stable even when the predicted SQL differs in syntax, such as through alias renaming, operator choice, or subquery restructuring, yet conveys the same semantics. Figure 5: Atomic Reward computation pipeline. The predicted SQL is compared against a set of reference SQLs that represent equivalent but stylistically different realizations of the same intent. Each comparison yields a Jaccard similarity across atomic operations, and the final reward is the maximum among these scores. Reference SQL enrichment. To increase the diversity and coverage of structurally correct SQL references, we enrich the ground-truth set using our largest distilled model (3B) in § IV-A. For each training question, we sample N=30N=30 candidate SQLs from the distilled model with temperature T=1.0T=1.0, using the exact same prompt format as in its SFT stage. This is important: since the distilled model has been explicitly trained to reproduce the correct SQL for these prompts, its generations are strongly anchored to the gold logical structure and typically remain highly similar to the ground-truth query. The observed diversity when decoding multiple candidates at T=1.0T=1.0 mainly stems from the distillation setup itself: during distillation, a single prompt is paired with multiple teacher-produced completions (i.e., different reasoning traces and SQL) coming from diverse teachers. As a result, sampling N=30N=30 completions naturally yields multiple stylistic variants in the thinking–SQL output (e.g., aliasing, join ordering, or equivalent predicate phrasing) while preserving the underlying semantics required to answer the question. We then execute each candidate on the corresponding database and retain only those whose denotation matches the gold query, adding them to the reference pool g1,…,gN′\g_1,…,g_N \ together with the original gold SQL. A potential concern is spurious correctness under empty execution result: if the gold SQL yields an empty result set, a degenerate “hack” query such as WHERE 1=0 could also return the same empty output and might be mistakenly added to the reference pool. In our setting, however, such hacks are unlikely to appear unless the training instance itself is mislabeled, because the distilled model is trained with the same prompts to reproduce the gold SQL and thus tends to generate queries that remain structurally close to the ground truth rather than collapsing to vacuous predicates. Empirically, the risk of reinforcing spurious structures is minimal: on the BIRD training set, 670/9,428670/9,428 samples (7.1%) produce empty gold results, yet the execution-verified candidates we retain still exhibit high structural overlap with the corresponding gold SQL. Additionally, in a manual audit of 100 additional non-empty cases, we did not observe hack-like patterns; the main discrepancy was SELECT versus SELECT DISTINCT, which is consistent with known labeling noise in NL2SQL training data [81]. Finally, since the atomic reward is computed as the maximum similarity over the reference pool (which always includes the gold SQL), enrichment primarily reduces false mismatches due to syntactic variations without encouraging semantically incorrect SQL. V Empirical Evaluation In this section, we conduct experiments with the aim of answering the following research questions: (RQ1) Does FINER-SQL improve execution accuracy of small language models over existing baselines? (§ V-B) (RQ2) How efficient is FINER-SQL in memory usage and inference time compared with existing methods? (§ V-C) (RQ3) How sensitive is model performance to hyperparameters such as temperature and candidate number? (§ V-D) (RQ4) How does reinforcement learning with dense rewards improve SQL accuracy over training steps? (§ V-E) (RQ5) How do different reward components (atomic, memory) contribute to the overall model performance? (§ V-F) (RQ6) How well does FINER-SQL handle SQL queries of varying complexity levels? (§ V-G) (RQ7) How does the reasoning evolve after reinforcement learning training? (§ V-H) V-A Experimental Setup Database. We rely on two popular Text-to-SQL benchmarks: Spider [7] and BIRD [8, 82, 83, 84]. Spider is a popular benchmark for NL2SQL translation, consisting of 200 databases with multiple tables that cover 138 diverse domains. Spider contains 7000 samples in a training set, a development set with 1024 samples, and a test set. BIRD contains 95 databases, cumulatively accounting for 33.4GB across 37 professional domains. BIRD contains 9428 samples in training set, a development set with 1534 samples and a hidden test set. BIRD is more challenging, with each of BIRD’s databases containing around 549K rows on average, compared to Spider’s limited capacity of just 2k rows. Also, BIRD offers evidence for a specific sample to facilitate the generation of the right SQL query. Evaluation Metrics. We evaluate model performance using Execution Accuracy (EX) and Pass@K [85, 86, 87]. EX measures whether the predicted SQL produces the same execution result as the ground truth, serving as the primary indicator of correctness. Pass@K captures the likelihood that at least one of the top-K generated SQL candidates executes correctly, which is particularly important for selection-based Text-to-SQL systems (e.g. CHASE-SQL [11], Reasoning-SQL [76]), as a correct query among top-K candidates can potentially be identified by an effective selection or ranking algorithm. Baselines. We compare FINER-SQL against a wide range of Text-to-SQL systems, including closed-source API-based methods and open-source fine-tuned models. Although recent approaches such as OmniSQL [88] and Arctic-Text-to-SQL-R1 [31] leverage large-scale synthetic corpora (e.g., SynSQL-2.5M [88], Gretel-Synth [89]), these introduce new schemas and question formulations that differ substantially from Spider and BIRD. To ensure fair, controlled comparisons that isolate training algorithms rather than data volume, we evaluate only methods trained on Spider and BIRD databases. Closed-source API-based Methods. DIN-SQL [90] decomposes complex questions into schema linking, query classification, and self-correction before SQL synthesis. DAIL-SQL [91] combines prompt engineering with lightweight fine-tuning, selecting demonstrations by question-query similarity. MAC-SQL [92] adopts a multi-agent framework where Decomposer, Selector, and Refiner iteratively improve SQL generation. SuperSQL [66] performs automated architecture search across schema linking, prompting, and post-processing with execution-based revision. MCS-SQL [93] uses multiple prompt templates and a multiple-choice selector to improve validity, while CHESS [10] and CHASE-SQL [11] employ modular, multi-path reasoning pipelines with large models to refine SQL candidates. Open-source Fine-tuning Methods. T5-3B + PICARD [48] enforces syntactic validity via constrained decoding. CodeS [9] incrementally pretrains open-source models (1B–15B) on curated NL2SQL data to improve structural robustness. SFT Llama2 [8] provides a supervised fine-tuning baseline without reinforcement signals. Alpha-SQL [75] combines MCTS with LLM reasoning for zero-shot SQL generation. CHESS (open-source)[10] adapts its modular framework to open-source LLMs, while Reasoning-SQL[76] introduces SQL-specific partial rewards for RL. SQL-R1 [94] uses coarse reward signals without fine-grained structural feedback, and ExCoT [32] applies iterative preference optimization guided by execution. TABLE I: Comparison of Text-to-SQL methods on BIRD and Spider Dev. Methods BIRD Dev EX% Spider Dev EX% Proprietary Models (>> 70B) DIN-SQL + GPT-4 50.72 82.8 DAIL-SQL + GPT-4 54.76 83.1 MAC-SQL + GPT-4 59.59 86.8 SuperSQL + GPT-4 58.50 87.0 MCS-SQL + GPT-4 63.36 86.8 CHESS + GPT-4 65.00 – CHASE-SQL + Gemini 1.5 73.01 – Open-source Models (>> 5B parameters) SFT Llama2-7B 45.37 77.8 SFT Llama2-13B 53.91 81.6 CodeS-7B 57.17 85.4 CodeS-15B 58.47 84.9 CHESS (open-source, 33B+70B) 59.86 – Alpha-SQL 7B 66.80 84.0 Alpha-SQL 14B 68.70 87.0 Alpha-SQL 32B 69.70 – ExCoT 70B 68.51 – Reasoning-SQL 7B 64.01 78.7 Reasoning-SQL 14B 65.31 81.4 SQL-R1 7B 63.10 84.5 SQL-R1 14B 67.10 86.7 Open-source Models (≤ 5B parameters) Fine-tuned T5-3B + PICARD 23.34 79.3 CodeS-1B 50.46 77.9 CodeS-3B 55.02 83.4 Reasoning-SQL 3B 58.67 – SQL-R1 3B 54.6 78.1 FINER-SQL 0.5B (Ours) 50.85 70.2 FINER-SQL 1.5B (Ours) 63.17 80.0 FINER-SQL 3B (Ours) 67.73 85.0 Setup. We train three policy models—Qwen2.5-Coder-0.5B, 1.5B, and 3B—using GRPO on two NVIDIA A6000 GPUs (48 GB each). All models are trained in bfloat16 precision with Flash Attention [95] for efficiency. For supervised fine-tuning, the model is trained for two epochs on the reasoning bank in § IV-A, with a learning rate of 2×10−52× 10^-5. For GRPO training, the number of rollouts per sample is 32, the learning rate is 8×10−68× 10^-6, and the global batch size is 32. For the memory reward, we set the number of retrieved reasoning traces 20. With this configuration, the total training time including supervised finetuning and reinforcement learning takes less than 2 days for a 3B model and much faster for 1.5B and 0.5B. During inference, FINER-SQL follows a lightweight three-stage pipeline comprising schema filtering → SQL candidate generation → majority voting. This setup is also adopted in many recent systems such as CHESS, CHASE-SQL, and SQL-R1. For schema filtering, we employ our prior work GRAST-SQL 0.6B 111https://huggingface.co/griffith-bigdata/GRAST-SQL-0.6B-BIRD-Reranker, a schema ranking model that retrieves the top-30 most relevant columns for each query. Unless otherwise specified, all main experiments for accuracy and performance comparison generate 30 SQL candidates per question. TABLE I: Inference efficiency and deployment cost comparison of Text-to-SQL models on BIRD Dev. Model Latency(s) DType Min. VRAM (GB) Compute Setup (GPU Memory) Closed-Source API-Based Methods DIN-SQL + GPT-4 24.09 – – OpenAI-based MAC-SQL + GPT-4 24.64 – – OpenAI-based CHESS(IR,S,CG) 118.61 – – OpenAI-based CHESS(IR,CG,UT) 156.50 – – OpenAI-based Open-Source Fine-Tuned Models Alpha-SQL 7B 1650.00 bf16 ∼ 22 2×46 GB L40S Alpha-SQL 14B 1802.00 bf16 ∼ 38 2×46 GB L40S Alpha-SQL 32B 2512.00 bf16 ∼ 80 4×46 GB L40S CodeS-1B 0.69 fp32 ∼ 3 1×24 GB A5000 CodeS-3B 1.06 fp32 ∼ 8 1×24 GB A5000 CodeS-7B 1.87 fp32 ∼ 17 1×24 GB A5000 CodeS-15B 3.52 fp32 ∼ 27 1×48 GB A6000 Ours: FINER-SQL FINER-SQL 0.5B 2.60 bf16 ∼ 3 1×24 GB A5000 FINER-SQL 1.5B 3.25 bf16 ∼ 6 1×24 GB A5000 FINER-SQL 3B 5.57 bf16 ∼ 10 1×24 GB A5000 V-B End-to-end Comparison Table I presents the execution accuracy (EX%) of FINER-SQL compared with recent Text-to-SQL systems on the BIRD and Spider development sets. Despite its small parameter scale, FINER-SQL consistently achieves accuracy competitive with or superior to much larger models across both benchmarks. On the BIRD benchmark, FINER-SQL 3B reaches 67.73% EX, surpassing CodeS-15B (58.47%), CHESS (33B+70B, 59.86%), and Reasoning-SQL 14B (65.31%), while remaining comparable to Alpha-SQL 14B (68.70%) and SQL-R1 14B (67.10%), both of which are over four times larger. The 1.5B variant of FINER-SQL achieves 63.17% EX, outperforming CodeS-7B (57.17%) and MAC-SQL (59.59%) even though these use larger or proprietary backbones. On the Spider benchmark, FINER-SQL 3B attains 85.0% EX, comparable to CodeS-15B (84.9%), SQL-R1 7B (84.5%), and Alpha-SQL 7B (84.0%), and approaching the best-performing 14B-32B models (86–87%). These results demonstrate that our fine-grained execution feedback and dense reward optimization effectively enable small models to close the gap with large-scale systems in both reasoning accuracy and generalization. Overall, FINER-SQL substantially reduces the dependency on massive model sizes or proprietary APIs. With maximum at 3B parameters, it achieves performance on par with or beyond many 14B-70B open-source models, confirming that fine-grained execution and structural feedback provide a cost-efficient path to high Text-to-SQL accuracy. V-C Performance Evaluation Table I presents the inference latency and deployment cost of Text-to-SQL models evaluated on the BIRD Dev. We compare three system categories: closed-source API-based methods, (i) open-source fine-tuned models, and (i) our proposed FINER-SQL family. All open-source systems are deployed using vLLM [96], where the minimum VRAM required for serving LLMs can be estimated as the sum of model parameters, KV cache, and minor ephemeral memory: VRAMserve≈VRAMmodel+VRAMKV-cache+VRAMothers.VRAM_serve\;≈\;VRAM_model\;+\;VRAM_KV-cache\;+\;VRAM_others. with KV-cache scaling linearly with context length (e.g., 40K tokens in Alpha-SQL greatly increase memory use). While large models such as Alpha-SQL 14B and Alpha-SQL 32B achieve slightly higher execution accuracy (Table I), they incur prohibitive inference latency (1800-2500s/sample) and memory costs (up to ∼ 80GB VRAM). In contrast, FINER-SQL 3B attains comparable accuracy with much lower overhead (5.57s/sample, ∼ 10GB VRAM). Proprietary pipelines such as CHESS remain competitive in accuracy but suffer from multi-stage inference latency exceeding 100s/sample due to sequential API calls [10, 20], making them unsuitable for latency-sensitive or on-premise settings. Importantly, the compact memory footprint of FINER-SQL enables deployment on cost-effective GPUs. The 3B-parameter variant can operate comfortably on widely available and affordable consumer GPUs, such as the NVIDIA RTX 5070 (12 GB), RTX 4090 or A5000 (24 GB), without requiring specialized server-grade hardware. This substantially lowers the barrier to real-world adoption compared to large-scale models requiring multi-GPU racks or proprietary API. Overall, these results show that FINER-SQL achieves a strong balance between accuracy, latency, and cost, enabling practical Text-to-SQL deployment on commodity hardware. Note that this analysis includes only models with public implementations; methods such as CHASE-SQL [11] and SQL-R1 [94] lack open-source code, preventing fair measurement of inference time under comparable settings. Figure 6: FINER-SQL Pass@K and EX% on BIRD Dev under different numbers of candidates (left) and sampling temperatures (right). (a) 0.5B (b) 1.5B (c) 3B Figure 7: Accuracy–latency trade-off of candidate selection for FINER-SQL (left-to-right: 0.5B, 1.5B, 3B). The blue curve denotes EX%, the red curve denotes end-to-end average latency per query, and the yellow curve denotes execution-only latency. V-D Hyperparameter Sensitivity Number of candidates. We analyze the impact of the number of sampled SQL candidates n on inference performance, as shown in Fig. 6 (left). Increasing n from 1 to 50 consistently improves both Pass@K and EX% across all FINER models, but the gain saturates beyond 30 candidates. The smallest model (0.5B) benefits the most, rising from 35% to nearly 49% EX, indicating that stochastic sampling and majority voting effectively compensate for limited capacity. Larger models (1.5B and 3B) exhibit higher initial accuracy and more stable convergence, reaching around 82% Pass@K and 68% EX at n=50n=50. These findings demonstrate that moderate candidate sampling provides an efficient trade-off between performance gains and computational cost during inference. We show the accuracy versus latency trade-off in Fig. 7. As the number of candidates increases, EX% (blue) improves steadily, but it comes with the increasing in end-to-end latency (red) and SQL execution latency. Across model scales, n in the range of 20–30 provides the best operating point, balance between accuracy and latency. This analysis guides the choice of n in interactive settings, noting that absolute execution time depends on database and SQL complexity. Temperature for candidate generation. We further analyze the impact of sampling temperature on SQL diversity and execution accuracy. As illustrated in Fig. 6 (right), raising the temperature from 0 to 1.0 consistently enhances both Pass@K and EX% across all model sizes. Higher temperatures encourage exploration of diverse reasoning and SQL structures, which leads to more correct candidates under majority voting. The smallest model (0.5B) shows the strongest improvement, with EX increasing from 35% at greedy decoding to nearly 49% at temperature 1.0. Larger models (1.5B and 3B) also benefit moderately, stabilizing around 60-68% EX. Overall, the best configuration is achieved at temperature 1.0 with 50 sampled candidates, showing that moderate stochastic sampling effectively balances exploration and accuracy. Figure 8: Sensitivity of memory retrieval top-k on BIRD Dev EX% with three retrieval scopes: Cross-DB (retrieving only from other databases), Same-only (retrieval only from current database), and Mixed (query from all databases). Memory configuration. Fig. 8 analyzes the effect of memory configuration by varying #retrieved reasoning traces (k) and the retrieval scope. Across all model sizes, increasing k yields modest gains that saturate around k∈10,20k∈\10,20\, while Cross-DB retrieval consistently achieves the highest EX% in the high-k regime. By excluding the querying database, Cross-DB retrieval enables access to more diverse reasoning traces from different databases. In contrast, in the Mixed setting, retrieval is often dominated by traces from the same database due to strong surface-level entity overlap, causing behavior and performance close to the Same-only setting. These results indicate that cross-database diversity is crucial for effective memory-based supervision, taking its centroid embedding allows transfer the reasoning patterns to SLMs. Figure 9: Sensitivity of the shaping function in Atomic Reward under four settings. The legend reports EX on BIRD Dev for 0.5B/3B as EX0.5B/EX3B. Atomic Shaping Function Sensitivity. We analyze the sensitivity of the atomic-op shaping function φ(x)=λx+(1−λ)βxγ (x)=λ\,x+(1-λ)β x^γ as introduced in § IV-D. Our design objective is to allocate relatively higher reward to low-overlap candidates (larger φ(x) (x) when x≈0x\!≈\!0) while preventing reward saturation for near-perfect matches by controlling the endpoint φ(1) (1) (smaller φ(x) (x) when x≈1x\!≈\!1). To keep the sweep compact, we select four representative settings by inspecting the geometry of φ(x) (x) and covering both endpoint caps and concavity: S1 (λ=0.15,β=1.0,γ=0.35)(λ=0.15,β=1.0,γ=0.35), S2 (λ=0.30,β=0.85,γ=0.55)(λ=0.30,β=0.85,γ=0.55), S3 (λ=0.05,β=0.79,γ=0.20)(λ=0.05,β=0.79,γ=0.20), and S4 (λ=0.60,β=0.50,γ=0.98)(λ=0.60,β=0.50,γ=0.98) which is near linear. Fig. 9 visualizes the resulting shaping curves, and the legend reports the corresponding execution accuracy on BIRD Dev for 0.5B and 3B (EX0.5B/EX3B). S3 and S4 achieve the best EX across both 0.5B and 3B models, and both share a capped endpoint φ(1)≈0.8 (1)≈ 0.8, which suppresses the reward for near-perfect atomic overlap when execution is not fully correct. Notably, S3 assigns much higher reward near Jaccard score near 0 and yields the strongest gains on the 0.5B model, reinforcing our design choice to boost low-overlap candidates while suppressing Jaccard score near 1. V-E Performance Gains through GRPO Training Steps We analyze the impact of GRPO optimization over successive training steps, as illustrated in Fig. 10. The curves report Pass@K and EX% on BIRD Dev, where step 0 corresponds to the supervised fine-tuned baseline and subsequent points reflect progressive policy updates guided by dense execution feedback. All models exhibit consistent improvement, confirming that GRPO effectively refines reasoning and SQL generation through iterative interaction with the environment. The 0.5B model gains the most, improving from 55.9% to 66.3% Pass@K and from 42.9% to 49.3% EX after 2000 steps. Larger models (1.5B and 3B) also show steady improvements, with the 1.5B model rising from 75.3%/59.4% to 80.1%/63.1% and the 3B model from 78.3%/63.4% to 81.6%/67.7% (Pass@K/EX). These results highlight that GRPO enables stable and monotonic performance gains across different model scales, with smaller models benefiting the most from fine-grained execution feedback. Figure 10: Performance improvement of Pass@K and EX on BIRD Dev across GRPO training steps. Step 0 represents the supervised fine-tuning baseline. Figure 11: Ablation of reward components. Left: Δ % when removing each reward. Right: syntax error rate when removing reward components. V-F Ablation Study Impact of Reward Components We evaluate the contribution of the memory and atomic rewards by removing them individually or jointly during GRPO training. As shown in Fig. 11, excluding either reward leads to a clear drop in EX% and a rise in syntax error rates across all model sizes. For the 0.5B model, removing the memory reward decreases EX by 1.79% and raises syntax errors from 19.6% to 31.5%, while removing the atomic reward causes a similar 1.92% EX drop. For the 3B model, removing the memory or atomic reward reduces EX by 2.22% and 3.26%, respectively, with syntax errors increasing from 6.0% to about 10%. When both rewards are removed, degradation becomes most severe (-2.97%, -2.16%, and -4.44% EX for 0.5B, 1.5B, and 3B), confirming their complementary effects. Removing the memory reward causes higher syntax error rates, as the model explores unstable reasoning paths that lead to invalid or unexecutable SQLs. Eliminating both rewards further lowers EX due to the sparse reward problem—when failures yield zero feedback, the model stops improving over time. Overall, the memory reward stabilizes reasoning and reduces invalid SQLs, while the atomic reward enforces operation-level structural correctness. Together, they provide fine-grained signals that guide learning and enable the model to improve even when the generated SQL is incorrect. TABLE IV: Reasoning Stability Analysis: No Memory vs. With Memory. Metrics FINER-SQL 0.5B FINER-SQL 1.5B FINER-SQL 3B w/o Mem w/ Mem w/o Mem w/ Mem w/o Mem w/ Mem EX (%) 46.28 50.85 61.21 63.17 65.38 67.73 Self-BLEU 0.674 0.724 0.607 0.631 0.584 0.615 Mean Exec. Groups 8.07 5.59 7.16 6.25 6.21 5.27 Figure 12: EX% by SQL complexity on BIRD Dev, showing FINER-SQL (1.5B-3B) stay competitive on challenging queries. Analysis of Reasoning Stability Given each prompt, we sample K=30K=30 candidate reasoning traces and their corresponding SQL queries. We quantify the diversity of the reasoning texts using Self-BLEU [97], where each trace is treated as the hypothesis and the remaining K−1K-1 traces serve as references; thus, a higher Self-BLEU indicates lower diversity. Table IV shows that enabling memory consistently increases Self-BLEU, meaning the model produces less diverse reasoning across candidates. This reduced reasoning variance propagates to the generated SQL, yielding fewer distinct execution results (lower mean execution groups), which is beneficial for majority voting: when candidates concentrate into fewer execution clusters, votes are less fragmented and the correct execution is more likely to win. For instance, at 0.5B, memory raises Self-BLEU from 0.674 to 0.724 while reducing mean execution groups from 8.07 to 5.59, improving execution accuracy from 46.28% to 50.85%. V-G Evaluation on SQL Complexity To examine how model scale and our reward design influence reasoning robustness, we analyze performance across three SQL complexity levels – simple, moderate, and challenging on the BIRD Dev. Fig. 12 presents results for all competing systems. Despite relying on SLMs, FINER-SQL maintains strong and consistent performance as query complexity increases. The 3B variant reaches 67.7% EX, closely approaching Alpha-SQL 32B and surpassing Alpha-SQL 7B. Meanwhile, the 1.5B model achieves 56.0% EX on moderate and 49.0% EX on challenging queries—outperforming DAIL-SQL and SuperSQL with GPT-4. We further observe that RL is a key driver of this robustness. Comparing FINER-SQL 3B against its No RL counterpart, RL consistently improves execution accuracy across all complexity levels: 74.16 vs. 70.49 on simple, 58.41 vs. 53.66 on moderate, and 54.48 vs. 49.66 on challenging. These results also suggest that methodology can outweigh raw model scale: even when using SLMs, FINER-SQL can handle complex reasoning and compositional SQL generation effectively, and can rival or exceed much larger or GPT-4-assisted baselines. Figure 13: The reasoning-length distributions before and after RL across query difficulties. Our RL framework leads to more concise reasoning traces. Example of reasoning before RL: 7.8K characters & incorrect First, the user wants: ”list the lowest three eligible free rates for students aged 5-17 in continuation schools.” From the schema, the eligible free rate is in frpm.‘Percent (%) Eligible Free (Ages 5-17)‘. The condition ”continuation schools” refers to School Type = ’Continuation High Schools’. External knowledge says: eligible free rate = Free Meal Count (Ages 5-17) / Enrollment (Ages 5-17). I should check which column represents that ratio… it may already exist as a computed field. … Maybe I need to join with schools to confirm the school type or use frpm.School Type. To be accurate, I should select from frpm where School Type = ’Continuation High Schools’, order by the eligible free rate ascending, and limit to 3 results. Example of reasoning after RL: concise & correct SQL We need the three lowest eligible free rates for students under 18, defined by frpm.‘Free Meal Count (Ages 5-17)‘ / frpm.‘Enrollment (Ages 5-17)‘ for schools where frpm.‘School Type‘ is ”Continuation High Schools”. Return rates. Note we must compute the rate even if there are nulls: SQL will ignore them. Order by rate ascending, limit 3. Use explicit CTE or subquery for clarity. Return only the rate. V-H Reasoning Evolves under RL To assess how FINER-SQL shapes reasoning behavior, we compare the 3B model before and after RL training. Fig. 13 shows reasoning-length distributions across query difficulties. Before RL, the model produces long, inconsistent chains (Simple: 2.38K, Moderate: 2.93K, Challenging: 3.49K on average, many exceeding 8K), reflecting redundant exploration and schema confusion that often fails to converge. After RL, reasoning is substantially shorter and more stable (Simple: 0.57K, Moderate: 0.74K, Challenging: 0.85K), indicating a shift toward concise, goal-oriented reasoning that yields correct SQL. A representative case from the california_schools database highlights this shift. Before RL (7.8K characters), the model redundantly restates schema elements, explores irrelevant joins, and fails to produce a correct query. After RL (0.7K characters), it quickly identifies relevant tables and fields, applies the correct expression and filter, and completes the SQL concisely. VI Conclusion We presented FINER-SQL, a reinforcement learning framework that boosts small language models for Text-to-SQL through fine-grained execution feedback and cost-efficient rewards. With dense and interpretable signals (memory and atomic rewards), FINER-SQL turns sparse supervision into continuous guidance, enabling stable GRPO optimization even when SQL fails. Experiments on Spider and BIRD show that 1.5B-3B models trained with our method achieve competitive execution accuracy with 14B-70B models at a fraction of the cost, offering a practical path for efficient and privacy-preserving Text-to-SQL deployment. References [1] B. Wang, R. Shin, X. Liu, O. Polozov, and M. Richardson, “Rat-sql: Relation-aware schema encoding and linking for text-to-sql parsers,” in ACL, 2020, p. 7567–7578. [2] S. Chang, J. Wang, M. Dong, L. Pan, H. Zhu et al., “Dr.spider: A diagnostic evaluation benchmark towards text-to-SQL robustness,” in ICLR, 2023. [3] Y. Gan, X. Chen, and M. Purver, “Exploring underexplored limitations of cross-domain text-to-SQL generalization,” in EMNLP, 2021, p. 8926–8931. [4] N. Q. V. Hung, M. Weidlich, N. T. Tam, Z. Miklós, K. Aberer, A. Gal, and B. Stantic, “Handling probabilistic integrity constraints in pay-as-you-go reconciliation of data models,” Information Systems, vol. 83, p. 166–180, 2019. [5] M. H. Nguyen, T. T. Nguyen, J. Jo, D. A. Nguyen, H. Yin, and Q. V. H. Nguyen, “Handling data sparsity and model poisoning attacks in federated sequential recommender systems,” Knowledge-Based Systems, p. 115545, 2026. [6] T. T. Nguyen, T. T. Nguyen, M. Weidlich, J. Jo, Q. V. H. Nguyen, H. Yin, and A. W.-C. Liew, “Handling low homophily in recommender systems with partitioned graph transformer,” IEEE Transactions on Knowledge and Data Engineering, 2024. [7] T. Yu, R. Zhang, K. Yang, M. Yasunaga, D. Wang, Z. Li, J. Ma, I. Li, Q. Yao, S. Roman, Z. Zhang, and D. Radev, “Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task,” in EMNLP, 2018, p. 3911–3921. [8] J. Li, B. Hui, G. Qu, J. Yang, B. Li, B. Li, B. Wang, B. Qin, R. Geng, N. Huo et al., “Can llm already serve as a database interface? a big bench for large-scale database grounded text-to-sqls,” NeurIPS, vol. 36, 2024. [9] H. Li, J. Zhang, H. Liu, J. Fan, X. Zhang, J. Zhu, R. Wei, H. Pan, C. Li, and H. Chen, “Codes: Towards building open-source language models for text-to-sql,” SIGMOD, vol. 2, no. 3, p. 1–28, 2024. [10] S. Talaei, M. Pourreza, Y.-C. Chang, A. Mirhoseini, and A. Saberi, “Chess: Contextual harnessing for efficient sql synthesis,” arXiv preprint arXiv:2405.16755, 2024. [11] M. Pourreza, H. Li, R. Sun, Y. Chung, S. Talaei, G. T. Kakkar, Y. Gan, A. Saberi, F. Ozcan, and S. O. Arik, “Chase-sql: Multi-path reasoning and preference optimized candidate selection in text-to-sql,” arXiv preprint arXiv:2410.01943, 2025. [12] K. T. Pham, T. T. Nguyen, V. Huynh, H. Yin, and Q. V. H. Nguyen, “An efficient and effective evaluator for text2sql models on unseen and unlabeled data,” in 2026 IEEE 42nd International Conference on Data Engineering (ICDE). IEEE, 2026. [13] Z. Ren, T. T. Nguyen, and W. Nejdl, “Prototype learning for interpretable respiratory sound analysis,” in Proc. ICASSP, 2022, p. 9087–9091. [14] M. T. Pham, T. T. Huynh, T. T. Nguyen, T. T. Nguyen, T. T. Nguyen, J. Jo, H. Yin, and Q. V. Hung Nguyen, “A dual benchmarking study of facial forgery and facial forensics,” CAAI Transactions on Intelligence Technology, vol. 9, no. 6, p. 1377–1397, 2024. [15] S. Abedini, S. Mohapatra, D. Emerson, M. Shafieinejad, J. C. Cresswell, and X. He, “Masksql: Safeguarding privacy for llm-based text-to-sql via abstraction,” arXiv preprint arXiv:2509.23459, 2025. [16] Z. Hui, Y. R. Dong, S. Sivapiromrat, E. Shareghi, and N. Collier, “Privacypad: A reinforcement learning framework for dynamic privacy-aware delegation,” arXiv preprint arXiv:2510.16054, 2025. [17] T. T. Nguyen, T. T. Huynh, Z. Ren, T. T. Nguyen, P. L. Nguyen, H. Yin, and Q. V. H. Nguyen, “Privacy-preserving explainable ai: a survey,” Science China Information Sciences, vol. 68, no. 1, p. 111101, 2025. [18] T. Nguyen Thanh, N. D. K. Quach, T. T. Nguyen, T. T. Huynh, V. H. Vu, P. L. Nguyen, J. Jo, and Q. V. H. Nguyen, “Poisoning gnn-based recommender systems with generative surrogate-based attacks,” ACM Transactions on Information Systems, vol. 41, no. 3, p. 1–24, 2023. [19] T. T. Nguyen, T. T. Huynh, H. Yin, M. Weidlich, T. T. Nguyen, T. S. Mai, and Q. V. H. Nguyen, “Detecting rumours with latency guarantees using massive streaming data,” The VLDB Journal, vol. 32, no. 2, p. 369–387, 2023. [20] Y. Chung, G. T. Kakkar, Y. Gan, B. Milne, and F. Ozcan, “Is long context all you need? leveraging llm’s extended context for NL2SQL,” PVLDB, vol. 18, no. 8, p. 2735–2747, 2025. [21] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. Rozière, N. Goyal, E. Hambro, F. Azhar et al., “Llama: Open and efficient foundation language models,” arXiv preprint arXiv:2302.13971, 2023. [22] A. Q. Jiang, A. Sablayrolles, A. Mensch et al., “Mistral 7b,” arXiv preprint arXiv:2310.06825, 2023. [23] T. T. Huynh, M. H. Nguyen, T. T. Nguyen, P. L. Nguyen, M. Weidlich, Q. V. H. Nguyen, and K. Aberer, “Efficient integration of multi-order dynamics and internal dynamics in stock movement prediction,” in Proceedings of the Sixteenth ACM International Conference on Web Search and Data Mining, 2023, p. 850–858. [24] C. T. Duong, T. T. Nguyen, H. Yin, M. Weidlich, T. S. Mai, K. Aberer, and Q. V. H. Nguyen, “Efficient and effective multi-modal queries through heterogeneous network embedding,” IEEE Transactions on Knowledge and Data Engineering, vol. 34, no. 11, p. 5307–5320, 2022. [25] T. T. Nguyen, Z. Ren, T. T. Nguyen, J. Jo, Q. V. H. Nguyen, and H. Yin, “Portable graph-based rumour detection against multi-modal heterophily,” Knowledge-Based Systems, vol. 284, p. 111310, 2024. [26] T. T. Nguyen, N. Quoc Viet Hung, T. T. Nguyen, T. T. Huynh, T. T. Nguyen, M. Weidlich, and H. Yin, “Manipulating recommender systems: A survey of poisoning attacks and countermeasures,” ACM Computing Surveys, vol. 57, no. 1, p. 1–39, 2024. [27] Q. V. H. Nguyen, T. T. Nguyen, V. T. Chau, T. K. Wijaya, Z. Miklós, K. Aberer, A. Gal, and M. Weidlich, “Smart: A tool for analyzing and reconciling schema matching networks,” in ICDE, 2015, p. 1488–1491. [28] Q. V. H. Nguyen, S. T. Do, T. T. Nguyen, and K. Aberer, “Tag-based paper retrieval: minimizing user effort with diversity awareness,” in International Conference on Database Systems for Advanced Applications, 2015, p. 510–528. [29] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, “Proximal policy optimization algorithms,” arXiv preprint arXiv:1707.06347, 2017. [30] Z. Shao, P. Wang, Q. Zhu, R. Xu, J. Song, X. Bi, H. Zhang, M. Zhang, Y. Li, Y. Wu et al., “Deepseekmath: Pushing the limits of mathematical reasoning in open language models,” arXiv preprint arXiv:2402.03300, 2024. [31] Z. Yao, G. Sun, L. Borchmann, Z. Shen, M. Deng, B. Zhai, H. Zhang, A. Li, and Y. He, “Arctic-text2sql-r1: Simple rewards, strong reasoning in text-to-sql,” arXiv preprint arXiv:2505.20315, 2025. [32] B. Zhai, C. Xu, Y. He, and Z. Yao, “Excot: Optimizing reasoning for text-to-sql with execution feedback,” arXiv preprint arXiv:2503.19988, 2025. [33] T. T. Nguyen, T. C. Phan, M. H. Nguyen, M. Weidlich, H. Yin, J. Jo, and Q. V. H. Nguyen, “Model-agnostic and diverse explanations for streaming rumour graphs,” Knowledge-Based Systems, vol. 253, p. 109438, 2022. [34] C. T. Duong, T. T. Nguyen, T.-D. Hoang, H. Yin, M. Weidlich, and Q. V. H. Nguyen, “Deep mincut: Learning node embeddings from detecting communities,” Pattern Recognition, p. 109126, 2022. [35] T. D. Hoang, T. T. Huynh, M. Weidlich, T. T. Nguyen, T. Chen, H. Yin, and Q. V. H. Nguyen, “Boosting small language models for text-to-sql with fine-grained execution feedback and cost-efficient rewards,” in ICDE. IEEE, 2026. [36] D. Guo, D. Yang, H. Zhang, J. Song, R. Zhang, R. Xu, Q. Zhu, S. Ma, P. Wang, X. Bi et al., “Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning,” arXiv preprint arXiv:2501.12948, 2025. [37] Y. Bai, A. Jones, K. Ndousse, A. Askell, A. Chen, N. DasSarma, D. Drain, S. Fort, D. Ganguli, T. Henighan et al., “Training a helpful and harmless assistant with reinforcement learning from human feedback,” arXiv preprint arXiv:2204.05862, 2022. [38] Q. V. H. Nguyen, T. Nguyen Thanh, Z. Miklós, and K. Aberer, “Reconciling schema matching networks through crowdsourcing,” EAI Endorsed Transactions on Collaborative Computing, vol. 1, no. 2, p. e2, 2014. [39] T. T. Nguyen, T. T. Nguyen, T. H. Nguyen, H. Yin, T. T. Nguyen, J. Jo, and Q. V. H. Nguyen, “Isomorphic graph embedding for progressive maximal frequent subgraph mining,” ACM Transactions on Intelligent Systems and Technology, vol. 15, no. 1, p. 1–26, 2023. [40] R. Rafailov, A. Sharma, E. Mitchell, C. D. Manning, S. Ermon, and C. Finn, “Direct preference optimization: Your language model is secretly a reward model,” NeurIPS, vol. 36, p. 53 728–53 741, 2023. [41] J. Hong, N. Lee, and J. Thorne, “Orpo: Monolithic preference optimization without reference model,” in EMNLP, 2024, p. 11 170–11 189. [42] T. T. Huynh, T. B. Nguyen, P. L. Nguyen, T. T. Nguyen, M. Weidlich, Q. V. H. Nguyen, and K. Aberer, “Fast-fedul: A training-free federated unlearning with provable skew resilience,” in Joint European Conference on Machine Learning and Knowledge Discovery in Databases. Springer, 2024, p. 55–72. [43] B. Zhao, H. van der Aa, T. T. Nguyen, Q. V. H. Nguyen, and M. Weidlich, “Eires: Efficient integration of remote data in event stream processing,” in Proceedings of the 2021 International Conference on Management of Data, 2021, p. 2128–2141. [44] V. Zhong, C. Xiong, and R. Socher, “Seq2sql: Generating structured queries from natural language using reinforcement learning,” arXiv preprint arXiv:1709.00103, 2017. [45] X. Xu, C. Liu, and D. Song, “Sqlnet: Generating structured queries from natural language without reinforcement learning,” arXiv preprint arXiv:1711.04436, 2017. [46] J. Guo, Z. Zhan, Y. Gao, Y. Xiao, J.-G. Lou, T. Liu, and D. Zhang, “Towards complex text-to-sql in cross-domain database with intermediate representation,” in Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, 2019, p. 4524–4535. [47] T. Yu, M. Yasunaga, K. Yang, R. Zhang, D. Wang, Z. Li, and D. Radev, “SyntaxSQLNet: Syntax tree networks for complex and cross-domain text-to-SQL task,” in EMNLP, 2018, p. 1653–1663. [48] T. Scholak, N. Schucher, and D. Bahdanau, “Picard: Parsing incrementally for constrained auto-regressive decoding from language models,” in EMNLP, 2021, p. 9895–9901. [49] D. C. Thang, N. T. Tam, N. Q. V. Hung, and K. Aberer, “An evaluation of diversification techniques,” in International Conference on Database and Expert Systems Applications, 2015, p. 215–231. [50] T. T. Nguyen, M. Weidlich, H. Yin, B. Zheng, Q. H. Nguyen, and Q. V. H. Nguyen, “Factcatch: Incremental pay-as-you-go fact checking with minimal user effort,” in Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, 2020, p. 2165–2168. [51] R. Sun, S. Ö. Arik, H. Nakhost, H. Dai, R. Sinha, P. Yin, and T. Pfister, “Sql-palm: Improved large language model adaptation for text-to-sql,” CoRR, 2023. [52] M. Pourreza and D. Rafiei, “Din-sql: Decomposed in-context learning of text-to-sql with self-correction,” 2023. [53] M. H. Nguyen, T. T. Huynh, T. T. Nguyen, P. L. Nguyen, H. T. Pham, J. Jo, and T. T. Nguyen, “On-device diagnostic recommendation with heterogeneous federated blocknets,” Science China Information Sciences, vol. 68, no. 4, p. 140102, 2025. [54] K. T. Pham, T. H. Nguyen, J. Jo, Q. V. H. Nguyen, and T. T. Nguyen, “Multilingual text-to-sql: Benchmarking the limits of language models with collaborative language agents,” in Australasian Database Conference. Springer, 2025, p. 108–123. [55] D. D. A. Nguyen, M. H. Nguyen, P. L. Nguyen, J. Jo, H. Yin, and T. T. Nguyen, “Multi-task learning of heterogeneous hypergraph representations in lbsns,” in International Conference on Advanced Data Mining and Applications. Springer, 2024, p. 161–177. [56] S. Lyu, H. Luo, R. Li, Z. Ou, J. Sun, Y. Qin, X. Shang, M. Song, and Y. Zhu, “Sql-o1: A self-reward heuristic dynamic search method for text-to-sql,” arXiv preprint arXiv:2502.11741, 2025. [57] D. C. Thang, H. T. Dat, N. T. Tam, J. Jo, N. Q. V. Hung, and K. Aberer, “Nature vs. nurture: Feature vs. structure for graph neural networks,” PRL, vol. 159, p. 46–53, 2022. [58] H. T. Trung, T. Van Vinh, N. T. Tam, J. Jo, H. Yin, and N. Q. V. Hung, “Learning holistic interactions in lbsns with high-order, dynamic, and multi-role contexts,” IEEE Transactions on Knowledge and Data Engineering, vol. 35, no. 5, p. 5002–5016, 2022. [59] T. T. Huynh, C. T. Duong, T. T. Nguyen, V. T. Van, A. Sattar, H. Yin, and Q. V. H. Nguyen, “Network alignment with holistic embeddings,” TKDE, vol. 35, no. 2, p. 1881–1894, 2021. [60] Q. V. H. Nguyen, K. Zheng, M. Weidlich, B. Zheng, H. Yin, T. T. Nguyen, and B. Stantic, “What-if analysis with conflicting goals: Recommending data ranges for exploration,” in 2018 IEEE 34th International Conference on Data Engineering (ICDE). IEEE, 2018, p. 89–100. [61] N. T. Toan, P. T. Cong, N. T. Tam, N. Q. V. Hung, and B. Stantic, “Diversifying group recommendation,” IEEE Access, vol. 6, p. 17 776–17 786, 2018. [62] N. Q. V. Hung, D. C. Thang, N. T. Tam, M. Weidlich, K. Aberer, H. Yin, and X. Zhou, “Answer validation for generic crowdsourcing tasks with minimal efforts,” The VLDB Journal, vol. 26, p. 855–880, 2017. [63] Q. V. H. Nguyen, C. T. Duong, T. T. Nguyen, M. Weidlich, K. Aberer, H. Yin, and X. Zhou, “Argument discovery via crowdsourcing,” The VLDB Journal, vol. 26, no. 4, p. 511–535, 2017. [64] T. T. Nguyen, T. C. Phan, H. T. Pham, T. T. Nguyen, J. Jo, and Q. V. H. Nguyen, “Example-based explanations for streaming fraud detection on graphs,” Information Sciences, vol. 621, p. 319–340, 2023. [65] J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou et al., “Chain-of-thought prompting elicits reasoning in large language models,” NeurIPS, vol. 35, p. 24 824–24 837, 2022. [66] B. Li, Y. Luo, C. Chai, G. Li, and N. Tang, “The dawn of natural language to sql: Are we fully ready?” PVLDB, vol. 17, no. 11, p. 3318–3331, 2024. [67] R. Murthy, P. Kumar, P. Venkateswaran, and D. Contractor, “Evaluating the instruction-following abilities of language models using knowledge tasks,” arXiv preprint arXiv:2410.12972, 2024. [68] Y. Qin, K. Song, Y. Hu, W. Yao, S. Cho, X. Wang, X. Wu, F. Liu, P. Liu, and D. Yu, “InFoBench: Evaluating instruction following ability in large language models,” in ACL, 2024, p. 13 025–13 048. [69] J. Zhou, T. Lu, S. Mishra, S. Brahma, S. Basu, Y. Luan, D. Zhou, and L. Hou, “Instruction-following evaluation for large language models,” arXiv preprint arXiv:2311.07911, 2023. [70] X.-B. Nguyen, X.-H. Phan, and M. Piccardi, “Fine-tuning text-to-sql models with reinforcement-learning training objectives,” Natural Language Processing Journal, vol. 10, p. 100135, 2025. [71] H. Lightman, V. Kosaraju, Y. Burda, H. Edwards, B. Baker, T. Lee, J. Leike, J. Schulman, I. Sutskever, and K. Cobbe, “Let’s verify step by step,” in ICLR, 2024. [72] W. Yuan, R. Y. Pang, K. Cho, X. Li, S. Sukhbaatar, J. Xu, and J. E. Weston, “Self-rewarding language models,” in ICML, 2024. [73] J. Lu, Z. Dou, H. Wang, Z. Cao, J. Dai, Y. Feng, and Z. Guo, “Autopsv: Automated process-supervised verifier,” NeurIPS, vol. 37, p. 79 935–79 962, 2024. [74] P. Wang, L. Li, Z. Shao, R. Xu, D. Dai, Y. Li, D. Chen, Y. Wu, and Z. Sui, “Math-shepherd: Verify and reinforce llms step-by-step without human annotations,” in ACL, 2024, p. 9426–9439. [75] B. Li, J. Zhang, J. Fan, Y. Xu, C. Chen, N. Tang, and Y. Luo, “Alpha-sql: Zero-shot text-to-sql using monte carlo tree search,” in ICML, 2025. [76] M. Pourreza, S. Talaei, R. Sun, X. Wan, H. Li, A. Mirhoseini, A. Saberi, S. Arik et al., “Reasoning-sql: Reinforcement learning with sql tailored partial rewards for reasoning-enhanced text-to-sql,” arXiv preprint arXiv:2503.23157, 2025. [77] T. D. Hoang, T. T. Nguyen, T. T. Huynh, H. Yin, and Q. V. H. Nguyen, “Scaling text2sql via llm-efficient schema filtering with functional dependency graph rerankers,” arXiv preprint arXiv:2512.16083, 2025. [78] Y. Han, C. Liu, and P. Wang, “A comprehensive survey on vector database: Storage and retrieval technique, challenge,” arXiv preprint arXiv:2310.11703, 2023. [79] Y. Zhang, M. Li, D. Long, X. Zhang, H. Lin, B. Yang, P. Xie, A. Yang, D. Liu, J. Lin et al., “Qwen3 embedding: Advancing text embedding and reranking through foundation models,” arXiv preprint arXiv:2506.05176, 2025. [80] J. Johnson, M. Douze, and H. Jégou, “Billion-scale similarity search with gpus,” T-BD, vol. 7, no. 3, p. 535–547, 2019. [81] X. Liu, S. Shen, B. Li, N. Tang, and Y. Luo, “Nl2sql-bugs: A benchmark for detecting semantic errors in nl2sql translation,” in Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V. 2, 2025, p. 5662–5673. [82] Z. Ren, Y. Chang, T. T. Nguyen, Y. Tan, K. Qian, and B. W. Schuller, “A comprehensive survey on heart sound analysis in the deep learning era,” IEEE Computational Intelligence Magazine, vol. 19, no. 3, p. 42–57, 2024. [83] T. T. Nguyen, Z. Ren, T. Pham, P. L. Nguyen, Q. V. H. Nguyen, and H. Yin, “A review of instruction-guided image editing,” EAAI, 2026. [84] M. T. Pham, Q. V. H. Nguyen, J. Jo, and T. T. Nguyen, “An extensible benchmark for value ambiguity resolution in text-to-sql,” in Australasian Database Conference. Springer, 2025, p. 124–138. [85] T. T. Huynh, T. B. Nguyen, T. T. Nguyen, P. L. Nguyen, H. Yin, Q. V. H. Nguyen, and T. T. Nguyen, “Certified unlearning for federated recommendation,” ACM Transactions on Information Systems, 2025. [86] C. Yang, W. Yuan, L. Qu, and T. T. Nguyen, “Pdc-frs: Privacy-preserving data contribution for federated recommender system,” in International Conference on Advanced Data Mining and Applications. Springer, 2024, p. 65–79. [87] D. Sakong, V. H. Vu, T. T. Huynh, P. Le Nguyen, H. Yin, Q. V. H. Nguyen, and T. T. Nguyen, “Higher-order knowledge-enhanced recommendation with heterogeneous hypergraph multi-attention,” Information Sciences, vol. 680, p. 121165, 2024. [88] H. Li, S. Wu, X. Zhang, X. Huang, J. Zhang, F. Jiang, S. Wang, T. Zhang, J. Chen, R. Shi et al., “Omnisql: Synthesizing high-quality text-to-sql data at scale,” arXiv preprint arXiv:2503.02240, 2025. [89] Y. Meyer, M. Emadi, D. Nathawani, L. Ramaswamy, K. Boyd, M. Van Segbroeck, M. Grossman, P. Mlocek, and D. Newberry, “Synthetic-Text-To-SQL: A synthetic dataset for training language models to generate sql queries from natural language prompts,” April 2024. [Online]. Available: https://huggingface.co/datasets/gretelai/synthetic-text-to-sql [90] M. Pourreza and D. Rafiei, “Din-sql: Decomposed in-context learning of text-to-sql with self-correction,” NeurIPS, vol. 36, p. 36 339–36 348, 2023. [91] D. Gao, H. Wang, Y. Li, X. Sun, Y. Qian, B. Ding, and J. Zhou, “Text-to-sql empowered by large language models: A benchmark evaluation,” arXiv preprint arXiv:2308.15363, 2023. [92] B. Wang, C. Ren, J. Yang, X. Liang, J. Bai, Q.-W. Zhang, Z. Yan, and Z. Li, “Mac-sql: Multi-agent collaboration for text-to-sql,” arXiv preprint arXiv:2312.11242, 2023. [93] D. Lee, C. Park, J. Kim, and H. Park, “Mcs-sql: Leveraging multiple prompts and multiple-choice selection for text-to-sql generation,” in COLING, 2025, p. 337–353. [94] P. Ma, X. Zhuang, C. Xu, X. Jiang, R. Chen, and J. Guo, “Sql-r1: Training natural language to sql reasoning model by reinforcement learning,” arXiv preprint arXiv:2504.08600, 2025. [95] T. Dao, D. Fu, S. Ermon, A. Rudra, and C. Ré, “Flashattention: Fast and memory-efficient exact attention with io-awareness,” NeurIPS, vol. 35, p. 16 344–16 359, 2022. [96] W. Kwon, Z. Li, S. Zhuang, Y. Sheng, L. Zheng, C. H. Yu, J. E. Gonzalez, H. Zhang, and I. Stoica, “Efficient memory management for large language model serving with pagedattention,” in SIGOPS, 2023. [97] Y. Zhu, S. Lu, L. Zheng, J. Guo, W. Zhang, J. Wang, and Y. Yu, “Texygen: A benchmarking platform for text generation models,” in The 41st international ACM SIGIR conference on research & development in information retrieval, 2018, p. 1097–1100.