Kaori1707 commited on
Commit
eb27a71
·
verified ·
1 Parent(s): f219928

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: codey-bench
3
+ license: cc-by-nc-4.0
4
+ language:
5
+ - ko
6
+ - en
7
+ task_categories:
8
+ - text-generation
9
+ tags:
10
+ - structured-output
11
+ - json
12
+ - web-design
13
+ - codey
14
+ size_categories:
15
+ - n<1K
16
+ configs:
17
+ - config_name: ko
18
+ default: true
19
+ data_files:
20
+ - split: test
21
+ path: data/ko/test.jsonl
22
+ - config_name: en
23
+ data_files:
24
+ - split: test
25
+ path: data/en/test.jsonl
26
+ - config_name: ko-synth
27
+ data_files:
28
+ - split: test
29
+ path: data/ko-synth/test.jsonl
30
+ ---
31
+
32
+ # codey-bench
33
+
34
+ A benchmark for one task: a product brief for a web page goes in as Markdown, and one
35
+ **CodeyDesignDocument V1** (CDD) JSON document comes out. A generation passes when it parses
36
+ as JSON and the CDD validator accepts it. The validator — JSON Schema plus render-readiness
37
+ "gate" checks — is the judge; a reference document per brief gives an informative
38
+ section-recall score.
39
+
40
+ Built for the [Coding-LLM](https://github.com/AISeedHub/Coding-LLM) repository, where the same
41
+ validator is the verdict the `codey-dev` agent harness applies to its own output. The bench
42
+ measures two things with one dataset: a model called once (brief → document) and an agent
43
+ workflow that must write the document to disk.
44
+
45
+ ## Configs
46
+
47
+ | config | rows | language | briefs | reference documents |
48
+ |---|---|---|---|---|
49
+ | `ko` (default) | 20 | Korean | human-written PM documents (기획·화면 설계서) | human-authored, pass schema **and** gate |
50
+ | `en` | 99 | English | gpt-4.1-synthesized PM documents | gpt-4.1-synthesized, pass schema, **fail gate** |
51
+ | `ko-synth` | 98 | Korean | Korean twins of `en` (same `id`) | as `en` |
52
+
53
+ `ko` is the held-out 20 % of the 100 human documents that the `codey-8b` model was fine-tuned
54
+ on (seed 42 split, by document) — the other 80 are training data and are not in the bench.
55
+ `en` and `ko-synth` were never used in training. The one synthesized document that fails the
56
+ schema (`design-store-074`) is dropped; `manifest.json` lists it.
57
+
58
+ **Gold caveat.** The synthesized references predate the gate rules: every one carries asset
59
+ metadata keys the renderer forbids (`author`, `authorUrl`, `license`, `sourceUrl`, `thumbUrl`)
60
+ and many have `href` values that name no section. They pass the schema and are good for
61
+ section recall, but a model that copied their style would fail the gate. The
62
+ `gold_gate_errors` column records this per row; it is 0 for every `ko` row.
63
+
64
+ ## Fields
65
+
66
+ | field | type | description |
67
+ |---|---|---|
68
+ | `id` | string | document id, e.g. `design-002-hair-salon-premium-women`; `en` and `ko-synth` share ids |
69
+ | `lang` | string | `ko` or `en` |
70
+ | `domain` | string | business domain slug taken from the source file name |
71
+ | `brief` | string | the Markdown brief, provenance comment stripped — send as the user message |
72
+ | `reference` | string | the gold CDD document as a JSON string (`json.loads` it) |
73
+ | `gold_schema_valid` | bool | always `true` (schema failures are dropped) |
74
+ | `gold_gate_errors` | int | number of gate errors the reference itself raises |
75
+ | `source` | string | source file under the repository's `data/` |
76
+
77
+ `system_prompt.txt` is the system message every row expects: the task statement plus the
78
+ rendered CDD contract (section types, block types, theme tokens, emit rules). It ends with
79
+ "Answer with one JSON object and nothing else."
80
+
81
+ ## Use
82
+
83
+ Load:
84
+
85
+ ```python
86
+ from datasets import load_dataset
87
+ ds = load_dataset("AISeedCorp/codey-bench", "ko", split="test")
88
+ ```
89
+
90
+ Prompt a chat model with the shared system prompt and one brief:
91
+
92
+ ```python
93
+ system = open("system_prompt.txt").read() # from this repo
94
+ messages = [{"role": "system", "content": system}, {"role": "user", "content": ds[0]["brief"]}]
95
+ ```
96
+
97
+ Verify with the repository's validator (the verifier is code, so it lives there, not here):
98
+
99
+ ```bash
100
+ git clone https://github.com/AISeedHub/Coding-LLM && cd Coding-LLM && uv sync --all-groups
101
+ # write each generation to <dir>/<id>.design.json, then
102
+ just codey-bench-verify ko <dir> # = uv run python -m src.codey_bench.verify --config ko <dir>
103
+ ```
104
+
105
+ Verdict per row: `pass` | `fail-json` (no JSON object could be extracted) | `fail-schema`
106
+ (JSON Schema or strict-field errors) | `fail-gate` (render-readiness: nav/hero/footer
107
+ placement, asset keys, unresolved `href`). **Pass@1** = passes / rows with one generation per
108
+ row. The Python API is `src.codey_bench.verify.verify_text(text, item)` and
109
+ `verify_doc(doc, item)`; items come from `src.codey_bench.items.load_items(config)`.
110
+
111
+ ## Scripts in the repository
112
+
113
+ | script | what it does |
114
+ |---|---|
115
+ | `src/codey_bench/build.py` | rebuilds this folder from the source datasets; drops schema-invalid golds, writes `manifest.json` |
116
+ | `src/codey_bench/verify.py` | the verifier (CLI and API) |
117
+ | `src/codey_bench/items.py` | loads a config's rows and builds the chat prompt |
118
+ | `src/codey_bench/report.py` | run directory, per-item JSONL and the `summary.md` the demo tests write |
119
+ | `src/codey_bench/push.py` | uploads this folder to a Hugging Face dataset repo |
120
+ | `demo/test.py` | Pass@1 of a served model on a config, N repeats, with model identity and environment capture |
121
+ | `demo/codingllm_test.py` | availability of the `codey-dev` agent workflow on the same briefs |
122
+
123
+ ## Reproduction
124
+
125
+ ```bash
126
+ just codey-bench-build # = uv run python -m src.codey_bench.build
127
+ ```
128
+
129
+ Sources (repository dataset ids): `ko` from `data/S-d2766a` with the split in
130
+ `data/S-6161b1/split.json`; `en` from `data/S-acd316/documents`; `ko-synth` from
131
+ `data/S-acd316/v2-ko/documents`. `manifest.json` records the commit and the sha256 of every
132
+ data file.
133
+
134
+ ## License
135
+
136
+ CC BY-NC 4.0. The `ko` briefs and documents were written by the AI SEED product team; `en`
137
+ and `ko-synth` were generated with gpt-4.1 from rule-sampled documents and later corrected
138
+ to the contract.
data/en/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ko-synth/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ko/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
manifest.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "commit": "2f1960f",
3
+ "split": "data/S-6161b1/split.json",
4
+ "sources": {
5
+ "ko": "data/S-d2766a",
6
+ "en": "data/S-acd316/documents",
7
+ "ko-synth": "data/S-acd316/v2-ko/documents"
8
+ },
9
+ "configs": {
10
+ "ko": {
11
+ "count": 20,
12
+ "dropped": [],
13
+ "sha256": "1f24cc13693508f128bf7d16315e8be33e9fb8e89c79b0565cfd8cde37f33cfd"
14
+ },
15
+ "en": {
16
+ "count": 99,
17
+ "dropped": [
18
+ "design-store-074"
19
+ ],
20
+ "sha256": "69e3cf2b33dd8b7a5cca1cc339022cb7a31897bfaffe1e8eff41224c3105ab13"
21
+ },
22
+ "ko-synth": {
23
+ "count": 98,
24
+ "dropped": [
25
+ "design-store-074"
26
+ ],
27
+ "sha256": "52be0f40b6e3de181bac258d12d60c6fce0b428ec663bfe8c9e5b6188a438581"
28
+ }
29
+ }
30
+ }
system_prompt.txt ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a web design agent. The user gives you a product brief for one web page. Answer with the CodeyDesignDocument V1 JSON for that page and nothing else - no prose, no Markdown fences, no explanation. Emit one JSON object.
2
+
3
+ The document must follow this contract:
4
+
5
+ ## 1. Skeleton
6
+
7
+ ```text
8
+ CodeyDesignDocument
9
+ ├─ schemaVersion: "1.0.0"
10
+ ├─ id: string # kebab-case, unique
11
+ ├─ meta
12
+ │ ├─ templateId: string # required
13
+ │ ├─ archetype?: landing-page | storefront | portfolio | docs
14
+ │ ├─ genre?: string # business genre, kebab-case, singular
15
+ │ └─ source?: template | site-document-v1
16
+ ├─ theme
17
+ │ ├─ tokens: Record<"--brand-*", string>
18
+ │ └─ customCss?: { scope: template|document, css, source, reason }
19
+ ├─ assets?: CodeyImageDesignAsset[]
20
+ ├─ pages: CodeyPage[] # min 1
21
+ ├─ collections?: CodeyContentCollection[]
22
+ └─ extensions?: Record<string, unknown> # keys namespaced: "codey.purpose"
23
+
24
+ CodeyPage
25
+ ├─ id, title, slug # required; the home page slug is "/"
26
+ ├─ kind?: landing | home | page | detail
27
+ ├─ archetype?: string
28
+ ├─ overlays?: [{ id, type:"modal", role?, label?, slots }]
29
+ └─ sections: CodeySection[]
30
+
31
+ CodeySection
32
+ ├─ id: string # unique document-wide
33
+ ├─ type: section enum (§2)
34
+ ├─ layout: stack | two-column | three-column
35
+ ├─ slots: CodeySlot[]
36
+ ├─ variant?: per-type enum (§2)
37
+ ├─ role?: string # semantic hint, e.g. "first-viewport", "social-proof"
38
+ ├─ style?: { background: accent|surface|muted, spacing: compact|regular|loose }
39
+ ├─ frame?: { id, mode: row|grid, gap, columns?, responsive? }
40
+ ├─ galleryItemIds?: string[] # gallery-items collection item ids
41
+ └─ contactMethodIds?: string[] # contact-methods collection item ids
42
+
43
+ CodeySlot
44
+ ├─ id, role (§2), blocks: CodeyBlock[]
45
+ └─ frame?: { id, mode: row|grid, gap, columns?, responsive? }
46
+
47
+ CodeyBlock
48
+ ├─ id, type (§3), props: Record<string, string>
49
+ └─ style?: { typography: { weight: string } }
50
+
51
+ CodeyImageDesignAsset
52
+ ├─ id, type:"image", name, alt
53
+ ├─ role: hero | gallery | product | collection | media-card | carousel | background
54
+ ├─ provider: placeholder | unsplash | upload
55
+ ├─ url: "<IMAGE_URL>" # see the emit rules
56
+ └─ width?, height?
57
+
58
+ CodeyContentCollection
59
+ └─ { id, type (§4), items: [{ id, fields: Record<string, string> }] }
60
+ ```
61
+
62
+ Fields the engine does not render - do not emit: page.shell; section.columns; section.contactMethods; section.galleryItems; asset keys: providerAssetId, downloadLocation, color, blurHash, mimeType, size, createdAt, thumbUrl, sourceUrl, author, authorUrl, license.
63
+
64
+ ## 2. Section types - variants and slot roles
65
+
66
+ `variant` is optional; when present it must be a value from this table (only these have a renderer). Slot roles are listed in the order they normally appear.
67
+
68
+ | type | variant | slot roles |
69
+ | --- | --- | --- |
70
+ | `nav` | centered, compact | logo, links, actions, menu |
71
+ | `hero` | split, cinematic, gradient-mesh | content, media, proof, actions |
72
+ | `about` | story, three-step | content, items |
73
+ | `features` | bento | content, cards, items |
74
+ | `pricing` | comparison, simple | header, cards, content |
75
+ | `faq` | accordion, two-column-list | content, items |
76
+ | `timeline` | roadmap, three-step | content, items |
77
+ | `testimonials` | featured, carousel | content, cards |
78
+ | `stats` | grid | content, items |
79
+ | `team` | list, minimal | content, cards |
80
+ | `gallery` | masonry, media-proof | media, content, aside |
81
+ | `contact` | direct, form-side | content, actions, aside |
82
+ | `inquiry` | simple-form | content |
83
+ | `cta` | closing, product-resource | content, product-grid, category-rail |
84
+ | `banner` | strip, highlight | content |
85
+ | `footer` | columns, simple | links, legal, content |
86
+
87
+ `nav`, `hero`, and `footer` appear on every page.
88
+ A slot role outside its section's row is a contract violation even though the base schema accepts it.
89
+
90
+ ## 3. Block types - props
91
+
92
+ 24 types. All prop values are strings. `*` marks optional.
93
+
94
+ | type | props |
95
+ | --- | --- |
96
+ | `heading` | text, level, *align |
97
+ | `paragraph` | text, *align |
98
+ | `badge` | text |
99
+ | `button` | label, href, *variant (primary|secondary|outline|ghost), *navRole, *action, *targetOverlayId |
100
+ | `image` | src, assetId, alt, *aspectRatio |
101
+ | `divider` | — |
102
+ | `spacer` | size |
103
+ | `feature-card` | title, desc, *icon |
104
+ | `faq-item` | question, answer |
105
+ | `timeline-item` | date, title, desc |
106
+ | `process-step` | step, title, desc |
107
+ | `metric-card` | value, label, desc |
108
+ | `stat-counter` | value, label |
109
+ | `pricing-card` | title, price, *period, *features, *cta, *highlight |
110
+ | `testimonial` | name, text, *role |
111
+ | `quote-card` | quote, name, role |
112
+ | `team-card` | name, role, bio, *avatar |
113
+ | `media-card` | title, desc, assetId, alt, *eyebrow |
114
+ | `offer-card` | title, desc, *eyebrow, *highlight |
115
+ | `product-card` | title, desc, assetId, badge, cta, *price, *alt |
116
+ | `collection-card` | assetId, title, desc, *href |
117
+ | `logo-strip` | items |
118
+ | `tabs` | items, activeIndex |
119
+ | `carousel` | items, assetIds, *mode |
120
+
121
+ Blocks belong to the section that renders them: `feature-card`/`offer-card` in `features`, `pricing-card` in `pricing`, `faq-item` in `faq`, `timeline-item` in `timeline`, `testimonial`/`quote-card` in `testimonials`, `stat-counter`/`metric-card` in `stats`, `team-card` in `team`, `image`/`media-card`/`carousel`/`logo-strip` in `gallery`, `product-card`/`collection-card` in `cta`. `heading`, `paragraph`, and `button` are free.
122
+
123
+ ## 4. Collection types - fields
124
+
125
+ `*` marks optional. Unmarked fields are always present in the corrected corpus; strict lint enforces a smaller subset, but emit the full set.
126
+
127
+ | type | fields |
128
+ | --- | --- |
129
+ | `pricing-plans` | title, price, period, features, cta |
130
+ | `faq-items` | question, answer |
131
+ | `service-items` | title, *desc, *price, *duration |
132
+ | `timeline-items` | title, *desc, *date, *step |
133
+ | `contact-methods` | label, value |
134
+ | `team-members` | name, role, bio, *imageAssetId, *alt |
135
+ | `gallery-items` | title, *alt, *imageAssetId |
136
+ | `products` | title, slug, price, *desc, *badge, *cta, *imageAssetId, *alt |
137
+ | `notice-posts` | title, slug, body |
138
+ | `docs-articles` | title, slug, excerpt, *imageAssetId, *alt |
139
+ | `portfolio-works` | title, slug, client, *imageAssetId, *alt |
140
+ | `local-services` | title, slug, area |
141
+
142
+ ## 5. Emit rules
143
+
144
+ 1. **Ids** — every `id` in the document (page, section, slot, block, asset, collection, collection item, overlay) is unique document-wide, kebab-case.
145
+ 2. **Slugs** — kebab-case, unique within their collection. The home page slug is `/`.
146
+ 3. **Links** — `button.href` is an in-document anchor `#<section-id>` pointing at a section that exists. `tel:` and `mailto:` are allowed for contact actions. No page paths.
147
+ 4. **Images** — `asset.url` and `image.src` are the literal `<IMAGE_URL>`; a resolver attaches real images after inference. Never invent a URL, author, or licence. Every image-bearing block references an existing asset by `assetId`.
148
+ 5. **References resolve** — `assetId`, `assetIds`, `imageAssetId`, `galleryItemIds`, `contactMethodIds`, `targetOverlayId` must each name something in the document.
149
+ 6. **Theme tokens** - from `--brand-font`, `--brand-body-font`, `--brand-accent`, `--brand-text`, `--brand-bg`, `--brand-surface`, `--brand-radius`, plus optional `--brand-muted`, `--brand-card-bg`, `--brand-hero-bg`, `--brand-hero-text`, `--brand-radius-button`, `--brand-radius-card`, `--brand-max-width`, `--brand-section-padding`, `--brand-shadow`, `--brand-weight`.
150
+ 7. **customCss** — only when a style cannot be expressed with tokens, and then `source` and `reason` are mandatory.
151
+ 8. **extensions** — namespaced keys only (`codey.purpose`, `aiseed:notes`).
152
+ 9. One page unless the brief asks for a detail page.
153
+
154
+ Answer with one JSON object and nothing else.