Dataset Viewer
Auto-converted to Parquet Duplicate
conversations
listlengths
11
13
luther
dict
[ { "from": "system", "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. After calling & executing the functions, you will be provided with function results within <tool_re...
{ "task_id": "toy-calc:a1b2c3d4e5f6:terse", "repo": "toy-examples", "sha": "a1b2c3d4e5f6", "attempt_file": "synthetic", "n_turns": 8, "tool_errors": 0, "recovered_from_error": false, "verified": true, "window": 0, "loss_from": 0 }
[ { "from": "system", "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. After calling & executing the functions, you will be provided with function results within <tool_re...
{ "task_id": "toy-cfg:f6e5d4c3b2a1:terse", "repo": "toy-examples", "sha": "f6e5d4c3b2a1", "attempt_file": "synthetic", "n_turns": 10, "tool_errors": 1, "recovered_from_error": true, "verified": true, "window": 0, "loss_from": 0 }

Execution-Verified Agent Trajectories — Format & Method

This repository documents a method and data format for building supervised fine-tuning sets from agent trajectories that are verified by running the code, not by asking a model whether the answer looks right.

This is a specification plus synthetic examples, not a corpus. The trajectories that trained Luthor 8B were generated against a private repository and cannot be released. Everything needed to rebuild an equivalent set against your own repositories is here.

Why verification-first

The usual way to build an agentic SFT set is to have a strong teacher model attempt tasks and keep the attempts that look good — judged by another model, or by nothing at all. That trains fluency at appearing to fix code.

The approach here keeps a trajectory only if it ends in a patch that turns a failing test suite green, checked by executing the suite in a per-task container. In the run that produced Luthor, 296 attempts yielded 138 verified trajectories across 64 of 74 tasks — so roughly 54% of confident-looking attempts were wrong and were discarded. That discard rate is the entire argument for the method.

Pipeline

mine tasks        real commits that fix a failing test  ->  fail-to-pass task specs
build images      one Docker image per task, pinned to the parent commit
roll out          N attempts per task with a teacher model driving real tools
verify            run the suite in the image; keep only green runs
window            trim, cap, and window to the trainer's context limit

Each stage is independently checkable, and the verifier is the test — there is no separate labelling step to trust.

Task mining

A task is a commit where a test that failed at the parent commit passes at the commit. This gives a ground-truth patch and an objective success signal for free. The agent is shown the failing test and the repo at the parent commit; it never sees the real fix.

Verification

A trajectory passes only if all hold:

  1. The extracted patch applies cleanly to the parent commit.
  2. The previously-failing test passes after applying it.
  3. No host-machine paths leaked into the transcript as evidence in tool output (a path appearing inside a repo file is not a leak; a path appearing in a command's output is).
  4. The run terminated on its own rather than hitting the turn cap.

Data format

ShareGPT-style JSONL. One line per window.

{
  "conversations": [
    {"from": "system", "value": "...<tools>[{...}]</tools>..."},
    {"from": "human",  "value": "The failing test and what to fix"},
    {"from": "gpt",    "value": "<think>...</think>\n<tool_call>\n{\"name\": \"bash\", ...}\n</tool_call>"},
    {"from": "tool",   "value": "<tool_response>\n...\n</tool_response>"},
    {"from": "gpt",    "value": "Summary of the fix"}
  ],
  "luther": {
    "task_id": "repo:sha:prompt_style",
    "repo": "toy-examples",
    "sha": "a1b2c3d4e5f6",
    "n_turns": 8,
    "tool_errors": 0,
    "recovered_from_error": false,
    "verified": true,
    "window": 0,
    "loss_from": 0
  }
}
Role Meaning
system Tool declarations in a Hermes-style <tools> block
human The task statement
gpt Assistant turn — reasoning and/or <tool_call>the only turns carrying loss
tool Tool output, wrapped in <tool_response>

loss_from is an index into conversations: assistant turns before it are overlap context carried from the previous window and must be masked out. Turns at or after it carry loss.

See examples/synthetic_trajectories.jsonl for two complete, runnable examples in this exact schema — one clean fix, one that hits a tool error and recovers. They are invented toy Python tasks.

Windowing — the part that is easy to get wrong

Raw trajectories are large: a median of roughly 61k tokens, dominated by tool output (40k) and reasoning blocks (25k). Three transforms make them trainable at a 16k context:

  1. Truncate tool outputs to ~4,000 characters. Directory listings and test logs are mostly noise past that.
  2. Cap <think> blocks at ~12,000 characters.
  3. Window to the context limit with one-turn overlap — do not tail-truncate.

Point 3 matters more than it looks. Tail-truncating a trajectory to fit the context removes its end, which is precisely where the successful fix and the green test run are. A trainer that does this silently learns to explore and never to finish. Windowing with loss_from keeps every part of the trajectory trainable while never computing loss twice on the same tokens.

Splitting

Split by commit, never by trajectory. Multiple attempts at one task share the same underlying fix, so a trajectory-level split leaks the answer across the train/eval boundary and inflates eval scores.

Reference statistics

From the run that produced Luthor 8B, for calibration:

Tasks mined 74
Attempts 296 (4 × 74)
Verified trajectories 138 (64/74 tasks)
Train / eval trajectories 95 / 16 (5 held-out commits)
Train / eval windows 493 / 78
Error-recovery examples 12
Mean turns 24.2
Window tokens (p50 / max) 13,789 / 16,251
Train tokens per epoch ~6.39M

Completed runs had a median of 22 turns and a p90 of 29 — a 30-turn cap truncated ~45% of attempts, so set the turn cap to at least 50.

Training notes

Loss on assistant turns only, masked to -100 elsewhere and before loss_from. At 16k sequence length with a ~152k-token vocabulary, two things are effectively mandatory on a single 80GB GPU:

  • Fused linear cross-entropy — an unfused loss materialises and repeatedly copies the logits tensor (~35 GB).
  • FlashAttention-2 — SDPA materialises the full seq² attention matrix per layer during gradient-checkpointed recompute (~16 GiB each). FA2 cut peak memory from >75 GB to 24.9 GB.

Limitations

  • Synthetic examples only. Two hand-built trajectories, for format illustration. Not a training corpus.
  • Single-domain reference stats. The numbers above come from one Python data-engineering codebase.
  • Verification is only as good as the test suite. A patch that games a weak test passes here too.
  • Teacher-dependent. Trajectories inherit the teacher's habits; the verifier filters correctness, not style.

License

Apache 2.0. The synthetic examples are original and carry no third-party rights.

Downloads last month
14