Llama Xpert CAD 与 ChatGPT 的 Text-to-CAD 工程质量对比
Can a $50 Fine-Tune Out-Engineer ChatGPT? Text-to-CAD Head-to-Head #1
XpertSystems.ai 用同一液压歧管提示词比较 ChatGPT 与微调模型 Llama Xpert CAD,二者均通过 6/6 项规格检查,但工程质量评分分别为 5/10 和 8/10。评测通过 Open CASCADE 检查 STEP 实体、流路和可加工性,发现 Llama Xpert CAD 仍存在螺栓孔与角部孔冲突、局部薄壁及错误标准标注等问题。
这项对比把文本遵循与工程质量分开评估,并展示了几何内核检查如何发现流路、孔位和壁厚问题。
x.com/i/article/2119162697849…
【X 长文】Can a $50 Fine-Tune Out-Engineer ChatGPT? Text-to-CAD Head-to-Head #1
XpertSystems.ai Text-to-CAD Head-to-Head series, part 1
We gave ChatGPT and our own fine-tuned model, Llama Xpert CAD, the same request: design a 4-station hydraulic manifold block and return a STEP file. Both models met every requirement in the prompt, 6 out of 6. But when each part was checked as a real engineering part, Llama Xpert CAD scored 8/10 and ChatGPT scored 5/10.
Llama Xpert CAD is an open-source Llama model fine-tuned on 20,000 CAD parts we generated. The training run cost about $50 in GPU time.
This article walks through the test from start to finish: the prompt, how the files were judged, a mix-up that taught us something about testing, the final scorecard, and the faults the winning part still has. It is the first in a series. We will run more of these comparisons across other part types and publish each one.
The setup: a small, cheap, specialist model
Large general models can write CAD code, but they learned it from whatever was on the public internet. We wanted to know whether a small open-source model, trained on clean engineering data, could do the job better for a fraction of the cost.
Item Detail
Base model Open-source Llama
Name after fine-tuning Llama Xpert CAD
Training data 20,000 mechanical CAD parts generated by XpertSystems (two lists of 10,000)
How the parts were made Deterministic Python CAD code (build123d on the Open CASCADE kernel)
Training cost About $50 of GPU time
Opponent ChatGPT, given the identical prompt
Every training part comes from code, not from a human clicking in a CAD tool. That means each part has exact, known dimensions and a known build history. The model learns from parts that are correct by construction, including the small details machinists care about: drill-point cones at the bottom of holes, chamfers, counterbores and spot faces.
The prompt
Both models got exactly this text:
Create a 3D CAD model and give me the downloadable .step file for a 4-Station Hydraulic Manifold Block: Rectangular steel block: 220 mm long x 95 mm wide x 95 mm high. Two 16 mm diameter through-holes (P and T main galleries) running along the full 220 mm length. 4 valve-mounting stations on the top face, each with four 8 mm ports (25 mm deep) and four M8 mounting holes (6.8 mm diameter, 16 mm deep). 4 corner mounting holes on the bottom face (11 mm through-hole with 18 mm counterbore, 10 mm deep). 1.5 mm chamfer on all outer edges. Please provide the .step file directly.
A hydraulic manifold is a solid metal block with drilled passages inside it. Valves bolt to the top. Oil comes in through the pressure gallery (P) and returns through the tank gallery (T). Each valve station has four ports: P and T connect to the galleries, and A and B are the work ports that send oil out to a cylinder or motor.
This is a good test part. Getting the outside shape right is easy. Getting the inside right is hard, because the holes have to connect where oil should flow and stay apart where it should not.
How we judged the files
We did not judge by screenshots. Each STEP file was loaded into the Open CASCADE geometry kernel, the same engine behind many CAD tools, and run through five checks:
1. Is it a valid solid? The kernel's own error check, plus a check for gaps in the outer skin. A file can look fine on screen and still fail to machine or simulate.
2. Does it match the prompt? The block size, every hole's diameter, depth and position, and the chamfer size were all measured, then compared line by line against the prompt.
3. Where can oil flow? We traced which holes actually cut into each other. That shows which ports reach which gallery, and whether any passage joins pressure to tank by mistake.
4. Is it machinable? Do holes that should be separate stay separate? Is there enough steel between them?
5. Is the file tidy? Part name, units and file format.
All checks were run by Claude, Anthropic's AI model, using the open-source kernel. In the first round the evaluator was not told which file came from which model.
Round 1: a blind test and an honest mix-up
In the first round, the evaluator got two STEP files with no labels and was asked one simple question: which is better quality?
Without knowing the prompt, it rated the Llama Xpert CAD file 6.5/10 and the ChatGPT file 5/10. The Llama file looked like a part made on a real CNC machine, with drill-tip cones, flat spot faces where fittings seat, and stepped valve cavities. The ChatGPT file was a plain block of straight drilled holes.
The evaluator was then asked to guess which file came from which model. It picked correctly, for two reasons:
• The Llama file's header named build123d, the same CAD library used to generate the 20,000 training parts. A model trained on that code writes the same kind of code.
• Its machining style matched the fluid-power parts in our training lists.
Then came the twist. Checked against the 220 mm prompt, the Llama file seemed to fail badly: it was 200 x 80 x 60 mm, with 12 mm galleries and none of the M8 holes. The verdict flipped: ChatGPT 6/6 on the prompt, Llama Xpert CAD 1/6.
Our engineer Ahmed spotted the cause. That Llama file was never made from the 220 mm prompt. It came from a separate internal test whose prompt asked for exactly 200 x 80 x 60 mm, 12 mm galleries and stepped cavities. Against its own prompt, it matched. The evaluator had simply been handed the wrong pair.
It was our mistake, not the model's, and it is a useful lesson. A text-to-CAD result means nothing unless the file is graded against the exact prompt that produced it.
Round 2: same prompt, fair fight
Ahmed ran the 220 mm prompt through Llama Xpert CAD. He also added two automatic checks to the pipeline that the first round had shown were needed: one to check every prompt item, and one to trace the flow paths. The new file then went through the same five checks.
Against the prompt: a tie
Prompt item ChatGPT Llama Xpert CAD
220 x 95 x 95 mm block Pass Pass
Two 16 mm full-length galleries Pass Pass, with 24 mm of steel between them
Four 8 mm ports per station, 25 mm deep Pass Pass
Four M8 holes per station, 6.8 mm x 16 mm deep Pass Pass, plus drill-tip cones and thread-entry chamfers
Corner holes: 11 mm through, 18 x 10 mm counterbore Pass Pass
1.5 mm chamfer on outer edges Pass (measured 1.5 mm) Pass (measured 1.5 mm)
Score 6 / 6 6 / 6
Both files are valid, closed solids that open cleanly in CAD.
As an engineered part: Llama Xpert CAD wins clearly
Check ChatGPT Llama Xpert CAD
Flow paths All 16 ports drain into only P and T. No A or B work outlets, so the valves have nowhere to send oil P ports to the P gallery, T ports to the T gallery, A and B ports to their own side outlets. No shorts, no dead ends
Machining detail Plain drilled holes Drill-tip cones, thread-entry chamfers, spot faces on outlets
Material use Bottom 60% of the block is solid, unused steel Passages placed with purpose
Holes clear of each other Yes No: 4 of 16 bolt holes clash (see below)
Part name in file Default name 4_Station_Hydraulic_Manifold_Block_Steel_AISI_4140
Overall quality 5 / 10 8 / 10
The ChatGPT block did exactly what the words said and nothing more. Taken literally, "four 8 mm ports per station" plus "P and T galleries" leads to the shortcut it took: every port wired to a gallery. A hydraulic engineer would never build it that way, because a valve's A and B ports must go somewhere other than pressure or tank.
Llama Xpert CAD filled that gap with real know-how. It treated the four ports as P, T, A and B, and drilled cross-passages to bring A and B out to the sides of the block. Nothing in the prompt asked for that. It came from what the model learned from 20,000 well-made parts.
What the winning part still gets wrong
An 8/10 is not a 10/10. The checks found three faults in the Llama Xpert CAD part, and we want to be clear about them.
1. Four bolt holes run into the corner holes. At each end of the block, the outermost valve bolt holes overlap the 11 mm corner mounting holes by about 4 mm. Those 4 of 16 threaded holes would be ruined in real machining. The pipeline's new checks did not catch this, because they test the prompt and the flow, not hole-to-hole clearance.
2. Thin walls. Only about 1.4 mm of steel separates the M8 threads from the nearby A and B ports. Under hydraulic pressure, that is a weak spot.
3. An overconfident label. The file header claims the part is "ISO 4401 / NFPA D03 compatible". It is not. That standard uses M5 bolts in a different pattern, and the prompt asked for M8. The material, AISI 4140 steel, appears only in the part name and a comment, not as a formal material record.
None of these show up in a screenshot. All of them show up in a kernel check. Fix the first one and the part is close to 9/10.
What we learned
- Data quality beats model size. A $50 fine-tune of an open-source model produced a better-engineered part than one of the best-known general models. The difference came from the training data: 20,000 parts that are correct by construction and full of real machining detail.
- "Follows the prompt" and "is good engineering" are different scores. Both models passed the prompt 6/6. Only one produced a manifold that would work in a hydraulic system. Any fair text-to-CAD test needs both scores, side by side.
- Grade against the exact prompt. Our own mix-up in round 1 made a good model look like a failure. Every result in this series will be graded against the exact prompt that produced it, and we will publish that prompt.
- Look inside, not just at the outside. Every fault that matters here, from missing work ports to clashing bolt holes, was invisible from the outside. Measuring holes and tracing flow paths in a geometry kernel is the minimum for judging CAD output.
- Automatic checks make the model better, fast. After round 1, adding a spec check and a flow check to the pipeline took the model from an untested result to 6/6 with working flow paths. The next checks to add are hole clearance and minimum wall thickness.
What's next in this series
This was one part. One part proves a point but not a pattern. Over the coming comparisons we plan to:
• Test more part types: gearbox housings, brackets, shafts, weldments and sheet-metal parts.
• Add more opponents, including other general AI models and the base Llama model before fine-tuning, to show exactly what the training data adds.
• Grow from single parts to a scored test set of hundreds of prompts, with both scores (follows the prompt, engineering quality) reported for every model.
• Add hole-clearance and wall-thickness checks, then retrain on the outputs that pass every check, and show the before-and-after.
Every round will publish the prompt, the scorecard and the faults found, including our own.
Work with us
XpertSystems.ai builds the data behind results like this: large, verified CAD corpora generated by deterministic code, with exact dimensions, build history and ground truth for every part. We also offer evals as a service for text-to-CAD models and AI agents.
If you are training a CAD model, or want to know how yours compares, contact pradeep@xpertsystems.ai
来源:Pradeep · x.com