Evaluating LLM Spatial Reasoning and Code-Generated Video: A Practical Guide

    Learn how to evaluate large language models on spatial reasoning, scripted 3D scenes, and code-generated video using reproducible, auditable workflows. This guide covers task design, isolated execution, geometric and temporal validation, human review, failure analysis, and deployment considerations, while distinguishing model capabilities from the contributions of the surrounding toolchain.

    When a new multimodal model launches, a few demonstration images, a short video, or a claim of “near-leading performance” often attracts the most attention. From an engineering perspective, however, these demonstrations show only that the model can complete a particular task with a particular prompt, asset set, and runtime environment.

    They do not directly answer two essential questions:

    • Does the model understand coordinates, scale, hierarchical relationships, and geometric constraints in three-dimensional space?
    • Can its generated code reliably produce video while maintaining spatial consistency and visual continuity over time?

    Rather than recommending a specific vendor or product, this guide presents a general evaluation framework for spatial reasoning, 3D script generation, video generation entirely through code, and creative coding. The goal is to make results reproducible, auditable, and useful for engineering decisions.

    1. From Generating Images to Constructing Spatial Scenes

    Spatial reasoning is not simply object recognition. Recognition asks, “What is in the image?” Spatial reasoning asks, “Where is each object? Which way does it face? How large is it? What is its parent? Does it satisfy the constraints? How does it change over time?”

    For code-driven 3D scene tasks, a model must complete a chain of capabilities:

    1. Understand the natural-language objective.
    2. Plan the scene structure.
    3. Select and combine geometric primitives.
    4. Define coordinates and units.
    5. Establish hierarchical transformations.
    6. Configure cameras and lighting.
    7. Create an animation timeline.
    8. Produce an executable script that renders the requested video.

    Failures along this chain are often spatial-semantic errors rather than syntax errors. Conflicting axis conventions can reverse an object’s orientation. Inconsistent units can distort proportions. Mixing local and world coordinates can break parent-child transformations. Objects may intersect, float above the ground, or fall outside the camera view. Discontinuous camera paths can create abrupt cuts, while inappropriate keyframe interpolation can cause sudden changes in speed.

    Video tasks add temporal consistency requirements. The same object should not drift, flicker, or change identity between frames. Camera movement must remain continuous, and lighting and materials should not change without a reason.

    Evaluation therefore cannot rely on a final screenshot alone. A stronger approach collects scripts, execution logs, scene metadata, rendered frames, and human ratings. This turns “looks good” into evidence that is executable, verifiable, and explainable.

    2. Build a Task Suite Around Scripted 3D Scenes

    Script-based tasks expose spatial understanding and engineering ability more clearly than drag-and-drop operations. The model must explicitly express coordinates, transformations, dependencies, and execution order.

    A useful benchmark progresses through several levels, covering both basic geometry and creative coding.

    2.1 Basic Placement and Dimension Control

    Provide an object list, dimensions, coordinates, and required spatial relationships, then ask for a complete scene script.

    Check whether all objects exist and whether their positions, orientations, proportions, relative distances, and units are correct. These tasks quickly reveal problems with coordinate axes, units, and numerical precision.

    2.2 Hierarchical Transformations and Parent-Child Relationships

    Ask the model to construct a robotic arm, a table-and-chair arrangement, a planetary system, or a similar structure.

    The objective is to test its understanding of local and world coordinates. Visual resemblance is not enough: child nodes must move correctly with their parents, rotation pivots must be appropriate, and hierarchical dependencies must be clear.

    2.3 Cameras, Lighting, and Composition

    Specify the camera target, subject position, background relationship, and desired share of the frame. Require the model to generate camera position, orientation, field of view, and lighting settings.

    Check whether the camera points at the subject, whether it passes through geometry, whether the subject is obscured, whether exposure is appropriate, and whether key objects remain in view.

    2.4 Constraint Satisfaction

    Examples include:

    • Multiple objects must not collide.
    • The layout must remain symmetrical.
    • A passage must preserve a minimum width.
    • Objects placed on the ground must not float above it.

    These tasks require the model to check its output rather than simply create a visually busy scene. Evaluation should measure geometric errors, count collisions, verify clearances, and record why constraints failed.

    2.5 Animation and Timeline Tasks

    Ask for animations such as a door opening, an object following a path, a camera orbit, or a sequence of shots.

    Check the first and last frames, keyframe count, motion continuity, velocity curves, loop closure, and video duration. Temporal consistency should be assessed independently, not inferred from the quality of a single frame.

    2.6 Creative Coding and Procedural Generation

    Within defined constraints, ask the model to generate parametric patterns, repeated structures, material variations, or randomized layouts.

    These tasks reveal creativity, parameterization skills, and code organization. Keep objective constraints separate from open-ended creative choices: the former can be checked automatically, while the latter require structured human review.

    2.7 Error Repair

    Provide a script containing coordinate errors, hierarchy errors, or runtime failures, and ask the model to identify and fix them.

    This tests whether the model can interpret error logs, reason about causes, and perform practical debugging.

    Make Prompt Assumptions Explicit

    Prompt design is part of evaluation quality. Specify the coordinate system, units, asset list, permitted geometric primitives, rendering resolution, duration, camera requirements, and success criteria.

    For creative tasks, leave room for exploration but define the subjective scoring dimensions in advance. Otherwise, a failure may reflect an unstated convention rather than limited spatial reasoning.

    3. Executable Validation: Turn Visual Impressions into an Engineering Loop

    An evaluation pipeline should include at least six stages:

    1. Task delivery
    2. Isolated execution
    3. Artifact collection
    4. Automated validation
    5. Human review
    6. Report generation

    The execution environment must restrict file access, network access, runtime, and resource consumption so that untrusted scripts cannot affect the evaluation system. Record rendering parameters, asset versions, random seeds, and runtime details to support reproducibility.

    The following pseudocode illustrates a general evaluation loop:

    1. function evaluate(task, model_output):
    2. sandbox = prepare_isolated_environment(task)
    3. run_result = execute(sandbox, model_output.script, timeout=task.timeout)
    4. if run_result.status != success:
    5. return failure_report(run_result.log)
    6. artifacts = collect(
    7. run_result,
    8. ["scene_metadata", "rendered_frames", "runtime_log", "output_video"]
    9. )
    10. checks = []
    11. checks.append(check_units_and_coordinates(artifacts))
    12. checks.append(check_object_presence(artifacts, task.expected_objects))
    13. checks.append(check_relative_transform(artifacts, task.expected_relations))
    14. checks.append(check_collision_and_clearance(artifacts, task.constraints))
    15. checks.append(check_camera_framing(artifacts, task.camera_goal))
    16. checks.append(check_temporal_consistency(artifacts, task.duration))
    17. checks.append(check_video_metadata(artifacts, task.duration, task.fps))
    18. manual_score = optional_human_review(artifacts, task.rubric)
    19. return aggregate(checks, manual_score, run_result.log)

    Failure reports should be structured rather than simply marked “failed.” Record whether the script executed, the failure stage, error type, missing objects, coordinate errors, colliding objects, camera problems, video output status, and timeouts.

    This information supports model comparison while helping distinguish model limitations from prompt ambiguity or evaluation-environment problems.

    Fair comparisons require the same prompt templates, assets, execution environment, time budget, and scoring rubric. Run each prompt multiple times and report success rates, variability, and representative failure modes. Do not select only a successful run. Where possible, use blind human review that hides the model’s identity to reduce prior bias.

    4. Dedicated Checks for Code-Generated Video

    Generating video entirely through code is more demanding than producing a single frame. The model must manage spatial structure, timing logic, and output quality simultaneously.

    Evaluation can be organized into five layers:

    1. Executability: Does the script finish in the isolated environment? Does it produce a video file and logs? Does it complete within a reasonable time?
    2. Semantic alignment: Does the video match the requested objects, actions, camera behavior, and style? Are any elements missing or incorrectly substituted?
    3. Spatial correctness: Are positions, orientations, proportions, occlusion relationships, and collision constraints correct? Does the camera cover the intended subject?
    4. Temporal consistency: Do objects retain their identities? Is camera movement continuous? Do lighting or materials change unexpectedly? Are there obvious jumps between keyframes?
    5. Engineering quality: Is the code clearly structured, appropriately parameterized, readable, and maintainable? Does it contain unsafe operations or waste resources?

    Use a combination of automated metrics, human scoring, and failure classification rather than relying on one overall score.

    Automated metrics may include execution success rate, constraint satisfaction rate, key-object detection rate, geometric error, compliance with video duration and frame-rate requirements, and structural stability between frames.

    Human review can assess composition, creativity, aesthetics, narrative quality, and ease of modification. Weights should vary by application: industrial layout tasks prioritize geometric precision and constraints, while creative short videos place greater emphasis on storytelling and visual presentation.

    Separate Model Performance from Toolchain Performance

    An end-to-end evaluation is not necessarily an evaluation of the model alone. If the system includes prompt rewriting, code templates, automatic repair, or rendering wrappers, its final performance may reflect the entire toolchain.

    Reports should state the system boundary clearly. Benefits introduced by supporting tools should not be attributed solely to the model.

    5. Interpreting Claims About New Model Capabilities

    When a model is promoted as having “near-leading spatial reasoning” or being able to “generate video,” the useful response is to ask testable questions:

    • On which tasks does the claim hold?
    • Under what constraints?
    • What is the failure rate?
    • Can failures be repaired?
    • Is the cost acceptable?

    Several capability dimensions deserve particular attention.

    First-Pass Success from Natural Language to Executable Script

    This reflects planning, code generation, and adaptation to the runtime environment.

    Stability Under Multiple Constraints

    Generating an attractive scene is not sufficient. Maintaining correctness under size, collision, camera, and temporal constraints is more indicative of practical usability.

    Self-Repair Based on Error Logs

    First-pass success is not the norm in real development. Locating errors and repairing them iteratively can have substantial engineering value.

    Explicit, Explainable Spatial Relationships

    Structured scene descriptions, dependency relationships, and constraint-check results provide stronger evidence than a final video alone.

    Diversity and Control in Creative Tasks

    Creative coding should offer variation, but that variation must also be reproducible through parameters, seeds, and constraints if it is to enter a production workflow.

    Temporal Stability in Video

    Pay close attention to camera continuity, stable object identity, complete actions, and first- and last-frame quality.

    Results on these tasks often fall into distinct categories: some scripts execute on the first attempt and satisfy most constraints; others run but contain incorrect spatial relationships; still others fail before rendering begins.

    These outcomes are part of the capability profile. Rather than relying on a simple ranking, assess task coverage, robustness, repairability, controllability, and engineering cost together.

    6. Common Evaluation Pitfalls and Risk Controls

    Several mistakes can undermine otherwise useful evaluations:

    1. Drawing conclusions from one demonstration. Report success rates and failure patterns across repeated runs, not just the best output.
    2. Comparing unequal conditions. Differences in prompt length, asset complexity, time budgets, and runtime environments make results difficult to compare directly.
    3. Judging only the final visuals. Script structure, execution logs, and geometric validation are also essential.
    4. Ignoring prompt ambiguity. Missing coordinate conventions, units, or success criteria should not be treated purely as model failures.
    5. Using only automated scoring. Spatial composition, creative quality, and the viewing experience still require structured human review.
    6. Neglecting code-execution safety. Sandboxing, resource limits, permission controls, and content safety review should be part of the evaluation infrastructure.
    7. Confusing toolchain capability with model capability. Define the boundary between the base model and the end-to-end system.

    7. Recommendations for Enterprise Adoption

    Research and development teams should begin with a small, stable benchmark covering basic placement, hierarchical transformations, cameras and lighting, constraint satisfaction, animation timing, and error repair. Creative tasks can be added gradually.

    After each model or system update, run the same regression suite and track changes in success rates and failure categories.

    Enterprise users should map evaluation results to their actual use cases. Is the system intended to produce quick concept scenes or automatically generate deliverable videos? Will it assist creative work or operate inside a production pipeline? These goals require different scoring weights, so general-purpose rankings should not be the sole basis for selection.

    The evaluation pipeline can run on cloud infrastructure that provides elastic compute, container orchestration, object storage, logging, monitoring, and alerts. For example, Baidu AI Cloud’s general compute and storage capabilities can support task execution, video archiving, and log retention, with monitoring and alerts used to track timeouts, failure rates, and unusual resource usage.

    Such infrastructure supports reproducible evaluation; it does not replace careful task design or human judgment.

    8. Conclusion

    The central question in evaluating spatial reasoning and video generation is not whether a new model has been released. It is whether the model can reliably produce executable, verifiable, and reproducible results under explicit task constraints.

    Scripted 3D scenes and code-generated video provide an end-to-end view of the process: from language understanding to spatial modeling, and from code generation to rendered output.

    A rigorous assessment should examine task completion, spatial correctness, temporal consistency, code quality, repairability, and engineering cost. It should avoid conclusions based on single demonstrations, cherry-picked comparisons, or irreproducible environments.

    Turning capability claims into measurable criteria—and demonstrations into a structured task matrix—provides a more dependable basis for model selection, further development, and production deployment.