# CADENA: Stepwise CAD Reverse Engineering

> CADENA reconstructs meshes as parametric CAD programs step-by-step with visual feedback, achieving state-of-the-art accuracy across five benchmarks via a generalized surface-matching metric.

- **Source:** [arXiv](https://arxiv.org/abs/2608.00799)
- **Published:** 2026-08-05
- **Permalink:** https://picx.dev/p/oKQ3uz
- **Whiteboard:** https://picx.dev/p/oKQ3uz/image

## Summary

## Summary (Overview)

- **CADENA** introduces a stepwise CAD reverse engineering approach that reconstructs 3D meshes as parametric CAD programs one operation at a time, using visual feedback from the partial build at each step
- The model uses a vision-language model (Qwen2-VL-2B) that observes the target mesh and current partial prediction rendered as a multi-view image, then predicts the next operation
- **CADENA-Bench** is introduced as a benchmark of 3,396 real mechanical parts across six families, addressing the lack of suitable evaluation datasets for mechanical parts
- **Generalized Match Score (GMS)** is proposed as a surface-matching metric that matches points by normal as well as position, unlike volume-based metrics (IoU) that can be satisfied by wrong primitives
- CADENA achieves state-of-the-art results on DeepCAD, Fusion360, MCB, CADENA-Bench, and BenchCAD datasets, with reinforcement learning from executed geometry improving both accuracy and validity

## Introduction and Theoretical Foundation

**Background and Motivation:**
- Parametric CAD models are essential for mechanical engineering, but most 3D assets exist only as raw geometry (meshes) without editable construction history
- Converting meshes to editable programs requires substantial expert effort; learning-based reverse engineering has made this tractable but existing systems emit entire programs in one pass without inspecting intermediate geometry
- Single-pass systems suffer from compounding early errors and condition on program text rather than remaining geometry

**Key Theoretical Insight:**
The target shape is available at inference time (it's the input, not a hidden label), so the system can compare the partial build against the target at every step. The policy is conditioned on the residual geometry — what remains to be modeled — rather than on program text.

**Problem Formulation:**
Given a mesh $M$, find a parametric program $P = (o_1, \ldots, o_T)$ whose execution reproduces $M$. The state after $t$ steps is $S_t = \text{exec}(P_t)$ with $S_0 = \emptyset$. Reconstruction is a sequential decision problem:
$$o_{t+1} \sim \pi(\cdot | R(M, S_t)), \quad P_{t+1} = P_t \oplus o_{t+1}$$

## Methodology

**Visual Feedback Representation:**
The observation $R(M, S_t)$ is a single multi-view image (504×1008 pixels) that superimposes:
- Target mesh in green channel
- Current partial prediction in red channel
- Six orthographic views (±X, ±Y, ±Z) with depth encoded as color intensity
- Two isometric views
- Yellow indicates overlap, green indicates missing geometry, red indicates excess material

**Hint Point Mechanism:**
A 3D coordinate provided as text to disambiguate which region to edit when multiple disconnected discrepancy regions exist. During training, hint points are sampled from newly added geometry boundaries; during inference, they are estimated via nearest-neighbor graph analysis on discrepancy regions.

**DSL and Execution:**
Operations are single lines of a CadQuery-based DSL with a single-variable convention:
```
r = extrude(r, point, plane, "sketch(...)", h)
```
Every operation consumes and rebinds variable $r$, making each step a well-formed continuation of any prefix. Coordinates are absolute and integral in a normalized frame where the largest bounding-box dimension equals a fixed world size (values in $[-100, 100]$).

**Training Procedure:**

1. **Supervised Fine-Tuning (SFT):**
   - Warm-up stage: 1.86M samples from programs of ≤2 operations
   - Main stage: 18.0M samples from programs up to 12 operations
   - Uses teacher-forced next-operation prediction with Qwen2-VL, batch size 64, learning rate $1.2 \times 10^{-4}$, cosine schedule

2. **Reinforcement Learning (RL):**
   - Reward: volumetric IoU between current build and target mesh (computed directly on meshes)
   - Uses ~4k meshes from training splits (1,500 from MCB, 2,500 from DeepCAD/Fusion360)
   - One-step signals: branches from reference trajectories into 32 candidates, keeps top-2 by advantage
   - GRPO normalization without KL penalty ($\beta = 0$)
   - 20 epochs over ~4k meshes, ~20k policy-gradient updates total

**Inference:**
- Greedy decoding with budget of 20 operations (extrapolates beyond 10-step training)
- Returns prefix maximizing IoU against target (test-time selection)
- Degrades gracefully: later operations that damage reconstruction are simply not selected

## Empirical Validation / Results

**Datasets and Metrics:**
- DeepCAD, Fusion360, MCB (external benchmarks)
- CADENA-Bench (3,396 parts across 6 families: shafts & bushings, gears & bearings, housings & frames, flat & levers, springs & fasteners, tooling & gauges)
- BenchCAD (17,895 parts, Vision2Code metric)
- Metrics: CD (Chamfer distance), IoU, GMS (Generalized Match Score), IR (invalid rate)

**GMS Definition:**
For $N$ points sampled on reference ($A$) and reconstructed ($B$) surfaces with unit normals:
- A point $p \in A$ is matched if $\exists q \in B$ with $\|p - q\| \leq \tau$ and $n_p \cdot n_q \geq \cos\alpha$
- $$\text{GMS} = \frac{100}{\alpha_{\max}} \int_0^{\alpha_{\max}} g(\tau, \alpha) \, d\alpha, \quad \alpha_{\max} = 25^\circ$$
- where $g(\tau, \alpha) = 2 \left( \text{Rec}(\tau, \alpha)^{-1} + \text{Prec}(\tau, \alpha)^{-1} \right)^{-1}$

**Main Results (Table 1):**

| Method | DeepCAD GMS↑ | Fusion360 GMS↑ | MCB GMS↑ | MCB IR↓ |
|--------|--------------|----------------|----------|---------|
| CAD-Recode | 92.9 | 85.8 | 54.7 | 21.5 |
| cadrille | 94.8 | 86.8 | 55.0 | 1.5 |
| CADReasoner | 94.9 | 88.6 | 55.2 | 31.7 |
| CADEvolve | 95.3 | 88.2 | 58.3 | 9.2 |
| CADFit | 89.8 | 84.6 | 60.1 | 29.7 |
| CADENA-SFT | 95.3 | 90.8 | 63.4 | 12.0 |
| **CADENA-RL** | **97.0** | **93.3** | **73.7** | **0.7** |

**Per-Category Results (Table 2):**

| Method | Shafts & bushings | Gears & bearings | Housings & frames | Flat & levers | Springs & fasteners | All |
|--------|------------------|------------------|-------------------|---------------|---------------------|-----|
| CAD-Recode | 53.8 | 39.1 | 56.1 | 58.8 | 45.3 | 48.9 |
| cadrille | 57.6 | 37.2 | 54.5 | 62.1 | 46.3 | 49.8 |
| CADReasoner | 55.6 | 46.9 | 56.4 | 69.7 | 43.4 | 52.9 |
| CADEvolve | 59.6 | 41.3 | 59.4 | 66.4 | 47.9 | 52.9 |
| CADFit | 60.8 | 61.3 | 48.5 | 66.2 | 42.3 | 54.8 |
| CADENA-SFT | 70.8 | 47.8 | 58.1 | 66.8 | 51.9 | 57.8 |
| **CADENA-RL** | **73.0** | **58.1** | **70.7** | **76.8** | **63.4** | **67.0** |

**BenchCAD Results (Table 3):**
- CADENA-RL: **0.910** voxel IoU, **0.9%** IR
- Next best specialist: qwen3-2b-rl-iid (0.752 IoU, 1.1% IR)
- Best frontier model: GPT-5.6 Sol (0.706 IoU, IR not reported)

**Key Findings:**
- DeepCAD is saturated (all methods within few points); real mechanical parts (CADENA-Bench) are dramatically harder
- CADENA-RL margin over strongest baseline: 1.7 points on DeepCAD → 12.2 points on CADENA-Bench
- Invalid rates span two orders of magnitude; CADENA-RL achieves ≤1.2% IR across all datasets
- Sampling decoding (E=12 candidates) improves over greedy, especially for SFT model on MCB (+6.7 GMS)

## Theoretical and Practical Implications

**Theoretical Contributions:**
- Demonstrates the value of stepwise generation with geometric feedback for CAD reverse engineering
- Shows that conditioning on residual geometry rather than program text reduces error compounding
- Proves that geometric reward (IoU) is sufficient for learning valid programs without program-level supervision
- GMS provides a more meaningful evaluation metric by matching surface types rather than occupied volume

**Practical Implications:**
- Enables automatic conversion of legacy 3D assets (scanned parts, archives without history) into editable parametric models
- Reduces expert effort required for CAD reverse engineering
- CADENA-Bench provides a standardized evaluation for mechanical parts, revealing domain-specific weaknesses
- The approach degrades gracefully on hard cases rather than failing catastrophically
- Stepwise inference (with execution and rendering) is more expensive than single-pass methods but justified by accuracy gains on complex parts

## Conclusion

CADENA outperforms prior methods across all evaluated datasets, with the margin widening significantly on real mechanical parts compared to sketch-extrude corpora. Reinforcement learning against executed geometry improves both reconstruction accuracy and program validity. The comparison with CADFit reveals complementary failure modes: learned methods struggle on rotationally patterned parts where direct optimization excels, suggesting the two approaches are better combined than treated as alternatives.

**Limitations:**
- Does not lead on gears & bearings (CADFit's direct fitting outperforms)
- Fixed eight-view protocol misses geometry hidden from canonical viewpoints
- Features without DSL operations are approximated by extrusion stacks
- Countable features (e.g., gear teeth) are approximated rather than counted
- Early errors in plane selection are worked around rather than undone
- Stepwise inference costs more per part than single forward pass

**Future Directions:**
- Include single-pass model trained on the same corpus to isolate stepwise inference contribution
- Address CAD query transfer limitations for industrial software compatibility

---

_Markdown view of https://picx.dev/p/oKQ3uz, served by PicX — AI-generated visual whiteboard summaries of research papers._
