From Intent to Execution: Multimodal Chain-of-Thought Reinforcement Learning for Precise CAD Code Generation
Abstract Computer-Aided Design (CAD) plays a vital role in engineering and manufacturing, yet current CAD workflows require extensive domain expertise and manual modeling effort. Recent advances in large language models (LLMs) have made it possible to generate code from natural language, opening new opportunities for automating parametric 3D modeling. However, directly translating human design intent into executable CAD code remains highly challenging, due to the need for logical reasoning, syntactic correctness, and numerical precision. In this work, we propose CAD-RL, a multimodal Chain-of-Thought (CoT) guided reinforcement learning post training framework for CAD modeling code generation. Our method combines CoT-based Cold Start with goal-driven reinforcement learning post training using three task-specific rewards: executability reward, geometric accuracy reward, and external evaluation reward. To ensure stable policy learning under sparse and high-variance reward conditions, we introduce three targeted optimization strategies: Trust Region Stretch for improved exploration, Precision Token Loss for enhanced dimensions parameter accuracy, and Overlong Filtering to reduce noisy supervision. To support training and benchmarking, we release ExeCAD, a noval dataset comprising 16,540 real-world CAD examples with paired natural language and structured design language descriptions, executable CADQuery scripts, and rendered 3D models. Experiments demonstrate that CAD-RL achieves significant improvements in reasoning quality, output precision, and code executability over existing VLMs.
Introduction. Computer-Aided Design (CAD) systems are foundational tools in engineering and manufacturing, enabling the creation of precise, parameterized 3D models for a wide range of industrial applications. However, traditional CAD workflows are highly manual, requiring extensive domain expertise and design iteration effort. While prior work has attempted to automate 3D reconstruction from sketches or images (Jayaraman et al. 2022; Li et al. 2020; Wu, Xiao, and Zheng 2021), the resulting models are typically non-editable, approximate, and lack parametric control—limitations that are incompatible with the tight tolerance requirements of industrial design. Recent advances in vision-language models (VLMs) (Niu et al. 2025b,a), particularly in natural language to code generation, open up a new paradigm: transforming high-level design intent into executable and semantically grounded CAD code. This capability promises to enable customized manufacturing, interpretable geometry modeling, and a substantial reduction in CAD development cost, while also bridging the gap between natural communication and formal design languages. Despite this promising direction, translating complex human intent into executable CAD modeling code remains highly challenging. First, it necessitates understanding precise dimensions and physical constraints embedded in design language. Second, the model must generate code that is syntactically valid, structurally coherent, and functionally executable. Recent efforts begin to tackle this space. Text- Guided CAD-Coder(He et al. 2025) maps language prompts to pre-defined command sequences, but its rigid structure restricts generalization to a narrow set of shapes. VLM CAD- Coder(Doris et al. 2025) utilizes single-modality image input to generate CAD code, but the lack of accurate dimensional constraints leads to coarse approximations that fall short in real industrial practice. CAD-Coder (Guan et al. 2025) achieves high accuracy by generating structured Cad- Query code from expert-written descriptions, but its reliance on expert-level inputs hinders accessibility for general users. Furthermore, all of these methods operate on single-modal input, limiting adaptability to diverse, real-world design scenarios. Existing approaches for adapting VLMs to domainspecific tasks rely primarily on two strategies: supervised fine-tuning (SFT) and reinforcement learning (RL). SFT provides stable, token-level supervision, allowing models to learn syntactic and structural patterns from annotated data. However, it falls short in optimizing downstream task performance—such as geometric accuracy and code executability—and requires large amounts of high-quality annotated data, which is prohibitively expensive in the CAD domain. In contrast, RL enables task-specific, goal-directed optimization using custom reward functions, making it a powerful complement to SFT. In this work, we posit three key principles for CAD code generation from human intent: (1) CAD modeling requires strong logical reasoning ability to align abstract design goals with precise, executable operations; (2) CAD code combines rigid structural syntax (e.g., extrusion) with fine-grained parameters (e.g., dimensions, tolerances), necessitating both syntactic correctness and numerical precision (3) the same geometry can be realized via multiple code sequences, so the model should prefer concise and efficient representations over verbose or redundant ones. To address these challenges, we propose CAD-RL, a multimodal Chain-of-Thought (CoT)-driven reinforcement learning post training framework for CAD code generation. Fig. 1 illustrates the real-world CAD modeling workflow enabled by CAD-RL, where users provide intent and the system generates precise, executable CadQuery code that compiles into accurate 3D CAD models. Our method enables robust interpretation of diverse textual design inputs—including natural language and structured specifications—while accurately capturing geometry, topology, and parametric logic. It generates structurally consistent, executable CadQuery code that compiles into high-fidelity 3D CAD models. Crucially, CAD-RL supports flexible multimodal input interfaces. It can process both natural language descriptions accessible to non-experts and technical specifications preferred by CAD professionals. In addition, our model accepts reference images to further enhance modeling fidelity. This flexibility enables the system to accommodate a wide range of real-world usage scenarios. As shown in Fig. 2, our training pipeline comprises two stages: (1) CoT-based Cold Start: We curate a small but high-quality dataset of multimodal examples with annotated reasoning traces to help the model learn the structure and format of long-horizon CoT reasoning. (2) Reinforcement Learning Post Training: We introduce three targeted rewards to guide the exploration of diverse reasoning paths.
Related work. 2.1 RL Adaptation for Code-Oriented VLMs Code generation from natural language is a central capability of modern LLMs (Jiang et al. 2024a). While supervised fine-tuning (SFT) based on maximum likelihood helps models learn syntax and structure, it does not directly optimize for downstream metrics such as execution correctness or semantic alignment. To address this, reinforcement learning (RL) is increasingly employed to align generation with taskspecific objectives (Fujimoto, Meger, and Precup 2019). RLbased techniques for code LLMs generally fall into three categories: Policy gradient methods like CodeRL (Le et al. 2022) and LEDEX (Jiang et al. 2024b) use PPO (Schulman et al. 2017) to maximize execution-based rewards, but require extensive computation and careful reward design. Preference-based methods reframe RLHF as a binary classification task over response pairs. DPO (Rafailov et al. 2023) improves training efficiency via closed-form policy updates but struggles with nuanced preference modeling. Gradientbased reward optimization, such as DeepSeek-RL (Guo et al. 2024), scales to large models using in-batch advantage estimation. Hybrid approaches like Swe-RL (Wei et al. 2025) and StepCoder (Dou et al. 2024) combine supervised and reward-driven objectives to improve reasoning and correctness. Each method offers trade-offs between supervision cost, scalability, and alignment fidelity, making them complementary in different stages of model adaptation.
2.2 CAD Code Generation CAD code generation aims to create precise, editable 3D models directly from user instructions. This approach improves on conventional 3D reconstruction by enabling parametric control and design flexibility. Several methods tackle this task using different modalities and representations. CAD-MLLM (Xu et al. 2024) and GenCAD (Alam and Ahmed 2024) map image inputs to CAD commands using vision-language models. Img2CAD (You et al. 2024) separates structure prediction and parameter regression in a two-stage design. CAD2Program (Wang et al. 2025) introduces a more flexible code format for richer modeling expressiveness. Recent methods increasingly adopt CadQuery, a Python-based modeling language, as the output format (He et al. 2025; Doris et al. 2025; Guan et al. 2025). Unlike command sequences or DSLs, CadQuery supports loops, conditionals, and parameterization, making it both expressive and executable. Its compatibility with industrial formats (e.g., STEP, STL) makes it a practical bridge between intent and deployable design.
Method. 3.1 Overview Inspired by recent advancements in RL for code generation (Guo et al. 2024; Dou et al. 2024), we propose CAD- RL, a reinforcement learning post training framework tailored for executable, high-precision CAD code generation. CAD-RL takes flexible multimodal inputs, including both natural language descriptions (e.g., from non-expert users) and structured design language (e.g., from professional engineers), optionally augmented by reference images. This flexible input paradigm makes our system adaptable to diverse, real-world CAD design scenarios. The model directly produces executable Python-based CadQuery scripts, enabling parametric modeling with high editability, syntactic correctness, and geometric fidelity. A key innovation in CAD-RL is the integration of Chain-of- Thought (CoT) reasoning into the RL post trainingg loop, aiming to activate pretrained vision-language models’ latent capacity for long-horizon symbolic reasoning. Our training pipeline (Fig. 2) consists of two stages:
• CoT-based Cold Start (Sec. 3.2): We fine-tune the model on a curated multimodal dataset with expert CoT annotations, teaching the model to map abstract geometric intent to executable CAD programs.
• Reinforcement Learning Post Training (Sec. 3.3): We optimize task-specific reward signals, executability, geometric accuracy, and external evaluation, to drive exploration beyond imitation and elicit semantically grounded reasoning paths.
To further stabilize learning under sparse feedback, we introduce three fine-grained optimization strategies: (1) Trust Region Stretch for expanding exploration bounds; (2) Precision Token Loss for emphasizing numerically sensitive tokens; and (3) Overlong Filteringto reduce reward noise from truncated sequences. Lastly, we introduce ExeCAD (Sec. 3.4), a noval benchmark with 16,540 aligned instances featuring paired natural and structured prompts, executable CAD code, and 3D renderings—providing strong supervision for real-world CAD generation.
3.2 CoT-based Cold Start While vision-language models (VLMs) exhibit latent capacity for symbolic reasoning, their pretraining lacks supervision on task-specific, executable representations like CAD code. Consequently, their outputs often lack structural consistency or precise semantics. To address this, we introduce a supervised CoT-based Cold Start stage that fine-tunes the model on a small, highquality dataset annotated with expert Chain-of-Thought traces. These multimodal examples guide the model to structure long-horizon reasoning steps that bridge abstract intent and concrete code. We model the joint reasoning and code sequence using an autoregressive objective:
3.3 Reinforcement Learning Post Training To further improve semantic alignment and execution fidelity, we introduce a reinforcement learning (RL) post training stage that shifts the model beyond imitation learning. In this stage, the model is viewed as a policy πθ, generating token sequences s = [s1, . . . , sT ] conditioned on multimodal input (x, y), where each output contains both CoT reasoning and CAD code. We optimize the expected reward rather than token likelihood:
Optimization Techniques. To ensure stable policy learning under sparse and high-variance reward conditions, we introduce three targeted optimization strategies:
3.4 ExeCAD A key obstacle hindering progress in CAD code generation is the absence of high-quality, open-source datasets that accurately reflect the precision and constraints of industrial design. Existing datasets frequently exhibit semantic misalignment between natural language descriptions and CAD code, resulting in inconsistencies such as vague or incomplete specifications, incorrect geometric references, and incoherent parametric logic. These issues limit the effectiveness of supervision and degrade the model’s ability to align symbolic code with geometric semantics. To overcome these limitations, we introduce ExeCAD—a large-scale, semantically aligned dataset specifically curated for executable and editable CAD modeling tasks. ExeCAD comprises 16,540 high-fidelity samples, each consisting of:
Discussion. Overall, CAD-RL achieves the best performance across all metrics. It reaches a code executability of 99.63% and an IoU of 78.7% under Structured Design Language input, surpassing CAD-Coder by +8.3% in IoU and +3.39% in executability, demonstrating the effectiveness of our post training method. 1) Pretrained VLMs face significant challenges in CAD code generation. While VLMs show strong capabilities on general multimodal tasks, Table 1 reveals their poor performance on CAD-specific code generation. Even the best-performing pretrained model (GPT-4o) only achieves a 72.72% executability and 47.7% IoU. This limitation stems from the inherent complexity of CAD modeling, which demands both symbolic reasoning over operations (e.g., extrusion, chamfer) and precise understanding of numeric constraints. These capabilities are far beyond the general representation learned by existing VLMs, necessitating taskspecific adaptation. 2) Structured design input significantly improves generation quality. Across both pretrained and fine-tuned models, Structured Design Language yields consistently higher performance than Natural Language Descriptions. This is because structured inputs are less ambiguous and contain less redundancy, enabling more precise alignment with the underlying geometry and code structure. Nevertheless, real-world usage often involves mixed or informal text input—highlighting the importance of supporting both modalities. 3) Size precision remains a key challenge. CAD-RL achieves 98.83% executability under structured input, indicating that the model has fully learned to generate syntactically and semantically valid CADQuery code. However, its IoU remains at 78.7%, exposing residual imprecision in the spatial structure. This performance gap underscores that while the model grasps the correct parametric form, finegrained control over geometric dimensions remains challenging. This observation further validates our introduction To better understand the contribution of each component in CAD-RL, we conduct a systematic ablation study on the ExeCAD benchmark. As shown in Tab. 2, we progressively incorporate three key parts: Reference Images, Chainof-Thought (CoT), and Reinforcement Learning (RL) Post Training. Results are reported under both Natural Language Description and Structured Design Language input settings. When using only cold-start supervised fine-tuning (SFT) without any reasoning or visual guidance, the model already achieves high code executability—90.64% and 91.86% under natural and structured text, respectively. However, the IOU remains low (around 50%), indicating that while the model learns to produce syntactically valid CADQuery code, it fails to accurately capture geometric dimensions and constraints—resulting in imprecise shape reconstructions. Incorporating Chain-of-Thought reasoning substantially boosts IOU and geometry fidelity. For instance, under natural language inputs, IOU improves from 49.5% to 60.8%. This suggests that multi-step planning enables the model to reason through construction logic more effectively.
Adding reference images alone brings modest gains, but when used alongside CoT, performance improves notably (e.g., IOU rises from 60.8% to 63.9%). We hypothesize that visual input helps resolve ambiguities or omissions in the textual description, especially when the model already possesses strong planning capabilities via CoT. Among all components, RL leads to the most substantial improvement. Under natural language input, RL raises IOU from 63.9% to 72.3%, with Mean CD dropping to 33.68 and Med CD reaching a minimum of 0.68—establishing new state-of-the-art results.
Conclusion. In this paper, we presented CAD-RL, a reinforcement learning framework for precise and executable CAD code generation from multimodal inputs. By leveraging text description and reference image, our method integrates Chain-of- Thought reasoning with reward-driven post training to align human design intent with syntactically and semantically correct CAD programs. To support evaluation and training, we introduced ExeCAD, a large-scale benchmark of 16,540 high-quality triplets encompassing text, code, and geometry. Experimental results demonstrate that CAD-RL achieves SOTA performance in both code executability and geometric fidelity, outperforming leading open-source and proprietary baselines. Our ablation studies further confirm the synergistic contributions of visual grounding, step-wise reasoning, and fine-grained reward functions, such as IoU-based alignment and precision-aware penalties. This work underscores the feasibility and promise of multimodal CAD automation workflow and highlights the critical role of reasoning-guided learning in bridging abstract design instructions with formal CAD representations. Future research may extend this framework to more expressive 3D domains, incorporate realworld manufacturing constraints, and explore interactive design paradigms.
Lines of inquiry this paper opens 24
Research framings built by reading the notes related to this paper — the questions it feeds into.
How should design principles adapt for AI-generated interfaces? Can visual rendering-based rewards effectively improve code and layout quality?- Does the rendering reward generalize beyond chart editing to other code generation tasks?
- How does the rendering reward weight code executability against visual fidelity failures?
- What filtering and verification steps ensure automatically generated CAD training data remain valid?
- Why does general VLM pretraining fail at numeric constraint understanding in CAD?
- How do executability and geometric accuracy rewards interact during training?
- How do format rewards and geometric rewards split the work of training CAD models?
- What is Chamfer Distance and why measure it for CAD models?
- Does format reward contribute independently to CAD-Coder's final performance?
- Why do multiple CadQuery scripts produce geometrically equivalent CAD models?
- Can structural features replace learned reward models in design generation tasks?
- What breaks when floor plan rewards ignore architectural style or program type?
- Can visual rendering rewards work for tasks beyond code reconstruction?
- How does render-and-compare training differ from expert-judged rewards in visual tasks?
- Can preference-based training replace hand-coded metrics for design evaluation?