Evaluating Spatial Reasoning in LLMs: A Practical Guide to Parametric 3D Generation
This article examines why generating 3D code does not prove a model has genuine spatial reasoning, and how to evaluate it reliably. It explains a three-layer capability model—geometric consistency, motion phase consistency, and parametric evolvability—and an evaluation method that moves from web-based 3D libraries to headless scripting in professional 3D software. You will find prompt design guidance covering scene narrative, global parameters, linkage rules, and acceptance actions, along with implementation tips for parametric dependencies, common failure modes, and a troubleshooting checklist. The core takeaway: turn aesthetic judgment into parametric acceptance so outputs stay correct after parameters change.
1. Background: Why Generating 3D Code Is Not Spatial Reasoning
In recent discussions of model capabilities, spatial reasoning is often reduced to “the ability to output a piece of 3D rendering code.” But once evaluation moves from web 3D libraries to the scripting interfaces of professional 3D software, the problem becomes clear quickly: the scene may look busy, yet the spatial relationships between parts do not hold up under parametric checks. Genuine spatial reasoning involves at least three layers of capability.
The first layer is geometric consistency: the positions of the frame, wheels, and drivetrain must be derived from the same set of dimensions, not hard-coded independently. The second layer is motion phase consistency: the crank, pedals, and foot contact points must satisfy the same phase constraint. The third layer is parametric evolvability: after changing a few global constants, the model must still recompute a self-consistent structure.
The original evaluation made a straightforward observation: given the same prompt, different models varied clearly in completeness—some ran through end to end, others failed midway. This shows the focus of evaluation should not be “does it look right,” but “is it still right after parameters change.”
2. Upgrading the Evaluation Method: From Web 3D to Scripted Modeling
Early testing often relied on web 3D libraries. The advantage is fast visualization; the drawback is limited scene scale, materials, and constraint-solving capability, which can easily mask modeling defects. Switching to the headless scripting mode of professional 3D software brings evaluation closer to a real production pipeline:
# Example: running a script in headless mode# blender --background --python text_to_3d_scene.py
This approach offers three benefits:
- Harder constraints: geometry must actually exist in the scene, so clipping and floating parts are observed directly.
- Reproducibility: the same script can run in batch under different parameters, which is convenient for regression.
- Verifiability: “aesthetic judgment” is converted into “parametric checks.”
3. Prompt Design: Pushing “Write Code” Toward “Build a Model”
The core of an evaluation prompt is not describing a picture, but defining the deliverable and the acceptance method. A high-quality prompt should contain four parts: scene narrative, global parameters, linkage rules, and acceptance actions.
Scene narrative example: a seaside boardwalk at dusk, a pelican riding a dark green steel-frame bicycle, body leaning forward, both wings extended forward to grip the handlebar, one webbed foot pressing a pedal while the other hangs in the air at the lowest point of the return stroke; the frame is a classic diamond type, a canvas tool bag hangs from the down tube, a fishing net is tied to the rear rack; the crank drives the rear wheel, the chain is tensioned, and the riding posture is consistent with the drivetrain phase.
Global parameters example (placed at the top of the script; all geometry must be derived from these constants):
PELICAN_WINGSPAN = 1.15 # Wingspan (m); controls handlebar width and grip spacingBICYCLE_WHEELBASE = 1.02 # Wheelbase (m); drives frame geometryCHAINRING_TEETH = 44 # Chainring teeth; drives chain length and gear ratioCOG_TEETH = 16 # Rear cog teethCRANK_PHASE = 35.0 # Crank phase angle (deg); drives pedal and foot contact
Linkage rules must state clearly “who drives whom”: wingspan drives the handlebar and grip spacing; wheelbase drives the frame triangles and the front/rear wheel positions; chainring and cog teeth together determine the gear ratio and chain path; crank phase determines pedal coordinates and foot contact.
Acceptance actions are the most easily overlooked yet most critical part: change only the numbers, leave the code untouched, rerun, and check whether the handlebar becomes wider while the grips still enclose the wing tips; whether the chain is recomputed after enlarging the chainring without clipping or floating; and whether, after the phase changes, the pedaling foot still contacts the pedal and the free foot remains at the low point of the return stroke.
4. Implementation Tips for Parametric Linkage
To pass acceptance, the script structure must be “parameters first.” A layered approach is recommended:
- Constants layer: holds only global parameters; magic numbers inside functions are forbidden.
- Derivation layer: compute wheel positions from the wheelbase, pitch circles and chain tangents from the tooth counts, and pedal coordinates from the phase.
- Assembly layer: place parts according to spatial relationships, and perform bounding-box and contact checks.
- Output layer: unify materials, naming, and collection structure for easy review.
The chain path is a common point of failure. The correct approach is to find the external common tangents of the chainring and cog pitch circles, then generate chain links according to tension conditions, rather than approximating with a fixed-length ring. Foot contact should be derived by computing the pedal surface normal from the phase angle, then projecting the sole of the webbed foot onto that plane.
5. Common Failure Modes and Troubleshooting Checklist
- Leftover magic numbers: handlebar width is hard-coded, so changing wingspan has no effect.
- Phase disconnect: the pedal moves but the foot does not, causing floating or clipping.
- Chain approximation: chain length does not update after the tooth count changes.
- Structural drift: the frame triangle does not close after the wheelbase changes.
- Incomplete delivery: missing a headless entry point or unavailable dependencies.
Recommended troubleshooting order: run with default parameters first, then change parameters one by one for differential comparison, and finally apply contact and bounding-box assertions.
6. Conclusion
The reliable path for evaluating spatial reasoning is to turn an aesthetic problem into a parametric acceptance problem. As long as the prompt specifies global constants, linkage relationships, and acceptance actions, model output shifts from “looks right” to “still right after changes.” For developers, this method can be applied directly to regression testing of intelligent coding tools. For enterprises, it can be combined with container platforms for batch execution, object storage for archiving scripts and results, and logging services with monitoring and alerting to track failure rates, forming a sustainable model-capability evaluation pipeline. It can also be implemented on Baidu AI Cloud’s general capabilities as a standardized evaluation practice.
