lpbf-defect-prediction
Skill16 starsChanged 16 days agoMITView on GitHub
Predict laser powder bed fusion (L-PBF) defect regimes — keyholing, lack of fusion, balling, or none — from process parameters (material, laser power, scan speed, beam diameter, hatch spacing, layer thickness), check measured melt-pool dimensions against the standard defect criteria, and draw power–velocity process maps with a recommended window. Based on AdditiveLLM (Barati Farimani Lab) and the MeltpoolNet dataset. Use for metal AM parameter selection, "will these settings keyhole?", process windows, or porosity troubleshooting.
In this repository34 other files it gives its agents.
- skills/cadsmith-text-to-cad/references/agents.mdAGENTS.md
- agentscad-fdm-dfamSkill
- am-alloy-screeningSkill
- am-literature-ragSkill
- cadsmith-text-to-cadSkill
- cfd-simulation-setupSkill
- design-review-packageSkill
- dfm-reviewSkill
- drawing-gdt-reviewSkill
- engineering-calc-reportSkill
- equation-discoverySkill
- image2gcodeSkill
- lattice-inverse-designSkill
- linkage-synthesisSkill
- llm-3d-print-monitorSkill
- llm-mechanical-designerSkill
- lpbf-superresSkill
- machine-element-sizingSkill
- material-selectionSkill
- mechanical-teardownSkill
- mechanics-visualsSkill
- meltpool-geometrySkill
- parametric-part-cadSkill
- query2cad-freecadSkill
- quick-feaSkill
- rocketsmithSkill
- sketch-to-cadSkill
- sls-process-optimizationSkill
- stress-field-surrogateSkill
- thermal-fluids-calcSkill
- thermal-porositySkill
- tolerance-stackupSkill
- worked-problem-generatorSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 52
Default --split grouped holds out whole melt pools, typically about 88% exact match.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
L-PBF defect prediction (AdditiveLLM)
Takes a metal L-PBF parameter set and says which defect regime it most likely falls in. Can
also draw the safe window across power and speed. The workflow follows AdditiveLLM
(Pak & Barati Farimani, Additive Manufacturing Letters 2025): MeltpoolNet melt-pool data,
labelled with three geometric criteria, augmented over hatch and layer, and learned as a
multi-label classifier. Paper details and how this skill differs are in
references/paper-notes.md.
Everything runs through scripts/lpbf.py (numpy, pandas, scikit-learn, matplotlib,
pyarrow). The first run downloads MeltpoolNet (~1 MB) from
github.com/BaratiLab/MeltpoolNet to ~/.cache/mechanical-engineering-skills/meltpoolnet. Set
LPBF_CACHE to put it elsewhere.
Pick the mode from what the user has
| User has | Use | Why |
| Measured or simulated melt-pool depth, width (and length) | criteria | Exact physics rules. No model, no uncertainty beyond the measurement. |
| Process parameters only | predict (after build + train, once) | Learned from about 2,400 experiments plus augmentation. |
| "What settings should I use?" | map | Power–velocity map, defect-free region, most robust point, and where the data actually is. |
Criteria (paper Eqs. 1–3)
python scripts/lpbf.py criteria --depth 120 --width 150 --length 420 --hatch 100 --layer 40| Regime | Fires when |
| Keyholing | W / D < 1.5 |
| Lack of Fusion | (h / W)² + (t / D)² > 1 |
| Balling | L / W > π |
The labels are not exclusive. None means every criterion that could be evaluated passed. Missing inputs leave that criterion unevaluated, and the output says so. Never report "None" when a criterion was skipped.
Model (one-time, about 1 minute)
python scripts/lpbf.py build --out data.parquet # ≈325k rows; prints label shares
python scripts/lpbf.py train --data data.parquet --model model.joblib # grouped split by defaulttrainprints exact-match accuracy (all four labels correct) and F1 for each label.- Default
--split groupedholds out whole melt pools, typically about 88% exact match. --split randomreproduces the paper's protocol and scores about 98%. It is inflated by leakage, so never quote it as expected accuracy (see notes).--no-monotoneremoves the physics constraints, for ablation only.
Predict and map
python scripts/lpbf.py predict --model model.joblib --material Ti-6Al-4V \
--power 280 --velocity 1200 --beam 80 --hatch 100 --layer 30
python scripts/lpbf.py map --model model.joblib --material Ti-6Al-4V \
--hatch 100 --layer 30 --beam 80 --out map.png [--pmax 500 --vmax 2500]predictreturns a probability for each regime, the predicted labels (None only if no defect head reaches 0.5), line and volumetric energy, and the model's validation scores.mapshades the regions where each defect head is above 0.5. Green means all three are below 0.5. Measured points for that material are drawn as circles. The output also reports the defect-free fraction and the most robust point (the largest smoothed margin).- Materials in the data include SS316L, SS17-4PH, IN625, IN718, IN738LC, Ti-6Al-4V,
Hastelloy X, Cu10Sn, AlSi10Mg, Ti-48Al and others. Other alloys need
--props density,Cp,k,Tm, and you should warn the user that the result is extrapolated.
How to report
- Give the regime and its probability, plus the energy numbers.
- Name the physical lever:
- keyhole: lower power or raise speed;
- LoF: lower hatch or layer, or raise energy;
- balling: lower speed at the same energy, or reduce the power–speed product.
- Say whether the point lies inside the measured data (circles on the map) or is extrapolated. Green regions with no circles are guesses.
- For a real build, recommend a small DOE of single tracks and density cubes around the suggested point. The model narrows the search; it does not replace qualification.
Caveats to pass on
- Labels come from single-track melt-pool geometry. They do not cover spatter, cracking, residual stress, contour or downskin effects.
- W/D < 1.5 is a conservative keyhole rule. Many SS316L conduction-mode tracks trip it, so that material's map shows a narrow window.
- Balling has few examples because it needs melt-pool length, so the balling head rarely fires.
- To fine-tune an actual LLM as in the paper,
data.parquetincludes the Baseline[SEP]text. Seereferences/finetune.md.
Cite: Pak & Barati Farimani, Addit. Manuf. Lett. 14 (2025) 100292; Akbari et al., MeltpoolNet, Addit. Manuf. 55 (2022) 102817.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

