| Training a 4B model to produce 81% faster query plans than Postgres(rohanbansal.com) | |
| 689 points by polyphilz 27 days ago | 143 comments | |
tl;dr: A developer post-trained a 4B parameter model (Qwen3.8-4B-Distill) using supervised fine-tuning on GPT-6 Astra trajectories plus custom GRPO reinforcement learning to generate Postgres query hints via the pg_hint_plan extension. The resulting agent achieved a 44.7% latency reduction across 113 join-heavy JOB benchmark queries, up from a baseline where the untrained model couldn't even produce valid plans for 99 of them. Key engineering work included building a low-noise Postgres measurement rig (tuning shared_buffers was critical) and designing reward signals robust to execution-time variance. | |
HN Discussion:
| |