Evaluating LLM Spatial Reasoning with Parameterized 3D Generation: A Practical Guide
This article explains how to evaluate LLM spatial reasoning by requiring models to generate parameterized 3D modeling scripts rather than static browser-based scenes. It covers parameter-driven design, a “pelican riding a bicycle” test case with layered spatial and kinematic constraints, systematic parameter perturbation tests, blind cross-model comparisons, common failure modes, and practical engineering recommendations. Readers receive a reproducible framework for assessing geometric understanding, constraint propagation, and motion consistency in model-generated 3D code.
1. Evaluation Context: Why Spatial Reasoning Is a Capability Divide
In code generation, producing syntactically correct and logically coherent code is only the baseline. The real differentiator is a model’s ability to construct a geometric world internally: whether it can understand the relative positions of parts, the relationships that transmit motion, and how the entire structure changes when a parameter changes.
A common evaluation method is to have the model generate browser-based 3D rendering scenes. This approach is easy to start with and visually intuitive, but it has clear limitations. Such scenes are often static displays, and coordinates are frequently fine-tuned by hand. As a result, they struggle to reveal how deeply a model understands structural constraints. By contrast, requiring the model to generate 3D modeling scripts that can run in headless background mode forces every geometric element into a precise coordinate and parameter system. This is a stricter test of the model’s capabilities.
2. Core Methodology: From “Writing Code” to “Building a Model”
The key to the evaluation design is to prevent the model from getting by on visual resemblance alone. It must satisfy verifiable parameterized constraints. An effective approach is as follows:
- Define every key dimension as a global constant at the top of the script.
- Require all geometry-generation logic to derive from these constants, prohibiting detached “magic numbers” inside functions.
- Modify the constants and rerun the script to test whether the model truly understands the structural relationships.
An illustrative parameter design is shown below:
# Global constants: all geometry generation must derive from thesePELICAN_WINGSPAN = 1.15 # Wingspan, drives handlebar width and grip spacingBICYCLE_WHEELBASE = 1.02 # Wheelbase, drives frame geometryBICYCLE_CHAINRING_TEETH = 44 # Number of chainring teeth, affects chain lengthBICYCLE_COG_TEETH = 16 # Number of rear cog teethBICYCLE_CRANK_PHASE = 35.0 # Crank phase angle, drives pedal positions# All functions below may reference only the constants and derived quantities above.# Hard-coded coordinates outside the parameter system are not allowed.
This design clearly separates “can generate code” from “can understand a model.” The former only checks whether the output runs. The latter also checks whether the result responds correctly to parameter changes.
3. Test Scene Design: “A Pelican Riding a Bicycle”
A strong test prompt should contain three kinds of difficulty at the same time: form creativity, spatial relationships, and dynamic coupling. Consider “a pelican riding a bicycle on a seaside promenade at dusk” as an example. Its constraints can be designed in layers:
- Form layer: The pelican leans forward, extends both wings to hold the handlebars, places one webbed foot on a pedal, and leaves the other suspended at the lowest point of its return stroke.
- Structure layer: The bicycle is a classic diamond steel frame with a dark green finish, a canvas tool bag hanging from the down tube, and a fishing net tied to the rear rack.
- Dynamics layer: The crank is driving the rear wheel, the chain is under tension, and the riding posture must be consistent with the current phase of the drivetrain.
- Style layer: Overall artistic treatment is allowed, but the spatial relationships between parts must pass parameterized checks.
The subtlety of this prompt lies in “dynamic consistency.” The pelican’s foot position is not arbitrary; it is uniquely determined by the crank phase angle. If the model merely generates a visually similar scene, then changing the phase angle will cause the foot to leave the pedal or clip through it, immediately exposing the problem.
4. Acceptance Plan: Parameter Perturbation Tests
Evaluation should not rely on a single rendered result. It should perform systematic parameter perturbation. Three core checks are recommended:
- Wingspan perturbation: Change the wingspan from 1.15 to 1.35, changing only the number and not the code, then rerun. Pass criteria: the handlebars widen accordingly, the grips still enclose the wing tips, and there is no floating or clipping.
- Drivetrain perturbation: Change the chainring tooth count from 44 to 52. Pass criteria: the chain path is recomputed from the tooth count and wheelbase; chain length, wrap angle, and tension state remain correct; and there is no clipping or floating.
- Phase perturbation: Change the crank phase angle from 35 to 140. Pass criteria: the pedaling webbed foot still contacts the pedal surface, while the suspended foot remains at the low point of the return stroke.
These three perturbations test local-to-global dimensional coupling, geometric solving capability, and kinematic consistency, respectively. Together they cover the main failure modes of spatial reasoning.
5. Comparative Experiment Design: Blind Testing of Multiple Models on the Same Prompt
To obtain persuasive conclusions, the following comparison method is recommended:
- Unified prompt: Give every tested model exactly the same original prompt, including parameter definitions, scene description, and acceptance criteria, to avoid bias introduced by wording differences.
- Unified execution environment: Run the generated scripts in the same version of the modeling software and the same headless batch execution mode to control environment variables.
- Unified perturbation workflow: Apply the same set of parameter changes to each model’s output, and record both rendered results and geometry-check results.
- Multiple sampling rounds: Generate multiple times from the same model to observe stability and avoid misjudging a single lucky run.
Scoring dimensions can include script runnability, correctness of parameter responses, accuracy of spatial relationships, consistency of motion coupling, visual completeness, and code engineering quality, such as whether constants are actually reused and whether magic numbers exist.
6. Common Failure Modes and Diagnosis
Several typical failures are worth recording in practice:
- Static screenshot-style generation: The image looks good, but all coordinates are hard-coded. Changing any constant leaves the scene unchanged or makes it crash outright.
- Local coupling failure: The handlebars widen with the wingspan, but the grips do not follow, leaving the wing tips floating.
- Transmission approximation error: The chain is assembled from fixed-length cylinders. After changing the tooth count, it passes through the frame or slips off the sprocket.
- Phase-pose disconnect: The crank angle changes, but the pelican’s feet do not move accordingly, producing “floating pedaling.”
- Parameter definition-use disconnect: Constants are defined at the top, but functions use separate hard-coded values internally, rendering the parameterization nominal.
Recording failure modes is more valuable than simply assigning scores. It reveals a model’s weaknesses in geometric understanding, constraint propagation, and kinematic modeling.
7. Engineering Practice Recommendations
- Explicitly constrain the prompt to prohibit magic numbers and require centralized constant declarations.
- Build self-check functions into the script. For example, check whether the distance between the foot and the pedal surface is below tolerance, and whether the distances from the chain endpoints to the centers of the chainring and cog match the pitch radii derived from tooth counts.
- Write acceptance criteria as automatically executable assertions to reduce the subjectivity of manual visual inspection.
- Preserve the raw script and rendered screenshot from every generation run for every model, creating a traceable evaluation archive.
- Ensure perturbation tests cover “change only the numbers, not the code.” This is the most direct way to test parameterization quality.
8. Conclusion
An evaluation method centered on parameterized 3D scripts moves LLM spatial reasoning from “looks right” to “computationally right.” It requires the model to combine geometric modeling, constraint propagation, and kinematic coupling, and to withstand rechecks under parameter perturbation. For developers who need to evaluate or select large models, this method provides a reproducible, quantifiable, and extensible framework. By changing the scene theme, different capability areas can be tested while the acceptance logic remains unchanged. True spatial intelligence is not about rendering a single beautiful frame; it is about ensuring that the whole world remains coherent after one number is changed.
