~/shanegraffiti.com/research/itercad-agent Shane Graffiti Inc. Semantic Adversarial Research Division 2026

CLOSING
THE LOOP
ON CAD
GENERATION

Most CAD-generation systems work the way a junior drafter would if forbidden from ever looking back at their own work: one shot, no revision, whatever the model outputs is final. Professional CAD practice runs the opposite loop generate, verify against the drawing, refine, repeat. IterCAD formalizes that loop as a multi-turn agent operating inside an executable CAD sandbox, unifying three tasks: turning a multi-view engineering drawing into parametric CadQuery code, turning a text requirement into code, and editing existing code from natural-language instructions. A two-stage recipe cold-start supervised fine-tuning on expert trajectories, then geometry-aware reinforcement learning with a viable-prefix masking scheme that stops crediting or blaming turns for failures they didn't cause teaches the agent to debug its own runtime errors and correct its own geometry against rendered visual feedback. A new evaluation curve, Chamfer-Distance Tolerance-Recall, closes a long-standing loophole in CAD benchmarking by scoring failed generations as zero recall instead of quietly dropping them from the average.

Division
Semantic Adversarial Research
Domain
Agentic AI / Computer-Aided Design
Published
arXiv 2606.13368 2026
Key Result
0.30% invalid ratio, AUC-TR 0.61, closed loop
Drawing-to-Code◆ Text-to-Code◆ Interactive Editing◆ Closed-Loop Refinement◆ CadQuery◆ GSPO◆ Geometry-Viable Prefix Masking◆ Chamfer Distance Tolerance-Recall◆ AUC-TR◆ Cold-Start SFT◆ Survivor-Bias-Free Evaluation◆ OCCT Kernel◆ Drawing-to-Code◆ Text-to-Code◆ Interactive Editing◆ Closed-Loop Refinement◆ CadQuery◆ GSPO◆
§ 2.0Core Concepts

IterCAD is governed by a "Look and Loop" philosophy. Look leverages multi-view engineering drawings with dimensional constraints as a persistent reference to isolate defects. Loop establishes a multi-dimensional refinement mechanism that integrates compiler, execution, and visual feedback rather than blind regeneration. [click a term to focus it]

{{ d.name }}
{{ d.body }}
§ 3.0The Two-Stage Training Pipeline

A static, open-loop policy can't learn to debug itself from imitation alone. IterCAD bootstraps procedural reasoning first, then hands the policy to closed-loop reinforcement learning to teach genuine self-correction. [click a stage for its measured outcome]

Stage 1 Imitation
Progressive
Cold-Start SFT
20K expert trajectories establish the basic mapping from engineering specifications to executable code. A further 8K on-policy trajectories, corrected by a teacher model against the base policy's own execution failures, instill iterative debugging behavior before RL ever begins.
⇄refine
Stage 2 Reinforcement
GSPO +
Geometry Rewards
Sequence-level policy optimization with group-relative advantages and a length-normalized importance ratio, restricted to 2K hard Drawing-to-Code samples the task that most rewards closed-loop geometric feedback over imitation alone.
{{ stageReadoutLabel }}{{ stageReadoutBody }}
Reward & advantage GSPO with GVPM R(y) = R_CD(y) + λf · R_fmt(y) + λp · R_prog(y) // λf = 0.5, λp = 0.2 geometric fidelity, format compliance, multi-turn progress Â_g = (r_g − mean({r_g'})) / std({r_g'}) // group size G = 8, length-normalized importance ratio prevents long trajectories from dominating f = min(f_exec, f_stall) // GVPM masks tokens past the viable-prefix boundary; masked trajectories clamp Â_g ≥ 0
§ 4.0Benchmark Results

Agentic Workflow on IterCAD-Draw closed-loop sandbox feedback, up to 5 turns. IterCAD (built on a 4B backbone) converts the multi-turn budget into accuracy that an order-of-magnitude-larger competitor can't match. [click any column header to sort]

