An NII machine in Nogales, AZ. (Image source)

There’s bound to be a lot of discussion of the Biden-Trump presidential debates last night, but I want to skip all the political prognostication and talk about the real issue: fentanyl-detecting machines.

Joe Biden says:

And I wanted to make sure we use the machinery that can detect fentanyl, these big machines that roll over everything that comes across the border, and it costs a lot of money. That was part of this deal we put together, this bipartisan deal.

More fentanyl machines, were able to detect drugs, more numbers of agents, more numbers of all the people at the border. And when we had that deal done, he went – he called his Republican colleagues said don’t do it. It’s going to hurt me politically.

He never argued. It’s not a good bill. It’s a really good bill. We need those machines. We need those machines. And we’re coming down very hard in every country in Asia in terms of precursors for fentanyl. And Mexico is working with us to make sure they don’t have the technology to be able to put it together. That’s what we have to do. We need those machines.

Wait, what machines?

You can remotely, non-destructively detect that a bag of powder contains fentanyl rather than some other, legal substance? And you can sense it through the body of a car?

My god. The LEO community must be holding out on us. If that tech existed, we’d have tricorders by now.

What’s actually going on here?

What’s Up With Fentanyl-Detecting Machines?

First of all, Biden didn’t make them up.

This year, the Department of Homeland Security reports that Customs and Border Patrol (CBP) has deployed “Non-Intrusive Inspection” at the US’s southwest border:

“By installing 123 new large-scale scanners at multiple POEs along the southwest border, CBP will increase its inspection capacity of passenger vehicles from two percent to 40 percent, and of cargo vehicles from 17 percent to 70 percent.”

In fact, there’s something of a scandal about how many of these scanners have been sitting in warehouses but not actually deployed. CBP Commissioner Troy Miller complained to NBC News that the scanners are sitting idle because Congress hasn’t allocated the budget for installing them.

These are, indeed, big drive-through machines. They X-ray cars, allowing most traffic to keep flowing without interruption.

Could an X-ray machine really detect fentanyl inside a car?

To answer that, we have to think about what an x-ray machine actually does.

An X-ray is a form of high-energy, short-wavelength electromagnetic radiation. X-rays can pass through solid objects, but how easily they pass through depends on the material — higher atomic number materials are more absorbing per unit mass.

This is why bones will show up on an X-ray scan. The calcium (element 20) in bones has higher atomic mass than the other most common elements in living things (carbon, hydrogen, oxygen, nitrogen, sulfur), and bones are also denser than soft tissue, so bones absorb X-rays while the rest of the body scatters it.

This is also how airport security scans baggage: a cabinet x-ray shows items inside a suitcase, differentiated by density. It’s also how industrial CT scans can look inside products nondestructively to see how they’re made.

Lumafield’s industrial CT scanner can tell dense, high-atomic-number lead solder apart from stainless steel.

To some extent, X-ray scanners can distinguish materials, by their density and atomic number.

But fentanyl is an organic compound — made of carbon, hydrogen, nitrogen, and oxygen, just like lots of other things. Its density is a very normal 1.1 g/mL (close to the density of water.)

I’m pretty sure it’s not going to be possible to tell fentanyl apart from other things by its density and atomic number alone.

Indeed, that’s not what the scanner vendors are promising to do.

Kevin McAleenam, the former DHS secretary who founded Pangiam, the AI-based scanning company that plans to analyze the X-ray images, said that his software would correlate X-ray results with vehicle manifests to see if a load looks like it’s supposed to, or whether it’s suspicious in some way.

“We can build software products that tell the officer, ‘That load’s supposed to be melons, it looks exactly like the other thousand shipments of melons that have crossed this border over the last two years, we don’t think you need to inspect it further.””

That’s not fentanyl detection — remote X-ray-based detection of a particular chemical compound — it’s the much easier problem of anomaly detection.

Maybe, indeed, you can catch a drug smuggler by using the X-ray machine to notice a discrepancy between what he said and what the inside of his truck looks like.

