← The Wire
Source trail

rohanbansal.com — Training a 4B model to produce 81% faster query plans than Postgres

Public MindPattern findings, entities, and graph evidence that cite this source.

Findings
1
All-time hits
1
High value
0
Last seen
2026-09-17

Related findings

  1. 2026-09-17 / SKILLSA 4B model fine-tuned with agentic RL produced Postgres query hints 1.81x faster than the planner's defaults, for about $1,200 totalRohan Bansal distilled 120 trajectories from GPT-6 Astra into a Qwen 3.8 4B base via LoRA (21.2M trainable parameters of 4.66B), then ran agentic RL where the model emits PostgreSQL hints for join ordering and execution strategy, an agent harness executes the plan against four containerized Postgres instances, and reward comes from measured latency against the default plan. Training used the 13,646-query Cardinality Estimation Benchmark and validated on the 113-query Join Order Benchmark over IMDb, with topologies verified distinct to prevent overfitting. Best-of-3 rollouts gave a 1.81x geometric mean speedup and 44.7% summed latency reduction, with 68 queries improving more than 5% and exactly one regressing past that threshold. Total spend was about $1,200 ($800 Lambda H100 rental, $400 API), and the code is public at polyphilz/qorl, which makes this a usable template for reward-from-measured-execution on any optimizer you can instrument.
Open latest cited source