Datasets:
Scaffold-Agent SFT final: 19652 records, 6792 sessions, 898.7M trainable tokens
Browse files- .gitattributes +1 -0
- README.md +78 -0
- scaffold_agent_sft_final.jsonl +3 -0
- training_set_final.json +10 -0
- training_set_final_c22.json +11 -0
- training_set_final_main.json +11 -0
- training_sft_config.yaml +103 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
scaffold_agent_sft_final.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- chain-of-thought
|
| 9 |
+
- reasoning
|
| 10 |
+
- sft
|
| 11 |
+
- tool-use
|
| 12 |
+
- coding-agent
|
| 13 |
+
- multi-turn
|
| 14 |
+
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
+
configs:
|
| 17 |
+
- config_name: default
|
| 18 |
+
data_files: "scaffold_agent_sft_final.jsonl"
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# Scaffold-Agent
|
| 22 |
+
|
| 23 |
+
Long, multi-turn agentic coding sessions for supervised fine-tuning. 19,652
|
| 24 |
+
records from 6,792 sessions (1,005.1M tokens, 898.7M trainable after masks).
|
| 25 |
+
Every assistant action is preceded by a Scaffold-CoT reasoning block
|
| 26 |
+
(Inventory → Interaction → Execution) in `reasoning_content`. Sessions cover
|
| 27 |
+
editing real repositories and building from scratch, including recovery from
|
| 28 |
+
errors and demanding simulated users. Sessions run 10 to 100+ turns.
|
| 29 |
+
|
| 30 |
+
Built from the ScaffoldAgent Experiment 2 generation pipeline (teacher:
|
| 31 |
+
`stealth/space-bunny-alpha` through a scaffold-reframing gateway; harness: Pi
|
| 32 |
+
0.81.1). See `training_sft_config.yaml` in this repo for the documented
|
| 33 |
+
multi-turn SFT setup (sample definition, role/loss mapping, splits).
|
| 34 |
+
|
| 35 |
+
## Fields
|
| 36 |
+
|
| 37 |
+
Every row is one compaction segment (1–8 per session, each ≤ 64k tokens) and is
|
| 38 |
+
a self-contained training sample — do not join segments of a session.
|
| 39 |
+
|
| 40 |
+
| Field | Contents |
|
| 41 |
+
| --- | --- |
|
| 42 |
+
| `id` | `{session}-s{segment}` record id |
|
| 43 |
+
| `session` | Session id (`repo-…` = live-repo work, `scratch-…` = from-scratch work) |
|
| 44 |
+
| `segment` / `segments_in_session` | Position of this record within its session |
|
| 45 |
+
| `tokens` / `chars` | o200k_base token count and character count of the record |
|
| 46 |
+
| `tools` | Function definitions available in this segment (render to tool schema; never train as text) |
|
| 47 |
+
| `messages` | Ordered chat messages: `system` (once), `user` (task + simulated user), `assistant` (with `tool_calls`, `reasoning_content`, and per-message `loss`), `tool` (execution results) |
|
| 48 |
+
|
| 49 |
+
Assistant messages carry `loss: {content, reasoning}`. Train content only when
|
| 50 |
+
`loss.content` is true and reasoning only when `loss.reasoning` is true;
|
| 51 |
+
everything else is context. The main shard (~916M tokens) is masked by a
|
| 52 |
+
two-judge turn filter (~3.4% of content, ~30.9% of reasoning masked as
|
| 53 |
+
contradicted or unfaithful). The campaign22 shard (~89M tokens) was admitted
|
| 54 |
+
under relaxed gates (verification only, no grade bar) and is fully unmasked.
|
| 55 |
+
|
| 56 |
+
## Build
|
| 57 |
+
|
| 58 |
+
Selected by hidden-test verification plus a senior-reviewer code grade
|
| 59 |
+
(mergeable verdict, correctness/readability/idiom/scope floors, no test
|
| 60 |
+
gaming; from-scratch bug claims checked by execution). Main shard: 6,444
|
| 61 |
+
sessions. Campaign22 shard: 348 verified sessions. Per-message loss masks from
|
| 62 |
+
two independent turn judgments on the main shard. Split train/val by session
|
| 63 |
+
id, never by record — segments of one session share history.
|
| 64 |
+
|
| 65 |
+
## Loading
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from datasets import load_dataset
|
| 69 |
+
ds = load_dataset("Specific-Labs/Scaffold-Agent", split="train")
|
| 70 |
+
rec = ds[0]
|
| 71 |
+
trainable = [m for m in rec["messages"]
|
| 72 |
+
if m["role"] == "assistant" and (m["loss"]["content"] or m["loss"]["reasoning"])]
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Each record trains standalone: system prompt, tool definitions, and message
|
| 76 |
+
history are all present in the row. Render `reasoning_content` through the
|
| 77 |
+
model's reasoning channel, or flatten as `<think>…</think>` for plain chat
|
| 78 |
+
models, following `loss.reasoning` either way.
|
scaffold_agent_sft_final.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ef167ff42a394ab00b63852e3ef25374c658dfc3c164b57b0129543f94107332
|
| 3 |
+
size 4363893990
|
training_set_final.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"selected_sessions": 6792,
|
| 3 |
+
"built_sessions": 6792,
|
| 4 |
+
"records": 19652,
|
| 5 |
+
"tokens": 1005069419,
|
| 6 |
+
"masked_tokens": 106397845,
|
| 7 |
+
"trainable_tokens": 898671574,
|
| 8 |
+
"assistant_messages": 796826,
|
| 9 |
+
"note": "main shard masked by two-judge filter; c22 shard unmasked per relaxed-gates owner decision 2026-10-05"
|
| 10 |
+
}
|
training_set_final_c22.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"selected_sessions": 348,
|
| 3 |
+
"built_sessions": 348,
|
| 4 |
+
"records": 1752,
|
| 5 |
+
"tokens": 88698480,
|
| 6 |
+
"masked_tokens": 0,
|
| 7 |
+
"trainable_tokens": 88698480,
|
| 8 |
+
"assistant_messages": 62397,
|
| 9 |
+
"content_masked_share": 0.0,
|
| 10 |
+
"reasoning_masked_share": 0.0
|
| 11 |
+
}
|
training_set_final_main.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"selected_sessions": 6444,
|
| 3 |
+
"built_sessions": 6444,
|
| 4 |
+
"records": 17900,
|
| 5 |
+
"tokens": 916370939,
|
| 6 |
+
"masked_tokens": 106397845,
|
| 7 |
+
"trainable_tokens": 809973094,
|
| 8 |
+
"assistant_messages": 734429,
|
| 9 |
+
"content_masked_share": 0.034434914743290364,
|
| 10 |
+
"reasoning_masked_share": 0.30928381096062385
|
| 11 |
+
}
|
training_sft_config.yaml
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multi-turn SFT training configuration for the ScaffoldAgent final dataset.
|
| 2 |
+
# This file is documentation-first: every setting explains what the data looks
|
| 3 |
+
# and why the setting is shaped that way. Values under `training:` are
|
| 4 |
+
# starting points for the trainer you are building, not tuned prescriptions.
|
| 5 |
+
#
|
| 6 |
+
# DATASET
|
| 7 |
+
# Records (JSONL, one per line): Data_Out/training/scaffold_agent_sft_final.jsonl
|
| 8 |
+
# Volume: 19,652 records / 6,792 sessions / 1,005.1M o200k tokens,
|
| 9 |
+
# 898.7M trainable after masks (see Results/training_set_final.json).
|
| 10 |
+
# Split by shard: main 6,444 sessions (two-judge masked) + campaign22 348
|
| 11 |
+
# sessions (relaxed gates, fully unmasked, owner decision 2026-10-05).
|
| 12 |
+
#
|
| 13 |
+
# SAMPLE DEFINITION (this is the core of the setup -- read carefully)
|
| 14 |
+
# One record == one training sample. A record is one compaction segment
|
| 15 |
+
# (segment / segments_in_session, 1-8 per session, each <= 64k o200k).
|
| 16 |
+
# Each record is SELF-CONTAINED: it re-opens with the system prompt, the
|
| 17 |
+
# tool definitions, and the full message history since the last compaction
|
| 18 |
+
# (later segments open with the compaction summary as context). Training
|
| 19 |
+
# per-record matches inference: the agent always acts on compacted context.
|
| 20 |
+
# Do NOT join segments of one session into a single sample: that duplicates
|
| 21 |
+
# system/tools, can exceed the context window, and breaks the invariant the
|
| 22 |
+
# data was generated under. Do NOT split a record: tool_call_id references
|
| 23 |
+
# and scaffold-to-action adjacency would break.
|
| 24 |
+
#
|
| 25 |
+
# MESSAGE MAP (observed in the bytes, shard_main.jsonl + shard_c22.jsonl)
|
| 26 |
+
# system x1 per record. Never trained. Keep verbatim (it names the tools).
|
| 27 |
+
# user task prompts + simulated-user turns. Never trained. `content` is
|
| 28 |
+
# a string or a [{type: text, ...}] list -- normalize lists to text.
|
| 29 |
+
# assistant tool-calling turns AND final text turns. The ONLY trained role,
|
| 30 |
+
# gated per message by its `loss` object (see MASKS).
|
| 31 |
+
# `content` may be null on pure tool-call turns (train the call).
|
| 32 |
+
# `reasoning_content` holds the Scaffold-CoT scaffold
|
| 33 |
+
# (Inventory -> Interaction -> Execution). `tool_calls` holds the
|
| 34 |
+
# OpenAI-style calls the scaffold justifies.
|
| 35 |
+
# tool execution results ({role, tool_call_id, content}). Never trained;
|
| 36 |
+
# they are the environment's voice. Keep as context.
|
| 37 |
+
# tools[] (top-level) function definitions, repeated per record. Render
|
| 38 |
+
# into the model's tool schema; do not train them as text.
|
| 39 |
+
#
|
| 40 |
+
# MASKS (per assistant message: loss: {content: bool, reasoning: bool})
|
| 41 |
+
# Train content only when loss.content, reasoning only when loss.reasoning.
|
| 42 |
+
# Everything else (system/user/tool, and any assistant message with both
|
| 43 |
+
# false) is context-only. Masked text STAYS in the sequence -- it is not
|
| 44 |
+
# deleted. Main shard: ~3.4% content and ~30.9% reasoning masked by the
|
| 45 |
+
# two-judge filter (contradicted claims / unfaithful scaffolds). C22 shard:
|
| 46 |
+
# 0% masked by owner decision -- its imperfect turns train as-is.
|
| 47 |
+
#
|
| 48 |
+
# REASONING CHANNEL (pick one; do not mix within a run)
|
| 49 |
+
# A) Native: feed reasoning_content through the model's reasoning channel
|
| 50 |
+
# (the format the teacher API used). Preferred when the target model has
|
| 51 |
+
# an explicit reasoning role or channel.
|
| 52 |
+
# B) Flattened: render as <think>...</think> prefix of the assistant message
|
| 53 |
+
# (the README's documented flattening). Preferred for plain chat models.
|
| 54 |
+
# Either way, loss on reasoning tokens follows loss.reasoning exactly.
|
| 55 |
+
#
|
| 56 |
+
# SPLITS
|
| 57 |
+
# Hold out by SESSION (session id), never by record: segments of one session
|
| 58 |
+
# share history, so a record-level split leaks across train/val. Suggested:
|
| 59 |
+
# 98/1/1 by session, stratified by kind (repo/scratch) and shard (main/c22).
|
| 60 |
+
#
|
| 61 |
+
# ACCEPTANCE (run before any training launch -- falsifiable)
|
| 62 |
+
# 1. Loader parses all 19,652 lines as JSON with messages/tools intact.
|
| 63 |
+
# 2. Masked-token share recomputed by the loader matches the summary within
|
| 64 |
+
# 1% (content ~3.4%, reasoning ~30.9% on the main shard; 0% on c22).
|
| 65 |
+
# 3. Zero loss falls on system/user/tool tokens (assert on one batch).
|
| 66 |
+
# 4. No sample exceeds the model's context in TARGET tokenizer tokens
|
| 67 |
+
# (records are <= 64k o200k; your tokenizer differs -- measure, and SKIP
|
| 68 |
+
# (don't truncate) the few overflows so tool references stay intact).
|
| 69 |
+
# 5. Val sessions share zero session ids with train.
|
| 70 |
+
|
| 71 |
+
dataset:
|
| 72 |
+
path: "../Data_Out/training/scaffold_agent_sft_final.jsonl"
|
| 73 |
+
format: "openai-chat-messages + reasoning_content + loss masks + tools"
|
| 74 |
+
sample_unit: "one record (one compaction segment)"
|
| 75 |
+
join_segments: false
|
| 76 |
+
split_segments: false
|
| 77 |
+
split_by: "session"
|
| 78 |
+
val_sessions: 68 # ~1% of 6,792; stratify by kind and shard
|
| 79 |
+
test_sessions: 68
|
| 80 |
+
|
| 81 |
+
mapping:
|
| 82 |
+
system: { train: false, keep: "verbatim" }
|
| 83 |
+
user: { train: false, normalize_content_list: true }
|
| 84 |
+
assistant:
|
| 85 |
+
train_content_when: "loss.content == true"
|
| 86 |
+
train_reasoning_when: "loss.reasoning == true"
|
| 87 |
+
reasoning_channel: "native" # or "think-tags"; see REASONING CHANNEL
|
| 88 |
+
train_tool_calls_when: "loss.content == true"
|
| 89 |
+
tool: { train: false, keep: "as context" }
|
| 90 |
+
tools: { train: false, render: "model tool schema" }
|
| 91 |
+
|
| 92 |
+
sequence:
|
| 93 |
+
max_tokens_target_tokenizer: 65536 # measure; records are <= 64k o200k
|
| 94 |
+
overflow_policy: "skip record, never truncate history"
|
| 95 |
+
packing: "optional; whole records only, never split a record"
|
| 96 |
+
shuffle: "by record; session-aware batching optional"
|
| 97 |
+
|
| 98 |
+
training: # starting points only -- tune on val loss
|
| 99 |
+
objective: "causal LM with per-token loss mask from mapping above"
|
| 100 |
+
learning_rate: 1.0e-5
|
| 101 |
+
warmup_ratio: 0.03
|
| 102 |
+
epochs: 2
|
| 103 |
+
batch_tokens: 1048576 # 1M-token batches; scale to hardware
|