Skill: lpbf-defect-prediction · Paper: P. Pak, A. Barati Farimani, AdditiveLLM: Large language models predict defects in metals additive manufacturing, Additive Manufacturing Letters 14 (2025) 100292, doi:10.1016/j.addlet.2025.100292 · arXiv:2501.17784 · Data: MeltpoolNet (Akbari et al., Additive Manufacturing 55 (2022) 102817)
Laser powder bed fusion parts fail in three ways that show up in the melt pool:
AdditiveLLM labelled MeltpoolNet’s measured melt pools with three geometric criteria. It then
augmented each melt pool over a 20 × 20 grid of hatch spacing and layer height, and
fine-tuned small LLMs on text such as
SS316L [SEP] 200 W [SEP] 800 mm/s [SEP] 80 microns [SEP] 100 microns [SEP] 30 microns.
The best model, Llama-3.2-1B, reached 94.2% exact-match accuracy.
This skill rebuilds the dataset from the public MeltpoolNet CSVs and trains a fast gradient-boosted model with physics monotonic constraints, for example that more power never makes keyholing less likely. It answers three questions:
references/finetune.md).npx skills add BaratiLab/mechanical-engineering-skills --skill lpbf-defect-prediction
pip install numpy pandas scikit-learn matplotlib pyarrow joblib scipy
cd skills/lpbf-defect-prediction
python scripts/lpbf.py criteria --depth 120 --width 150 --length 420 --hatch 100 --layer 40
labels: ["Keyholing"]
Keyholing width/depth = 1.25 (< 1.5)
Lack of Fusion (h/W)^2 + (t/D)^2 = 0.56 (<= 1)
Balling length/width = 2.80 (<= pi)
If a dimension is missing, that criterion is reported as not evaluated. It is never counted as passing.
python scripts/lpbf.py build --out data.parquet
python scripts/lpbf.py train --data data.parquet --model model.joblib
The build produces 324,850 rows:
Validation exact match:
| Split | This skill | AdditiveLLM, best LLM |
|---|---|---|
| Random 75/15/10, the paper’s protocol | 98.1% | 94.2% |
| Grouped: whole melt pools held out (default) | 87.9% (macro-F1 0.886) | not reported |
The random split leaks. Augmented copies of the same melt pool end up in both train and
validation, and once W and D are memorised the lack-of-fusion label is a closed-form function
of hatch and layer. 87.9% is the number to quote for a parameter set the model hasn’t
seen. Turning off the monotonic constraints (--no-monotone) drops it to 83.9%.
python scripts/lpbf.py predict --model model.joblib --material Ti-6Al-4V \
--power 280 --velocity 1200 --beam 80 --hatch 100 --layer 30
At 350 W and 300 mm/s the same alloy gives Keyholing with probability 0.98.
python scripts/lpbf.py map --model model.joblib --material Ti-6Al-4V --hatch 100 --layer 30 --beam 80 --out map_ti64.png

The map shows the textbook shape:
The most robust point is about 233 W at 870 mm/s.
Treat the map with care:

Cite: Pak & Barati Farimani, Addit. Manuf. Lett. 14 (2025) 100292; Akbari et al., Addit. Manuf. 55 (2022) 102817.