Contact sheet
The exact same 9 held-out test tasks (first three of metaball, spiral, wobble — not cherry-picked).
Toggle between Run 4 (after closing the compiler and pixel-metric loopholes) and Run 2 (before the fixes) to inspect every shader live in WebGL2.
Four runs, four exploits
All rows evaluated on the exact same 150 held-out-family tasks behind Khronos glslangValidator (strict GLSL ES 3.00).
| run | setup | compile | v1 pixel pass | v2 shape pass | honest pass | what happened |
|---|---|---|---|---|---|---|
| base | Qwen2.5-Coder-1.5B | 26.7% | 0.7% | 0.0% | 0.0% | Rarely emits valid Shadertoy GLSL |
| Run 2 | SFT 2400 + GRPO v1 (loose Mesa) | 69.3% | 48.7% | 36.7% | 36.7% | Wobble 55/55 honest; spiral Mesa bug (0/46 strict); metaball cross hack (18/49 fooled v1) |
| Run 3 | SFT 2400 + GRPO v1 (strict glslang) | 62.7% | 4.7% | 0.7% | 0.7% | Driver bug & cross dead; overfit SFT (loss 0.0003) killed wobble (0/55); 6/7 spirals were abs(atan) mirrors |
| Run 4 | SFT 480 + GRPO v2 (strict + Sobel) | 99.3% | 72.7% | 34.0% | 32.7% | Spiral 46/46 (100%, sim 0.998) honest; cross & mirror hacks 0/95; caught single-blob metaball shortcut (47/49 rejected by v2) |
Why v1 (72.7%) lies on Run 4: once v2 killed the Run 2 cross hack, GRPO invented a smarter shortcut on metaball — draw Blob A as an exact circle length(p - c) < r and omit Blob B. That single-blob shortcut clears v1 on 49/49 (100%), whereas v2 (0.30·SSIM + 0.35·(1−2·RMSE) + 0.35·SobelDice) catches and rejects 47 of 49 (median 0.724; only 2 scanline-heavy frames slip past 0.85). Honest strict passes in Run 4: 46/46 spirals + 3/55 phase-aligned wobbles = 49/150 (32.7%).
Why Run 3 collapsed: the SFT inverted-U cliff
Before starting Run 4 GRPO, we probed pass@16 (T = 1.15, strict glslang + v2 reward) on 4 held-out prompts per family across SFT warm-start lengths (seen families only, lr = 5e-5):
| SFT samples (steps) | final loss | wobble compile / std>0 | metaball compile / std>0 | spiral compile / std>0 | active groups |
|---|---|---|---|---|---|
| 0 (base) | — | 0.0% · 0/4 | 4.7% · 2/4 | 0.0% · 0/4 | 2 / 12 |
| 80 (10) | 0.246 | 0.0% · 0/4 | 6.2% · 2/4 | 0.0% · 0/4 | 2 / 12 |
| 160 (20) | 0.141 | 4.7% · 2/4 | 7.8% · 3/4 | 1.6% · 1/4 | 6 / 12 |
| 320 (40) | 0.041 | 18.8% · 4/4 (pass 1/4) | 75.0% · 4/4 (pass 1/4) | 1.6% · 1/4 | 9 / 12 |
| 480 (60) · Run 4 | 0.0046 | 17.2% · 4/4 (pass 2/4) | 76.6% · 4/4 | 17.2% · 4/4 (pass 1/4) | 12 / 12 |
| 640 (80) | 0.019 | 9.4% · 3/4 | 93.8% · 4/4 | 6.2% · 3/4 (pass 1/4) | 10 / 12 |
| 2400 (300 · Run 3) | 0.0003 | 0.0% (dead) | 100% (wrong template) | 17% (abs(atan)) | collapsed |
Too little SFT (0–160) leaves the model unable to emit valid Shadertoy boilerplate; too much SFT (640–2400) crushes logit entropy and erases coding diversity before RL begins. At 480 seen-only examples, all 12/12 held-out prompts produce nonzero GRPO gradient, pushing Run 4 compile rate to 99.3% and held-out shape similarity from 0.134 → 0.756.
Run 4 breakdown & honest tradeoffs
Spiral: 0/46 → 46/46 (100%, mean sim_v2 0.998, min 0.939). Every single spiral compiles under Khronos glslangValidator and WebGL2, uses the true signed atan(p.y, p.x) formula (0/46 abs(atan) mirrors), and matches pixel-for-pixel.
Metaball: cross hack killed (0/49), single-blob shortcut discovered. GRPO replaced Run 2’s cross with an exact circle at Blob A (length(p - c) < r), dropping Blob B. That scores 0.93 median under v1 (49/49 fooled) but 0.724 median under v2 (47/49 rejected).
Wobble: 54/55 compile, phase-shift local optimum. GRPO fixed the Run 3 u/v declaration error and learned uv.x + amp * sin(...) on all 55 tasks, but settled on p.y (shifted by −0.5 from uv.y) and a sticky constant near 2.19 * pi, so only 3/55 clear 0.85 under v2.
Stability-plasticity tradeoff: training 80% held-out / 20% seen from the lighter sft_480 warm start pushed unseen similarity 5.6× higher, while seen-family test_iid_a dipped from 89% → 66% (v2) / 91% → 77% (v1).
Runs 2 & 3: the earlier exploits we closed
Run 2 wobble (55/55 honest): SFT never produced a compiling wobble shader; GRPO discovered x + a·sin(2π·f·y) from pixels alone. Run 2 metaball cross (18/49 fooled): two bars through the blob centres cleared pixel similarity v1. Run 2 spiral driver bug: assigning vec2 to float passed an old Mesa build on the GPU box (98% there, 0% in strict WebGL2). Adding glslangValidator in Run 3 killed the driver bug and the cross, exposing the mirrored abs(atan) spiral hack (6/7 passes) and the SFT overfitting cliff.
Playground: concentric rings
The task generator in miniature. Move a slider and the spec, the shader and the live WebGL2 render change together.