---
title: "How we boosted SQL query accuracy by 33% with LLMs"
url: https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka
source_url: https://habr.com/en/companies/postgrespro/articles/954974/
type: article
source: "habr"
published: 2025-10-24T13:50:23.368Z
updated: 2025-10-24T13:50:57.425Z
tags: ["machine-learning", "llm", "sql", "postgresql", "reinforcement-learning"]
reading_time: 11
upvotes: 1
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How we boosted SQL query accuracy by 33% with LLMs

**[habr](https://daily.dev/sources/habr)** · 11 min read · 1 upvotes · 0 comments

## Summary

A technical deep-dive into improving LLM-based SQL query generation using reinforcement learning techniques. The team developed GGPO (Guided Grammar Policy Optimization), combining GRPO/GSPO algorithms with grammar-guided decoding to fine-tune a Qwen3-0.6B model. Training on custom PostgreSQL datasets yielded a 33% relative improvement in execution accuracy on challenging queries from the BIRD benchmark, though overall performance remained similar to the base model. The approach addresses key limitations of supervised fine-tuning for reasoning tasks by directly optimizing for execution correctness rather than token likelihood.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://habr.com/en/companies/postgrespro/articles/954974/>

## Similar posts on daily.dev

- [Your Data Model Is the Semantic Layer](https://daily.dev/posts/your-data-model-is-the-semantic-layer-ro8bktzht) · MotherDuck · 0 upvotes · 0 comments

---

Tags: [#machine-learning](https://daily.dev/tags/machine-learning), [#llm](https://daily.dev/tags/llm), [#sql](https://daily.dev/tags/sql), [#postgresql](https://daily.dev/tags/postgresql), [#reinforcement-learning](https://daily.dev/tags/reinforcement-learning)

[View this post on daily.dev](https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka)
