A Practical Method for Evaluating LLM Code Generation and Visual Aesthetics
This article presents a general, model-agnostic methodology for evaluating whether large language models can deliver runnable, verifiable, and visually expressive works through code. It breaks model capability into four acceptance criteria—functional correctness, engineering runnability, visual and physical consistency, and iteration cost—and demonstrates the approach through two controlled tasks: an end-to-end animated vector graphic and a pure-code light-and-shadow rendering. It also analyzes common weaknesses and offers engineering recommendations for building a reproducible benchmark suite.
A Practical Method for Evaluating LLM Code Generation and Visual Aesthetics
This article does not recommend any specific commercial model. Instead, it abstracts the question “can a model use code to complete a runnable, verifiable, and visually expressive work” into a general technical problem. Many flagship models have recently emphasized improvements in underlying world knowledge, multimodal perception, coding, and agentic capabilities in their announcements, but often without disclosing parameter counts, benchmark scores, or training data. For developers, announcements alone cannot determine whether a model fits real projects. Cross-validation through controlled tasks, runnable artifacts, and human review is essential.
1. Evaluation Boundaries: Breaking “Model Capability” into Verifiable Items
The most common mistake in evaluating LLM code generation is replacing a complete assessment with a single screenshot or demo. A screenshot only shows that “one frame looks good”—it says nothing about code maintainability, offline runnability, or interaction completeness. A more reasonable approach splits the task into four layers:
- Functional correctness: Does the artifact satisfy the explicit constraints in the prompt, such as animation, controls, day/night switching, and standalone operation after export?
- Engineering runnability: Does it depend on uncontrollable external resources? Does it still run offline? Are there obvious errors or infinite loops?
- Visual and physical consistency: Are proportions, perspective, light direction, shadow softness, and material detail natural? Do motion curves match intuition?
- Iteration cost: Can the model locate problems based on feedback? Does it demonstrate task decomposition, tool invocation, and self-correction?
Run multiple trials under fixed prompts, fixed sampling parameters, and a fixed acceptance environment. Record the first-pass rate, the number of human rework rounds, and final maintainability. For visual tasks, also preserve intermediate artifacts and code structure rather than judging only the final output.
2. Task One: End-to-End Delivery of an Animated Vector Graphic
A classic test can be abstracted as a “character riding a bicycle” animation: generate a standalone runnable vector animation containing a character, a bicycle, a coastal background, rotating wheels, and a fluttering scarf, with controls for pause, playback speed, and day/night switching. The task looks simple, but it simultaneously tests scene modeling, part hierarchy, animation timing, interaction binding, and offline runnability.
In controlled tests, some models produce fairly complete end-to-end artifacts: a hat-wearing rider on a bicycle, continuously rotating wheels, a scarf fluttering backward, and a control panel that can pause, adjust pedaling speed, and switch between day and night. After increasing playback speed and exporting, the standalone vector file still animates when opened offline. This shows real progress in “decomposing natural-language requirements into composable modules”—agentic capability no longer stops at verbal planning but lands in code structure.
Visual weaknesses are equally apparent. Proportions between the rider and the bicycle, part connection relationships, shadow direction, and motion easing curves can easily look “like a staged set.” For example, wheels rotating at a uniform linear speed lack pedaling rhythm; a scarf animated with simple displacement lacks the lag of a flexible object. During acceptance, developers should focus on:
- Whether layers and groups are clearly organized, and whether the rider, bike, and background can be adjusted independently;
- Whether the animation timeline supports pause, speed change, and reset;
- Whether day/night switching actually changes lighting and color scheme rather than applying a simple overlay;
- Whether the exported file is self-contained, without referencing external fonts, images, or scripts.
An illustrative structure looks like this:
<svg viewBox="0 0 800 450"><g id="scene"><g id="background">...</g><g id="bicycle"><g id="wheel-front">...</g><g id="wheel-rear">...</g></g><g id="rider"><g id="body">...</g><g id="scarf">...</g></g></g><g id="controls">...</g></svg>
The point of this structure is not the tags themselves, but whether the model understands that a “maintainable animation” needs a stable hierarchy, addressable nodes, and clear control entry points. If the artifact piles all graphics into a single path, it is not engineering-usable even if the picture moves.
3. Task Two: The Light-and-Shadow Challenge of Pure-Code Image Rendering
The second task is closer to “painting a photograph with code”: use any code technique to render afternoon indoor light and shadow—window-frame shadows sweeping across a wall, a chair, and parquet flooring—with a quiet atmosphere. This task tests not just syntax but the combined capability of geometric modeling, lighting equations, sampling strategy, material expression, and tone mapping.
In controlled tests, a model may build the room with browser graphics APIs or implement CPU rendering in a systems language. Better results typically show window-frame light slanting in, passing over a small round stool and reaching the lower edge of the frame—evidence that the model understands the causal chain of “light direction → occluder → projection.” But the gaps are equally visible: wall-corner edges too hard, plants and flooring looking like a freshly assembled set, and unnatural transitions from highlights to shadows. The sophistication of a pure-code image often depends on global illumination, soft shadows, anti-aliasing, material roughness, and tone mapping—details that are hard to get right in a single generation.
Take path-tracing pseudocode as an example. The core loop is not complicated; the difficulty lies in sampling quality and scene organization:
for each pixel:color = 0for sample in range(S):ray = camera.generate_ray(pixel, jitter)hit = scene.intersect(ray)if hit:color += trace(hit, depth)framebuffer[pixel] = tone_map(color / S)
If a model only writes a loop that “produces an image” while ignoring importance sampling, noise control, boundary handling, and post-processing, the result will be “structurally correct but weak in texture.” Acceptance can be scored along four dimensions: whether light and shadow directions are consistent, whether shadow edges are plausible, whether materials have layering, and whether noise and aliasing are under control. The “slightly weak aesthetics” problem should not be attributed simply to the model not knowing how to code—coding ability and visual aesthetics are two coupled but non-equivalent chains.
4. Improvements and Shortcomings: How to View a Test Round Objectively
From tasks like these, the main improvement lies in end-to-end delivery and tool-based execution: models can decompose a prompt into subtasks such as scene, animation, controls, and export; generate artifacts that run offline; and patch issues based on feedback to some extent. This has practical value for prototyping, teaching demos, and lightweight interactive pages.
The shortcomings concentrate in three areas. First, insufficient aesthetic and physical consistency—light transitions, material detail, and proportions still require human oversight. Second, long-task planning tends to be “loose at the front, tight at the back”: the early structure is complete, but later details collapse. Third, cross-file engineering and maintainability are weak—a single-file demo that runs does not equal something ready for a real project. Therefore, a single work cannot judge a model’s strength, and “can generate” must not be confused with “can deliver.”
5. Engineering Recommendations for Evaluation
Build a small benchmark suite covering animated vector graphics, pure-code images, data visualization, interactive pages, and agentic tool invocation. Each task should combine automated acceptance with human review: automated checks for offline runnability, errors, and control behavior; human review for visual naturalness, code structure, and rework cost. For batch execution, evaluation tasks can be orchestrated on general-purpose cloud services—such as Baidu AI Cloud’s container platform, object storage, and log services—to archive artifacts, logs, and scoring sheets uniformly for regression comparison.
Final model selection should return to task matching: in the prototyping phase, prioritize generation speed and end-to-end completeness; in production, maintainability, testability, and human rework cost are mandatory. Pure-code visual tasks especially require human review, because there remains a clear gap between “runs” and “looks good.” For developers, building a reproducible evaluation methodology is more valuable than chasing one-off demos.
