betaFeedback

WorksComputer Science

PhyCAD: Physics-Aware Text-to-CAD Generation via Hierarchical Reinforcement Learning

Abstract

Language-driven computer-aided design (CAD) generation enables the creation of editable parametric models from text, yet geometric correctness alone does not ensure physical feasibility. We present PhyCAD, a framework for physics-aware Text-to-CAD generation that trains language models to produce executable CadQuery programs under geometric and physical constraints. To support this setting, we construct a Text-to-CAD dataset that links parametric CAD models with geometric specifications, loading conditions, and physical constraints. We further develop an automated CAD–CAE verifier that combines program execution, geometric checks, and finite element analysis to provide feedback for model training. A key learning challenge is to prioritize joint satisfaction of geometric and physical constraints while retaining informative feedback on partial progress. A flat aggregation of heterogeneous rewards can obscure this priority, allowing improvements in individual criteria to compensate for unmet design requirements. We therefore introduce a Hierarchical Balanced Advantage for Group Relative Policy Optimization, grouping candidates into levels according to their verification status and combining between-level progress with objective-wise peer ranking within each level. This formulation preserves cross-level priority in the training signal while providing fine-grained feedback for satisfying constraints and improving feasible designs. Experiments across multiple language models show that PhyCAD consistently improves joint geometric and physical constraint satisfaction. These results demonstrate the value of verifiable engineering feedback for advancing language-driven CAD generation beyond geometric reconstruction toward physics-aware design.

Introduction

CAD is a fundamental component of modern engineering, providing editable and parametric representations for downstream simulation, optimization, and manufacturing. Learning-based CAD generation has progressively moved from modeling CAD construction sequences and design histories [26, 24] toward language-driven generation with large language models (LLMs) [31]. Recent methods can translate natural-language descriptions into parametric CAD sequences [9], generate CAD programs from textual or multimodal inputs [14, 23], or synthesize executable modeling code through iterative or tool-augmented workflows [2, 27, 16]. In particular, CadQuery provides an executable, Python-based parametric representation that aligns naturally with code-generation capabilities of pretrained LLMs [27, 7].

Despite this progress, geometric correctness alone does not ensure physical feasibility. Existing Text-to-CAD systems are commonly optimized or evaluated using geometric similarity or visual consistency [9, 1, 27, 7]. However, natural-language descriptions do not always fully specify the dimensions, topology, and structural details required for engineering design, and even small geometric deviations may substantially affect structural behavior. More importantly, engineering design is ultimately concerned with whether a component meets prescribed dimensional and physical requirements under specified material properties, loads, and boundary conditions, rather than merely whether it resembles a target shape. Bringing an initially generated model into compliance often requires repeated manual measurement, geometric modification, simulation, and re-evaluation, resulting in a costly refinement process. These limitations have motivated increasing attention to functional and physics-based criteria for evaluating and refining generated CAD models, allowing engineering feedback to guide geometry toward designs that satisfy downstream requirements [3, 22].

Computer-aided engineering (CAE), particularly simulation based on the finite element method (FEM), provides a natural source of deterministic feedback for evaluating generated designs. Recent studies have demonstrated the use of LLMs in automated FEM-based workflows and the acquisition of verifiable engineering signals [8, 18]. Simulation outcomes have also been used to guide iterative CAD generation and optimization [3, 22, 5]. Reinforcement learning (RL) has further enabled CAD-generation models to learn from geometric feedback [7]. Training with both geometric and physical feedback introduces a key challenge: prioritizing joint constraint satisfaction while retaining informative feedback on partial progress. A flat aggregation of heterogeneous rewards can obscure this priority, allowing improvements in individual criteria to compensate for unmet design requirements. This calls for a learning signal that distinguishes progress toward feasibility from improvements within the feasible design space.

As illustrated in Figure 1, we present PhyCAD, a physics-aware Text-to-CAD framework that generates executable CadQuery programs from geometric specifications and physical constraints under prescribed material properties, loads, and boundary conditions. The task defines a constrained design space with admissible dimensional ranges rather than a unique target geometry. We construct a corresponding dataset and an automated CAD–CAE verifier that provides training feedback through program execution, geometric checks, and FEM-based simulation. Building on supervised fine-tuning, we introduce a Hierarchical Balanced Advantage for Group Relative Policy Optimization (GRPO) [21], grouping candidates by verification status and combining between-level progress with objective-wise peer ranking within each level. This formulation preserves between-level priority in the training signal while providing fine-grained feedback for satisfying constraints and improving feasible designs. The trained model directly generates programs without an iterative simulation-guided refinement loop at inference time. Experiments across multiple language models show that PhyCAD consistently improves joint geometric and physical constraint satisfaction.

Figure 1. Physics-aware CAD optimization. (A) A source CAD model is annotated with FEM conditions and responses. (B) Its exact dimensions are redacted to form an inverse-design task with physical constraints. (C) While the SFT design achieves lower mass but violates the physical constraints, PhyCAD produces a feasible design with lower mass than the reference.

Our contributions are summarized as follows:

  • We formulate physics-aware Text-to-CAD generation and construct a dataset that jointly captures geometric specifications, loading and boundary conditions, and physics-based constraints.

  • We develop an automated CAD–CAE verification pipeline that provides verifiable feedback on program executability, geometric and dimensional compliance, and physical constraint satisfaction to support model training.

  • We introduce a Hierarchical Balanced Advantage that combines between-level progress with objective-wise peer ranking within each level, preserving cross-level priority in the training signal while providing fine-grained feedback for satisfying constraints and improving feasible designs.

Related Work

