Evaluating Spatial Reasoning in Large Models: A Script-Based Benchmarking Approach

    This article breaks down a practical method for evaluating the spatial reasoning abilities of large language models. It explains why generating runnable code is not the same as building self-consistent 3D geometry, why script-based modeling tools are preferred over browser-based rendering libraries for parameterized assembly tests, and how to structure prompts around deliverable constraints, scene narrative, parameter linkage, and regression acceptance. The core benchmark—a pelican riding a bicycle—is used to illustrate three acceptance checks: handlebar width derived from wingspan, chain path recalculation from sprocket teeth, and crank phase consistency. The article closes with reusable practices such as enforcing a single source of parameters, preferring headless execution, and keeping failure samples.

    1. Background: Why Generating Code Is Not Spatial Reasoning

    When evaluating a large model’s programming and 3D modeling abilities, a common mistake is treating “can it output a runnable script?” as the ceiling of its capability. Generating syntactically correct code is only the first step. The real difficulty is getting the model to construct self-consistent spatial relationships between parts from a natural language description alone, without a reference image, and to keep those relationships valid after parameters change.

    The original benchmark deliberately chose a high-difficulty prompt: “a pelican riding a bicycle.” The reason is that it combines rigid bodies (frame, wheels), a drivetrain (chainring, chain, cog), flexible attachments (canvas bag, fishing net), and a biological posture (forward lean, wings extended forward, webbed feet on the pedals). Any error in a spatial relationship shows up immediately in the rendered result.

    2. Choosing the Evaluation Vehicle: From Browser 3D Libraries to Scripted Modeling

    Early evaluations mostly relied on browser-based 3D rendering libraries. The advantage is instant visualization and easy debugging, but the limitation is clear: these tools are better at “displaying” than at “parameterized assembly.” When you need to verify how the wheelbase, gear ratio, and phase angle interact, a scripted modeling toolchain—one that supports headless execution and builds scenes driven by Python—better reflects a model’s control over geometric constraints.

    The evaluation approach was therefore changed: the model must deliver a Python script that runs in background mode, with the script handling modeling, materials, camera, and render settings. This shift moves the focus from “visual effect” to “engineering correctness.”

    3. Prompt Design Framework: Put Acceptance Criteria Up Front

    The key to a high-quality evaluation is writing the acceptance method into the prompt rather than guessing it after the fact. The original prompt structure can be abstracted into four layers:

    1. Deliverable constraints: Specify the file format, how it runs, and the headless execution requirement, so the model does not produce interactive code.
    2. Scene narrative: A seaside boardwalk at dusk, a dark green steel frame, a forward-leaning riding posture—these provide style and semantic anchors.
    3. Parameter linkage: Extract wingspan, wheelbase, chainring teeth, cog teeth, and crank phase as global constants at the top of the script, and require all geometry to be derived from those constants. “Magic numbers” that are disconnected from the constants must not appear inside functions.
    4. Regression acceptance: State that the reviewer will only change the constant values (for example, wingspan from 1.15 to 1.35, chainring from 44 to 52, phase from 35 to 140), rerun the script, and check whether three spatial relationships still hold.

    A schematic structure looks like this:

    1. # Global constants: all geometry must be derived from these
    2. PELICAN_WINGSPAN = 1.15 # Wingspan; determines handlebar width and grip spacing
    3. BICYCLE_WHEELBASE = 1.02 # Wheelbase; drives frame geometry
    4. CHAINRING_TEETH = 44 # Chainring teeth
    5. COG_TEETH = 16 # Rear cog teeth
    6. CRANK_PHASE_DEG = 35.0 # Crank phase angle
    7. def build_handlebar():
    8. # Width must be derived from wingspan; do not hardcode a value
    9. width = PELICAN_WINGSPAN * 0.92
    10. ...
    11. def build_drivetrain():
    12. ratio = CHAINRING_TEETH / COG_TEETH
    13. # The chain path must be re-solved from teeth counts and wheelbase
    14. # to stay tensioned and avoid clipping through the frame
    15. ...

    4. Three Core Acceptance Points and Their Technical Meaning

    First, handlebar width and grip position. When the wingspan changes, the handlebar must widen accordingly, and the grips must still “wrap” the wing tips. This tests whether the model has established a derived relationship between “body scale” and “part dimensions,” rather than treating them as independent constants.

    Second, chain path recalculation. Increasing the chainring teeth changes the pitch circle radius, so the chain wrap angle, the length of the tensioned segment, and the position relative to the cog all need to be re-solved. If the model merely writes the tooth count into a label, the render will show the chain floating or clipping into the frame. This is the dividing line between “writing code” and “building a model.”

    Third, phase consistency. After the crank phase changes, the webbed foot on the driving side must still contact the pedal surface, while the other side remains at the low point of the return stroke. This requires the model to understand the coupling between periodic motion and posture, rather than statically placing a foot.

    5. The Value of Cross-Model Comparison

    Running multiple models in parallel under the same prompt exposes capability tiers: some models satisfy all constraints first; some complete the main body but solve the drivetrain roughly; some fail at the parameter regression stage. The point of comparison is not ranking but locating failure modes—whether the model lacks parameter-derivation awareness, geometric solving ability, or experience modeling periodic motion.

    6. Reusable Practical Recommendations

    • Write acceptance into the prompt: Making the regression method explicit—“change only the numbers, not the code”—significantly suppresses a model’s tendency to take shortcuts.
    • Enforce a single source of parameters: Requiring all dimensions to be derived from top-level constants makes it easy to automatically check for magic numbers.
    • Prefer scripted pipelines that run headless: This makes batch testing easier in container platforms or CI workflows.
    • Build a tiered scoring sheet: Four progressive levels—syntactically runnable, main body spatially consistent, parameter regression passed, style expressed.
    • Keep failure samples: Failed cases guide prompt iteration better than successful ones.

    In summary, the evaluation of spatial reasoning is shifting from “describing what you see” to “verifiable parameterized assembly.” Only by making constraints, derivation, and regression solid can you truly measure whether a model has spatial understanding in an engineering sense.