Skill files2 files

references/

SKILL.md216 lines
1
---
2
name: trace-to-training-data
3
description: Convert evaluation traces and production logs into SFT examples and preference pairs. Use when graded traces or failure examples exist and need to become training data, when applying rejection sampling to model outputs, or when building DPO pairs from passing and failing runs.
4
---
5
6
# Trace To Training Data
7
8
This skill assumes `eval-harness-first`
9
already graded the traces being
10
converted here — goldens, graders,
11
and `runs/<run-id>/results.json`
12
all exist before conversion
13
starts. This is the flywheel edge
14
that skill names in its own flow:
15
"the same labeled traces become
16
the training set." Conversion
17
happens here; grading already
18
happened upstream.
19
20
**Input:** graded traces —
21
`eval/goldens.jsonl` plus
22
`runs/<run-id>/results.json`, each
23
row carrying a `task_id`, a
24
`verdict` from the grader, and a
25
`reward` when the task supports a
26
scalar score (judge score,
27
execution partial-credit, or an
28
RLVR verifier):
29
30
```json
31
{"task_id": "t-042", "trace_id": "t-042-a3",
32
"messages": [{"role": "user", "content": "..."}],
33
"verdict": "pass", "reward": 0.91,
34
"grader": "exact_match"}
35
```
36
37
**Output format:** rows shaped
38
exactly like `dataset-curation`'s
39
Format Selection table — SFT
40
`messages` rows or DPO
41
`prompt`/`chosen`/`rejected`
42
pairs — so this skill's output is
43
that skill's input with no
44
reshaping step in between.
45
46
## The Principle
47
48
The eval harness already did the
49
labeling work: every trace in
50
`results.json` carries a verdict,
51
and often a reward, before this
52
skill ever touches it. Converting
53
a graded trace into a training
54
row is mechanical — pick a shape
55
from `dataset-curation`'s table,
56
map fields, write JSONL.
57
**Curation is the work that
58
remains** — which traces clear a
59
quality bar, which pairs are
60
informative, and which rows must
61
never enter the training set at
62
all.
63
64
Treat any conversion step that
65
requires re-judging a trace as a
66
sign the harness is missing a
67
grader, not a gap this skill
68
should paper over. A trace with
69
no verdict or reward isn't
70
convertible yet — route it back
71
to `eval-harness-first` first,
72
don't hand-label it here to
73
unblock conversion.
74
75
## SFT From Traces
76
77
- **Keep the top-reward fraction
78
of successful trajectories**,
79
not every passing one. Rank
80
passing traces by reward and
81
take a fraction (the
82
Agent-lightning pattern) rather
83
than every trace that merely
84
cleared the pass bar — a trace
85
that barely passed is a weaker
86
SFT signal than one that scored
87
well above threshold.
88
- **Expert-corrected failures
89
become gold SFT examples
90
directly** (the Langfuse
91
pattern) — when a human edits a
92
failing trace's output into a
93
correct one, that correction
94
needs no reward threshold; a
95
human already validated it.
96
Route corrections straight into
97
the SFT set.
98
- **Step-level masking beats
99
whole-trajectory discard for
100
multi-step traces.** When only
101
some steps in a multi-step
102
trajectory are bad, mask the
103
loss on the bad steps and keep
104
the good ones, rather than
105
discarding the whole trajectory.
106
SRFT reports 32.2% vs. 30.9% on
107
SWE-bench for step-level critic
108
masking over trajectory discard
109
— a real, if modest, gap from
110
the finer-grained cut.
111
112
## Preference Pairs From Traces
113
114
- **Build pairs from
115
passing-vs-failing trajectories
116
on the SAME task**, never from
117
unrelated best- and
118
worst-scoring traces pulled
119
across different tasks —
120
cross-task pairs teach the
121
model to prefer one task over
122
another, not one response over
123
another.
124
- **Select the rejected member at
125
μ−2σ of the reward distribution
126
for that task, never the
127
absolute minimum.**
128
`preference-optimization`'s
129
Pair Construction section owns
130
the full selection formula;
131
this skill supplies the graded
132
trajectories it consumes.
133
- **Judge-scored delta selection
134
cuts pair volume without
135
cutting signal.** Score each
136
candidate pair by
137
chosen-minus-rejected judge
138
delta and keep only the
139
highest-delta subset — the top
140
5k of a 16.5k candidate pool
141
matched the full pool's
142
downstream result. Build the
143
full candidate set first, then
144
filter by delta; don't cap
145
generation at 5k up front.
146
147
## Hygiene
148
149
- **Scan for secrets and PII before any row ships,
150
and redact what's found.** Traces sourced from
151
production logs can carry credentials, API keys,
152
tokens, or customer data — run a secret/PII scan
153
over every SFT and DPO row and redact matches;
154
conversion fails closed (the row is dropped, not
155
shipped with the raw content) if sensitive fields
156
remain after redaction. Never commit secrets.
157
- **Eval goldens must never leak
158
into training data.** Hold
159
every `eval/goldens.jsonl` ID
160
out of every converted SFT and
161
DPO set — a trace that also
162
appears as a golden trains on
163
the exact item the checkpoint
164
gets graded against later,
165
silently inflating every
166
subsequent eval run.
167
- **Dedup against the training
168
set**, not just within the
169
newly converted rows —
170
exact-match or
171
embedding-similarity, matching
172
`dataset-curation`'s dedup
173
method field, run against
174
whatever training data already
175
exists before this batch merges
176
in.
177
- **Provenance goes into the
178
dataset card.** Every converted
179
row must trace back to its
180
source `run_id` and `trace_id`
181
— `dataset-curation`'s
182
Provenance field checks for
183
exactly this link back to
184
`trace-to-training-data`
185
output; a row with no traceable
186
source isn't ready to merge.
187
188
## Related Skills
189
190
- `eval-harness-first` — produces
191
the graded traces this skill
192
converts; a trace with no
193
verdict or reward isn't
194
convertible yet, route it back
195
there before conversion.
196
- `dataset-curation` — owns the
197
target formats and the dataset
198
card this skill's provenance
199
data feeds; converted rows must
200
match its Format Selection
201
table field names exactly, not
202
an approximation of them.
203
- `preference-optimization` —
204
consumes the DPO pairs this
205
skill builds and owns the full
206
μ−2σ rejection-selection
207
formula referenced above.
208
209
Worked JSONL-to-JSONL conversions
210
— graded trace to SFT row, trace
211
pair to DPO pair, correction to
212
SFT row, the rejection-sampling
213
loop, and the goldens-holdout
214
check — live in
215
`references/conversion-recipes.md`.
216

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…