But it’s not a “fentanyl scanner” that detects fentanyl in the way a metal detector detects metal. 1

The manufacturer of these X-ray scanning portals, OSI systems, does claim they can detect “metallic and organic threats and contraband, such as weapons, stowaways, explosives, drugs, and alcohol.” This seems like a bit of marketing exaggeration — an X-ray machine would not be able to detect in full generality that something is an explosive or illegal drug as opposed to an innocuous/legal material, though it could tell, e.g., that there were organic compounds stored in parts of the vehicle that were expected to be empty.

But I Wanted Remote Chemical Compound Detection!

Ok, but suppose we wanted to detect the presence of fentanyl, or some other particular organic compound. How close can we get to doing that for real?

This isn’t just about law enforcement. There are lots of reasons you might want to find out what something is made of without touching it. Nondestructive quality control in manufacturing; analyzing the geological composition of underground mineral resources; medical diagnostics; and much more.

In an ideal world, if you want to know the chemical composition of an object, you’d get to take a sample.

Then you can use powerful, destructive methods like mass spectrometry, where you ionize the whole thing, run an electric current through it, and look at the amount of each ion (ranked by mass-to-charge ratio) to reconstruct which chemical compounds must have been in the mixture.

If you’re looking at biological samples, you can put nature to work for you at detecting particular compounds; find an antibody, aptamer, or oligonucleotide that binds selectively to your compound of interest, and attach it to some highly noticeable molecule like a dye. This is how immunoassays like pregnancy tests and home COVID tests work.

But these are all destructive tests; you have to have a sample, and you have to be okay with using it up in the testing process.

What can the world of non-destructive tests do?

Spectroscopy

The general category of spectroscopy refers to measuring how light is absorbed vs scattered by a sample.

X-ray imaging is a form of spectroscopy whose “light” is x-rays; other wavelengths, ranging from microwaves through infrared and visible light to ultraviolet, are generally less able to penetrate opaque solid objects but better at distinguishing between lighter organic chemical compounds.

Small, affordable infrared spectrometers are used for everything from detecting the blood alcohol content of a (suspected) drunk driver to nondestructively analyzing the composition of food products and pharmaceuticals on the production line.

FTIR, or Fourier Transform InfraRed spectroscopy, shines a beam on the sample consisting of many infrared wavelengths at once, and measures how much of each wavelength is absorbed, resulting in a characteristic "spectrum” or fingerprint for each sample.

FTIR can’t tell apart all chemical compounds, but it’s pretty sensitive. It can distinguish organic compounds that differ by just a single functional group.

Why do these very similar compounds have different IR spectra but indistinguishable X-ray absorption? In other words, why can’t you use X-rays to determine fine-grained chemical composition?

Because infrared light is lower energy, so it mostly interacts with the vibrations in chemical bonds (and behaves differently with different bonds), while X-rays go straight to the inner-shell electrons of the atoms (an interaction that depends less on the molecular environment surrounding the struck atom).

UV and visible light are intermediate in energy level, so they have enough energy to knock valence-shell electrons to higher orbitals, but not enough to knock inner-shell electrons up to the valence shell.

So UV and visible light spectroscopy methods are intermediate between infrared (lots) and X-rays (very little) in their ability to distinguish between similar chemical compounds.

The bottom line is, there’s a physical tradeoff between how good a spectroscopic technique is at penetrating solid objects (like a car) and how sensitive it is at telling different compounds apart. You can certainly tell fentanyl from aspirin with FTIR; but infrared light won’t pass through solid metal.

Ok, That’s Light. What About Sound? Or Electricity?

There are other non-destructive methods for sensing material composition that also work by the same basic premise of “send a wave of some sort to the material, see what happens to what’s left of the wave after it’s reflected back or transmitted through, notice how different materials distort it differently.”

When you do this with sound waves, you have ultrasound imaging. Sound is also distorted differently by different materials.

The key metric for ultrasound is acoustic impedance, or how much a material resists conducting sound.

