Scaffold-Agent / README.md
saraoz01's picture
Link Scaffold Chat (formerly Scaffold-CoT); document meta/counter fields
a502819 verified
|
Raw History Blame Contribute Delete
4.09 kB
---
license: cc-by-4.0
task_categories:
- text-generation
language:
- en
tags:
- chain-of-thought
- reasoning
- sft
- tool-use
- coding-agent
- multi-turn
size_categories:
- 10K<n<100K
configs:
- config_name: default
data_files: "scaffold_agent_sft_final.jsonl"
---
# Scaffold-Agent
Long, multi-turn agentic coding sessions for supervised fine-tuning. 19,652
records from 6,792 sessions (1,005.1M tokens, 898.7M trainable after masks).
Every assistant action is preceded by a scaffold reasoning block
(Inventory → Interaction → Execution) in `reasoning_content`. Sessions cover
editing real repositories and building from scratch, including recovery from
errors and demanding simulated users. Sessions run 10 to 100+ turns.
## Related datasets
- [Specific-Labs/Scaffold-Chat](https://huggingface.co/datasets/Specific-Labs/Scaffold-Chat) —
3,450,159 chat examples carrying the same scaffold reasoning format, with
no tool use: chat and reasoning only. Scaffold Chat (formerly
Scaffold-CoT) removed its tool-calling examples because those tool calls
were generated text that was never executed. The tool calls in
Scaffold-Agent are the opposite: every one was really executed in the Pi
harness, and session outcomes were verified with real builds and tests.
Train chat/reasoning behavior from Scaffold Chat and tool use from here.
Built from the ScaffoldAgent Experiment 2 generation pipeline (teacher:
`stealth/space-bunny-alpha` through a scaffold-reframing gateway; harness: Pi
0.81.1). See `training_sft_config.yaml` in this repo for the documented
multi-turn SFT setup (sample definition, role/loss mapping, splits).
## Fields
Every row is one compaction segment (1–8 per session, each ≤ 64k tokens) and is
a self-contained training sample — do not join segments of a session.
| Field | Contents |
| --- | --- |
| `id` | `{session}-s{segment}` record id |
| `session` | Session id (`repo-…` = live-repo work, `scratch-…` = from-scratch work) |
| `segment` / `segments_in_session` | Position of this record within its session |
| `tokens` / `chars` | o200k_base token count and character count of the record |
| `counter` | Tokenizer used for `tokens` (`o200k_base`) |
| `meta` | `{task_id, persona, outcome, verify_exit_code}` — simulated-user persona and verification outcome for the session |
| `tools` | Function definitions available in this segment (render to tool schema; never train as text) |
| `messages` | Ordered chat messages: `system` (once), `user` (task + simulated user), `assistant` (with `tool_calls`, `reasoning_content`, and per-message `loss`), `tool` (execution results) |
Assistant messages carry `loss: {content, reasoning}`. Train content only when
`loss.content` is true and reasoning only when `loss.reasoning` is true;
everything else is context. The main shard (~916M tokens) is masked by a
two-judge turn filter (~3.4% of content, ~30.9% of reasoning masked as
contradicted or unfaithful). The campaign22 shard (~89M tokens) was admitted
under relaxed gates (verification only, no grade bar) and is fully unmasked.
## Build
Selected by hidden-test verification plus a senior-reviewer code grade
(mergeable verdict, correctness/readability/idiom/scope floors, no test
gaming; from-scratch bug claims checked by execution). Main shard: 6,444
sessions. Campaign22 shard: 348 verified sessions. Per-message loss masks from
two independent turn judgments on the main shard. Split train/val by session
id, never by record — segments of one session share history.
## Loading
```python
from datasets import load_dataset
ds = load_dataset("Specific-Labs/Scaffold-Agent", split="train")
rec = ds[0]
trainable = [m for m in rec["messages"]
if m["role"] == "assistant" and (m["loss"]["content"] or m["loss"]["reasoning"])]
```
Each record trains standalone: system prompt, tool definitions, and message
history are all present in the row. Render `reasoning_content` through the
model's reasoning channel, or flatten as `<think>…</think>` for plain chat
models, following `loss.reasoning` either way.