xingxm commited on
Commit
dfa1204
Β·
verified Β·
1 Parent(s): 21d3433

Add evaluator models (9B step100, 27B step296): checkpoints, benchmark, usage

Browse files
Files changed (1) hide show
  1. README.md +187 -7
README.md CHANGED
@@ -11,6 +11,8 @@ tags:
11
  - javascript
12
  - code-generation
13
  - full-sft
 
 
14
  ---
15
 
16
  # DesignCoder
@@ -18,14 +20,25 @@ tags:
18
  Checkpoint collection for **DesignCoder**, a family of full-parameter SFT models for UI design
19
  research and end-to-end HTML/CSS/JavaScript implementation.
20
 
 
 
 
 
 
 
 
 
 
 
21
  Each subfolder in this repository is a self-contained, directly loadable checkpoint.
22
 
23
  ## Naming convention
24
 
25
  ```
26
- designcoder_{basemodel}_{size}_{optimizer}_bs{global_batch}[_{extra_axes}]_step{global_step}
27
  ```
28
 
 
29
  - `basemodel` / `size`: base model family and parameter scale
30
  - `optimizer`: `muon` or `adamw`
31
  - `bs`: global batch size (`per_device Γ— grad_accum Γ— world_size`)
@@ -35,16 +48,22 @@ designcoder_{basemodel}_{size}_{optimizer}_bs{global_batch}[_{extra_axes}]_step{
35
 
36
  ## Dataset revisions
37
 
38
- Checkpoints in this repository come from two different dataset revisions. **Scores and loss
39
  values are only comparable within the same revision.**
40
 
41
- | Tag | Samples | Used by |
42
- |---|---:|---|
43
- | *(untagged)* `data37865` | 37,865 | `*_step1900`, `*_step3800` |
44
- | `data41287` | 41,287 | `*_data41287_step200`, `*_data41287_step400` |
 
 
 
 
45
 
46
  ## Checkpoints
47
 
 
 
48
  | Subfolder | Base model | Optimizer | LR | Global batch | Dataset | Step | bench-200 (full, n=200) | Notes |
49
  |---|---|---|---|---|---|---|---|---|
50
  | `designcoder_qwen3.5_4b_muon_bs32_step1900` | Qwen3.5-4B | Muon | 1e-5 | 32 | 37,865 | 1900 | – | smallest of the first release |
@@ -59,6 +78,29 @@ values are only comparable within the same revision.**
59
  All four `data41287` scores are **final full-benchmark runs: 200/200 rollouts, 200/200
60
  screenshot captures, 200/200 judge evaluations** per model (no subsetting).
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  ## Benchmark
63
 
64
  `bench-200` is the frozen 200-case DesignCoder benchmark (100 Track A landing, 40 Track A
@@ -133,8 +175,80 @@ subset score collapsed from 84.22 to 68.35. **Do not pick checkpoints from this
133
  loss.** Note also that small subsets systematically overestimate: the subset ranks checkpoints
134
  correctly but runs several points above the full 200-case benchmark.
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  ## Shared training setup
137
 
 
 
138
  - Objective: full-parameter supervised fine-tuning (no LoRA / adapters)
139
  - Dataset: `designcoder_sft_v2_train` in ShareGPT format (see revision table above)
140
  - Chat template: `qwen3_5` with thinking enabled
@@ -142,8 +256,19 @@ correctly but runs several points above the full 200-case benchmark.
142
  - Sequence packing: enabled, with neat packing (no cross-sample attention)
143
  - LR schedule: cosine, warmup ratio 0.1
144
 
 
 
 
 
 
 
 
 
 
145
  ## Usage
146
 
 
 
147
  ```python
148
  from transformers import AutoModelForCausalLM, AutoProcessor
149
 
@@ -160,7 +285,7 @@ To download a single checkpoint only:
160
  hf download xingxm/DesignCoder --include "designcoder_qwen3.8_27b_adamw_bs128_data41287_step400/*" --local-dir ./DesignCoder
161
  ```
162
 
163
- ### Inference contract
164
 
165
  These models are trained as tool-using agents, not single-turn generators. A case runs
166
  `design_search` β†’ (`websearch`, landing only) β†’ a final answer containing exactly three code
@@ -169,6 +294,61 @@ format from `examples/designcoder/runtime/infer_designcoder.py`; prompting with
169
  instruction and no tool turns does not match the training distribution and will score far
170
  below the numbers above.
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  ## Provenance
173
 
174
  Each subfolder additionally ships `trainer_state.json` / `trainer_log.jsonl` (and
 
11
  - javascript
12
  - code-generation
13
  - full-sft
14
+ - evaluator
15
+ - reward-model
16
  ---
17
 
18
  # DesignCoder
 
20
  Checkpoint collection for **DesignCoder**, a family of full-parameter SFT models for UI design
21
  research and end-to-end HTML/CSS/JavaScript implementation.
22
 
23
+ The repository holds **two kinds of model**:
24
+
25
+ | Kind | What it does | Folder prefix |
26
+ |---|---|---|
27
+ | **Generation** | writes HTML/CSS/JS from a design brief | `designcoder_{basemodel}_...` |
28
+ | **Evaluator** | scores a rendered UI screenshot against a rubric | `designcoder_evaluator_{basemodel}_...` |
29
+
30
+ They are trained on **different datasets** and answer **different inputs** β€” an evaluator will
31
+ not generate pages, and a generation model will not produce valid rubric verdicts.
32
+
33
  Each subfolder in this repository is a self-contained, directly loadable checkpoint.
34
 
35
  ## Naming convention
36
 
37
  ```
38
+ designcoder_[evaluator_]{basemodel}_{size}_{optimizer}_bs{global_batch}[_{extra_axes}]_step{global_step}
39
  ```
40
 
41
+ - `evaluator`: present only for rubric-scoring models; absent means generation
42
  - `basemodel` / `size`: base model family and parameter scale
43
  - `optimizer`: `muon` or `adamw`
44
  - `bs`: global batch size (`per_device Γ— grad_accum Γ— world_size`)
 
48
 
49
  ## Dataset revisions
50
 
51
+ Checkpoints in this repository come from three different dataset revisions. **Scores and loss
52
  values are only comparable within the same revision.**
53
 
54
+ | Tag | Samples | Dataset | Used by |
55
+ |---|---:|---|---|
56
+ | *(untagged)* `data37865` | 37,865 | `designcoder_sft_v2` (generation) | `*_step1900`, `*_step3800` |
57
+ | `data41287` | 41,287 | `designcoder_sft_v2` (generation) | `*_data41287_step200`, `*_data41287_step400` |
58
+ | `data37847` | 37,847 | **`DesignCoder-evaluate`** (screenshot scoring) | `designcoder_evaluator_*` |
59
+
60
+ > ⚠️ `data37847` and `data37865` are **entirely different datasets** β€” the near-identical
61
+ > sample counts are a coincidence. Never compare loss across them.
62
 
63
  ## Checkpoints
64
 
65
+ ### Generation models
66
+
67
  | Subfolder | Base model | Optimizer | LR | Global batch | Dataset | Step | bench-200 (full, n=200) | Notes |
68
  |---|---|---|---|---|---|---|---|---|
69
  | `designcoder_qwen3.5_4b_muon_bs32_step1900` | Qwen3.5-4B | Muon | 1e-5 | 32 | 37,865 | 1900 | – | smallest of the first release |
 
78
  All four `data41287` scores are **final full-benchmark runs: 200/200 rollouts, 200/200
79
  screenshot captures, 200/200 judge evaluations** per model (no subsetting).
80
 
81
+ ### Evaluator models
82
+
83
+ Rubric scorers for UI screenshots β€” intended as reward / judge models during rollout, **not**
84
+ for page generation. Trained on `DesignCoder-evaluate` (37,847 samples), evaluated on
85
+ held-out benchmark screenshots scored by a stronger external vision judge (ΞΊ = agreement
86
+ with that judge; see [Evaluator benchmark](#evaluator-benchmark)).
87
+
88
+ | Subfolder | Base model | Optimizer | LR | Global batch | Dataset | Step | OOD ΞΊ | Notes |
89
+ |---|---|---|---|---|---|---|---:|---|
90
+ | `designcoder_evaluator_qwen3.5_9b_adamw_bs256_data37847_step100` | Qwen3.5-9B | AdamW | 1e-5 | 256 | 37,847 | 100 | **0.694** | 1/3 memory, 2Γ— speed; **requires exactly 10-item rubrics** |
91
+ | `designcoder_evaluator_qwen3.8_27b_adamw_bs256_data37847_step296` | Qwen3.8-27B | AdamW | 5e-6 | 256 | 37,847 | 296 | 0.664 | **robust to any rubric length** β€” default choice |
92
+
93
+ **Which one to use.** Counter-intuitively the 9B has slightly *higher* agreement; the 27B's
94
+ advantage is **format robustness**. Verdict-count exact match across rubric lengths:
95
+
96
+ | Rubric items | 5 | 10 | 15 | 20 | 25 |
97
+ |---|---:|---:|---:|---:|---:|
98
+ | 9B step100 | 0.00 | **1.00** | 0.92 | 0.94 | 0.85 |
99
+ | 27B step296 | **1.00** | **1.00** | **0.99** | **1.00** | **1.00** |
100
+
101
+ Training rubrics are always exactly 10 items, so anything else is out-of-distribution.
102
+ Use the 9B when your rubric is fixed at 10 items; use the 27B otherwise.
103
+
104
  ## Benchmark
105
 
106
  `bench-200` is the frozen 200-case DesignCoder benchmark (100 Track A landing, 40 Track A
 
175
  loss.** Note also that small subsets systematically overestimate: the subset ranks checkpoints
176
  correctly but runs several points above the full 200-case benchmark.
177
 
178
+ ## Evaluator benchmark
179
+
180
+ `DesignCoder-evaluate` ships **no test split**, and both evaluators trained on all 37,847
181
+ samples for 2 epochs β€” so there is no clean in-training validation set. Evaluation instead
182
+ uses **held-out inputs**: 239 generated-page screenshots from the DesignCoder benchmark, each
183
+ already scored check-by-check by a stronger external vision judge. A byte-level md5 check
184
+ confirmed **0 overlap** between those benchmark screenshots and the 37,851 training images.
185
+
186
+ Alignment is possible because the training target's `frozen_dynamic_scores.verdicts` and the
187
+ external judge's `verdict` are both binary and share the same `(dimension, point)` structure.
188
+
189
+ **Headline metrics** (239 held-out cases, original 24–25-item benchmark rubrics):
190
+
191
+ | Metric | 9B step100 | 27B step296 |
192
+ |---|---:|---:|
193
+ | JSON parse rate | 1.0000 | **1.0000** |
194
+ | Per-check agreement | 0.9226 | **0.9313** |
195
+ | Cohen's ΞΊ vs external judge | 0.6353 | **0.6802** |
196
+ | Defect recall (verdict = 0) | 0.6581 | **0.6996** |
197
+ | Case-level Pearson | 0.8417 | **0.8572** |
198
+
199
+ Raw agreement is a weak signal here β€” 87% of checks are `1`, so always-pass already scores
200
+ ~88%. **ΞΊ and defect recall are the meaningful numbers.**
201
+
202
+ **Reproducing the known quality ordering.** The external judge ranks three generation
203
+ checkpoints 4B `0.833` < 9B `0.884` < 27B `0.905`. Both published evaluators recover that
204
+ ordering to within ~2pp:
205
+
206
+ | Scorer | 4B | 9B | 27B | Ordering |
207
+ |---|---:|---:|---:|---|
208
+ | External judge (reference) | 0.833 | 0.884 | 0.905 | – |
209
+ | Evaluator 9B step100 | 0.855 | 0.886 | 0.910 | βœ… |
210
+ | Evaluator 27B step296 | 0.840 | 0.893 | 0.909 | βœ… |
211
+
212
+ ### Evaluator checkpoint selection
213
+
214
+ Checkpoints were chosen on a purpose-built **out-of-distribution suite** (576 prompts:
215
+ rubric lengths 5/10/15/20/25 Γ— three dimension-grouping shapes), not on training loss.
216
+ The two families behave differently:
217
+
218
+ | Run | Step | Train loss | OOD ΞΊ | Overfit gap (in-dist βˆ’ OOD) |
219
+ |---|---:|---:|---:|---:|
220
+ | 9B AdamW | 50 | – | 0.6568 | +0.004 |
221
+ | 9B AdamW | **100** | 0.4956 | **0.6943** | +0.007 |
222
+ | 9B AdamW | 150 | – | 0.6730 | +0.018 |
223
+ | 9B AdamW | 200 | – | 0.6649 | +0.011 |
224
+ | 9B AdamW | 250 | – | 0.6765 | βˆ’0.019 |
225
+ | 9B AdamW | 296 (final) | 0.4358 | 0.6501 | +0.027 |
226
+ | 27B AdamW | 200 | – | 0.6625 | +0.002 |
227
+ | 27B AdamW | **296 (final)** | 0.4246 | **0.6640** | βˆ’0.029 |
228
+
229
+ The 9B reproduces the "loss keeps falling, held-out quality degrades" pattern seen in the
230
+ generation runs β€” but peaks **much earlier** (~34% of training vs ~75%). The 27B shows no
231
+ late-training degradation, so its final checkpoint is published.
232
+
233
+ ### Evaluator optimizer ablation
234
+
235
+ A 9B run with **Muon + `pure_bf16`** (identical data, batch, and steps) failed badly:
236
+
237
+ | | Muon + pure_bf16 | AdamW + ZeRO-3 |
238
+ |---|---:|---:|
239
+ | Final train loss | 0.7505 | **0.4358** |
240
+ | Truncated generations | 14 / 389 | **0 / 389** |
241
+ | Cohen's ΞΊ | 0.4831 | **0.6353** |
242
+ | Quality ordering | ❌ inverted | βœ… correct |
243
+
244
+ The Muon arm stalled early (loss 1.376 β†’ 1.138 over 50 steps) and degenerated into repetition
245
+ loops hitting the 8192-token cap. It is not published. **Do not use Muon + `pure_bf16` for
246
+ this task** β€” note this differs from the generation family, where Muon is viable.
247
+
248
  ## Shared training setup
249
 
250
+ **Generation models**
251
+
252
  - Objective: full-parameter supervised fine-tuning (no LoRA / adapters)
253
  - Dataset: `designcoder_sft_v2_train` in ShareGPT format (see revision table above)
254
  - Chat template: `qwen3_5` with thinking enabled
 
256
  - Sequence packing: enabled, with neat packing (no cross-sample attention)
257
  - LR schedule: cosine, warmup ratio 0.1
258
 
259
+ **Evaluator models**
260
+
261
+ - Objective: full-parameter SFT, **vision tower frozen** (LM + multimodal projector tuned)
262
+ - Dataset: `DesignCoder-evaluate`, 37,847 samples, one screenshot per sample
263
+ - Chat template: `qwen3_5` with thinking enabled; context length 32,768
264
+ - `image_max_pixels`: 1,048,576 β€” inputs must be downscaled the same way at inference
265
+ - Precision / parallel: bf16 + DeepSpeed ZeRO-3; 2 epochs, global batch 256
266
+ - LR schedule: cosine, warmup ratio 0.1
267
+
268
  ## Usage
269
 
270
+ ### Generation models
271
+
272
  ```python
273
  from transformers import AutoModelForCausalLM, AutoProcessor
274
 
 
285
  hf download xingxm/DesignCoder --include "designcoder_qwen3.8_27b_adamw_bs128_data41287_step400/*" --local-dir ./DesignCoder
286
  ```
287
 
288
+ #### Inference contract
289
 
290
  These models are trained as tool-using agents, not single-turn generators. A case runs
291
  `design_search` β†’ (`websearch`, landing only) β†’ a final answer containing exactly three code
 
294
  instruction and no tool turns does not match the training distribution and will score far
295
  below the numbers above.
296
 
297
+ ### Evaluator models
298
+
299
+ Note the different loader class (`AutoModelForImageTextToText`) β€” `AutoModelForCausalLM`
300
+ resolves to a text-only shell and `generate()` will reject the image tensors.
301
+
302
+ ```python
303
+ from transformers import AutoModelForImageTextToText, AutoProcessor, AutoTokenizer
304
+ from PIL import Image
305
+ import torch, math
306
+
307
+ repo = "xingxm/DesignCoder"
308
+ subfolder = "designcoder_evaluator_qwen3.8_27b_adamw_bs256_data37847_step296"
309
+
310
+ tok = AutoTokenizer.from_pretrained(repo, subfolder=subfolder, trust_remote_code=True)
311
+ proc = AutoProcessor.from_pretrained(repo, subfolder=subfolder, trust_remote_code=True)
312
+ model = AutoModelForImageTextToText.from_pretrained(
313
+ repo, subfolder=subfolder, dtype=torch.bfloat16, device_map="cuda", trust_remote_code=True
314
+ )
315
+
316
+ img = Image.open("screenshot.png").convert("RGB")
317
+ w, h = img.size # match training preprocessing
318
+ if w * h > 1048576:
319
+ s = math.sqrt(1048576 / (w * h))
320
+ img = img.resize((int(w * s), int(h * s)))
321
+
322
+ user = (
323
+ "<image>\n"
324
+ "Evaluate the attached UI screenshot using the selected visual criteria.\n\n"
325
+ "<surface>\nlanding\n</surface>\n\n"
326
+ "<generation_brief>\n...brief...\n</generation_brief>\n\n"
327
+ '<frozen_rubric>\n{"rubric":{"Alignment":["..."],"Layout":["..."]}}\n</frozen_rubric>'
328
+ )
329
+ text = tok.apply_chat_template(
330
+ [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user}],
331
+ tokenize=False, add_generation_prompt=True,
332
+ ).replace("<image>", "<|vision_start|><|image_pad|><|vision_end|>")
333
+
334
+ inputs = proc(text=[text], images=[img], return_tensors="pt").to("cuda")
335
+ out = model.generate(**inputs, max_new_tokens=4096, do_sample=False)
336
+ print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
337
+ ```
338
+
339
+ #### Evaluator inference contract
340
+
341
+ - `SYSTEM_PROMPT` must be the one shipped with the `DesignCoder-evaluate` dataset β€” it
342
+ enumerates the rubric namespace the model was trained against.
343
+ - The chat template already ends with `<think>\n`, so generated text continues *inside* the
344
+ reasoning block and carries **no opening `<think>` tag**. Split on `</think>` to reach the
345
+ JSON payload.
346
+ - Downscale images to ≀ 1,048,576 px as shown; larger inputs drift from training.
347
+ - Parse `frozen_dynamic_scores.verdicts`. **Ignore the sibling `summary` string** β€” it
348
+ miscounts (e.g. reads `"24/24"` next to 25 emitted verdicts) in both models.
349
+ - `static_scores` / `dynamic_scores` (40 items, 0/1/2) have **no held-out validation** β€” they
350
+ were only checked against contaminated training samples. Treat them as unverified.
351
+
352
  ## Provenance
353
 
354
  Each subfolder additionally ships `trainer_state.json` / `trainer_log.jsonl` (and