The acoustic impedance of a material is basically just a function of stiffness and density. So ultrasound is good enough for visualizing the shapes of firm, dense masses in the body (e.g. it can tell “baby” from “amniotic fluid”) but it can’t tell apart two different chemical compounds with the same physical properties.

What about electricity?

Impedance spectroscopy involves running current through an object to measure the impedance (measured in ohms) of the material inside.

The principle here is that different materials conduct electricity differently. Even small differences in molecular structure can affect a material’s dielectric properties.

In medicine, it’s possible to use impedance tomography to visualize and monitor blood clots or lung function in real time (since a clot in a blood vessel or fluid in a lung will show up as a difference in impedance.)

However, impedance spectroscopy doesn’t work for truly remote sensing, because you need electrodes to be touching the sample. (No beaming electricity through the open air.) It also couldn’t detect a sample of fentanyl inside a car, because the metal would shield against the electricity.

Dude, Where’s My Tricorder?

While the list of non-destructive imaging or material characterization techniques is long, most of them fundamentally use light, electricity, or sound, or combinations of those.2

And some rough version of the penetration/specificity tradeoff seems to hold generally; the better a form of energy is at punching through thick heavy materials, the less it cares about the difference between slightly different organic molecules.

So that’s the challenge of “detecting fentanyl in your car” (or, more medically, things like “detect a biomarker in your body”). Usually the techniques that allow completely remote, label-free sensing can’t tell you as much about chemical composition, and the techniques that can give you precise chemical information require a sample that’s, if not destroyed by analysis, then at least conveniently placed relative to the sensor.

Could that change?

In Big Hero 6, medical robot Baymax “scans” the entire city of San Fransokyo to detect all men with the same cholesterol, blood type, and hormone levels as the suspect. Could we ever do this?

god i wish this were real

Right now it seems pretty intractable, though I’m not prepared to claim it’s physically impossible.

There are a few special cases where Nature is kind — for instance, some compounds, like hemoglobin, have a strong photoacoustic effect, so a laser beam and an ultrasound sensor are enough to pick them up.

But few techniques are fully general. Photoacoustic imaging can’t tell apart chemically similar compounds (like estrogen and testosterone.) FTIR could tell them apart — but you can’t just point it at a person and read off the composition of their bloodstream, because the infrared doesn’t penetrate more than a millimeter into the skin.

Maybe someday we’ll combine different modalities to get a vastly expanded set of remote chemical sensing capabilities. But the tradeoff landscape is still there, and it’s less friendly to potential tricorders, Baymaxes, and fentanyl scanners than you might hope.

1

And it’s not just Biden who refers to the new X-ray machines as “fentanyl scanners” — that phrase is all over the news and in the “Deploy Fentanyl Scanners Act of 2024” introduced in the Senate this March.

2

(Or bombardment with bigger particles like neutrons, which, like X-rays but more so, is better suited for detecting the presence of heavy elements than for classifying different organic molecules made of light elements.)

New Comment
26 comments, sorted by Click to highlight new comments since:
[-]gwern9517

What comes to mind immediately as an approach for a 'fentanyl machine' is that they already exist: we call them sniffer dogs. Because it is almost impossible to store or seal bulk chemicals so that zero molecules leak out - as marijuana smugglers know, even triple or quadruple sealing drugs is not enough to render them truly impermeable and invisible to drug detecting dog noses. (Even if they start out invisible, apparently getting knocked around during transit or the contents slowly permeating out is enough. So at least when I was tracking the DNMs, weed sellers would triple-bag and then require an express priority shipping type - the logic being that the faster it got shipped, the less smelly it would be, and the more unwilling the shipper would be to interfere with it, and if they pulled it out of the shipping flow and got a warrant to open it, that might blow the shipping deadline and at least warn the sender or recipient so they can clean house.) And that is with purely passive smelling.

