Grafy News
Try Grafy free

PhyCAD Introduces Physics‑Aware Text‑to‑CAD Generation via Hierarchical Reinforcement Learning

Researchers unveiled PhyCAD, a framework that makes text‑driven CAD models physically feasible using hierarchical reinforcement learning.

Illustration for the news story: PhyCAD Introduces Physics‑Aware Text‑to‑CAD Generation via Hierarchical Reinforcement LearningSource: Arxiv AI Recent

PhyCAD, a new framework announced on arXiv, teaches language models to output executable CadQuery scripts that satisfy both geometric specifications and physical constraints. By adding physics awareness to text‑to‑CAD pipelines, the system promises designs that are not only printable but also structurally sound.


What is PhyCAD and how does it work?

PhyCAD extends the classic text‑to‑CAD pipeline by inserting a physics verification loop between prompt interpretation and final code emission. The authors first fine‑tune a large language model (LLM) to translate natural‑language design requests into CadQuery code. That code is then fed to an automated CAD‑CAE verifier that checks geometry, loads, and material limits. If the verifier flags a violation, a hierarchical reinforcement learning (HRL) controller adjusts the prompt representation and regenerates the script until all constraints are met. According to the arXiv preprint, the HRL agent operates at two levels: a high‑level policy selects which constraint to prioritize, while a low‑level policy edits the CadQuery parameters.

Why does physics awareness matter for text‑to‑CAD?

Traditional text‑to‑CAD systems focus on producing syntactically correct models, but they ignore whether a design can actually bear the forces it will encounter. This gap limits practical adoption in engineering, robotics, and additive manufacturing, where a part that looks correct on screen may fail under load. PhyCAD’s physics‑aware approach ensures that generated parts respect loading conditions, material strengths, and boundary constraints, moving the technology from artistic prototyping toward functional engineering.

How was the dataset built and what does it contain?

To train and evaluate the system, the researchers assembled a new Text‑to‑CAD dataset linking parametric CadQuery models with three layers of metadata:

  1. Geometric specifications – dimensions, tolerances, and parametric relationships.
  2. Loading conditions – forces, pressures, and fixed supports that the part must endure.
  3. Physical constraints – material properties, safety factors, and regulatory limits. Each entry includes the original natural‑language description, the ground‑truth CadQuery program, and a set of constraint checks generated by a finite‑element analysis (FEA) pipeline. The paper notes that the dataset is publicly released to encourage reproducibility, though exact numbers are not quoted in the summary.

What role does hierarchical reinforcement learning play?

Hierarchical reinforcement learning provides a structured way to satisfy multiple, sometimes competing, constraints. The high‑level policy decides which constraint to address next—e.g., thickness for stress reduction or hole diameter for weight saving—while the low‑level policy makes concrete edits to the CadQuery code. Rewards are calculated from the verifier’s pass/fail signals and from a smooth penalty based on how close the design is to meeting each target. This hierarchy allows the system to converge faster than flat RL approaches because it isolates decision making at appropriate abstraction levels.

How can creators and developers try similar workflows in Grafy?

While PhyCAD itself is not yet a Grafy app, the workflow maps cleanly onto several existing tools:

  • Grafy Code – Use the AI coding studio to experiment with CadQuery generation. By feeding a natural‑language prompt to a language model (via Grafy Chat) and then executing the resulting script in the Code environment, you can iterate quickly on geometry.
  • Grafy 3D Studio – Import the generated CAD files (STEP, STL, or GLB) into the 3D Studio to visualize, tweak, and render them. The studio also supports basic physics preview through built‑in mesh analysis tools.
  • Grafy Chat – For rapid prototyping, ask the multi‑model chat to produce CadQuery snippets and immediately test them with the built‑in verifier.
  • Grafy Reader – Load the PhyCAD paper into Reader to search the methodology, extract code examples, and ask follow‑up questions without leaving the workspace.

A practical experiment could look like this:

  1. Open Grafy Chat and select a model that supports code generation (e.g., a GPT‑4‑code variant). Prompt it with a design request such as “a lightweight bracket that holds a 5 kg load with a safety factor of 2.”
  2. Copy the returned CadQuery script into Grafy Code, run the script, and export the geometry.
  3. Drag the exported file into Grafy 3D Studio to inspect the shape and run a quick stress test using the studio’s analysis overlay.
  4. Iterate by adjusting the prompt or editing the script directly in Code, mirroring the HRL loop used by PhyCAD.

What are the next steps and current limitations?

The authors acknowledge several areas for future work. First, the current verifier runs a deterministic FEA pass, which can be computationally expensive for complex assemblies; scaling the loop to industrial‑size parts may require surrogate models. Second, the dataset, while diverse, still focuses on relatively simple mechanical components; extending it to multi‑body mechanisms or compliant mechanisms will test the limits of hierarchical RL. Finally, the system assumes a single material throughout a part; handling composites or graded materials will need richer constraint representations.


Source: “PhyCAD: Physics‑Aware Text‑to‑CAD Generation via Hierarchical Reinforcement Learning,” arXiv (2026‑11‑09).


Source: Arxiv AI Recent — PhyCAD: Physics-Aware Text-to-CAD Generation via Hierarchical Reinforcement Learning