4B Qwen tuned with SFT+RL produces 81% faster Postgres query plans for $1,200
JeremyCMorgan · x · 2026-09-22
Rohan Bansal post-trained a 4B Qwen model with SFT plus agentic RL to steer Postgres via pghintplan, achieving a 1.81x geomean speedup on the Join Order Benchmark for $1,200 all in. Code is public.
Key details:
- Join ordering is NP-hard and Postgres optimizers still leave much on the table (Leis et al. 2015 and 2025); query plan quality is trivially verifiable, making it an ideal RL reward.
- Each rollout sends a candidate strategy to Postgres, measures it against the default plan, and assigns scalar rewards by execution time.
- Raising sharedbuffers to 2GB cut phantom rewards (noise) 4x — critical for clean measurements.
More from coding & agent
- Dev builds real-time voice chess coach with new GPT-Live-1 API backed by Stockfish — OpenAIDevs · 2026-09-22
- LangChain hosts open-source decision model SemIf free for a week via LangSmith Gateway — hwchase17 · 2026-09-22
- Open-source landing-page-design skill packs intake, copy and visual system for Claude Code — GCWebDesigner · 2026-09-22
- Doe v. GitHub AI case sees a meaningful ruling on Copilot output claims — technollama · 2026-09-22
- claude-uds-bridge: An MCP Server Connecting Codex and Claude Natively — LeonKohli · 2026-09-22
- Generating responsive UIs in under 2 seconds with shadcn plus Mobbin MCP — msharmas · 2026-09-22