You could make smelling much more active: use compressed-air hoses to blow through the truck and spew out all sorts of compounds for collection and intensive analysis using every wavelength or sensor type you please. (Is this illegal as a violation of privacy, as it is actively extracting atoms rather than atoms the subject carelessly spews around publicly and so abandons their property rights in? No, because it's the border. You have no rights at the border.)

So maybe all your tricorder needs is... a little fan. "Bones, inspect this man!" bzzzzzz

[-]jbash111

DNM sellers are mostly not too bright[1], and the dreaded killer weed is relatively smelly, bulky, and low-value compared to something like fentanyl. If I remember right, they use, or at least used to use, heat-sealed mylar bags, which you'd expect would leak.

If I wanted to ship fentanyl past dogs, I'd research the possibility of sealing it in glass ampoules. A correctly sealed ampoule will hold a hard vacuum for decades. Assuming it was properly cleaned on the outside, I don't believe a dog would detect it even from sniffing it directly. And I do know some of the very impressive things dogs can detect. Welded metal vessels can also be pretty tight.

A bit off topic, dogs are also unreliable enough that they shouldn't really be allowed to be used, even if you think mass-searching shipments is OK to begin with. It's not that dog doesn't know what's there; it's that the communication between the dog and the handler is suspect.

  1. ^

    Smarter than buyers, but still not smart.

Assuming it was properly cleaned on the outside

That's a big assumption! It is difficult to clean truly thoroughly (see eg disappearing polymorph contamination), and DNM sellers have been busted using fingerprints even when they thought they were being careful to avoid that. It is surely possible with enough care, but by the point you're using vacuum-sealed glass ampoules and cleanrooms to avoid contamination on the outside...

It definitely raises the bar, and it may very well raise it well out of reach of the average DNM seller, but I think you may be imagining the whole process to be harder than it has to be.

I have everything I'd need to seal ampoules lying around downstairs[1]. It's a few hundred dollars worth of stuff. More than a bag sealer, but not a fortune. You wouldn't even have to buy blanks; you could make them from plain tubing. You don't have to seal them under vacuum. There's not that much skill involved, either; closing a tube is about as simple as flameworking can get. The biggest learning investment would probably be learning how to handle the torch without unfortunate unintended consequences.

You don't have to avoid contamination; you just have to clean it off. One nice thing about glass is that you can soak it for as long as you like in a bottle of just about any any noxious fentanyl-eating chemical you can identify. You can wash down the outside of the bottle with the same stuff. I doubt you'd have to resort to any exotic chemicals; one or another of bleach, peroxide, lye, or your favorite mineral acid would probably destroy it pretty rapidly.

It would be a really good idea to have a separate pack-and-ship facility, and an accomplice to run it, but you don't need to resort to a clean room.

FIngerprints (and stray hairs and the like) would actually be much harder to deal with, although of course they won't alert dogs.


  1. Doesn't everybody have basic glassblowing and welding equipment? Kids these days. ↩︎

Hmm, but that has trade-off with not showing up as suspect to X-ray. So maybe a mix of approaches makes it quite expensive to smuggle drugs and thus limit supply/raise price/drop consumption

My take on sniffer dogs is that frequently, what they are best at is picking up is unconscious tells from their handler. In so far as they do, they are merely science!-washing the (possibly meritful) biases of the police officier. 

Packaging something really air-tight without outside contamination is indeed far from trivial. For example, the swipe tests taken at airports are useful because while it is certainly possible to pack a briefcase full of explosives without any residue on the outside is certainly possible, most of the people who could manage to build a bomb would not manage to do that. 

Of course, there are also no profit margins in blowing up airplanes, so stopping the amateurs is already 95% of the job. 

There are significant profit margins in drug trafficking. After you intercept a few shipments and arrest a few mules, the cleverer drug lords will wisen up. 

A multi-method approach might work for a while, glass vials are probably more visible on that CT scan than some organic substance. 

[-]Ben72

The idea that the sniffer dog picks up on what the handler is thinking and plays it out for them is very interesting, and maybe does indeed happen sometimes.

But I think you are probably overcorrecting somewhat. Sniffer dogs do actually smell things. In much more low-stakes situations I have seen one in New Zealand successfully identify several people getting off a flight who had forgotten about food in their backpacks (they have strict laws against food going in in case you bring a new blight or pest or whatever).  So my read is that sniffer dogs are at least good enough at actual sniffing to demand some kind of response from would be smugglers (eg. extra plastic wrapping).

"Food" in general is about the easiest and most natural thing for a dog to identify. Distinguishing illegal drugs from all the other random stuff a person might be carrying (soap, perfume, medicine, etc.) at least requires a lot better training than finding food.

[-]Ben73

Very possible. I am not fully convinced. The dog had to identify the people who had food in there bags, and tell them apart from all the people who used to have food in those same bags, or were eating on the flight and have food on there breath or hands. A dog trying to identify (for example) canabis would probably have an easier time.

My stance is not "I know 100% that sniffer dogs are a silver bullet", but the weaker position "The majority of the value of a sniffer dog comes from it actually smelling things, rather than giving the officer controlling it a plausible way of profiling based on other (possibly protected) characteristics."

[-]Tenoke2-2

Weed smells orders of magnitude more than many powders and I imagine releases way more particles into the air but assuming this is doable for well packed fentanyl is there a limit? Can you expose dogs to enough say carfentanil safely initially to start training them? lofentanil? 

And if it's detectable by dogs surely it can't be that far from our capabilities to create a sensor that detects particles in the air at the same fidelity as a dog's nose by copying the general functionality of olfactory receptors and neurons if cost isn't a big issue.

You forgot to mention VASOR136, a trace vapor detection unit that is very versatile. The VASOR 136 holds 36 bees in cartridges. They are all ready to detect the presence of something in the air.

This is no BS or joke.

See here. Of course, that article is a bit light on information on detection thresholds, false-positive rates and so on as compared to dogs, mass spectrometry or chemical detection methods. 

I will also note that humans have 10-20M olfactory receptor neurons, while bees have 1M neurons in total. Probably bees are under more evolutionary pressure to make optimal use of their olcfactory neurons, though. 

I think this reveals something interesting about how US policymakers think about technology.  They don't really care how it works, they care that if they put budgetary dollars on this, they might plausibly get an outcome where (in combination with the social system that is the border and its policing), they get fentanyl detected.

What about NMR or XRF? XRF can non-destructively tell you the elemental composition of a sample, which (if the sample is pure) can often pin down the compound, and NMR spectroscopy is also non destructive and can give you some info about chemical structure too

Do x-rays only interact with close in electrons? 

I would expect there to be some subtle effect where the xray happened to hit an outer electron and knock it in a particular way. 

For that matter, xray diffraction can tell you all sorts of things about crystal structure. I think you can detect a lot, with enough control of the xrays going in and out.

My first question is about the title picture. I have some priors on how a computer tomography machine for vehicles would look like. Basically, you want to take x-ray images from many different directions. The medical setup where you have a ring which contains the x-ray source on one side and the detectors on the other side, and rotate that ring to take images from multiple directions before moving the patient perpendicular to the ring to record the next slice exists for a reason: high resolution x-ray detectors are expensive. If we scaled this up to a car size, we might have a ring of four meters in diameter. A bridge of some low-Z material (perhaps beams of wood) would go through that ring. Park on the bridge, get out of the car, and watch as the rotating ring moves over the bridge. 

The thing in the picture looks does not look like it has big moving parts. I can kind of see it taking a sideways x-ray image of the car but I am puzzled by the big grey boxes visible over the car. Having an x-ray source or detector above the car would only make sense if you had the other device below the car, in the road. Of course, if there is anything in the road, one would imagine that that piece of road was some low-Z material material designed not to block half of your x-rays. Instead, the road material below the car looks exactly like the road outside the detector, concrete probably. 

In Europe, we kind of dislike being exposed to ionizing radiation (even though Germany is rather silly about it). I get that the US is a bit more relaxed about it, but a computer tomography device capable of scanning a car with a good resolution would likely emit to a lot of scattered x-rays to anyone nearby. The position in which that boarder guard stands would likely not be a safe position to stand a significant fraction of your work-life. 

At the very least, I would expect that black and yellow trefoil sign warning of ionizing radiation, with a visual indicator if the x-ray is on, and a line marking the minimum safe distance. More realistically, you might have something like a garage door before and behind the car. 

Just from the vibes, I get that the pictured non-intrusive fentanyl inspection machine might run on the operation principle of the famous ADE 651, which is to say it does nothing whatsoever. 

While detecting dry fentanyl through high resolution CT scans seems to be possible in principle at least, once the smugglers go through the additional trouble of dissolving it all bets are off. Wikipedia is light on solubility data, but from the looks of it fentanyl should dissolve well in organic solvents. 

You can check the gas tank of every car if you want, but what are you going to do if an eight-wheeler full of one- gallon-bottles of cooking oil crosses the border? If your scan is good, it would perhaps detect if one bottle in the middle of the stack has been filled with powder instead. There is no way in hell it will detect if one such bottle has ten grams (perhaps 10k doses) of fentanyl dissolved in it. Your best bet would be to detect some residue of the oil on product seized off the streets and work backwards from that.

Of course, "as long as the profit margin is that high, we could go full iron curtain on our borders and would not stop the trafficking" is not a politically acceptable answer. Hence some snake oil salesmen are able to get your tax dollars for products which have not been proven in adversarial conditions. (To train an AI, it is not enough to have a ton of samples, you would need known positive and negative samples. Also, while we are playing buzzword bingo, why not mention that the shipping manifests will be securely stored on The Blockchain?)

You're very likely correct IMO.  The only thing I see pulling in the other direction is that cars are far more standardized than humans, and a database of detailed blueprints for every make and model could drastically reduce the resolution needed for usefulness.  Especially if the action on a cursory detection is "get the people out of the area and scan it harder", not "rip the vehicle apart".

It can’t get through metal, but this fentanyl-detecting machine can detect fentanyl in packages:

You can use the Dirichlet-to-Neumann operator associated with an unknown elliptic operator to reconstruct the coefficient of the operator and consequently the structure of the inside of the domain. It's a problem proposed by Calderon and is well understood for the Laplacian. Good luck with the Stokes operator tomorrow though.

Let's say you did have a magical fentanyl-detection machine. Unfortunately it would still be quite useless due to the fact that numerous routes exist into the country that entirely bypass border control. Sure, you won't be able to bring truckloads of goods that way but with fentanyl all you need is a few pounds to supply the whole country for several weeks.

The LessWrong Review runs every year to select the posts that have most stood the test of time. This post is not yet eligible for review, but will be at the end of 2025. The top fifty or so posts are featured prominently on the site throughout the year.

Hopefully, the review is better than karma at judging enduring value. If we have accurate prediction markets on the review results, maybe we can have better incentives on LessWrong today. Will this post make the top fifty?

Dear Review Bot,

please avoid double-posting. 

On the other hand, I don't think voting you to -6 is fair, so I upvoted you. 

Excellent writeup!

[-]devas0-2

Wait, but airport scanners HAVE reached this type of analysis level - the only problem is that do so the x-ray emitter has to rotate around the bag (or the car in this instance) to create a 3D model of the objects within, which is then used to estimate density to a high degree - and from there things became much easier.

Of course, they're used to analyze bags, not cars, and the objects have to pass within...but still

A 3D density map does not reveal the chemical structure of the material in the interior. You're describing abilities of X-ray scanning consistent with Constantin's description, which fall far short of a "tricorder" or detecting fentanyl inside a car. Looking it up airport scanners can also use millimeter-wave scanning, which I believe still fits Constantin's high-level description of scanning methods in the high-penetration/low-detail side of the tradeoff.

A 3D density map does not reveal the chemical structure by itself.

Since you also have the X-ray spectrogram of the material, you can narrow down the materials that have the same spectrogram but different densities - i.e. organic compounds and water