Evaluating LLM Code Generation, Creative Coding, and Spatial Reasoning

    A practical guide to evaluating large language models on code-driven video generation, creative coding, and spatial reasoning. Learn how to distinguish runnable output from requirements-compliant delivery, assess geometric and visual correctness, and build reproducible tests that measure efficiency, repair capability, and reliability.

    1. Define What It Means to Complete a Task

    When watching demonstrations of large language models (LLMs), developers often focus on two questions: Did the model produce a result, and which model finished first? For complex tasks involving programming, rendering, and spatial calculations, neither question is sufficient for a meaningful evaluation.

    A model may quickly generate substantial code that does not run. Another may produce a playable video that fails to follow the requested motion path, camera movement, or spatial relationships. A third may fail on its first attempt but repair its implementation after receiving error feedback. These outcomes reflect different engineering capabilities and should not be reduced to a simple “strong” or “weak” label.

    A more useful approach separates task completion into four levels:

    1. Completeness of the response: Does it include the required code, scene description, execution steps, and supporting explanations?
    2. Execution correctness: Does the code run in the specified environment and produce valid output?
    3. Requirements compliance: Does the output satisfy constraints such as duration, object count, motion rules, spatial positions, and visual style?
    4. Delivery reliability: Does it succeed consistently across repeated runs, and can the model diagnose and repair failures?

    If the available evidence consists only of brief observations such as “finished first,” “completed successfully,” or “did not finish,” without task definitions, environment details, or repeated tests, it supports only a description of that particular experiment. It does not establish an overall model ranking.

    A professional evaluation should turn those observations into verifiable questions rather than broad performance claims.

    2. Code-Driven Video Generation: Building Dynamic Scenes Programmatically

    Generating video through code typically means having a model write a program that defines a scene, its objects, animation rules, and rendering process. An execution environment then renders individual frames and encodes them into a video. This is a different technical approach from direct text-to-video generation and should be evaluated separately.

    The typical workflow is:

    Requirements → Scene structure → Animation rules → Frame-by-frame rendering → Video encoding → Output validation.

    The model must handle more than syntax. It must coordinate several interdependent engineering steps.

    Scene Modeling and Requirements Breakdown

    Consider a request to create a short video in which a ball follows a curved path, the camera slowly moves forward, and the background changes color over time. The model should first identify the objects, timeline, and constraints rather than immediately assembling drawing statements.

    A structured breakdown should establish:

    • Which objects appear in the scene, including their shapes and materials.
    • How each object’s position, orientation, and size change.
    • Whether the camera remains fixed or follows a specified path.
    • Whether lighting, backgrounds, and text change over time.
    • The required duration, frame dimensions, and frame rate.

    This decomposition reduces omissions and makes validation easier. For complex scenes, visual decoration should also be distinguished from mandatory functional constraints. Otherwise, the model may spend its effort on appearance while missing an essential action.

    Temporal Continuity and Motion Correctness

    Procedural animation typically computes the state of each frame from time. For a video of duration T at frame rate f, the expected frame count is approximately T × f. The implementation must use consistent rounding and endpoint conventions. Frame i can be associated with time t = i / f.

    The following pseudocode illustrates the workflow. Its functions are conceptual, not interfaces from an existing tool:

    1. total_frames = calculate_frame_count(duration, frame_rate)
    2. for each frame_index:
    3. time = frame_index / frame_rate
    4. object_state = calculate_position_and_orientation(time)
    5. camera_state = calculate_camera_parameters(time)
    6. image = render_scene(object_state, camera_state)
    7. save_frame(image)
    8. encode_frames_as_video()
    9. validate_output()

    Evaluation should look for position jumps, abrupt speed changes, disappearing objects, and unnatural transitions at loop boundaries. A playable video confirms that the encoding pipeline broadly works; it does not prove that the animation logic is correct.

    Executable Deliverables, Not Code-Like Text

    Developers need reproducible results. Tests must therefore record execution conditions, including whether dependencies are preinstalled, network access is permitted, files can be written, and memory and execution time are limited.

    Video validation should check whether the file exists, can be decoded, has the required duration, and contains an appropriate number of frames. Checking only the filename or file size cannot rule out empty content, corruption, or encoding errors.

    3. Creative Coding: Assessing Creativity Within Constraints

    Creative coding uses programs to produce visual, interactive, or generative designs. It involves aesthetics, mathematical modeling, algorithm organization, and engineering implementation. “Looks good” is therefore not an adequate evaluation standard.

    Creativity Should Come from Structure, Not Just Decoration

    Meaningful creativity often comes from rule design: varying parameters to generate different compositions, using relationships between particles to create collective motion, or mapping input data to colors, shapes, and rhythms.

    Adding gradients, glow effects, or random colors does not necessarily demonstrate greater creative capability. Evaluation should ask whether the visual approach fits the theme, whether dynamic changes follow an internal logic, and whether those rules can be explained and adjusted through the program.

    Evaluate Hard Constraints and Soft Goals Separately

    Creative tasks usually contain two types of requirements.

    Hard constraints include object counts, required elements, execution mode, output dimensions, and prohibited actions or elements.

    Soft goals include rhythm, compositional balance, stylistic consistency, and originality.

    These should be scored separately. A visually impressive result that omits a required object is not a complete deliverable. A result that meets every hard constraint but feels visually unremarkable deserves credit for functional correctness while leaving room for improvement in visual expression.

    This separation prevents aesthetic preferences from obscuring engineering errors and makes differences between reviewers easier to explain.

    Modifiability Reflects Real Development Value

    Business applications usually require repeated changes rather than a one-off demonstration. Evaluations should therefore include iteration tasks, such as extending the animation while preserving its style, adjusting the palette, changing the number of objects, or adding a new phase of motion.

    If the model rewrites the entire program for every change—or breaks existing functionality—its delivery is not yet stable. A better implementation separates scene parameters, motion logic, and rendering so that a local requirement change can be handled through a local modification.

    4. Spatial Reasoning: From Language Understanding to Geometric Consistency

    Spatial reasoning concerns whether a model correctly understands position, direction, distance, occlusion, and coordinate transformations, then implements those relationships in code or rendered output.

    Specify Reference Frames to Avoid Directional Ambiguity

    Instructions such as “move left,” “rotate around its own axis,” or “place it in front of the camera” can have different interpretations without a defined reference frame.

    Test tasks should specify whether they use world coordinates, object-local coordinates, or camera coordinates. They should also define axis directions, angle units, and rotation order. Otherwise, a mismatch between the rendered scene and expectations may reflect ambiguous requirements rather than a reasoning error.

    Transformation order also matters. Rotating before translating generally produces a different result from translating before rotating.

    Distinguish Geometry from Screen Projection

    The actual distance between 3D objects is not the same as their projected distance on a screen. Perspective affects apparent size, and camera position changes occlusion. A single screenshot therefore cannot establish whether every spatial constraint has been satisfied.

    A more reliable method combines scene data with rendered output:

    • Verify object positions using coordinates.
    • Check distances or collisions through geometric calculations.
    • Inspect images to confirm the final visible result.

    These checks complement one another. They can reveal cases where numerical relationships are correct but the composition is unsuitable, or where the image appears correct while the underlying geometry is wrong.

    Use Layered Tasks to Identify Capability Limits

    Spatial reasoning tests can increase in difficulty step by step:

    • Two-dimensional relative positioning and path planning.
    • Three-dimensional object arrangements and viewpoint changes.
    • Continuous rotation and combinations of coordinate transformations.
    • Multi-object occlusion, collisions, and trajectory constraints.

    Layered testing provides more diagnostic value than a single difficult task. A complex failure may arise from one incorrect coordinate transformation, a missed requirement, a code defect, or an environmental limitation. It should not automatically be attributed to weak spatial reasoning.

    5. Build a Reproducible Evaluation Process

    Keep Tasks and Execution Conditions Consistent

    Within a test round, use the same requirements, input assets, resource limits, and rules for external feedback.

    State in advance whether models may execute code, inspect runtime logs, and attempt repairs. Success from a single generation and success after several rounds of tool feedback represent different test conditions and should not be combined in the same comparison.

    Measure Generation, Execution, and Acceptance Time Separately

    “Fastest completion” needs a precise definition. Time to first response, code generation time, execution time, and total time to meet acceptance criteria are distinct metrics.

    For practical development, the last metric is often the closest measure of delivery cost. Quickly generated code that requires extensive manual debugging may be less efficient than code that takes slightly longer to generate but passes on its first run.

    Use Repeated Tests to Measure Reliability

    A single result can be affected by output randomness, runtime variation, and incidental errors. Run multiple tests within the same task category and record success rates, timing distributions, repair rounds, and failure types.

    When sample sizes are limited, state the scope of the findings clearly. Small experiments should not be presented as universal performance conclusions.

    Create an Interpretable Acceptance Checklist

    Evaluation dimension Key checks
    Task completeness Required objects, actions, and output files are present
    Execution correctness Code runs successfully and outputs are readable
    Temporal and spatial consistency Trajectories, timing, rotations, and occlusion meet requirements
    Creative expression Thematic consistency, rule design, and visual variation
    Engineering quality Modular structure, parameter organization, and error handling
    Resources and efficiency Execution time, memory use, and repair cost
    Reliability Performance across repeated runs and recovery after failures

    These dimensions do not need to be forced into one overall score. Model selection can prioritize them according to the application: automated production places greater weight on reliability, prototyping on efficient expression, and geometric design on spatial correctness.

    6. Move from Capability Demonstrations to Engineering Delivery

    In real systems, LLMs are well suited to interpreting requirements, drafting code, adjusting parameters, and analyzing errors. Execution and acceptance, however, should remain governed by explicit engineering mechanisms.

    A recommended workflow is:

    Generation → Isolated execution → Automated checks → Feedback-driven repair → Human confirmation.

    The execution environment should restrict file access, network access, and resource consumption, with timeouts to prevent generated code from affecting production systems.

    Automated validation should cover static rules, runtime results, and application-specific constraints. For video tasks, checks can include decodability, duration, and key frames. For spatial tasks, they can cover coordinates, distances, and collision conditions. Creative tasks still need human review to assess thematic expression and visual quality.

    The central question is not which model submits a result first in one demonstration. It is whether a model can consistently deliver correct, executable, modifiable, and verifiable work under clearly defined constraints. Evaluating code-driven video generation, creative coding, and spatial reasoning within a shared engineering framework turns impressive demonstrations into more trustworthy assessments of capability.