Text-to-CAD code generation is a long-horizon task that translates textual instructions into long sequences of interdependent operations. Existing methods typically decode text directly into executable code (e.g., bpy) without explicitly modeling assembly hierarchy or geometric constraints, which enlarges the search space, accumulates local errors, and often causes cascading failures in complex assemblies. To address this issue, we propose a hierarchical and geometry-aware graph as an intermediate representation. The graph models multi-level parts and components as nodes and encodes explicit geometric constraints as edges. Instead of mapping text directly to code, our framework first predicts structure and constraints, then conditions action sequencing and code generation, thereby improving geometric fidelity and constraint satisfaction. We further introduce a structure-aware progressive curriculum learning strategy that constructs graded tasks through controlled structural edits, explores the model's capability boundary, and synthesizes boundary examples for iterative training. In addition, we build a 12K dataset with instructions, decomposition graphs, action sequences, and bpy code, together with graph- and constraint-oriented evaluation metrics. Extensive experiments show that our method consistently outperforms existing approaches in both geometric fidelity and accurate satisfaction of geometric constraints.
Figures & tables
Figure 1: Geometric decomposition graph. (a) Top-down decomposition of a user instruction (microwave oven example). The process starts from the complete product and recursively factors it into parts by assembly relations until components can be realized with bpy operators, forming multi-level nodes. (b) Graph Connection. Edges between nodes define explicit geometric constraints that encode their spatial relations. (c) Structured textual representation that captures both the node hierarchy and the constraint links.
Models
CADBench-Sim
CADBench-Wild
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
GPT-5 (end-to-end)
0.7013
0.7347
0.4250
0.6203
2.8%
0.6449
0.3846
0.6858
0.7091
0.5595
0.6515
5.5%
0.6003
0.4017
GPT-5 (Graph-CAD)
0.7342
0.7199
0.4451
0.6270
2.2%
0.6535
0.6603
0.7677
0.7523
0.5377
0.6859
4.0%
0.6318
0.5849
Claude-opus-4-1 (end-to-end)
0.7216
0.7368
0.5403
0.6662
7.4%
0.6151
0.4932
0.6847
0.7218
0.5997
0.6687
14.5%
0.5550
0.5062
Claude-opus-4-1 (Graph-CAD)
0.7573
0.7394
0.5025
0.6664
6.4%
0.6381
0.5705
0.7524
0.7301
0.5745
0.6857
8.5%
0.6059
0.5518
Table 1: Performance comparison of two inference pipelines for general-purpose LLMs on CADBench. The table compares a end-to-end paradigm, which directly generates bpy code, with our three-stage Graph-CAD inference process. Both methods are prompted with two-shot examples to enhance task understanding.
Figure 2: Overall framework of Graph-CAD. The framework comprises three sequential stages: Geometry Decomposition, Action Planning, and Code Generation. Each stage is independently driven by a dedicated Large Language Model (LLM)-based module.
Figure 3: The SAPCL mechanism. This mechanism alternates between two core modules: SFT and SAPCE. The SFT module fine-tunes the three constituent models of the Graph-CAD using all training data. The SAPCE module, in turn, begins by sampling a subset of training instances and introduces a Problem Generator to synthesize three-level difficulty variants for each instance, forming a comprehensive problem set. Subsequently, a Exploration of Capability Boundary sub-module assesses the model’s performance on these variants to determine its current capability level. Based on these levels, a Boundary Data Generation sub-module uses the Graph-CAD and an auxiliary LLM to synthesize new data at the determined difficulty boundary. After validation, these new data are merged into the training set for the next round of SFT.
Models
CADBench-Sim
CADBench-Wild
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Specifically Text-to-CAD open-source models
BlenderLLM
0.6893
0.6953
0.3650
0.5832
2.4%
0.6409
0.5513
0.6782
0.6363
0.4581
0.5909
5.3%
0.6056
0.4983
Text2CAD
0.3278
0.2084
0.0446
0.1936
6.6%
0.5707
-
0.4198
0.3082
0.1323
0.2868
14.0%
0.5211
-
CADFusion
0.3566
0.2258
0.0674
0.2166
6.2%
0.5578
-
0.3822
0.3716
0.1496
0.3011
11.5%
0.5278
-
General-purpose Large Language Models
Table 2: Quantitative comparison of CAD code generation methods on CADBench. Results are reported separately on the CADBench-Sim (in-distribution instructions) and CADBench-Wild (out-of-distribution instructions) subsets to evaluate both in-domain performance and out-of-distribution generalization. Attr., Spat., and Inst. measure visual quality via VLM, and Avg. is the average of these three scores. CLIP measures global text–shape semantic alignment, complementing the VLM-based visual metrics. Esyntax denotes the syntax error rate, and GCS measures geometric constraint satisfaction. Best results are in bold.
Figure 4: Qualitative results of Graph-CAD and baseline methods on the CADBench. Our method generates more geometrically plausible models that better align with user instructions compared to baseline methods.
Figure 5: Qualitative comparison of ablated variants. For three CADBench prompts, we show results from the end-to-end baseline, w/o Graph Decom., w/o Action Planning, and the full Graph-CAD (SFT). Red marks indicate typical failures (assembly errors, unreasonable shapes, syntax errors), while Graph-CAD produces coherent assemblies that better follow the instructions.
Training pipeline
CADBench-Sim
CADBench-Wild
Time (s)↓
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
End-to-end
0.6701
0.6542
0.3477
0.5573
5.8%
0.6381
0.6923
0.6785
0.6643
0.4268
0.5899
8.0%
0.6087
0.7012
64.861
w/o Graph Decom.
0.6942
0.6995
0.4561
0.6166
5.0%
0.6424
0.7268
0.6730
0.7123
0.5018
0.6290
6.5%
0.6164
0.7207
79.516
w/o Action Planning
0.6791
0.6825
0.4006
0.5874
6.4%
0.6405
0.7545
0.6735
0.6849
0.4502
0.6029
11.0%
0.6127
0.7451
91.830
Graph-CAD (SFT)
0.7295
0.7265
0.4733
0.6431
2.2%
0.6544
0.7830
0.6944
0.7270
0.5861
0.6692
4.5%
0.6358
0.8025
104.755
Table 3: Ablation study of our pipeline components, evaluated on the CADBench using the SFT setting. We compare our three-stage pipeline against an End-to-end baseline. To isolate the impact of each intermediate representation, we also evaluate two two-stage variants: w/o Graph Decom., which omits the graph by generating an action sequence directly from the instruction; and w/o Action Planning, which omits the action sequence by generating code directly from the graph. CLIP measures global text–shape semantic alignment, and Time reports the average inference time per sample. Best results are in bold.
Figure 6: Detailed visualization analysis of the SAPCL mechanism.
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
Training pipeline
Stage1 (s)
Stage2 (s)
Stage3 (s)
Total (s)
End-to-end
–
–
–
64.861
w/o Graph Decom.
–
12.603
66.913
79.516
w/o Action Planning
25.549
–
66.281
91.830
Graph-CAD (SFT)
24.345
15.141
65.269
104.755
Appendix
Table 4: Inference time breakdown of different pipeline variants. Stage1, Stage2, and Stage3 correspond to the three components of our Graph-CAD inference pipeline. Total time is the sum of the stages used by each method.
Figure 7: Examples of Failure Cases on Highly Complex Geometries. This figure illustrates current limitations of our method when tasked with generating objects with extremely intricate structures. (a) An “ant queen” model, which requires complex, organic curves and a high part count. (b) A “bicycle” model, which involves a large number of parts with precise mechanical and transmission-related constraints. In both cases, while the model attempts to capture the overall form, it struggles with the fine-grained geometric details and the complex inter-part relationships, leading to structural errors. These failures highlight the need for more powerful base models and more diverse, complex training data.
Figure 8: Data annotation pipeline. Our annotation process begins with user instructions sourced from the BlenderLLM dataset. It proceeds through a three-stage generation workflow, where distinct prompts guide a LLM to sequentially produce geometric decomposition graphs, action sequences, and executable bpy code. Subsequently, a VLM evaluates whether the multi-view renderings generated from the bpy code align with the original instructions. Finally, industrial designers perform a second round of verification, reviewing the VLM’s judgments, confirming correct samples, and refining erroneous ones. The validated quadruplets are then integrated into our dataset.
BlenderLLM
GPT-5 (e2e)
GPT-5 (3 stages)
Claude-opus-4-1 (e2e)
Claude-opus-4-1 (3 stages)
Ours (SFT)
Ours (SAPCL)
App.
2.3 %
2.7 %
8.4 %
4 %
9.65 %
10.05 %
62.9 %
GP.
3.8 %
0.4 %
5.2 %
0.55 %
6.5 %
16.3 %
67.25 %
Appendix
Table 5: Quantitative results of the human evaluation. The table shows user preference scores for CAD models generated by different methods. App. indicates the preference rate based on visual appearance and alignment with the user’s instruction. GP indicates the preference rate based on the geometric plausibility of the final assembly.
Figure 9: Additional Qualitative Comparison with Baselines. This figure presents more qualitative examples comparing our method, Graph-CAD, with baseline approaches on challenging prompts from the CADBench benchmark.
Figure 10: Visualization of Progressive Improvement with SAPCL. This figure illustrates the evolution of the model’s generative capabilities on a single, challenging user instruction across different stages of training.
Table 6: Cross Validation with GPT-5.
Models
CADBench-Sim (human)
CADBench-Wild (human)
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
BlenderLLM
0.6914
0.6862
0.3759
0.5845
0.6722
0.6509
0.4651
0.5914
GPT-5 (end-to-end)
0.7146
0.7281
0.4507
0.6311
0.6894
0.7107
0.5902
0.6634
GPT-5 (Graph-CAD)
0.7351
0.7237
0.4398
0.6328
0.7682
0.7475
0.5460
0.6872
Claude-opus-4-1 (end-to-end)
0.7185
0.7298
0.5460
0.4458
0.6923
0.7285
0.6072
0.6760
Claude-opus-4-1 (Graph-CAD)
0.7521
0.7434
0.4962
0.6639
0.7462
0.7356
0.6907
0.7242
Appendix
Table 7: Human Evaluation Scores on a 30% Subset of CADBench. The table shows the average scores assigned by 10 human evaluators. The performance ranking of the models is consistent with the VLM-based results in Table 1 and 2 , supporting the reliability of our automated evaluation.
Models
CADBench-Sim
CADBench-Wild
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
GCS↑
GPT-5 (end-to-end inference with zero-shot)
0.5632
0.5896
0.3764
0.5097
20.8%
0.2467
0.5338
0.5610
0.3295
0.4748
18.0%
0.2522
GPT-5 (Graph-CAD inference with zero-shot)
0.2465
0.2447
0.1720
0.2211
31.6%
0.2663
0.2582
0.2733
0.2045
0.2453
37.5%
0.2038
GPT-5 (end-to-end inference with 1-shot)
0.6482
0.6895
0.3867
0.5745
7.0%
0.2971
0.6713
0.6519
0.4475
0.5902
11.5%
0.3294
GPT-5 (Graph-CAD inference with 1-shot)
0.6715
0.6620
0.4108
0.5814
8.4%
0.5984
0.6526
0.6935
0.4621
0.6027
12.5%
0.5211
GPT-5 (end-to-end inference with 2-shot)
0.7013
0.7347
0.4250
0.6203
2.8%
0.3846
0.6858
0.7091
0.5595
0.6515
5.5%
0.4017
Appendix
Table 8: Impact of Few-Shot Examples on the Performance of General-Purpose LLMs. The table compares the direct End-to-end paradigm against our Three-stage Graph-CAD inference as the number of few-shot examples is varied from zero to three. This analysis is conducted on the CADBench benchmark to evaluate how each paradigm benefits from in-context learning.
Models
CADBench-Sim
CADBench-Wild
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
GCS↑
Qwen3-8B (SFT)
0.7295
0.7265
0.4733
0.6431
2.4%
0.7830
0.6944
0.7270
0.5861
0.6692
4.5%
0.8025
Llama3-8B (SFT)
0.7146
0.7080
0.4941
0.6389
3.2%
0.7732
0.6894
0.7107
0.5902
0.6634
5.5%
0.8126
Qwen3-8B (SAPCL)
0.7681
0.7423
0.5546
0.6883
2.0%
0.9018
0.7695
0.7590
0.6057
0.7114
2.5%
0.8943
Llama3-8B (SAPCL)
0.7693
0.7356
0.5248
0.6765
2.6%
0.9142
0.7639
0.7651
0.5812
0.7034
3.0%
0.8817
Appendix
Table 9: Performance Comparison of Different LLM Backbones on CADBench. The table shows the results of our full Graph-CAD framework when built upon two different 8B-parameter base models: Qwen3-8B and Llama3-8B. The highly comparable performance across all metrics indicates that our approach is robust to the choice of the underlying LLM.
Figure 11: Qualitative Comparison with Sketch-and-Extrude Methods on the DeepCAD Dataset. This figure compares outputs from our Graph-CAD method with a representative sketch-and-extrude (SEM) baseline on the DeepCAD test set.
Figure 12: Object-level metrics as a function of the Unique Part Count on CADBench. We report (a) Object Attributes (Attr), (b) Spatial Understanding and Structure (Spat), (c) Instruction Execution (Inst), (d) Overall Average (Avg), and (e) Geometric Constraint Satisfaction (GCS). Blue curves correspond to Graph-CAD with the intermediate graph representation; orange curves correspond to the ablated model without graph representation.
Figure 13: Columns show objects with 5, 10, 15, 20, 25, and 35 unique parts. For each object, the top row shows results generated with the graph representation, and the bottom row shows results from the ablated model without graph representation. Red circles highlight typical failure modes of the non-graph model, including unreasonable shapes and assembly errors (e.g., floating or intersecting parts, missing supports).
Table 10: Cross Validation with Qwen-VL.
Method
CADBench-Sim
CADBench-Wild
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Attr.↑
Spat.↑
Inst.↑
Avg.↑
Esyntax ↓
CLIP↑
GCS↑
Unified single model
0.7035
0.6951
0.4472
0.6153
5.6%
0.6371
0.7049
0.6840
0.6924
0.5386
0.6383
11.5%
0.6182
0.7544
Graph-CAD (SFT)
0.7295
0.7265
0.4733
0.6431
2.2%
0.6544
0.7830
0.6944
0.7270
0.5861
0.6692
4.5%
0.6358
0.8025
Appendix
Table 11: Performance comparison of the three-stage pipeline (Graph-CAD (SFT)) versus a unified multi-task single-model baseline on CADBench.
Figure 14: Qualitative comparison between the three-stage pipeline (Graph-CAD (SFT)) and the unified single-model baseline on CADBench prompts. The unified model more frequently produces structurally flawed or incomplete assemblies (e.g., floating or missing parts, misaligned components), whereas the three-stage Graph-CAD generates coherent, geometrically consistent designs that better satisfy the textual instructions.
Outcome
Proportion (%)
GPT-5 auto pass (before human review)
72.56
Human-accepted without modification
69.51
Human-accepted after minor corrections
26.45
Requiring complete manual redesign
4.04
Appendix
Table 12: Annotation outcomes for the automatically generated BlendGeo samples. All numbers are percentages over the full dataset. GPT-5 “auto pass” denotes samples initially judged correct by GPT-5 before human review; the remaining rows summarize the final human assessment outcomes.
Figure 15: Representative examples of automated annotations and human corrections. Top row: samples that are directly accepted without modification. Middle row: geometric placement errors that are fixed by minor edits. Bottom row: failures on complex geometries that require complete redesign.
Recent text-to-CAD approaches have shown promising results by leveraging large language models, but they often struggle with maintaining structural consistency in complex designs and accurately grounding geometric parameters. To address these issues, we propose HierCAD, a hierarchical text-to-CAD framework that improves both structural reasoning and parameter prediction. HierCAD reformulates CAD generation as progressive reasoning by decomposing CAD construction trees into object-level procedural reasoning and part-level topology reasoning trajectories. To further improve generation fidelity, we introduce a unified Structure Alignment and Parameter Grounding (SAPG) learning strategy. Structure alignment aligns topology reasoning trajectories with their corresponding parametric CAD spans, while parameter grounding mitigates shortcut learning through structure-preserving parameter perturbations and ranking-based supervision. Experiments demonstrate that HierCAD outperforms prior state-of-the-art methods on both CAD sequence generation and reconstructed CAD model evaluation. Our code is available at https://github.com/Collab-Gen/HierCAD.
Jimin Xu, Tianbao Wang, Tao Jin +1
College of Computer Science and Technology, Zhejiang University, Hangzhou, China
Natural-language Computer-Aided Design (CAD) code generation aims to turn design intent into executable and editable parametric programs. Large language models (LLMs) make this goal increasingly practical, but useful systems must preserve the construction process behind the rendered geometry. Existing benchmarks and methods mostly focus on how closely the generated CAD model matches the reference geometry, often using metrics such as Intersection over Union (IoU). Such metrics can miss errors in part decomposition, construction hierarchy, Boolean operations, sketch structure, and geometric relations. This gap calls for a representation that makes design intent explicit and lets a system check generated code against that intent. We propose CIT-CAD, a framework that infers a Constraint Intent Tree (CIT) from the input description to represent the intended entities, hierarchy, operations, and relations. The tree has two roles: it guides CAD code generation and defines expected constraints for verification. The framework extracts actual constraints from the generated program, compares them with the expected constraints, and uses mismatches to localize and repair design violations. Experiments show that the framework improves CAD generation performance, with larger gains on more complex multi-entity designs. By turning design intent into an explicit and checkable object, this work is the first attempt to move text-to-CAD generation beyond rendered-geometry matching toward construction-aware synthesis, verification, and repair.
Yali Du, Hui Sun, San-Zhuo Xi +1
National Key Laboratory for Novel Software Technology, School of Artificial Intelligence, Nanjing University, China
Computer-aided design (CAD) defines 3D models as compact, precise, and editable representations, making it directly useful for several fields. Recently, CAD generation has been gaining more attention in both the research community and industry. Crafting CAD models has long been a painstaking and time-intensive task, demanding both precision and expertise from designers. Prior works have achieved early success in single-part CAD generation, which is not well-suited for real-world applications, as multiple parts need to be assembled under semantic constraints and geometric compatibility. In this paper, we propose CADKnitter, a compositional CAD generation framework with geometric-guiding cues to steer diffusion sampling. CADKnitter is able to generate a complementary CAD part that follows both the geometric constraints of the given CAD model and the semantic constraints of the desired design text prompt. We also curate a dataset, so-called KnitCAD, containing over 310,000 samples of CAD models, along with textual prompts and assembly metadata that provide semantic and geometric constraints. Intensive experiments demonstrate that our proposed method outperforms other state-of-the-art baselines by a clear margin. Our project page is available at https://cadknitter.github.io/.
Tri Le, Khang Nguyen, Baoru Huang +2
FPT Software AI Center, Vietnam · Department of Robotics, Mohamed bin Zayed University of Artificial Intelligence (MBZUAI), UAE · Department of Computer Science, University of Liverpool, UK +1