Evaluating Spatial Reasoning in Large Language Models: Methods and Practices

    This article presents a neutral, reproducible framework for evaluating the spatial reasoning and parametric modeling abilities of large language models. It explains why generating runnable code does not prove a model understands geometric constraints, then outlines evaluation design principles, prompt structure, linkage validation checkpoints, scoring dimensions, and common failure modes. Readers will learn how to test whether a model stays correct after key parameters change, using automated geometric checks rather than visual references.

    1. Background: Why Writing Code Is Not the Same as Modeling

    In large language model evaluation, spatial reasoning and creative coding are the two most discriminative capability areas. Many models can generate syntactically correct, runnable scripts. Yet once a single key dimension is changed, the output starts to show misaligned parts, broken drivetrain relationships, and geometry clipping. This indicates the model is only performing a surface-level text-to-code mapping without building a real model of spatial constraints.

    A meaningful evaluation should shift the focus from “does it run” to “is it still correct after the parameters change.” This is the starting point of the methodology in this article: a neutral, reproducible evaluation process built around parameter linkage and automatically verifiable geometric relationships.

    2. Design Principle: Parameterization First

    The evaluation script should declare global constants at the top. Every geometric body must be derived from these constants, and functions must not contain magic numbers disconnected from them. A sample structure:

    1. WINGSPAN = 1.15 # Wingspan; drives handlebar width and grip spacing
    2. WHEELBASE = 1.02 # Wheelbase; drives frame geometry
    3. CHAINRING_TEETH = 44 # Chainring teeth; drives chain length and gear ratio
    4. COG_TEETH = 16 # Rear cog teeth
    5. CRANK_PHASE = 35.0 # Crank phase angle; drives pedal and foot contact

    The key point is that every constant must have clear downstream consumers. Each one should affect at least two geometric components, forming a linkage chain that can be checked.

    3. Scenario-Based Prompt Design

    The evaluation task should use no reference image, text description only, and delivery of a script that can run in the background. This prevents the model from taking shortcuts through visual input. The prompt should contain four layers:

    1. Narrative layer: describe time, place, and the main action. For example, on a coastal promenade at dusk, a pelican rides a dark green steel-frame bicycle, leaning forward, both wings extended to the handlebar, one foot on the pedal, the other suspended at the lowest point of the return stroke.
    2. Structure layer: the frame is a classic diamond type, a canvas tool bag hangs from the down tube, and a fishing net is strapped to the rear rack.
    3. Drivetrain layer: the crank drives the rear wheel, the chain is tensioned, and the riding posture must match the drivetrain phase.
    4. Acceptance layer: state clearly that the reviewer will only change numbers, not code, then rerun and check the linkage results.

    This separates artistic style from parametric verifiability. Appearance is free, but spatial relationships must be computable.

    4. Key Checkpoints for Linkage Validation

    Acceptance should cover at least three types of checks:

    • Dimension linkage: change the wingspan from 1.15 to 1.35. Does the handlebar widen accordingly, and do the grips still enclose the wing tips?
    • Drivetrain linkage: change the chainring teeth from 44 to 52. Is the chain path recomputed correctly, with no clipping or floating segments?
    • Phase linkage: change the crank phase from 35 degrees to 140 degrees. Do the pedal position and foot contact point update together, and does the riding posture remain consistent?

    Automated assertions can be added. For example, compute the minimum distance between the chain envelope and the chainring outer circle; if it is below a threshold, flag clipping. Compute the containment relationship between the grip endpoints and the wing tip coordinates; if it falls outside tolerance, mark a failure.

    5. Suggested Scoring Dimensions

    Use five scoring dimensions: parameter coupling, geometric consistency, drivetrain correctness, failure explainability, and code maintainability. Failure explainability means whether the model proactively states its limitations when it cannot satisfy a constraint, instead of silently producing incorrect geometry. This often reflects real reasoning ability better than a single success.

    6. Common Failure Modes and How to Avoid Them

    Common failures include: copying constants into functions so parameter changes have no effect; using a fixed polyline for the chain instead of deriving it from tooth counts; hardcoding foot position instead of computing it from the phase with trigonometry; ignoring tolerance so floating-point error is judged as failure. The way to avoid them is to write all derived quantities as pure functions and output a parameter snapshot and validation report at the end of the script for manual review.

    7. Conclusion

    The value of spatial reasoning evaluation is not a single overall score, but exposing whether a model has truly built constraint awareness. With parameter linkage as the backbone, automated validation as the judge, and explainable failure as a bonus, this method transfers to mechanical assembly, scene layout, procedural generation, and other tasks, providing a stable basis for model selection and iteration.