Spaces:
Running
Running
Errors figure: one orange for errors, check/cross marks, color-blind safe
Browse files- unit2-errors-train-vs-eval.html +45 -19
unit2-errors-train-vs-eval.html
CHANGED
|
@@ -86,9 +86,14 @@
|
|
| 86 |
fixed: 'A tool error, and the run still passed every test. In training that\'s all 65 error traces, because failed runs were thrown away. At evaluation, 54 of the 269 runs with an error (20%).',
|
| 87 |
failed: 'A tool error the agent didn\'t recover from. The student never saw one of these in training, and 215 of its 771 evaluation runs end this way.',
|
| 88 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
let view = 'sft';
|
| 90 |
-
const DEFAULT_BASE = 'The base model, in the same evaluation job. It hits a tool error more often than the SFT model (50% of runs against 35%), and recovers from more of them (30% against 20%).';
|
| 91 |
-
const DEFAULT = 'Each square is 1% of the traces or runs. Errors are rare in what the student trained on and common in what it meets.
|
| 92 |
|
| 93 |
let width = 640, hover = null;
|
| 94 |
const svg = document.createElementNS(NS, 'svg');
|
|
@@ -105,16 +110,41 @@
|
|
| 105 |
buttons[key] = b; controls.appendChild(b);
|
| 106 |
});
|
| 107 |
ctx.root.append(svg, controls, note);
|
| 108 |
-
ctx.describe('Two grids of 100 squares, each square 1%. Left, the 1,380 traces the student trained on, where 65 (5%) contain a tool error and all of them end with the tests passing, because only passing traces were kept. Right, the 771 evaluation runs of the SFT model, where 269 (35%) hit a tool error, 54 of them still passed every test and 215 failed.');
|
| 109 |
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
|
| 116 |
function draw() {
|
| 117 |
const C = Hand.colors(ctx.root);
|
|
|
|
| 118 |
svg.replaceChildren();
|
| 119 |
const h = Hand.create(svg, { seed: 31 });
|
| 120 |
const narrow = width < 700;
|
|
@@ -131,19 +161,16 @@
|
|
| 131 |
const gy = 46;
|
| 132 |
let idx = 0;
|
| 133 |
KINDS.forEach((k, ki) => {
|
| 134 |
-
const
|
| 135 |
for (let c = 0; c < p.cells[ki]; c++, idx++) {
|
| 136 |
const col = idx % 10, row = Math.floor(idx / 10);
|
| 137 |
const x = x0 + col * cell, y = gy + row * cell;
|
| 138 |
-
const dim = hover && hover !== k.key;
|
| 139 |
const pad = cell > 18 ? 2 : 1.5;
|
| 140 |
-
|
| 141 |
-
const r =
|
| 142 |
-
Object.entries({ x, y, width: cell, height: cell, fill: 'transparent' }).forEach(([a, v]) => r.setAttribute(a, v));
|
| 143 |
r.style.cursor = 'pointer';
|
| 144 |
r.addEventListener('pointerenter', () => setHover(k.key));
|
| 145 |
r.addEventListener('click', () => setHover(k.key));
|
| 146 |
-
svg.appendChild(r);
|
| 147 |
}
|
| 148 |
});
|
| 149 |
const err = p.counts.fixed + p.counts.failed;
|
|
@@ -154,25 +181,24 @@
|
|
| 154 |
p.counts.failed === 0 ? 'all end with a fix' : `${p.counts.fixed} still passed (${rec}%)`]
|
| 155 |
: [`${err.toLocaleString('en-US')} of ${p.total.toLocaleString('en-US')} (${pct}%) with a tool error`,
|
| 156 |
p.counts.failed === 0 ? 'all of them end with a fix' : `${p.counts.fixed} of them still passed every test (${rec}%)`];
|
| 157 |
-
lines.forEach((l, li) => h.text(x0, gy + grid + 22 + li * 19, l, { size: fs, color: li === lines.length - 1 ? C.muted : C.ink }));
|
| 158 |
bottom = Math.max(bottom, gy + grid + 22 + (lines.length - 1) * 19);
|
| 159 |
});
|
| 160 |
-
// Legend.
|
| 161 |
let ly = bottom + 30;
|
| 162 |
let lx = 0;
|
| 163 |
KINDS.forEach((k) => {
|
| 164 |
-
const st = style(C, k.key);
|
| 165 |
const w = 22 + k.label.length * (narrow ? 6.6 : 7.2) + 18;
|
| 166 |
if (lx + w > width) { lx = 0; ly += 24; }
|
| 167 |
-
|
| 168 |
-
h.text(lx +
|
| 169 |
lx += w;
|
| 170 |
});
|
| 171 |
const H = ly + 10;
|
| 172 |
svg.setAttribute('viewBox', `0 0 ${width} ${H}`);
|
| 173 |
svg.setAttribute('height', H);
|
| 174 |
Object.entries(buttons).forEach(([k, b]) => b.setAttribute('aria-pressed', String(k === view)));
|
| 175 |
-
note.textContent = hover
|
| 176 |
}
|
| 177 |
function setHover(k) { hover = k; draw(); }
|
| 178 |
svg.addEventListener('pointerleave', () => { hover = null; draw(); }, { signal: ctx.signal });
|
|
|
|
| 86 |
fixed: 'A tool error, and the run still passed every test. In training that\'s all 65 error traces, because failed runs were thrown away. At evaluation, 54 of the 269 runs with an error (20%).',
|
| 87 |
failed: 'A tool error the agent didn\'t recover from. The student never saw one of these in training, and 215 of its 771 evaluation runs end this way.',
|
| 88 |
};
|
| 89 |
+
const NOTES_BASE = {
|
| 90 |
+
none: 'Runs where every run_python call worked. 95% of the training traces, 50% of the base model\'s evaluation runs.',
|
| 91 |
+
fixed: 'A tool error, and the run still passed every test. The base model recovers in 116 of its 385 runs with an error (30%).',
|
| 92 |
+
failed: 'A tool error the agent didn\'t recover from. 269 of the base model\'s 771 evaluation runs end this way.',
|
| 93 |
+
};
|
| 94 |
let view = 'sft';
|
| 95 |
+
const DEFAULT_BASE = 'The base model, in the same evaluation job. It hits a tool error more often than the SFT model (50% of runs against 35%), and recovers from more of them (30% against 20%). Switch back to the SFT model to compare.';
|
| 96 |
+
const DEFAULT = 'Each square is 1% of the traces or runs. Errors are rare in what the student trained on and common in what it meets. Switch to the base model to compare, or hover a square.';
|
| 97 |
|
| 98 |
let width = 640, hover = null;
|
| 99 |
const svg = document.createElementNS(NS, 'svg');
|
|
|
|
| 110 |
buttons[key] = b; controls.appendChild(b);
|
| 111 |
});
|
| 112 |
ctx.root.append(svg, controls, note);
|
| 113 |
+
ctx.describe('Two grids of 100 squares, each square 1%. Squares with a tool error are orange, with a check mark if the run still passed every test and a cross if it failed. Left, the 1,380 traces the student trained on, where 65 (5%) contain a tool error and all of them end with the tests passing, because only passing traces were kept. Right, the 771 evaluation runs of the SFT model, where 269 (35%) hit a tool error, 54 of them still passed every test and 215 failed. A button switches the right grid to the base model, where 385 of 771 runs (50%) hit a tool error and 116 of them still passed.');
|
| 114 |
|
| 115 |
+
// One strong hue for every run with a tool error. Recovered runs get a tinted fill and a check mark,
|
| 116 |
+
// failed runs a solid fill and a cross, so the two differ in lightness and in shape, not only in color.
|
| 117 |
+
function palette() {
|
| 118 |
+
const dark = document.documentElement.getAttribute('data-theme') === 'dark';
|
| 119 |
+
return dark
|
| 120 |
+
? { err: '#ff922b', errTint: 'rgba(255, 146, 43, 0.30)', onErr: '#0f1115', check: '#ffc078', none: 'rgba(255, 255, 255, 0.28)', noneFill: 'rgba(255, 255, 255, 0.04)' }
|
| 121 |
+
: { err: '#e8590c', errTint: 'rgba(232, 89, 12, 0.24)', onErr: '#ffffff', check: '#c2410c', none: 'rgba(0, 0, 0, 0.26)', noneFill: 'rgba(0, 0, 0, 0.02)' };
|
| 122 |
+
}
|
| 123 |
+
function el(tag, attrs, parent) {
|
| 124 |
+
const n = document.createElementNS(NS, tag);
|
| 125 |
+
Object.entries(attrs).forEach(([a, v]) => n.setAttribute(a, v));
|
| 126 |
+
parent.appendChild(n);
|
| 127 |
+
return n;
|
| 128 |
+
}
|
| 129 |
+
// A square of side s at (x, y), with its mark.
|
| 130 |
+
function square(parent, P, key, x, y, s) {
|
| 131 |
+
const r = Math.min(3, s / 5);
|
| 132 |
+
if (key === 'none') {
|
| 133 |
+
el('rect', { x: x + 0.5, y: y + 0.5, width: s - 1, height: s - 1, rx: r, fill: P.noneFill, stroke: P.none, 'stroke-width': 1 }, parent);
|
| 134 |
+
return;
|
| 135 |
+
}
|
| 136 |
+
const solid = key === 'failed';
|
| 137 |
+
el('rect', { x: x + 0.75, y: y + 0.75, width: s - 1.5, height: s - 1.5, rx: r, fill: solid ? P.err : P.errTint, stroke: P.err, 'stroke-width': 1.5 }, parent);
|
| 138 |
+
const m = s * 0.3, cx = x + s / 2, cy = y + s / 2;
|
| 139 |
+
const d = solid
|
| 140 |
+
? `M${cx - m * 0.8},${cy - m * 0.8} L${cx + m * 0.8},${cy + m * 0.8} M${cx + m * 0.8},${cy - m * 0.8} L${cx - m * 0.8},${cy + m * 0.8}`
|
| 141 |
+
: `M${cx - m},${cy + m * 0.05} L${cx - m * 0.3},${cy + m * 0.7} L${cx + m},${cy - m * 0.7}`;
|
| 142 |
+
el('path', { d, fill: 'none', stroke: solid ? P.onErr : P.check, 'stroke-width': Math.max(1.6, s / 9), 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }, parent);
|
| 143 |
}
|
| 144 |
|
| 145 |
function draw() {
|
| 146 |
const C = Hand.colors(ctx.root);
|
| 147 |
+
const P = palette();
|
| 148 |
svg.replaceChildren();
|
| 149 |
const h = Hand.create(svg, { seed: 31 });
|
| 150 |
const narrow = width < 700;
|
|
|
|
| 161 |
const gy = 46;
|
| 162 |
let idx = 0;
|
| 163 |
KINDS.forEach((k, ki) => {
|
| 164 |
+
const g = el('g', { opacity: hover && hover !== k.key ? 0.3 : 1 }, svg);
|
| 165 |
for (let c = 0; c < p.cells[ki]; c++, idx++) {
|
| 166 |
const col = idx % 10, row = Math.floor(idx / 10);
|
| 167 |
const x = x0 + col * cell, y = gy + row * cell;
|
|
|
|
| 168 |
const pad = cell > 18 ? 2 : 1.5;
|
| 169 |
+
square(g, P, k.key, x + pad, y + pad, cell - 2 * pad);
|
| 170 |
+
const r = el('rect', { x, y, width: cell, height: cell, fill: 'transparent' }, svg);
|
|
|
|
| 171 |
r.style.cursor = 'pointer';
|
| 172 |
r.addEventListener('pointerenter', () => setHover(k.key));
|
| 173 |
r.addEventListener('click', () => setHover(k.key));
|
|
|
|
| 174 |
}
|
| 175 |
});
|
| 176 |
const err = p.counts.fixed + p.counts.failed;
|
|
|
|
| 181 |
p.counts.failed === 0 ? 'all end with a fix' : `${p.counts.fixed} still passed (${rec}%)`]
|
| 182 |
: [`${err.toLocaleString('en-US')} of ${p.total.toLocaleString('en-US')} (${pct}%) with a tool error`,
|
| 183 |
p.counts.failed === 0 ? 'all of them end with a fix' : `${p.counts.fixed} of them still passed every test (${rec}%)`];
|
| 184 |
+
lines.forEach((l, li) => h.text(x0, gy + grid + 22 + li * 19, l, { size: fs, color: li === lines.length - 1 ? C.muted : C.ink, weight: li === 0 ? 600 : undefined }));
|
| 185 |
bottom = Math.max(bottom, gy + grid + 22 + (lines.length - 1) * 19);
|
| 186 |
});
|
| 187 |
+
// Legend, with the same marks as the grids.
|
| 188 |
let ly = bottom + 30;
|
| 189 |
let lx = 0;
|
| 190 |
KINDS.forEach((k) => {
|
|
|
|
| 191 |
const w = 22 + k.label.length * (narrow ? 6.6 : 7.2) + 18;
|
| 192 |
if (lx + w > width) { lx = 0; ly += 24; }
|
| 193 |
+
square(svg, P, k.key, lx, ly - 13, 16);
|
| 194 |
+
h.text(lx + 22, ly, k.label, { size: fs, color: C.muted });
|
| 195 |
lx += w;
|
| 196 |
});
|
| 197 |
const H = ly + 10;
|
| 198 |
svg.setAttribute('viewBox', `0 0 ${width} ${H}`);
|
| 199 |
svg.setAttribute('height', H);
|
| 200 |
Object.entries(buttons).forEach(([k, b]) => b.setAttribute('aria-pressed', String(k === view)));
|
| 201 |
+
note.textContent = hover ? (view === 'base' ? NOTES_BASE : NOTES)[hover] : (view === 'base' ? DEFAULT_BASE : DEFAULT);
|
| 202 |
}
|
| 203 |
function setHover(k) { hover = k; draw(); }
|
| 204 |
svg.addEventListener('pointerleave', () => { hover = null; draw(); }, { signal: ctx.signal });
|