Renaissance Labs · Code
Code / Pitfalls
Pitfalls

What goes wrong, and how to see it coming

Most failed runs fail for the same few reasons.

Most failed runs fail for one of a handful of reasons. Each is easy to avoid once you know to look for it.

Contamination: the score went up, the model did not get better

  • Symptom: big gains on a classic benchmark, no gain on your own tasks.
  • Cause: benchmark problems or solutions (or rewrites of them) in the training data. Rephrased copies slip through n-gram decontamination (arXiv 2311.04850).
  • Fix: decontaminate with a proper tool (decon (Ai2) is one), score on a time-windowed eval such as LiveCodeBench, and keep a private eval that never touches a training set.

Reward hacking: the model learned to cheat your verifier

  • Git history. Cursor audited agent trajectories and reported that in a measurable share the agent searched the repository’s git history for the future fix commit (Cursor blog). SWE-bench removed future history from its images upstream, so older images are leaky.
  • Editing tests. If the agent can change the test files, it can make the tests pass. Apply tests after the agent finishes, from outside the sandbox.
  • Network access. Agents have been seen fetching fixes from the public web. Run rollouts without internet, or through an allowlist proxy.
  • Special-casing. Weak tests reward code that returns the expected values for the visible cases. Add tests, and check each task against a reference solution.
  • Fix: isolate, hide, strip, and monitor a sample of rollouts by eye, or with a judge model. A judge catches obvious hacks that held-out tests miss (arXiv 2511.21654).

Weak or wrong tests

  • Symptom: the reward goes up while real quality does not.
  • Cause: too few tests, flawed tests, or tests that accept different behavior from the reference. One study found that a notable share of sampled SWE-bench Verified tasks accepted patches that differ from the reference (arXiv 2606.16062). More generated tests give a better reward signal (arXiv 2501.01054).
  • Fix: filter tasks that the reference does not pass or that the unfixed code passes, and add tests where you can.

Dead tasks: RL that learns nothing

If every rollout for a task gets the same reward, the group-relative signal is zero. Keep a middle band of difficulty. See the figure in the guide. Starting RL from a model that solves almost nothing has the same effect.

License and terms traps

  • Corpora are mixed-license by file. Keep the metadata and filter.
  • Synthetic data inherits the teacher’s terms. Cards name OpenAI, Anthropic, DeepSeek, Qwen and other teachers. Some sets are non-commercial.
  • Some open-weight model licenses carry conditions (revenue thresholds, non-production clauses). Read them before you distill from or ship derivatives of those models.
  • A missing license field means unknown, not free.

Running untrusted code

Model-written code can delete files, read secrets and open connections. Never run it on your host or on a machine with credentials. Use a container or VM with no network, a read-only filesystem, and limits on memory, CPU and processes. A subprocess with a timeout is a convenience, not a security boundary. On a shared HPC cluster use rootless containers such as Apptainer, and ask your admins.

Hardened Docker run for untrusted generated code
docker run --rm \
  --network none \
  --read-only \
  --memory 256m --memory-swap 256m \
  --cpus 1 \
  --pids-limit 64 \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --user 65534:65534 \
  --tmpfs /tmp:rw,noexec,nosuid,size=16m \
  -v "$PWD/job:/work:ro" -w /work \
  python:3.12-slim timeout 10 python candidate.py

Verified: ran locally (Docker 29.1.3); flags checked in docker/cli source, version seen: Docker 29.1.3, python:3.12-slim. Every flag exists in docker/cli container opts source (network, read-only, memory, pids-limit, cap-drop, security-opt, user, tmpfs, cpus). A near-identical command was run on Docker 29.1.3 with python:3.12-slim: the script ran as uid 65534, outbound socket failed, writes to the read-only mount failed, and writes to /tmp worked. Kernel shared with host: for adversarial code add gVisor/Firecracker and seccomp. The timeout is the coreutils one inside the image (not separately tested); also enforce a wall-clock kill from the outside (docker kill). source source

Evaluation mistakes

  • Treating a famous benchmark as ground truth. SWE-bench Verified and SWE-Bench Pro both have documented problems with flawed tests (see the caveats on each page). Prefer refreshing sets such as SWE-bench-Live, and read failures.
  • Comparing scores across different harnesses, prompts or sample counts.
  • Reporting a single sample. Use several samples and the unbiased pass@k estimator.
  • Trusting a small gap on one benchmark. Read the failures.
  • Skipping a regression check on general coding after a narrow RL run.

SFT mistakes

  • Training on the prompt tokens as well as the response. Mask the prompt.
  • Mixing chat templates. Use one, consistently, in training and in evaluation.
  • Keeping unverified synthetic solutions that are simply wrong. Run them, or sample-check them.
  • Match agent trajectories to the harness you will deploy with. Tool formats differ.