LearnQuestion bank

You need RL training data for a coding agent: thousands of executable tasks, each with an environment and tests. Design a pipeline, in the spirit of SWE-smith, that generates, validates and decontaminates them.

Applied LLMSystem designHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Select permissively licensed repos with green test suites; pin each to a commit and build reproducible containers
  • Generate tasks by synthesising changes that break existing tests or mining real PRs; write issue text that describes the symptom without leaking the fix
  • Validate: tests fail pre-fix and pass with the reference fix; repeated runs catch flaky tests; audits catch tests too narrow or too loose
  • Calibrate difficulty with model pass rates; drop tasks where every sample passes or fails (zero advantage in group-relative RL)
  • Decontaminate against eval benchmarks: exclude their repos, check text overlap, use time-based splits
  • Serve surviving environments behind a standard reset/step interface in a secure sandbox

In full

The core idea is to treat task generation as a data-quality pipeline, not a one-shot generation step. I would start by filtering to permissively licensed repositories with working test suites, pinning each to a specific commit and building a reproducible container per repo. Tasks come from two sources: synthesised changes that break existing tests, with an issue description written to describe the symptom rather than the fix, and mined real pull requests — the spirit of SWE-smith’s roughly 50,000 instances from 128 repositories. Each candidate task is validated by running the tests before the fix (must fail) and after the reference fix (must pass), with repeated runs to catch flaky tests and audits to catch tests that are too narrow — only one implementation passes — or too loose. I then calibrate difficulty by sampling a model on each task and dropping tasks where every sample passes or fails, since they give zero advantage in group-relative RL. Finally I decontaminate against evaluation benchmarks by excluding their repositories, checking text overlap, and using time-based splits, and serve the surviving environments behind a standard reset/step interface in a secure sandbox.

Checked against sources by an independent AI reviewer.

What a strong answer covers

  • Selects permissively licensed repositories with working test suites and builds reproducible containerised environments pinned to a commit
  • Generates tasks by synthesising changes that break existing tests (or mining real pull requests) and writing an issue description that does not leak the fix; SWE-smith produced about 50,000 instances from 128 repositories
  • Validates each task: tests fail before and pass with the reference fix, repeated runs catch flaky tests, and audits catch tests that are too narrow (only one implementation passes) or too loose
  • Calibrates difficulty with model pass rates and drops tasks every sample passes or fails, since they give zero advantage in group-relative RL
  • Decontaminates against evaluation benchmarks (exclude their repositories, check text overlap, use time-based splits) and serves environments behind a standard reset/step interface in a secure sandbox

Common mistakes

  • Skipping the fail-before, pass-after check
  • Training on repositories that also appear in the evaluation benchmark

Follow-ups

  • How would you detect reward hacking, such as an agent editing the tests?