RL based Query Rewriting

Behind the numbers

Things we did not expect

Prompting can break a perfect query
1 → 406
“python substring index of” became “python string find”, and the correct function fell from rank 1 to 406 with BM25. The trained model kept it at 1.
Headroom in the untrained model
0.542 → 0.756
BM25 Hit@10 if an oracle picked the best of 8 sampled rewrites. The ability was there, the choice was not.
Rewrites graded per training run
128,000
Each one ranked against the whole collection by the frozen retriever, with no human or AI judge.
Changing the GPU changes the output
6.4% / 8%
of rewrites (CoSQA / CodeSearchNet) changed when the same model ran on a different GPU type. MRR@10 moved by at most 0.004, so smaller gaps mean nothing.
Training twice as long
+0
The 1,000 step run never beat its own step 500 checkpoint on dev.
Nobody asked for snake_case
78%
of the BM25 model's CodeSearchNet rewrites contain an underscore, up from 13% of original queries. The reward alone taught it that style.

What the rewrites look like

Test rewrites per method. Words are counted by spaces, so rank_list_object is one word.

Dataset

Words per rewrite

Rewrites containing an underscore

Show data