Study Uses AI to Screen Milk Samples for Mycotoxin Contamination

A recent scientific study demonstrated the potential usefulness of analyzing routinely collected milk product measurements with artificial intelligence (AI) to help predict mycotoxin contamination and inform targeted testing. The findings were published in Current Research in Food Science.
Specifically, researchers developed a machine learning (ML) prescreening approach to predict whether aflatoxin M1 (AFM1) in raw milk exceeded the EU regulatory threshold of 0.05 micrograms per liter (μg/L). AFM1 is a carcinogenic mycotoxin that can enter milk when dairy cattle consume feed contaminated with aflatoxin B1, which is then metabolized and excreted as AFM1.
Limitations of Traditional Laboratory Testing
Although sensitive detection methods like ELISA or liquid chromatography–tandem mass spectrometry (LC–MS/MS) are used for AFM1 detection, the study emphasized that costs, timely sample preparation, and skilled labor requirements can limit high-throughput application in large dairy operations. Hoping to address these limitations, the researchers investigated whether AI models could be used as a cost-effective tool to identify higher-risk samples for further laboratory analysis.
Using Routinely Collected Data to Screen for High-Risk Samples
The model was trained on a dataset originating from a dairy processor’s raw milk records collected over two decades, which measured features like composition, microbiological indicators, and handling conditions. Key, routinely measured predictors included protein, fat, lactose, total solids, non-fat milk solids, acidity, freezing point, relative density, milk temperature at receipt, total colony count, psychrophilic bacteria, somatic cell count, and viscosity. Geographic identifiers (i.e., country, province) were also incorporated as categorical predictors to account for regional differences linked to feed contamination risk.
AI Predicted 83 Percent of Mycotoxin-Contaminated Samples
AFM1 concentrations were labeled based on whether samples contained levels above or below the EU threshold of 0.05 μg/L. Of the more than 40,000 samples included in the dataset, approximately 500 exceeded 0.05 μg/L AFM1 levels, requiring the researchers to balance the data using statistical techniques.
Across 100 repeated experiments using the balanced dataset, the most successful model was able to correctly identify 83.2 percent of milk samples with AFM1 levels exceeding 0.05 μg/L.
In an external validation experiment using an independent 2018 dataset, the model correctly identified 75.91 samples exceeding the 0.05 μg/L limit, with 33 missed samples and 793 false positives. The dataset contained 8,634 AFM1-positive samples and 137 AFM1-negative samples.
Looking for quick answers on food safety topics?
Try Ask FSM, our new smart AI search tool.
Ask FSM →
The researchers said these results are consistent with imbalanced classification dynamics and are acceptable for risk-averse prescreening where sensitivity is prioritized.
Implications for Industry: Using AI to Augment Traditional Detection Workflows
Based on their findings, the researchers believe ML models that leverage existing, low-cost intake and quality measurements can be used to flag samples with a higher risk of mycotoxin contamination in real time. If applied as an early warning tool, the model could help processors triage lots for confirmatory testing, concentrate laboratory resources on higher-risk batches, and expand mycotoxin surveillance without expending resources.
The researchers described the use of ML to augment traditional detection workflows as “AI+” and noted that the approach could be adapted for other food safety hazards where routine plant measurements may help predict risk. However, broader, multi-regional validation and continual model updates would be necessary before large-scale industry application.









