Evaluating Spatial Reasoning in LLMs: A Practice of Parameterized 3D Generation Scripts
Text benchmarks often miss whether a model can keep a consistent 3D scene in mind. This article describes a harder test: generate a headless, runnable 3D modeling Python script for a pelican on a bicycle, then change global constants and re-run to check that geometry still fits. It covers task design, parameterized acceptance, why modeling APIs beat high-level renderers, typical score bands across models, and how teams can automate the loop.
Why spatial reasoning is a blind spot in LLM evaluation
Text evaluation for large language models is relatively mature: benchmarks, human ratings, and domain Q&A have well-established methods. Spatial reasoning still lacks a widely accepted test.
The usual approach is to ask models to answer geometry questions in words—cross-sections of solids, relative positions of objects. That setup has two serious flaws:
- Models can guess from language patterns without building a 3D scene internally.
- Correct-sounding text is not the same as a geometrically valid 3D model; executability is never checked.
A growing consensus is that the hard test is to have the model emit a runnable geometry-construction script and judge the render. Coding skill is only the vehicle. The real question is whether the model can keep a consistent coordinate system so that positions, orientations, and sizes of parts fit together, rather than looking “about right” in isolation.
Task design: a pelican riding a bicycle
To illustrate the design, consider a concrete task: from a text description only, produce a complete scene that runs as a Python script in an open-source 3D modeling tool in headless mode.
The scene: at dusk on a seaside promenade, a pelican rides a dark-green steel-frame bicycle. The body leans forward, both wings reach ahead to hold the handlebars; one webbed foot is on a pedal, the other hangs at the bottom of the return stroke. The frame is a classic diamond; a canvas tool bag hangs from the down tube; a roll of fishing net is tied to the rear rack.
The task discriminates because it is not “stack a few primitives.” Biological pose and mechanical structure must stay consistent through the drivetrain phase: crank angle sets pedal position, pedal position sets where the foot contacts, handlebar width must match wingspan, and the chain path must stay taut without intersecting geometry. Any spatial error shows up as obvious interpenetration, floating parts, or broken links.
Parameter coupling: coding vs. actually modeling
The most important check is parameterized acceptance. The script must define all key sizes as top-level global constants, and all geometry must derive from them:
PELICAN_WINGSPAN = 1.15 # wingspan; drives handlebar width and grip spacingBICYCLE_WHEELBASE = 1.02 # wheelbase; drives frame geometryCHAINRING_TEETH = 44 # chainring teeth; sets gear ratioCOG_TEETH = 16 # cog teethCRANK_PHASE = 35.0 # crank phase angle; drives pedals and foot contact
Reviewers change only the numbers, leave the code untouched, re-run, and check three points:
- Wingspan 1.15 → 1.35: do the handlebars widen? Do the wing tips still land on the grips?
- Chainring 44 → 52 teeth: is the chain path recomputed? Intersections or slack?
- Crank phase 35° → 140°: does the pedaling foot still sit on the pedal face? Is the other foot still at the low point of the return stroke?
That hits three layers of spatial reasoning:
- Geometric derivation: handlebar width must be a function of wingspan, not a hard-coded independent number.
- Drivetrain: chain length depends on tooth counts; the model must use tangent geometry of circles and a taut-chain condition.
- Phase coupling: pedal position is a trigonometric function of phase; foot pose must be solved to match.
Many models produce a scene that looks right once. Change a parameter and it falls apart—they fitted a static picture, not a parameterized spatial model.
Evaluation setup: from render libraries to modeling scripts
Early tests used in-browser 3D libraries. Those hit a ceiling quickly: cameras, lights, and composite transforms let models skip low-level coordinate work, so discrimination drops.
Switching to a professional 3D tool’s Python API forces vertices, meshes, transform matrices, and parent–child links. Spatial failures show up more honestly. Headless batch mode also supports automated regression: change parameters, re-run, capture renders, check acceptance points—without subjective human scoring.
Cross-model observations
Several mainstream models, same prompt, same parameter-change regressions, typically split into bands:
- Top tier: parameterized derivation works; chain, pedals, and grips stay consistent after edits; interpenetration stays acceptable.
- Mid tier: first render is passable, but coupling fails—handlebars ignore wingspan, chain path breaks after a tooth-count change—hidden hard-coding between parts.
- Fail: script does not run, or the result badly violates the spatial constraints in the prompt.
Claimed spatial-ability scores and this test do not always agree. Two models with similar paper benchmarks can diverge sharply on parameterized regression. For practitioners, a spatial-constraint task that matches the product is more informative than marketing numbers.
Practical suggestions
- Prefer strongly constrained tasks. Specifics (phase angle, tooth ratio, wheelbase) separate real ability from surface fitting.
- Put parameterized acceptance in the pipeline: constant sizes, derived geometry, and “change a number and re-run” checks.
- Use an automatable environment: headless scripts, render screenshots, and assertions form a reproducible loop.
- Run generation and evaluation in bulk on containers or function compute, archive renders in object storage, and keep execution traces in logs so the evaluation set is traceable.
Spatial reasoning is a step from “can talk” to “can do.” Parameterized generation is cheap to run and relatively objective; teams that care about LLM engineering capability should add it to their evaluation stack.
