mobius-rag-rl / README.md
johnucm's picture
Upload Mobius RAG + Unit-Test RL dataset (2,219 train / 554 validation + mobius.tar)
ef7d10f verified
|
Raw History Blame Contribute Delete
3.73 kB
metadata
license: mit
pretty_name: Mobius RAG + Unit-Test RL
language:
  - en
tags:
  - code
  - reinforcement-learning
  - retrieval-augmented-generation
size_categories:
  - 1K<n<10K
configs:
  - config_name: default
    data_files:
      - split: train
        path: train.jsonl.gz
      - split: validation
        path: validation.jsonl.gz

Mobius RAG + Unit-Test RL

Repository-specific coding tasks for reinforcement learning on Mobius at commit 0cc842f3. Each task asks a model to implement one function, method or class of Mobius from five code chunks retrieved from other Mobius files, and existing Mobius unit tests grade the answer. It is the dataset of the mobius_rag_rl environment in the Microsoft Foundry fine-tuning cookbook.

Files

File Contents
train.jsonl.gz 2,219 training tasks
validation.jsonl.gz 554 validation tasks, from source files that training tasks neither come from nor retrieve
mobius.tar Mobius source at 0cc842f3 (MIT License), which the unit tests run against

Fields

  • focal_symbol: dotted name of the definition to implement, such as mobius.integrations.gguf._quant_registry._dequantize_verdict.
  • source_file: the file that defines it.
  • messages: the system prompt and the user prompt, which holds the five retrieved code chunks and the question.
  • reward_info.target_identifiers: 1 to 5 identifiers (median 4) a correct answer uses.
  • reward_info.reference_answer: the original definition.
  • reward_info.unit_test_nodeids: 1 to 12 pytest node IDs (median 9) of existing tests that fail when the definition is broken.

How It Was Built

  1. Focal definitions. Every function, method and method-less class in src/ with 10 to 120 non-blank lines (except __init__ and classes whose methods are separate definitions). Every top-level definition and method is also a retrieval chunk (7,774 chunks).
  2. Unit tests. All *_test.py files ran once under a Python sys.monitoring call trace, offline and without a Hugging Face cache. For each definition, up to 24 passing tests that call it ran again with the definition replaced by raise RuntimeError; up to 12 that then failed became its unit_test_nodeids. Definitions without such tests were dropped (2,850 remained).
  3. Questions. gpt-6.1-sol received up to 6 definitions from one file and 3 related definitions from other files, and wrote one implementation question and up to 5 target identifiers per definition, keeping identifiers that occur in the original definition. The signature and any 2- to 6-digit constants were appended when a question omitted them. 2,773 definitions received a question.
  4. Retrieval. Code chunks and questions were embedded with text-embedding-3-small; each question has the 5 most similar chunks from other files (up to 2,000 characters each).
  5. Splits. Files are split by a hash of their name (one in five to validation; foo.py and _foo.py together), and training prompts never retrieve validation files.

Reward

The environment replaces the definition in mobius.tar with the answer's definition, runs unit_test_nodeids, and scores 0.70 * unit-test pass fraction + 0.20 * static score + 0.10 * context bonus. The static score combines identifier recall, presence of all target identifiers, AST call and attribute F1 against the reference, and conciseness; the context bonus is 1 below 32K context tokens. Answers that are not valid Python or do not define the focal symbol score 0.