CAD-Coder: Text-to-CAD Generation with Chain-of-Thought and Geometric Reward

Y. Guan, Xi-Lin Wang, Ximing Xing, Jing Zhang, Dong Xu +1 more
5/1/2025
80 citations
rlrlhf-rlvr-dpo

No official code found. Best implementation: gudo7208/CAD-Coder (12 stars).

Abstract

In this work, we introduce CAD-Coder, a novel framework that reformulates text-to-CAD as the generation of CadQuery scripts - a Python-based, parametric CAD language. This representation enables direct geometric validation, a richer modeling vocabulary, and seamless integration with existing LLMs.

Show full abstract

To further enhance code validity and geometric fidelity, we propose a two-stage learning pipeline: (1) supervised fine-tuning on paired text-CadQuery data, and (2) reinforcement learning with Group Reward Policy Optimization (GRPO), guided by a CAD-specific reward comprising both a geometric reward (Chamfer Distance) and a format reward. We also introduce a chain-of-thought (CoT) planning process to improve model reasoning, and construct a large-scale, high-quality dataset of 110K text-CadQuery-3D model triplets and 1.5K CoT samples via an automated pipeline. Extensive experiments demonstrate that CAD-Coder enables LLMs to generate diverse, valid, and complex CAD models directly from natural language, advancing the state of the art of text-to-CAD generation and geometric reasoning.

View on arXivView PDF

Code Implementations(1)

gudo7208/CAD-CoderCommunity25%

CAD-Coder: Text-to-CAD Generation with Chain-of-Thought and Geometric Reward

120

Similar Papers

Cite this paper

@article{guan2025cadcoder,
  title  = {CAD-Coder: Text-to-CAD Generation with Chain-of-Thought and Geometric Reward},
  author = {Y. Guan and Xi-Lin Wang and Ximing Xing and Jing Zhang and Dong Xu and Qian Yu},
  year   = {2025},
  eprint = {2505.19713},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2505.19713},
  url    = {https://doi.org/10.48550/arXiv.2505.19713},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.19713.svg)](https://codeofpaper.com/paper/2505.19713)

Discussion