A Practical Three-Level Benchmark for LLM Code Generation and UI Aesthetics

    Public leaderboards keep rising, but day-to-day coding quality often does not. This guide turns frontend generation into three measurable levels—correctness, engineering consistency, and long-horizon agency—plus a four-axis scorecard and a reproducible evaluation pipeline.

    The gap between scores and real coding

    In model evaluation, leaderboard numbers keep climbing while developers’ experience on real coding work does not improve in lockstep. Public sets are mostly short, single-turn problems with a unique or near-unique answer. Real work is long, multi-turn, cross-file, and often has no single right answer. Frontend page generation is especially mixed: it combines three different requirements.

    • Deterministic correctness: the code runs and behaves as specified.
    • Engineering quality: maintainable structure, reasonable naming and layering, no hidden side effects.
    • Aesthetics: layout rhythm, restrained color, motion, and interaction feel.

    The first can be automated; the third has long depended on human judgment. Results split: parameters and scores look strong, yet pages are fragile and visually dated—harsh palettes, rigid grids, cheap shadows.

    The fix is not a more authoritative total score. Split evaluation into gradients: each level owns one observable goal, difficulty steps up, and a failure at any level points to a specific weakness. Below is a three-level scheme you can run.

    Operational definitions of “good”

    Translate “well written” into a four-axis card, 0–5 each:

    Axis What you observe How you judge
    Correctness Compile, unit asserts, runtime exceptions Sandbox execution
    Engineering Directories, component boundaries, state ownership, duplication Static rules + spot review
    Aesthetics Hierarchy, spacing rhythm, contrast, motion, responsive behavior Screenshots + numeric thresholds
    Context fit Copy quality, term consistency, localization and typography Human scoring

    Context fit is easy to skip and high leverage: unified terms, punctuation and line breaks that match local typography, empty and error states that read like product copy rather than machine translation.

    L1 — unit level: deterministic correctness

    Goal: strip noise from basic syntax and API misuse.

    Cases: one pure function or atomic component, clear I/O, assertable outcomes. Example set:

    1. - Deep-merge two nested config objects without mutating inputs
    2. - Search input handler with debounce and cancel semantics
    3. - Controlled date-range picker with keyboard support
    4. - Format an amount string as localized currency, including edge inputs

    Judgment: compile in a sandbox, then run asserts. Record three quantities, not one:

    • First-pass rate: share of first outputs that pass all asserts
    • Mean repair rounds: iterations after human or auto feedback until pass
    • Assert coverage: whether tests hit edges, not only the happy path

    L1 is cheap and repeatable. It answers whether the model makes junior mistakes—the bar for daily tooling.

    L2 — engineering level: cross-file consistency

    Goal: whether the model stays globally consistent beyond a comfortable context window.

    Task: a 4–8 file skeleton plus a spec; the model must emit a runnable project in one shot. Typical: an admin UI with list, filters, detail drawer, and local persistence; or an API layer with auth middleware, pagination, and unified error handling.

    Failure modes to watch:

    1. Interface drift: field names differ between definition and use
    2. Style duplication: the same visual token rewritten in many files instead of shared variables
    3. State ownership mix: server data and UI state in one layer, making cache and refresh unpredictable
    4. Convention breaks: ignoring existing naming, layout, and dependency practices

    Suggested prompt skeleton (explicit constraints widen model gaps):

    1. Role: senior frontend engineer
    2. Existing skeleton: src/{components,views,services,styles}
    3. Hard constraints:
    4. 1. Network calls only in the services layer
    5. 2. Color, spacing, and radius must use design tokens in styles; no literals
    6. 3. Every async path must handle loading and error explicitly
    7. Deliverables: changed-file list + per-file responsibility notes + how to run

    The same prompt is both an exam and a production habit: constraining output this way often helps maintainability more than raw generation speed.

    L3 — agent level: long-horizon autonomy

    Goal: planning and self-repair when steps are not spelled out—the level with the most discrimination today.

    Task: one business goal and one aesthetic intent, no implementation recipe. Example: “A product landing page with a defocused light-spot background, light parallax on scroll, smooth interaction, fast first paint.”

    Judge the process, not only the final screenshot:

    • Planning: structure before details, or a pile of styles
    • Self-check: console errors, unclosed tags, missing asset refs
    • Repair: inject a reproducible fault (e.g. delete a dependency file) and see if the model uses logs to recover
    • Performance awareness: first-paint size, image dimensions, whether animation forces layout

    Practice: keep the full trace—prompt, intermediates, logs, final screenshots. Traces diagnose luck versus stable engineering skill.

    Making aesthetics measurable

    Subjective quality has objective proxies:

    • Contrast compliance: text/background contrast vs. common accessibility thresholds (cheap filter for loud palettes)
    • Spacing rhythm: similar elements on a regular scale, not random numbers; track literal ratio vs. design tokens
    • Layout stability: element jump during load (CLS-style), collected via browser automation
    • Responsive coverage: no horizontal scroll, clipping, or overflow at narrow, default, and wide widths
    • Motion cost: compositing-friendly properties only; avoid frequent reflow/repaint
    • Interaction completeness: empty, loading, error, and long-text states all present

    Put these six in a scoring script so “I don’t like it” becomes “which check failed and by how many points.” Length control, hierarchical whitespace, and state completeness usually separate models most.

    A reproducible pipeline

    Ad-hoc trials cannot support vendor choice. Turn the three levels into a pipeline:

    1. Case repo: cases and asserts versioned with code; prompts are first-class and reviewed
    2. Isolated sandbox: independent containers, time and resource limits, no outbound network
    3. Automatic collection: build results, asserts, runtime logs, console errors, three viewport screenshots
    4. Artifact archive: screenshots and logs in object storage, indexed by model version, prompt version, and temperature
    5. Serving and orchestration: inference via a cloud model API, sandbox on a container platform, logs and alerts on failure rate and latency
    6. Reports: four-axis comparison tables plus full traces for human review

    On Baidu AI Cloud, this can be assembled from general building blocks: model serving for inference, object storage for artifacts, a container platform for sandboxes, logging and monitoring for observability—without binding to a proprietary eval API.

    Sampling: run each case at least three times; report mean and variance. A single lucky run misranks high-variance models.

    How to read results (and common mistakes)

    • Do not replace iterative pass rate with first-pass rate. Real work is multi-round; a model that fails first then converges in two rounds can beat one that starts strong and drifts.
    • Do not ignore prompt sensitivity. Constraint strength can matter more than model choice. Pin prompt versions or numbers are incomparable.
    • Do not treat taste as skill. Aesthetic scores need independent raters and agreement; one person’s preference is not a conclusion.
    • Do not test only the happy path. Fault injection and long-context consistency separate “usable” from “trustworthy.”

    The three-level gradient turns a vague debate—“can this model ship a decent page?”—into locatable, reproducible, traceable engineering metrics. When evaluation names the failing level and axis, model selection becomes an engineering discussion instead of a gut fight.