Text-to-CAD Generation. Early learning-based CAD methods modeled construction histories, sketch constraints, and assembly relations using datasets such as DeepCAD [26], SketchGraphs [20], and Fusion 360 Gallery [24, 25]. Subsequent approaches map text or engineering drawings to CAD sequences using task-specific transformers [9, 19], or adapt pretrained LLMs and VLMs to structured CAD generation [11, 6, 29]. CadQuery supports executable program generation [27], while tool augmentation, self-refinement, and evolutionary search enable iterative refinement [16, 15, 17]. PhyCAD studies generation under joint geometric and physical requirements, including global dimensional bounds and FEM-verified physical constraints.

Physics-Aware CAD Generation and Engineering Agents. Recently, [3] integrates physics-based verification into multi-agent CAD refinement, while [22] combines structured blueprints, visual inspection, and finite-element feedback to refine single-part and multi-part STEP models. COSMO-Agent [5] trains an LLM through tool-augmented RL to optimize parameterized components through CAE-guided updates to geometry and material choices. Related agents automate computational fluid dynamics [4, 28, 30], finite-element analysis [8, 18], and multiphysics simulation [32]. Complementary to these engineering workflows, PhyCAD addresses a learning challenge in physics-aware CAD generation: prioritizing joint geometric and physical feasibility while retaining informative feedback on partial progress. We introduce a Hierarchical Balanced Advantage that combines progress across verification levels with objective-wise peer ranking within each level. This organizes heterogeneous CAD–CAE outcomes into a training signal that preserves cross-level priority while guiding constraint satisfaction and improvements within the feasible design space.

Reinforcement Learning with Verifiable Feedback. GRPO [21] enables policy optimization using group-relative rewards, while InternBootcamp [13] provides diverse tasks with programmatic verifiers. In CAD, CAD-Coder [7] combines supervised fine-tuning and GRPO using geometric and format rewards, while cadrille [10] uses geometric feedback for multimodal reconstruction. ReCAD [12] combines parameterized-code guidance with hierarchical primitive learning, following a curriculum over increasingly complex geometric structures. These methods primarily target geometric fidelity and output validity rather than FEM-verified physical constraints. PhyCAD incorporates CAD–CAE feedback into policy training through a Hierarchical Balanced Advantage. Rather than scheduling a geometric curriculum, it groups candidates by verification status and combines between-level progress with objective-wise peer ranking within each level.

Method

Our goal is to train a LLM to generate CAD programs that satisfy both geometric specifications and physical constraints. As illustrated in Figure 2, our framework takes a physics-aware prompt as input, generates executable CadQuery programs with an LLM policy, evaluates them through a deterministic CAD–CAE verification pipeline, and converts the verification outcomes into structured reinforcement signals for policy optimization. The resulting training framework integrates CAD executability, geometric compliance, and physics-based feasibility into a unified optimization process.

Figure 2. Overview of our framework. The LLM policy generates candidate CAD programs from a physics-conditioned prompt containing geometric requirements, design-domain constraints, loads, and physical limits. A deterministic CAD-CAE verifier sequentially evaluates each program for CAD executability, geometric validity, and FEM-based physical feasibility and objectives. These verification results define a Hierarchical Balanced Advantage, which combines between-level progress with within-level peer ranking over objective scores. The resulting advantage AiA_i provides structured reinforcement signals for updating the CAD-generation policy.

Problem Formulation

Let q∈Qq \in\mathcal{Q} denote a physics-aware design prompt describing geometric requirements, the admissible design domain, material properties, loading and boundary conditions, engineering constraints, and a design objective. An LLM policy πθ\pi_\theta, parameterized by θ∈Rd\theta\in\mathbb{R}^{d}, defines a conditional distribution over CadQuery programs O\mathcal{O}. During training, we sample a group of candidates oi∼πθ(⋅∣q)o_i \sim\pi_\theta(\cdot\mid q), i=1,…,Gi = 1,\ldots,G.

Our setting specifies selected geometric parameters through admissible ranges rather than fixed values, defining a constrained design space rather than a unique target geometry. A program o∈Oo \in\mathcal{O} is feasible if it executes successfully to produce a valid CAD solid, satisfies the specified geometric requirements, and passes FEM evaluation with all physical constraints satisfied. We denote the feasible set by F(q)⊆O\mathcal{F}(q) \subseteq\mathcal{O}. Among feasible programs, we optimize an engineering objective J(o;q)J(o;q), with smaller values preferred. For the tasks considered here, J(o;q)=m(o;q)J(o;q) = m(o;q), where m(o;q)m(o;q) is the mass of the generated solid. The resulting constrained design problem is

o∗∈arg⁡min⁡o∈F(q) J(o;q).(1)o^{*} \in\underset{o \in\mathcal{F}(q)}{\arg\min}\ J(o;q). \tag*{(1)}

During training, optimization is performed over the sampled candidate set Oθ(q)\mathcal{O}_{\theta}(q). The CAD–CAE verifier identifies the feasible subset Fθ(q)\mathcal{F}_{\theta}(q) and provides hierarchical feedback for candidates according to their verification status. The policy is optimized to increase the probability of feasible designs while improving J(o;q)J(o;q) among feasible candidates.

Deterministic CAD–CAE Verifier

For any group of programs oio_i sampled from πθ(⋅∣q)\pi_\theta(\cdot\mid q), we evaluate each program using the same deterministic CAD–CAE pipeline. The verifier proceeds through three stages.

