zhobogaga

Fine-tuning

CAD-LLM

A study and proof of concept: natural-language design intent goes in, a compact bracketed CAD language comes out, and FreeCAD checks that it actually builds.

The idea

Instead of asking a model to write long Python or STEP files, we give it a small, dense vocabulary of CAD tokens. Short sequences let the model pay attention to structure. A Python driver then turns the token stream into FreeCAD calls.

[CAD_START] [RECT] [W] [MM_50] [H] [MM_40] [EXTRUDE] [MM_10] [CAD_END]

A 50 × 40 mm rectangular plate, extruded 10 mm.

Locked decisions

Output
A custom CAD language, validated by executing it in FreeCAD.
Dimensions
Discrete millimetre tokens from 5 to 100 mm in 5 mm steps. No raw digits.
First family
Family A: a rectangular plate with a single extrude; thickness 5, 10, 15 or 20 mm.
Approach
Vocabulary extension and supervised fine-tuning. No retrieval (RAG).

How it is trained

How it is measured

The key metric is execution success: does the output parse, and does it build a solid in FreeCAD? A curated 40-row held-out set uses wording that never appears in the training data. The evaluation code never loads a model; predictions are dumped separately and then scored.

TODO: content from Sam — held-out results after training. No results are published here until they are measured.