Training a 4B model to produce 81% faster query plans than Postgres
Researchers trained a 4-billion-parameter language model using supervised fine-tuning and reinforcement learning to generate PostgreSQL query plans that are 44.7% faster than Postgres's default optimizer on join-heavy queries. The approach leverages the fact that query plan quality is easily verifiable through execution time, making it well-suited for language model optimization, and demonstrates that small open-source models can be post-trained to outperform traditional database query optimizers on specific workloads.