CAD execution. The generated program is checked for syntax and safety, executed, and tested for valid output construction. It must produce a valid CAD solid that can be exported in STEP format and reimported by the downstream geometry kernel. Failure at this stage is recorded as a CAD-construction failure. Geometry check. For successfully constructed solids, we compare the global bounding-box extents with the prompt’s dimensional ranges and check whether the required geometric constructions are present. This checks compliance with the design requirements, separately from the solid-validity check above. Candidates satisfying these requirements proceed to CAE verification.

CAE verification. The solid is meshed and analyzed using FEM under the prescribed material properties, loads, and boundary conditions. For candidate oio_i, we record the volume-weighted 99th-percentile element von Mises stress σi\sigma_i, maximum nodal displacement δi\delta_i, and mass mi=m(oi;q)m_i = m(o_i; q). Let σˉ\bar{\sigma}, δˉ\bar{\delta}, and mˉ\bar{m} denote their respective upper bounds in the prompt. Physical verification succeeds when the CAE procedure completes and σi≤σˉ\sigma_i \le\bar{\sigma}, δi≤δˉ\delta_i \le\bar{\delta}, and mi≤mˉm_i \le\bar{m}.

To summarize these outcomes, let Li∈{0,1,2,3}L_i \in\{0,1,2,3\} denote the verification level of candidate oio_i:

