DEV Community

Cover image for Gemma 4 CAD Orchestrator
Aravind d
Aravind d Subscriber

Posted on

Gemma 4 CAD Orchestrator

Gemma 4 Challenge: Build With Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

Gemma 4 CAD Orchestrator is a cloud-native, AI-powered parametric CAD application that lets engineers describe mechanical parts in plain English and instantly see them rendered in 2D blueprint view and 3D interactive viewport β€” powered by Google DeepMind's Gemma 4 26B A4B IT via Vertex AI Model Garden.

πŸŽ₯ Live Demo

🌍 Try the Application:
Gemma 4 CAD Orchestrator Live Demo

πŸ”₯ How I Used Gemma 4

πŸ—οΈ Engineering the Future of CAD with AI

  1. The Vision

Traditional CAD workflows are powerful β€” but painfully slow.

Mechanical engineers already visualize components mentally long before they open design software. Yet translating those ideas into production-ready geometry still requires repetitive manual operations.

I wanted to eliminate that friction completely.

The goal was ambitious:

β€œWhat if engineers could design mechanical parts exactly the way they think?”

So I built a deterministic text-to-geometry orchestration engine powered by Gemma 4.

A user can type:

Create a mounting plate 100mm long, 60mm wide, 8mm thick with four 10mm bolt holes.
Enter fullscreen mode Exit fullscreen mode

…and within seconds the system generates:

A structured parametric model
A live 3D interactive viewport
A synchronized 2D engineering blueprint
An editable feature tree
Accurate dimensional calculations

No installation.
No workstation-heavy CAD software.
Just AI-native engineering.

πŸ€– Why Gemma 4?

The hardest challenge wasn't rendering geometry.

It was teaching an LLM to reliably understand engineering intent while producing deterministic JSON structures without hallucinating invalid dimensions or impossible geometry.

Gemma 4 handled this exceptionally well.

Its MoE architecture enabled:

Faster structured generation
Lower inference overhead
Stable schema adherence
High-context engineering interpretation
Strong reasoning across dimensional constraints

To maximize reliability, I built the orchestration layer with a multi-provider cascading architecture.

AI Backend Cascade
Ollama β†’ Local workstation inference fallback (gemma4:31b, gemma4:26b)
Vertex AI Gemma 4 MaaS β†’ Primary production inference engine
Hugging Face Inference API β†’ Serverless resilience layer
Google Gemini API β†’ Operational failover endpoint

The backend automatically detects available providers and gracefully reroutes requests during failures.

3. System Architecture

User Browser Cloud Run Vertex AI
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” HTTP β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” gRPC β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Three.js 3D │◄────────────►│ Express Backend │◄────────►│ Gemma 4 26B A4B β”‚
β”‚ Canvas 2D β”‚ /api/* β”‚ @google/genai β”‚ β”‚ MaaS (Global) β”‚
β”‚ Copilot UI β”‚ β”‚ JSON Parser β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ System Prompt β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ google.json β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

⚑ Operational Pipeline

  1. Intent Capture Users define mechanical concepts directly inside a terminal-style AI Copilot interface.
  2. Contextualization
    Middleware injects highly constrained system prompts defining:
    Valid geometric primitives
    Parametric boundaries
    Execution examples
    Dimensional validation rules
    Typed schema contracts

  3. Inference Execution
    Gemma 4 generates deterministic structured payloads containing:
    shapeType
    params
    featureTree
    coordinates
    engineering explanation

  4. Geometry Translation
    The frontend converts the generated schema into live geometry.
    Three.js renders the interactive WebGL viewport
    HTML5 Canvas produces synchronized orthographic engineering blueprints
    Responsive orbit controls enable real-time interaction

5. Key Technical Decisions

Decision Tactical Benefit
Serverless Cloud Run Zero cluster overhead, auto-scaling execution to 0, isolated 512MB RAM footprintsβ€”ideal for hyper-efficient, cost-conscious microservice hosting.
Pure Client-Side Renders Leveraged vanilla HTML5 Canvas and native Three.js via CDN. Zero heavy server-side image processing, reducing latency to near real-time.
MoE Routing Constraints Utilizing the 26B A4B variant routes work to 3.8B active parameters per token, slashing generation times while holding high-level structural intelligence.
Unified @google/genai Integration Erased SDK technical debt by utilizing the new standardized Google SDK, establishing clean async patterns via ai.models.generateContent().

Structured JSON Contracts Guaranteed geometry-safe deterministic outputs
πŸ› οΈ Engineering Challenges Solved
πŸ”„ SDK Migration During Development

Mid-development API changes required rebuilding inference routing from legacy model instantiation methods into unified client pipelines.

🌐 Vertex AI MaaS Routing

Debugging global endpoint routing behavior for Model Garden MaaS instances required runtime-level validation and failover engineering.

πŸ“¦ JSON Conformance Stability

LLMs often break structured output when prompts become highly technical.

I solved this by:

Separating reasoning blocks from payload blocks
Enforcing strict tagged response zones
Designing schema-first prompts
Using deterministic parsing validation

πŸ“š Core Parametric Geometry Library

Primitive Param 1 Param 2 Param 3 Param 4
plate length width thickness holeDia
bracket leg1 leg2 width thickness
spacer length outer bore β€”
block length width height bore
cube length width height β€”
cylinder radius height β€” β€”
sphere radius β€” β€” β€”
cone radius1 radius2 height β€”
torus ringRadius tubeRadius β€” β€”

πŸš€ What’s Next
πŸ–ΌοΈ Multimodal Blueprint Reconstruction

Gemma 4 already supports multimodal inputs.

The next phase is enabling users to upload:

Whiteboard sketches
Hand-drawn blueprints
Engineering photos

…and automatically reconstruct them into editable CAD geometry.

🏭 Industrial Export Pipelines

Planned support includes:

STEP
STL
DXF
Manufacturing-ready CAD exports
✨ Advanced Geometry Modifiers

Upcoming AI-assisted geometric operations:

Chamfer generation
Fillet computation
Shell modifiers
Parametric edge reconstruction

Snip about my ideas:

🌌 Final Thoughts

Gemma 4 CAD Orchestrator represents more than a hackathon project.

It explores a future where:

Engineers communicate with software naturally
AI understands manufacturable intent
CAD becomes conversational
Design iteration happens instantly

This project combines:

AI reasoning
Cloud-native infrastructure
Real-time rendering
Parametric engineering
Deterministic geometry systems

…into a single AI-native mechanical design workflow.

The future of engineering software won't start with menus.

It will start with language.

Top comments (0)