Skip to content

ReverseZoom2151/spatialhero

Repository files navigation

SPATIALHERO

Making Instruction-Tuned LLMs Spatially Aware

Fine-tune LLMs to generate better 3D CAD code with multi-modal reward signals

Quick StartKey FeaturesWhy SpatialHeroPerformance

Python 3.8+ GPT-5 Compatible Tests Passing MIT License


What is SpatialHero?

SpatialHero is a production-ready system that trains large language models to understand and generate 3D spatial content. Unlike vanilla LLMs that struggle with spatial reasoning, SpatialHero uses multi-modal reward signals to teach models to create accurate CAD designs from natural language.

The Problem

Current LLMs can generate simple CAD code, but lack the spatial context needed for complex, real-world geometries.

Our Solution

A multi-modal reward system that evaluates CAD generation across 4 dimensions:

  • Code Validity - Syntax and execution
  • Dimensional Accuracy - Programmatic measurement (91.7% accurate)
  • Visual Quality - LLM-based evaluation with real 3D renders
  • Geometric Topology - Physical plausibility checks

Result: Generate complex CAD models with 82-93% quality scores


Key Features

  • Multi-Modal Evaluation - 4D composite reward signals (vs single 0-1 score)
  • 5-Stage Validation - Comprehensive error detection pipeline
  • GPT-5 Integration - Full support for latest OpenAI models
  • Rich Feedback - Actionable error messages and suggestions
  • 91.7% Accurate - Dimensional measurement precision
  • Fast - 6-13 seconds per sample
  • Cost Effective - 4x cheaper than original proposal
  • 100% Tested - 18/18 tests passing

Quick Start

# Install
pip install -r requirements.txt

# Set API key in .env
echo "OPENAI_API_KEY=sk-..." > .env

# Generate CAD code!
python examples/demo.py

Why SpatialHero?

Feature Original Proposal SpatialHero
Reward Signal 1D (0-1) 4D composite
Validation Vision only 5-stage pipeline
Dimensional Checks None Programmatic
Test Coverage None 100%
Feedback Vague Precise & actionable

Performance

  • Code Validity: 100%
  • Dimensional Accuracy: 91.7%
  • Average Reward: 0.847
  • Test Coverage: 100% (18/18 passing)

License

MIT License


Made for the CAD AI community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages