DEV Community

GrayCyan AI
GrayCyan AI

Posted on

We Used Machine Learning to Cut Defects on Our Line — Here's How

Wanted to share this because I've seen a lot of "AI will fix your quality problems" content that's way too abstract to actually act on. This is just what we did, what worked, and what didn't.

The problem

We run a mid-size production line (won't get into specifics about the product, but think high-volume, tight tolerances) and were sitting at a defect rate that was... fine, but not great. Somewhere around 3.5% of units failing final inspection. Manual inspection was catching most of it, but not all, and by the time a defect got flagged, we'd usually already run a batch of bad units before anyone noticed a pattern.

The annoying part wasn't the defects themselves — it was that we kept finding out about problems too late. A tool would start drifting out of calibration, or a material batch would be slightly off, and we wouldn't catch it until inspection numbers already looked bad for a shift or two.

What we actually did

We started collecting more granular sensor data than we had before — temperature, pressure, cycle time, vibration, stuff we were already generating but not really using. Then we trained a model to look for patterns that showed up right before defect rates started climbing, instead of waiting for the defects to show up in inspection.

Honestly the hardest part wasn't the model itself, it was getting clean, labeled data. We spent way more time on data cleanup than on anything ML-related. If you're starting this kind of project, budget for that — it's not glamorous but it's most of the work.

Once we had decent data, the model got pretty good at flagging "something's drifting" 20-40 minutes before it would've shown up as a defect spike. That gap gave operators enough time to actually intervene — recalibrate, swap material, whatever — before it turned into scrapped units.

Results

Over about four months, our defect rate went from 3.5% down to just under 1.8%. Not everything was the model — we also tightened some maintenance schedules based on what it was surfacing — but the early-warning piece was the biggest single factor.

What didn't work

Our first model was way overfit to one specific failure mode and basically useless for anything else. Had to retrain with a broader dataset.
We initially tried to make it fully automated (auto-adjust parameters), and pulled that back because operators didn't trust a black box making changes without them seeing why. Ended up just surfacing alerts + reasoning instead, which people actually used.
Underestimated how much ongoing tuning it needed. It's not a "set it up once and forget it" thing, especially if your product mix changes.

Honest takeaway

This wasn't some magic fix. It was mostly just: use the data you're already generating, catch drift earlier, and give operators something they can act on instead of a black-box decision. Machine learning in manufacturing gets talked about like it's this huge transformation, but for us it was a pretty incremental, unglamorous process of fixing data quality and building trust with the people on the floor.

If anyone's doing something similar or hit different walls, curious to hear how you approached the data side — that was honestly our biggest bottleneck, more than model selection.

(Also wrote up a longer, more technical version of this if anyone wants deeper detail: machine learning in manufacturing)

Top comments (0)