Inferring Analogs Algorithmically
The need for these new algorithms stems from the limitations of existing methods for detecting fentanyl analogs, which rely on matching a physical or chemical signature to a library of known analogs. That means existing methods generally can’t identify never-before-seen fentanyl analogs, which bad actors are developing at a staggering and ever-increasing pace.
By training algorithms on data about known fentanyl analogs, machine-learning experts at APL are able to play the same game as the criminals — but in reverse. Data scientist Phillip Koshute said the inspiration came a few years ago from another APL project that applied a similar technique to biological data.
“Given the fentanyl analogs that we are aware of, and their chemical structures, we’ve found that we can identify novel fentanyl analogs with an encouraging degree of accuracy,” Koshute said.
Koshute and his team, which includes Lawrence, data scientist Jordan Jameson and chemist Nathan Hagan, have applied machine-learning techniques to data gathered by two different methods for detecting fentanyl: gas chromatography mass spectrometry and Raman spectroscopy.
Machine-learning models using mass spectrometry have returned results with higher accuracy, identifying fentanyl analogs correctly 99% of the time versus the models for Raman spectroscopy, which have posted an 85-90% success rate. But both cases had false-positive rates of 2% or less, and Koshute says that’s a key feature of the technique. “You can always predict a rainy day if you always say it’s going to rain,” he noted, wryly.
The team published papers on both techniques, describing their approach with gas chromatography mass spectrometry in Forensic Chemistry in March 2022 and with Raman spectroscopy in a preprint paper in the open-access repository of the Social Science Research Network, posted in October 2022.
“So far, we’ve been testing the algorithms on pure samples in a laboratory environment, and we’d like to advance the work so we can achieve the same results with mixtures,” said Koshute. “If you’re looking for fentanyl analogs being smuggled in across the border, you’d more likely encounter a pure substance, but out in the field within the U.S., it’s far more likely you’ll find mixtures.”
Detecting Unknown Threats
This work is part of a larger portfolio of ongoing work at APL applying machine learning to identify dangerous unknown substances.
Computer scientist Dave Portnoy is working with Hagan and chemist Alan Becknell on a similar project that’s also focused on fentanyl analogs. Their algorithm uses linear algebra to analyze the spectra from unknown substances. It relies on the known mass spectra of fentanyl analogs and over 300,000 non-fentanyl-related compounds to find combinations of spectra that best reconstruct the mass spectra of the unknown substance.
“If one of the reconstructed spectra utilizes the mass spectra of known fentanyl analogs, then the unknown substance is likely to contain a fentanyl-related compound,” explained Portnoy.
Their algorithm has already been integrated into a software tool used by a government sponsor to analyze unknown substances.
Lawrence said the approach underlying these projects — training algorithms in pattern recognition to determine whether an unknown substance is a particular kind of threat, without having to know precisely what it is — will be useful against all manner of emerging threats.
“To a soldier in the field, it most likely doesn’t matter whether a chemical is a specific nerve agent — what matters is whether or not it’s a nerve agent, and the forensics people can work out what exactly it is at their leisure,” he said. “This kind of generalized approach to the problem is only going to become more useful and relevant in the future.”
Andy Oak, who leads the Homeland Protection Mission Area at APL, said this work applies the Lab’s multidisciplinary expertise to an urgent problem.
“Fentanyl variants can be lethal for those exposed to even a very small amount, so accidental exposures — such as might occur in the line of duty — are a big concern,” Oak said. “The work our teams have been doing over the past few years will help keep law enforcement, first responders, warfighters and the public at large out of harm’s way.”