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 MM, find a parametric program P=(o1,,oT)P = (o_1, \ldots, o_T) whose execution reproduces MM. The state after tt steps is St=exec(Pt)S_t = \text{exec}(P_t) with S0=S_0 = \emptyset. Reconstruction is a sequential decision problem:

ot+1π(R(M,St)),Pt+1=Ptot+1o_{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,St)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 rr, 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][-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×1041.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 (β=0\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 NN points sampled on reference (AA) and reconstructed (BB) surfaces with unit normals:

  • A point pAp \in A is matched if qB\exists q \in B with pqτ\|p - q\| \leq \tau and npnqcosαn_p \cdot n_q \geq \cos\alpha
  • GMS=100αmax0αmaxg(τ,α)dα,αmax=25\text{GMS} = \frac{100}{\alpha_{\max}} \int_0^{\alpha_{\max}} g(\tau, \alpha) \, d\alpha, \quad \alpha_{\max} = 25^\circ
  • where g(τ,α)=2(Rec(τ,α)1+Prec(τ,α)1)1g(\tau, \alpha) = 2 \left( \text{Rec}(\tau, \alpha)^{-1} + \text{Prec}(\tau, \alpha)^{-1} \right)^{-1}

Main Results (Table 1):

MethodDeepCAD GMS↑Fusion360 GMS↑MCB GMS↑MCB IR↓
CAD-Recode92.985.854.721.5
cadrille94.886.855.01.5
CADReasoner94.988.655.231.7
CADEvolve95.388.258.39.2
CADFit89.884.660.129.7
CADENA-SFT95.390.863.412.0
CADENA-RL97.093.373.70.7

Per-Category Results (Table 2):

MethodShafts & bushingsGears & bearingsHousings & framesFlat & leversSprings & fastenersAll
CAD-Recode53.839.156.158.845.348.9
cadrille57.637.254.562.146.349.8
CADReasoner55.646.956.469.743.452.9
CADEvolve59.641.359.466.447.952.9
CADFit60.861.348.566.242.354.8
CADENA-SFT70.847.858.166.851.957.8
CADENA-RL73.058.170.776.863.467.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

Related papers