Evaluating 3D Spatial Reasoning in Large Models: Methods and Practice

    This article presents a practical methodology for evaluating the 3D spatial reasoning of large language models. Instead of relying on visual review, it treats evaluation as engineering acceptance: models generate complete scripts that run in a headless batch environment, and verification scripts inspect the resulting geometry. The article covers prompt design with four layers of constraints, three regression checks triggered by parameter changes, a four-step execution pipeline, and common failure modes with suggested fixes.

    1. Background: Generating 3D Code Is Not Spatial Reasoning

    Over the past year, AI coding tools have improved rapidly at a specific task: generating runnable 3D scene scripts from plain text. On the surface, a model succeeds as soon as it outputs a script that executes in a rendering environment. What actually separates strong models from weak ones is whether the geometry inside the script is self-consistent, whether parameters genuinely drive the structure, and whether spatial constraints still hold after key constants change.

    A common mistake in existing evaluation approaches is to use a front-end 3D rendering library for demonstrations. Such setups are good at showing visual effects quickly, but they struggle to strictly validate spatial relationships between parts, and they make it hard to express conditions such as mechanical transmission, contact, and phase consistency as automatically checkable assertions. A more rigorous route is therefore “headless execution + parametric modeling + scripted geometry generation”: the model outputs a complete script, the script runs in batch mode without a GUI to produce a scene file, and an acceptance script reads the geometry data and performs quantitative checks.

    The essence of this shift is upgrading evaluation from visual review to engineering acceptance. Visual review depends on subjective judgment and is easily influenced by materials, lighting, and composition. Engineering acceptance breaks requirements into measurable indicators, for example whether width changes with a parameter, whether the chain path is recomputed, and whether the foot stays in contact with the pedal. Only the latter allows stable comparison of different models’ spatial reasoning and code organization.

    2. Design Principles: Expressing Spatial Relationships as Executable Constraints

    A high-quality evaluation prompt should contain four layers of constraints.

    The first layer is the deliverable constraint. It requires a single complete script and specifies how it runs: a script file executed by an interpreter in headless mode. It also forbids reliance on external reference images, forcing the model to complete the spatial layout from the text description alone. This tests spatial imagination and structural derivation more purely.

    The second layer is the scene semantics constraint. Take “a pelican riding a bicycle” as an example. The pose, transmission state, and phase relationships must be described clearly: body leaning forward, both wings extended forward to grip the handlebar, one webbed foot pressing a pedal while the other hangs at the lowest point of the return stroke; a classic diamond frame with a tool bag on the down tube and a fishing net strapped to the rear rack; cranks driving the rear wheel with a taut chain. These details are not decoration; they are the basis for later geometric verification.

    The third layer is the parameter linkage constraint. Key dimensions and mechanical parameters go at the top of the script as global constants, and all geometry must be derived from them. Functions must not contain “magic numbers” disconnected from those constants. Typical parameters include wingspan (controlling handlebar width and grip spacing), wheelbase (driving frame geometry), chainring teeth (affecting chain length and gear ratio), cog teeth, and crank phase angle (driving pedal position and foot contact).

    The fourth layer is the acceptance constraint. It declares that the reviewer will change only numbers, never code, then rerun the script and check whether several spatial relationships still hold. This is the core of the whole evaluation, because it separates “writing code” from “building a model”: the former only needs to produce a static appearance, while the latter must maintain the functional dependency between parameters and geometry.

    The parameters and their derivations can be expressed schematically like this:

    1. # Global constants (the reviewer only changes these numbers)
    2. PELICAN_WINGSPAN = 1.15 # Wingspan; drives 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. # Derived example: grip spacing comes from wingspan, not hardcoded independently
    8. GRIP_SPACING = PELICAN_WINGSPAN * 0.82
    9. HANDLEBAR_WIDTH = GRIP_SPACING * 1.10
    10. # Gear ratio and chain length must be derived from tooth counts
    11. GEAR_RATIO = CHAINRING_TEETH / COG_TEETH
    12. # The chain path should be recomputed from the center distance and pitch radii of both sprockets

    3. A Quantifiable Acceptance Checklist: Three Key Regressions

    The most valuable part of the evaluation is the regression checks performed after parameter changes. At least three categories are recommended.

    The first is the dimension linkage regression. Change the wingspan from a smaller value to a larger one, modify only the number, and rerun the script. Check whether the handlebar widens accordingly and whether the grip positions still enclose the wing tips. If the model hardcodes handlebar width, or never links grip position to the wing tips, this check fails immediately.

    The second is the transmission path regression. Increase the chainring teeth count, and the chain path must be recomputed: it must not pass through the frame or other parts, and must not contain floating, broken segments. A passing implementation typically derives a closed chain path from the center distance, pitch radii, and wrap angle of the two sprockets, rather than approximating with a fixed polyline.

    The third is the phase consistency regression. Change the crank phase angle to a different value: the webbed foot on the pedal must stay in contact with the pedal surface, and the other foot must remain low in the return stroke. This requires the model to express foot position as a function of phase, rather than fixing both feet at arbitrary coordinates.

    A simplified phase-to-pedal-position relationship can be written as:

    1. import math
    2. def pedal_position(crank_center, crank_length, phase_deg):
    3. rad = math.radians(phase_deg)
    4. x = crank_center[0] + crank_length * math.cos(rad)
    5. z = crank_center[1] + crank_length * math.sin(rad)
    6. return (x, z)
    7. # Contact between the supporting foot and the pedal surface: sole height is derived from pedal position
    8. foot_contact_z = pedal_position(CRANK_CENTER, CRANK_LENGTH, CRANK_PHASE_DEG)[1]

    4. Execution Pipeline: From Script Generation to Automated Assertions

    The workflow is best fixed into four steps, which makes cross-model comparison and continuous regression easier.

    1. Generation: submit the same prompt to multiple models, all required to output a complete script plus run instructions, with external assets forbidden.
    2. Execution: run the scripts in a unified batch environment and record whether errors occur, whether generation succeeds, and whether runtime is stable.
    3. Verification: read the geometry data from the generated output and run assertions, for example on width ratios, chain path continuity, and the distance threshold between foot and pedal.
    4. Reporting: produce structured conclusions that separate three dimensions, “runnability”, “parameter linkage”, and “spatial self-consistency”, so a single aggregate score does not hide weaknesses.

    For assertion design, prefer “thresholds + relative relationships” over absolute coordinates. For example, check whether the grip spacing to wingspan ratio falls in a reasonable range; check whether distances between consecutive chain path points are continuous and whether unexpected crossings appear; check whether the vertical distance between the supporting foot sole and the pedal top surface is below a set tolerance. Such assertions are more tolerant of stylized rendering while being more sensitive to spatial errors.

    5. Common Failure Modes and Suggested Fixes

    Failure mode one: decorative parameters. The constants exist but do not participate in geometry derivation, so changing the numbers leaves the scene unchanged. The fix is to require all key dimensions to be referenced as function parameters or global constants, and to search for hardcoded values during code review.

    Failure mode two: drifting contact relationships. Foot-to-pedal and wing-tip-to-grip contact looks correct at the initial phase but separates after parameters change. The fix is to express contact points as derived quantities in the same coordinate system and add distance assertions.

    Failure mode three: approximated chain paths. A fixed polyline replaces a closed path, causing clipping or floating segments when tooth counts change. The fix is to compute tangents and wrap angles from sprocket pitch radii and center distance, and generate a closed path.

    Failure mode four: phase decoupled from pose. The cranks rotate but the feet do not move. The fix is to let foot position, pedal position, and crank angle share the same phase variable.

    6. Conclusion: Let Engineering Acceptance Drive Capability Assessment

    When assessing “3D spatial reasoning and creative coding ability”, what matters is not whether the output looks good, but whether geometric and mechanical relationships remain correct after parameters change. Rewriting the evaluation as an engineering workflow of “global constants driving geometry + headless script execution + automated assertion regression” makes conclusions more reproducible and better reflects how usable a model is in real development scenarios. Teams that want to build such an evaluation system can run isolated environments on a container platform, store generated artifacts in object storage, and use logging and monitoring with alerting to track execution stability, forming a sustainable, automated evaluation loop.