RL based Query Rewriting

The data

Two datasets, three separate question sets

Every question has exactly one correct function. Test questions were used only for final numbers, dev questions for every choice we made, and train questions only for training.

CoSQA

Real web searches. Short and vague, 6.6 words on average.

Functions searched6,267
Test questions500
Dev questions500
Train questions available7,877
Train questions used4,000
  • We used the official test, validation and train splits of the CoIR version.
  • We merged exact duplicate functions: 20,604 → 6,267.
  • For training we kept only pairs labelled as matches, and removed 1,143 whose answer is also a test answer.

CodeSearchNet Python

Function descriptions. Longer and technical, 12.7 words on average.

Functions searched22,176
Test questions1,000
Dev questions500
Train questions available18,499
Train questions used4,000
  • We searched all functions of the official Python test split, with their descriptions removed from the code.
  • We used the first paragraph of each description as the question, if unique and at least 3 words (19,999 candidates).
  • We drew 1,000 test and 500 dev questions at random with a fixed seed. The rest became train.
Retrievers
2
BM25 (keywords) and UniXcoder (meaning), both frozen
Training mix
8,000
questions, half from each dataset
Rewrites per training run
128,000
500 steps × 256 rewrites
Overlap checks
0
questions repeated across sets, and no train answer is a test answer