0%
IterCAD invalid ratio vs 62.30% backbone baseline
0
AUC-TR best of all evaluated models
0
Mean Chamfer Distance ×10³ lowest in field
0
Average turns most parts solved in a single pass
IterCAD-Draw Agentic Workflow (closed-loop sandbox)
ModelIR%AUC-TRMean CDMed. CDAvg Turn
GPT-54.700.5012.181.072.44
Gemini-3-flash-lite12.700.565.790.093.12
GLM-4.6v9.700.4313.723.272.59
Qwen3.5-35B-A3B37.500.3612.510.103.50
Qwen3.5-4B (backbone)62.300.2113.040.094.39
IterCAD (ours)0.300.615.090.352.48
IterCAD-Edit instruction-based local editing
ModelIR%AUC-TRMean CDMed. CDAvg Turn
GPT-50.500.792.140.052.31
Gemini-3-flash-lite11.000.514.270.064.23
Qwen3.5-35B-A3B11.000.557.490.143.84
Qwen3.5-4B (backbone)63.000.189.961.254.49
IterCAD (ours)1.000.547.520.772.34
§ 5.0What Each Stage Buys

Starting from the bare Qwen3.5-4B backbone, every added component compounds. The full recipe SFT, on-policy refinement, GSPO, and GVPM is what closes the gap from a 62.30% invalid ratio to 0.30%. [click a step to expand it]

01
Cold-Start SFT on Expert Trajectories+
The first imitation pass alone drops invalid ratio from 62.30% to 7.50% and lifts AUC-TR from 0.21 to 0.52 establishing the basic specification-to-program mapping before any closed-loop signal is introduced.
02
On-Policy Refinement Data+
Adding teacher-corrected trajectories that target the base policy's own execution failures pushes invalid ratio down to 0.80% proof that imitation alone, without geometry-aware RL, still leaves Mean CD high at 12.44.
03
GSPO Reinforcement Learning+
Closed-loop reward optimization lowers Mean CD to 8.00 and lifts AUC-TR to 0.58 but without further correction, average turns collapse to 2.18 as the policy learns premature termination is locally rewarding.
04
Geometry-Viable Prefix Masking+
Masking gradient contributions from stalled or error-cascading suffixes fixes the credit-assignment problem directly: invalid ratio falls to 0.30%, AUC-TR reaches 0.61, Mean CD drops sharply to 5.09 and the agent persists through productive multi-turn correction instead of bailing early.
§ 6.0What IterCAD Unlocks

Open-loop, one-shot CAD generation can't recover from its own mistakes by definition. IterCAD's closed-loop architecture generalizes well beyond its own benchmark confirming the gains aren't an artifact of one evaluation protocol.

01
Drawings as Spatial Anchors+
Multi-view engineering drawings with dimensional constraints persist across every turn as a physical reference, letting the agent isolate which specific feature is wrong rather than regenerating the whole part from scratch.
02
One Agent, Three Modalities+
A single unified session reconstructs a base plate from a drawing, then applies sequential natural-language edits increase thickness, add fillets, undo an operation, add a chamfered boss while preserving unaffected geometry throughout.
03
Generalizes Beyond Its Own Benchmark+
On the external Text2CAD benchmark, IterCAD posts a 0.64% invalid ratio against general-purpose models exceeding 50%. On CADPrompt, it beats the domain-specific CAD-Judge baseline by an order of magnitude in median Chamfer Distance.
~/conclusion
$ query: what does IterCAD change // CAD generation stops being open-loop and one-shot. // the drawing becomes a persistent reference the agent checks itself against. $ query: what does this cost // two training stages instead of one, plus a sandbox the agent can fail inside safely. // GVPM exists specifically so failure in turn 4 doesn't punish a correct turn 1. $ query: what is the actual result // 0.30% invalid ratio, AUC-TR 0.61, 2.48 average turns. // a 4B-parameter model out-debugging baselines an order of magnitude larger.

CAD GENERATION
ISN'T
ONE-SHOT.
IT'S A
LOOP.