Li={0,CAD construction fails,1,CAD succeeds but geometric requirements fail,2,geometry passes but CAE or a physical constraint fails,3,all geometric and physical requirements pass.(2)L_i = \begin{cases} 0, & \text{CAD construction fails},\\ 1, & \text{CAD succeeds but geometric requirements fail},\\ 2, & \text{geometry passes but CAE or a physical constraint fails},\\ 3, & \text{all geometric and physical requirements pass}. \end{cases} \tag*{(2)}

Thus, the three checks yield four possible outcomes: failure at any one of the checks, or success at all three. A larger LiL_i indicates further progress through the verification procedure; Li=3L_i = 3 identifies a jointly feasible candidate.

Hierarchical Balanced Advantage

The verification levels distinguish coarse progress toward feasibility but do not distinguish candidates with the same status. For example, two physically infeasible candidates may violate their constraints by very different amounts. Conversely, directly aggregating all objective scores can allow improvements in individual criteria to compensate for unmet requirements. We therefore combine a between-level advantage with a within-level comparison, retaining both the verification ordering and feedback on partial progress.

Between levels. For GG rollouts generated from the same prompt, we define the level advantage as

Ailevel=Li−1G∑j=1GLj.(3)A_i^{\mathrm{level}} = L_i - \frac{1}{G}\sum_{j=1}^{G} L_j. \tag*{(3)}

This term compares each candidate’s level with the group mean. Candidates above the mean receive positive level advantages. When all candidates occupy the same level, this term is zero, and the within-level component provides the remaining distinctions.

Within a level. Candidates are compared only with others from the same prompt and the same verification level. We first map the verification outcomes to level-specific objective scores, then rank candidates separately for each objective. Figure 3 summarizes the score definitions and (1). For candidates with Li=0L_i = 0, CAD-progress feedback reflects output completeness, code-only formatting, syntax validity, safe calls, result construction, and STEP export. This distinguishes partial construction progress even when a valid CAD solid has not been obtained. (2). For Li=1L_i = 1, we assign equal weights to bounding-box closeness and geometric-semantic recall. These scores measure proximity to the dimensional ranges and coverage of the required geometric constructions, respectively. (3). For Li=2L_i = 2, we compare closeness to the stress, displacement, and mass limits, again with equal weights. For an available measurement vv with upper bound vˉ\bar{v}, its score is 11 when v≤vˉv \le\bar{v}, and vˉ/v\bar{v}/v otherwise. An unavailable measurement receives a score of zero. These scores distinguish different degrees of constraint violation without rewarding further improvement of a quantity that already satisfies its limit. (4). For Li=3L_i = 3, all constraints are satisfied. We compare mass efficiency 1−mi/mˉ1 - m_i/\bar{m}, stress margin, and displacement margin with equal weights. The two margin scores are capped at a 10% margin, beyond which additional margin receives no further reward. Feasible-design feedback therefore combines the mass objective with capped margin objectives rather than ranking feasible candidates by mass alone.

Figure 3. Reward definitions for within-level PeerRank. Each block specifies how an evaluated outcome is mapped to an objective reward within its corresponding level. Solid regions denote fixed rewards once a condition is satisfied, while shaded gradients indicate rewards that vary continuously with closeness to the target or the achieved margin; faded regions correspond to outcomes receiving zero or lower reward. The resulting objective rewards are independently peer-ranked and combined using the indicated within-level weights.

For a given prompt and a level ℓ∈{0,1,2,3}\ell\in\{0,1,2,3\}, let Iℓ={j∈{1,…,G}:Lj=ℓ}\mathcal{I}_{\ell} = \{j \in\{1,\ldots,G\}: L_j = \ell\} be the set of candidate indices at that level. Let KℓK_{\ell} be its number of objectives. For candidate i∈Iℓi \in\mathcal{I}_{\ell}, denote its score for objective k∈{1,…,Kℓ}k \in\{1,\ldots,K_{\ell}\} by siks_{ik}, and its tie-aware centered rank among Iℓ\mathcal{I}_{\ell} by rik∈[−1,1]r_{ik} \in[-1,1], with higher ranks indicating better scores. Scores within 10−310^{-3} are treated as ties. With nonnegative objective weights wℓkw_{\ell k} satisfying ∑k=1Kℓwℓk=1\sum_{k=1}^{K_{\ell}} w_{\ell k} = 1, the within-level advantage is

A~i={∑k=1KLiwLikrik,∣ILi∣>1,0,∣ILi∣=1.(4)\widetilde{A}_i = \begin{cases} \sum_{k=1}^{K_{L_i}} w_{L_i k} r_{ik}, & |\mathcal{I}_{L_i}| > 1,\\ 0, & |\mathcal{I}_{L_i}| = 1. \end{cases} \tag*{(4)}

We refer to this objective-wise ranking and averaging operation as PeerRank. It compares ranks rather than a weighted sum of the original objective scores, and gives ∣A~i∣≤1|\widetilde{A}_i| \le1.

Combined advantage. The nonnegative weights λL\lambda_L and λw\lambda_w control the between-level and within-level terms, respectively. We combine them as

Ai=λLAilevel+λwA~i.(5)A_i = \lambda_L A_i^{\mathrm{level}} + \lambda_w \widetilde{A}_i. \tag*{(5)}

For candidates ii and jj from the same prompt group with Li>LjL_i > L_j, the common level baseline cancels, giving

Ai−Aj=λL(Li−Lj)+λw(A~i−A~j)≥λL−2λw.A_i - A_j = \lambda_L(L_i - L_j) + \lambda_w(\widetilde{A}_i - \widetilde{A}_j) \ge\lambda_L - 2\lambda_w.

Choosing λL>2λw\lambda_L > 2\lambda_w therefore ensures that the higher-level candidate receives a larger advantage regardless of its within-level rank. This is an ordering guarantee for the training signal within each prompt group. Both components are computed together, not introduced in successive training stages.

Policy optimization. We use the hierarchical advantages in GRPO ([21]). The policy loss uses DAPO-style token-level aggregation: generated-token losses are averaged across the batch rather than first averaged separately within each completion. Let AA collect the advantages for the sampled completions, each computed within its own prompt group, and let LDAPO(θ;A)\mathcal{L}_{\mathrm{DAPO}}(\theta; A) denote the GRPO policy term with this aggregation. With a reference policy πref\pi_{\mathrm{ref}} and KL regularization weight β≥0\beta\ge0, the training objective is

L=LDAPO(θ;A)+βDKL(πθ ∥ πref).(6)\mathcal{L} = \mathcal{L}_{\mathrm{DAPO}}(\theta; A) + \beta D_{\mathrm{KL}}(\pi_{\theta} \,\|\, \pi_{\mathrm{ref}}). \tag*{(6)}

where DKLD_{\mathrm{KL}} denotes the Kullback–Leibler divergence. The CAD kernel and FEM solver supply verification outcomes, not gradients through geometry construction or simulation. At inference time, the trained policy directly generates a CadQuery program without an iterative simulation-guided refinement loop.

Experiment

Dataset Generation

We construct a physics-aware Text-to-CAD dataset from the Text-to-CadQuery corpus [27], which contains approximately 110k CadQuery programs with geometric and semantic descriptions. Each program serves as a reference design and is processed by a CAD–CAE pipeline. We first derive boundary and loading conditions from the geometry, then perform FEM to obtain the maximum displacement δmax⁡\delta_{\max}, 99-th percentile von Mises stress σP99\sigma_{\mathrm{P99}}, and mass mm.

Each successfully analyzed reference is converted into an inverse-design task rather than used as a direct reconstruction target. We remove exact dimensions and other numerical specifications that could reveal the reference geometry, while retaining high-level geometric semantics needed to define the intended structure. The reference measurements are then used to derive displacement, stress, and mass limits with a small feasibility margin, ensuring that the reference remains a feasible solution without exposing its exact simulation results. The resulting prompt specifies the geometry semantics, coarse design bounds, boundary and loading conditions, and physical requirements, and asks the model to generate a feasible design while minimizing mass. Detailed construction and sanitization rules are provided in the Appendix.

After CAD–CAE annotation, 77,067 designs successfully pass the complete pipeline. We divide them into disjoint SFT and GRPO subsets. The SFT subset contains 11,024 samples paired with sanitized reference CadQuery programs, whereas the GRPO subset contains 66,043 tasks without target programs and is optimized solely through CAD–CAE verification.

Implementation Details

From the 66,043 samples allocated to RL, we reserve 3,373 samples as a held-out evaluation set and use the remaining 62,670 prompts for GRPO training. The held-out samples are excluded from all policy updates and are used consistently for evaluating the SFT and GRPO checkpoints. All training and CAD–CAE evaluation experiments are conducted on a NVIDIA H800 GPU.

For GRPO, we use a training batch size of 4 prompts. For each prompt, the policy generates 4 independent completions, resulting in 16 rollout samples per batch. The four completions corresponding to the same prompt form a GRPO group and are evaluated independently by the deterministic CAD–CAE verifier described in § 3.2. Their verification outcomes are then converted into the hierarchical advantages introduced above. We use a learning rate of 5×10−75 \times10^{-7} for policy optimization, with a sampling temperature of 0.9 and top-pp of 0.95. For the hierarchical advantage, we instantiate equation 5 with λL=1.0\lambda_{L} = 1.0, λw=0.25\lambda_{w} = 0.25 and β=0.01\beta= 0.01 in equation 6.

Evaluation Metrics

We evaluate generated designs using seven metrics. Valid CAD measures whether the generated program successfully produces a valid CAD solid. BBox measures whether all three bounding-box dimensions satisfy the specified design bounds. CAE denotes successful finite-element analysis with valid physical measurements. Displacement (Disp.) and Stress report the pass rates for the prescribed maximum-displacement and stress constraints, respectively. Physics measures simultaneous satisfaction of the displacement, stress, and mass constraints. Finally, Joint measures whether both the geometric requirements and all physical constraints are satisfied.

Comparison with the State of the Art

We compare PhyCAD with three strong proprietary models under direct prompting, including Claude Opus 5, GPT-5.6 Sol, and DeepSeek-V4-Flash-Ascend. We further evaluate five open-source models under SFT and GRPO, with zero-shot results reported where applicable, to examine the effectiveness of our training pipeline across different model families.

Table 1 and Figure 4 show a consistent progression across training stages. SFT substantially improves CAD validity and CAE success, while GRPO further improves geometric and physical constraint satisfaction across all evaluated models. In particular, Joint success increases from 21.76%–37.36% after SFT to 39.49%–58.05% after GRPO, with corresponding gains in displacement and stress satisfaction. The trained models also achieve substantially higher success on the complete set of design requirements than proprietary models under direct prompting. These results indicate that CAD–CAE verification provides effective supervision beyond program validity and guides generation toward designs that better satisfy geometric and physical constraints.

Figure 4. Qualitative comparison across training stages and model families. Surface color indicates stress relative to the prescribed limit, while the bars summarize displacement, stress, and mass constraint satisfaction. Across model families, SFT improves CAD generation but can still violate geometric or physical constraints, whereas GRPO more consistently achieves joint feasibility.

Table 1: Quantitative comparison on the full evaluation set of 3,373 tasks. All results are reported as success rates (%). Bold values indicate the best result among different settings of the same model.

ModelSettingValid CAD↑\uparrowBBox↑\uparrowCAE↑\uparrowPhysical Constraints↑\uparrowJoint↑\uparrow
Claude Opus 5Direct73.8242.3170.7146.5249.878.427.29
GPT-5.6 SolDirect62.4135.6156.6946.5835.7516.8715.51
DeepSeek-V4-Flash-AscendDirect63.3350.5260.4539.7938.3610.859.28
Qwen3-4BZero-shot18.5611.4117.5512.2413.931.220.74
SFT94.2577.7391.4963.0963.2739.1936.64
GRPO99.1491.2596.9284.4481.8357.4055.71
Ministral-3-3BZero-shot1.270.621.070.680.650.240.12
SFT95.5578.3392.6864.6366.5040.5037.36
GRPO98.9994.2297.4584.3281.2059.2958.05
SmolLM3-3BZero-shot6.912.916.555.375.900.650.18
SFT93.9274.9890.3158.8560.7231.2828.73
GRPO98.9991.3196.8077.4776.2845.7544.56
StarCoder2-3BZero-shot10.943.9110.298.818.981.040.56
SFT93.7474.5090.1656.9558.4328.9426.33
GRPO98.9692.0597.1576.6774.1243.1441.65
Qwen2.5-3BZero-shot1.450.471.361.010.950.210.00
SFT90.0765.1686.4555.6857.7525.3221.76
GRPO98.5588.5096.3274.4770.5340.9439.49

Table 1.

Ablation on hierarchical learning.

Table 2 evaluates the effect of the hierarchical objective and staged optimization. Starting from the same SFT model, non-hierarchical GRPO improves CAD validity to 98.40% but reduces joint feasibility from 21.76% to 18.80%. In contrast, direct hierarchical GRPO achieves 98.55% valid CAD and 39.49% joint feasibility, nearly doubling the feasible designs relative to SFT. This indicates the gain comes from explicitly organizing feedback by feasibility level rather than from GRPO alone.

Training StrategyStageValid CAD ↑\uparrowBBox ↑\uparrowCAE ↑\uparrowPhysics ↑\uparrowJoint ↑\uparrowCode Tokens ↓\downarrow
BaselineZero-shot1.450.471.360.210.001002.41
BaselineSFT90.0765.1686.4525.3221.76201.06
DirectNon-hierarchical GRPO98.4060.9083.6023.4018.80199.78
DirectHierarchical GRPO98.5588.5096.3240.9439.49195.46
Training Objective→\rightarrow Geometry GRPO95.2972.3791.5525.8822.86191.60
Training Objective→\rightarrow Physics GRPO94.7275.2791.4030.3327.63188.03
Training Objective→\rightarrow Hierarchical GRPO99.2392.0597.4543.3442.01184.85

Table 2. Ablation of hierarchical reinforcement learning. Comparison of direct hierarchical GRPO, non-hierarchical GRPO, and staged training objectives.

The staged results further show that optimizing geometric or physical objectives independently is insufficient: Geometry and Physics reach only 22.86% and 27.63% joint feasibility, respectively, improving over SFT by only 1.10 and 5.87 percentage points. Joint feasibility rises to 42.01% only when the explicit Hierarchical objective is introduced. This is particularly important for physical feasibility, where satisfying the prescribed stress and displacement thresholds requires the model to prioritize constraint satisfaction before objective refinement. Although staged optimization yields a further 2.52-point gain over direct hierarchical GRPO, it requires additional RL stages and substantially higher training cost.

Discussion

Conclusion. Our work establishes a physics-aware Text-to-CAD setting that connects executable CAD generation with deterministic CAE verification. By combining a physics-aware dataset, CAD–CAE verifier, and hierarchical reinforcement learning, the framework improves geometric and physical compliance across multiple models. These results demonstrate the potential of incorporating verifiable engineering feedback into CAD generation beyond geometric reconstruction.

Limitation and Future Work. The current study has a few scope limitations. First, the prompts mainly encode physical constraints, while broader engineering intent is only weakly represented. Second, the dataset does not systematically cover material variations, though the same verification pipeline can be extended to different material settings. Future work could further introduce local hard dimensional constraints to enforce critical engineering requirements and reduce ambiguity in the generated geometry.

Implementation of Dataset Generation

This appendix provides implementation details for the dataset-generation procedure introduced in § 4.1. We focus on the construction of physical conditions, inverse-design constraints, and dimension-free geometry semantics.

Reference CAD–CAE Annotation and Physical Conditions

Each source CadQuery program is executed and retained only if it produces exactly one valid connected solid that can be processed by the downstream CAD–CAE pipeline. We analyze all retained designs using three-dimensional small-strain linear elasticity in SI units, with isotropic structural steel (E=2.1×1011E = 2.1 \times10^{11} Pa, ν=0.3\nu= 0.3, and ρ=7850\rho= 7850 kg/m3^3). For each successfully simulated design, we record the maximum nodal displacement δmax⁡\delta_{\max}, the volume-weighted 99-th percentile element von Mises stress σP99\sigma_{P99}, and the total mass mm.

Because the source geometries vary substantially in shape and orientation, the fixture and loading regions are determined automatically. We compute the centroid of every CAD surface and select the pair of surface centroids with the largest Euclidean separation. The normalized direction between this pair defines the functional analysis axis. All surface centroids are projected onto this axis, and surfaces whose projections lie within 5% of either end of the projected range form the two terminal surface groups. This grouping allows multiple coplanar or fragmented terminal surfaces to be handled consistently.

The negative terminal group is fully fixed (ux=uy=uz=0u_x = u_y = u_z = 0), while a uniform traction is applied to the positive terminal group such that its integrated resultant force is 100 kN along the positive analysis axis. The resulting analysis axis, fixture definition, and loading condition are explicitly included in the model prompt.

Inverse-Design Task Construction

Each successfully analyzed reference is converted into an inverse-design task while withholding its exact dimensions and simulation measurements.

Coarse design domain. For each global bounding-box extent ee, we expose only the enclosing interval between adjacent powers of two,

B(e)=[2⌊log⁡2e⌋,2⌊log⁡2e⌋+1].(7)B(e) = \left[2^{\lfloor\log_2 e \rfloor}, 2^{\lfloor\log_2 e \rfloor+ 1}\right]. \tag*{(7)}

The model therefore receives a coarse admissible range along each axis rather than the dimensions of the reference design.

Performance requirements. The displacement, stress, and mass limits are derived independently from δmax⁡\delta_{\max}, σP99\sigma_{P99}, and mm. Each reference measurement is multiplied by 1.10 and rounded upward to two significant digits to form the corresponding upper bound. The margin keeps the reference design feasible under small numerical variations from CAD processing, meshing, and FEM evaluation, while rounding avoids exposing its exact simulation measurements.

Geometry Semantic Construction

The geometry specification must preserve the intended design structure without revealing the parameters of the reference CAD. We construct this specification from both the source textual description and the CadQuery operation sequence.

Numerical redaction. We remove numerical information that may reveal the reference geometry, including explicit dimensions, angles, quantities with units, and spelled-out numerical values. We retain non-numerical information describing the shape class, topology, feature types and counts, and spatial or compositional relationships. Thus, for example, the existence and relative placement of a cylindrical feature are preserved while its diameter and height are withheld.

Operation-derived semantics. Because textual descriptions do not always capture the CAD construction consistently, we additionally parse the CadQuery program and map its modeling operations to dimension-free geometric features. Numerical operation arguments are discarded. Representative mappings are shown in Table 3.

CadQuery constructionExtracted geometry semantics
boxrectangular-prismatic feature
cylindercylindrical feature
polygonal sketch + extrudepolygonal-prismatic feature
curved sketch + extrudecurved-profile feature
revolverevolved feature
cutmaterial-removal relation
holehole or through-feature
filletrounded-edge feature
shellhollow or shell construction
union / compositionpart-composition relation

Table 3. Representative CadQuery operation-to-feature mappings used to construct dimension-free geometry semantics. Numerical parameters are not exposed to the model.

The sanitized textual description and operation-derived features are combined into the final geometry-semantic specification. It preserves the overall shape class, topology, feature composition, and relationships between components, while leaving their exact dimensions unspecified.

Consequently, the reference CAD remains one feasible realization of the task rather than a uniquely specified target geometry.

Representative tasks produced by the complete pipeline are shown in Figure 5, where the reference CAD and FEM results are included only for illustration and are not provided to the model.

Figure 5. Representative physics-aware Text-to-CAD tasks. Each example shows the private reference geometry and its FEM stress field together with the corresponding model-visible task. Exact reference dimensions and simulation measurements are withheld; the model receives dimension-free geometry semantics, coarse design bounds, physical conditions, and displacement, stress, and mass limits. It must generate an executable CadQuery design satisfying these requirements while minimizing mass.

Hierarchical Balanced GRPO

Algorithm 1 summarizes the training procedure of our Hierarchical Balanced GRPO.

Algorithm 1 Hierarchical Balanced GRPO.

Require: Policy πθ\pi_\theta, reference policy πref\pi_{\mathrm{ref}}, prompts Q\mathcal{Q}, group size GG, weights λL\lambda_L, λw\lambda_w, β\beta

  1. for each training iteration do

  2. Sample a prompt batch B⊂Q\mathcal{B} \subset\mathcal{Q}

  3. for each prompt q∈Bq \in\mathcal{B} do

  4. Sample {oi}i=1G∼πθ(⋅∣q)\{o_i\}_{i=1}^{G} \sim\pi_\theta(\cdot\mid q)

  5. Verification: evaluate each oio_i with the CAD–CAE verifier to obtain level Li∈{0,1,2,3}L_i \in\{0,1,2,3\} and level-specific scores {sik}k=1KLi\{s_{ik}\}_{k=1}^{K_{L_i}}

  6. Li=0L_i = 0: invalid CAD; Li=1L_i = 1: geometry failure; Li=2L_i = 2: physics failure; Li=3L_i = 3: fully feasible

  7. Between-level advantage: Lˉ=1G∑j=1GLj,Ailevel=Li−Lˉ\bar{L} = \frac{1}{G}\sum_{j=1}^{G} L_j,\quad A_i^{\mathrm{level}} = L_i - \bar{L}

  8. Within-level PeerRank: initialize A~i=0\widetilde{A}_i = 0 for all ii

  9. for ℓ=0,1,2,3\ell= 0,1,2,3 do

  10. Iℓ={i:Li=ℓ}I_\ell= \{i : L_i = \ell\}

  11. if ∣Iℓ∣>1|I_\ell| > 1 then

  12. Compute tie-aware centered ranks rikr_{ik} of {sik}i∈Iℓ\{s_{ik}\}_{i\in I_\ell} for k=1,…,Kℓk = 1,\ldots,K_\ell

  13. A~i=∑k=1Kℓwℓkrik,∀i∈Iℓ\widetilde{A}_i = \sum_{k=1}^{K_\ell} w_{\ell k}r_{ik},\quad\forall i \in I_\ell

  14. end if

  15. end for

  16. Hierarchical advantage: Ai=λLAilevel+λwA~iA_i = \lambda_L A_i^{\mathrm{level}} + \lambda_w\widetilde{A}_i

  17. end for

  18. Update θ\theta using DAPO-style GRPO: L=LDAPO(θ;A)+βDKL(πθ∥πref)\mathcal{L} = \mathcal{L}_{\mathrm{DAPO}}(\theta; A) + \beta D_{\mathrm{KL}}(\pi_\theta\Vert\pi_{\mathrm{ref}})

  19. end for

  20. return Optimized policy πθ\pi_\theta

References

  1. [1]Kamel Alrashedy, Pradyumna Tambwekar, Zulfiqar Haider Zaidi, Megan Langwasser, Wei Xu, and Matthew Gombolay. Generating cad code with vision-language models for 3d designs. In International Conference on Learning Representations, volume 2025, pp. 52236–52262, 2025.arxiv.org/abs/2410.05340
  2. [2]Akshay Badagabettu, Sai Sravan Yarlagadda, and Amir Barati Farimani. Query2cad: Generating cad models using natural language queries. arXiv preprint arXiv:2406.00144, 2024.arxiv.org/abs/2406.00144
  3. [3]Elias Berger, Muhammad Usama, Jan Mehlstäubl, Bernhard Saske, and Kristin Paetzold-Byhain. Physics-in-the-loop: A hybrid agentic architecture for validated cad engineering design. arXiv preprint arXiv:2605.19717, 2026.arxiv.org/abs/2605.19717
  4. [4]Yuxuan Chen, Xu Zhu, Hua Zhou, and Zhuyin Ren. Metaopenfoam: an llm-based multi-agent framework for cfd. arXiv preprint arXiv:2407.21320, 2024.arxiv.org/abs/2407.21320
  5. [5]Liyuan Deng, Shujian Deng, Yongkang Chen, Yongkang Dai, Zhihang Zhong, Linyang Li, Xiao Sun, Yilei Shi, and Huaxi Huang. Cosmo-agent: Tool-augmented agent for closed-loop optimization, simulation, and modeling orchestration. arXiv preprint arXiv:2604.05547, 2026.arxiv.org/abs/2604.05547
  6. [6]Prashant Govindarajan, Davide Baldelli, Jay Pathak, Quentin Fournier, and Sarath Chandar. Cad-mium: Fine-tuning code language models for text-driven sequential cad design. arXiv preprint arXiv:2507.09792, 2025.arxiv.org/abs/2507.09792
  7. [7]Yandong Guan, Xilin Wang, Ximing Xing, Jing Zhang, Dong Xu, and Qian Yu. Cad-coder: Text-to-cad generation with chain-of-thought and geometric reward. Advances in Neural Information Processing Systems, 2025.arxiv.org/abs/2505.19713
  8. [8]Shifu Hou, Rick Johnson, Ramandeep Makhija, Lingwei Chen, and Yanfang Ye. Autofea: Enhancing ai copilot by integrating finite element analysis using large language models with graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pp. 24078–24085, 2025.DOI
  9. [9]Mohammad S Khan, Sankalp Sinha, Talha U Sheikh, Didier Stricker, Sk A Ali, and Muhammad Z Afzal. Text2cad: Generating sequential cad designs from beginner-to-expert level text prompts. Advances in Neural Information Processing Systems, 37:7552–7579, 2024.arxiv.org/abs/2409.17106
  10. [10]Maksim Kolodiazhnyi, Denis Tarasov, Dmitrii Zhemchuzhnikov, Alexander Nikulin, Ilya Zisman, Anna Vorontsova, Anton Konushin, Vladislav Kurenkov, and Danila Rukhovich. cadrille: Multi-modal cad reconstruction with reinforcement learning. arXiv preprint arXiv:2505.22914, 2025.arxiv.org/abs/2505.22914
  11. [11]Jiahao Li, Weijian Ma, Xueyang Li, Yunzhong Lou, Guichun Zhou, and Xiangdong Zhou. Cad-llama: leveraging large language models for computer-aided design parametric 3d model generation. In 2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 18563–18573. IEEE, 2025a.arxiv.org/abs/2505.04481
  12. [12]Jiahao Li, Yusheng Luo, Yunzhong Lou, and Xiangdong Zhou. Recad: Reinforcement learning enhanced parametric cad model generation with vision-language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 40, pp. 6190–6198, 2026a.
  13. [13]Peiji Li, Jiasheng Ye, Yongkang Chen, Yichuan Ma, Zijie Yu, Kedi Chen, Ganqu Cui, Haozhan Li, Jiacheng Chen, Chengqi Lyu, et al. Internbootcamp technical report: Boosting llm reasoning with verifiable task scaling. arXiv e-prints, pp. arXiv–2508, 2025b.arxiv.org/abs/2508.08636
  14. [14]Xingang Li, Yuewan Sun, and Zhenghui Sha. Llm4cad: Multimodal large language models for three-dimensional computer-aided design generation. Journal of Computing and Information Science in Engineering, 25(2):021005, 2025c.DOI
  15. [15]Xueyang Li, Jiahao Li, Yu Song, Yunzhong Lou, and Xiangdong Zhou. Seek-cad: A self-refined generative modeling for 3d parametric cad using local inference via deepseek. In International Conference on Learning Representations, volume 2026, pp. 94278–94298, 2026b.
  16. [16]Dimitrios Mallis, Ahmet Serda Karadeniz, Sebastian Cavada, Danila Rukhovich, Niki Foteinopoulou, Kseniya Cherenkova, Anis Kacem, and Djamila Aouada. Cad-assistant: Tool-augmented vllms as generic cad task solvers. In 2025 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 7284–7294. IEEE, 2025.arxiv.org/abs/2412.13810
  17. [17]Tobias Preintner, Weixuan Yuan, Adrian König, Thomas Bäck, Elena Raponi, and Niki Van Stein. Evocad: Evolutionary cad code generation with vision language models. In 2025 IEEE 37th International Conference on Tools with Artificial Intelligence (ICTAI), pp. 504–511. IEEE, 2025.
  18. [18]Yupeng Qi, Ran Xu, and Xu Chu. Feagpt: an end-to-end agentic-ai for finite element analysis. arXiv preprint arXiv:2510.21993, 2025.arxiv.org/abs/2510.21993
  19. [19]Feiwei Qin, Shichao Lu, Junhao Hou, Changmiao Wang, Meie Fang, and Ligang Liu. Drawing2cad: Sequence-to-sequence learning for cad generation from vector drawings. In Proceedings of the 33rd ACM international conference on multimedia, pp. 10573–10582, 2025.
  20. [20]Ari Seff, Yaniv Ovadia, Wenda Zhou, and Ryan P Adams. Sketchgraphs: A large-scale dataset for modeling relational geometry in computer-aided design. arXiv preprint arXiv:2007.08506, 2020.
  21. [21]Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, YK Li, Yang Wu, et al. Deepseekmath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300, 2024.
  22. [22]Guijin Son, Jeh yun Park, Seeyeon Park, Sunghee Ahn, and Youngjae Yu. Self-improving cad generation agents with finite element analysis as feedback. arXiv preprint arXiv:2605.17448, 2026.
  23. [23]Yuewan Sun, Xingang Li, and Zhenghui Sha. Large language models for computer-aided design fine tuned: Dataset and experiments. Journal of Mechanical Design, 147(4):041710, 2025.
  24. [24]Karl DD Willis, Yewen Pu, Jieliang Luo, Hang Chu, Tao Du, Joseph G Lambourne, Armando Solar-Lezama, and Wojciech Matusik. Fusion 360 gallery: A dataset and environment for programmatic cad construction from human design sequences. ACM Transactions on Graphics (TOG), 40(4): 1–24, 2021.DOI
  25. [25]Karl DD Willis, Pradeep Kumar Jayaraman, Hang Chu, Yunsheng Tian, Yifei Li, Daniele Grandi, Aditya Sanghi, Linh Tran, Joseph G Lambourne, Armando Solar-Lezama, et al. Joinable: Learning bottom-up assembly of parametric cad joints. In 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 15828–15839. IEEE, 2022.
  26. [26]Rundi Wu, Chang Xiao, and Changxi Zheng. Deepcad: A deep generative network for computer-aided design models. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 6752–6762. IEEE, 2021.
  27. [27]Haoyang Xie and Feng Ju. Text-to-cadquery: A new paradigm for cad generation with scalable large model capabilities. arXiv preprint arXiv:2505.06507, 2025.
  28. [28]Zhaoyue Xu, Long Wang, Chenyu Wang, Yixin Chen, Qingyong Luo, Hua-Dong Yao, Shizhao Wang, and Guowei He. Cfdagent: A language-guided, zero-shot multi-agent system for complex flow simulation. Physics of Fluids, 37(11), 2025.
  29. [29]Zhe Yuan, Jianqi Shi, and Yanhong Huang. Opencad: An efficient visual language model for editable 3d-cad design. Computers & Graphics, 124:104048, 2024.
  30. [30]Ling Yue, Nithin Somasekharan, Tingwen Zhang, Yadi Cao, Zhangze Chen, Shimin Di, and Shaowu Pan. Foam-agent: Towards automated intelligent cfd workflows. arXiv preprint arXiv:2505.04997, 2025.
  31. [31]Licheng Zhang, Bach Le, Naveed Akhtar, Siew-Kei Lam, and Duc Ngo. Large language models for computer-aided design: A survey. ACM Computing Surveys, 58(9):1–39, 2026.arxiv.org/abs/2505.08137
  32. [32]Tao Zhang, Zhenhai Liu, Yong Xin, and Yongjun Jiao. Mooseagent: A llm based multi-agent framework for automating moose simulation. arXiv preprint arXiv:2504.08621, 2025.arxiv.org/abs/2504.08621

Paper details

vlnc:W_8c3td9us
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 18

downloads · 3

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents