<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka" -->

---
title: How we boosted SQL query accuracy by 33% with LLMs
description: A technical deep-dive into improving LLM-based SQL query generation using reinforcement learning techniques. The team developed GGPO (Guided Grammar Policy...
canonical: https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How we boosted SQL query accuracy by 33% with LLMs | daily.dev
og:description: A technical deep-dive into improving LLM-based SQL query generation using reinforcement learning techniques. The team developed GGPO (Guided Grammar Policy...
og:url: https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka
og:image: https://api.daily.dev/og/posts/wRgVNPqkA.png
og:image:alt: How we boosted SQL query accuracy by 33% with LLMs
og:image:width: 1200
og:image:height: 630
og:locale: 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
- [Using LangSmith to Support Fine-tuning](https://daily.dev/posts/using-langsmith-to-support-fine-tuning-gns73hvdu) · LangChain · 0 upvotes · 0 comments
- [LLM Fine-tuning: Techniques for Adapting Language Models](https://daily.dev/posts/llm-fine-tuning-techniques-for-adapting-language-models-becy4meiz) · Daily Dose of Data Science \| Avi Chawla \| Substack · 1 upvotes · 0 comments
- [The State Of LLMs 2025: Progress, Problems, and Predictions](https://daily.dev/posts/the-state-of-llms-2025-progress-problems-and-predictions-zw1ic2d9p) · Sebastian Raschka · 177 upvotes · 1 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)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"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","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka"},"datePublished":"2025-10-24T13:50:23.368Z","dateModified":"2025-10-24T13:50:57.425Z","description":"A technical deep-dive into improving LLM-based SQL query generation using reinforcement learning techniques. The team developed GGPO (Guided Grammar Policy...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7c06dbf21a6f3108dc227a2d857839fc?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7c06dbf21a6f3108dc227a2d857839fc?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"habr","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"habr","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/habr","url":"https://daily.dev/sources/habr"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-we-boosted-sql-query-accuracy-by-33-with-llms-wrgvnpqka","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"machine-learning,llm,sql,postgresql,reinforcement-learning","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"habr","item":"https://daily.dev/sources/habr"},{"@type":"ListItem","position":3,"name":"How we boosted SQL query accuracy by 33% with LLMs"}]}
```

