How Machines Learned to Discover Drugs

The A.I. revolution is coming to a pharmacy near you.
An illustration of a pill overlaid with details from plants by Daniel Livano Source photographs from Alamy.
The natural world contains many billions of potential medications. The question is how to find the ones that work.Illustration by Daniel Liévano; Source photographs from Alamy

When I first became a doctor, I cared for an older man whom I’ll call Ted. He was so sick with pneumonia that he was struggling to breathe. His primary-care physician had prescribed one antibiotic after another, but his symptoms had only worsened; by the time I saw him in the hospital, he had a high fever and was coughing up blood. His lungs seemed to be infected with methicillin-resistant Staphylococcus aureus (MRSA), a bacterium so hardy that few drugs can kill it. I placed an oxygen tube in his nostrils, and one of my colleagues inserted an I.V. into his arm. We decided to give him vancomycin, a last line of defense against otherwise untreatable infections.

Ted recovered with astonishing speed. When I stopped by the next morning, he smiled and removed the oxygen tube, letting it dangle near his neck like a pendant. Then he pointed to the I.V. pole near his bed, where a clear liquid was dripping from a bag and into his veins.

“Where did that stuff come from?” Ted asked.

“The pharmacy,” I said.

“No, I mean, where did it come from?”

At the time, I could barely pronounce the names of medications, let alone hold forth on their provenance. “I’ll have to get back to you,” I told Ted. He was discharged before I could. But, in the years that followed, I often thought about his question. Every day, I administer medicines whose origins are a mystery to me. I occasionally meet a patient for whom I have no effective treatment to offer, and Ted’s inquiry starts to seem existential. Where do drugs come from, and how can we get more of them?

On a wet morning in May, I walked to the stately gates of the Rockefeller University, on the Upper East Side, and met Sean Brady, a bearded and bespectacled chemical biologist who discovers medicines for a living. Wearing jeans, a button-down shirt, and chunky sneakers, Brady looked like a nerdy hiker. He had promised to take me prospecting for antibiotics. “Ready?” he asked, his glasses spattered with rain.

Brady oversees a program called Drugs from Dirt, which sifts through soil samples from around the world in search of antibiotics. On our way into his lab, we passed a bench piled with bags of dirt—one from the Chihuahuan Desert, another from the Sonoran Desert. “My parents sent me those during the pandemic,” Brady told me. He has been given soil from Saudi Arabia and the Serengeti; his collaborators have gathered samples in Mexican sinkholes and Australian grasslands. Inside the lab, we found shovels and black buckets amid flasks and mass-spectrometry machines. I took off my blazer and picked up a bucket, and Brady grabbed a shovel. We set off into the drizzle.

Many of the world’s leading drugs originated in the natural world. Ancient Egyptians soothed their wounds with aloe-vera gel; morphine and codeine came from the opium poppy; Ozempic was inspired by a peptide in lizard venom. Dirt is one of the richest sources of medicine, because its microbes have been waging a war with one another for millions of years. Vancomycin—essentially a biochemical weapon that one bacterium uses to kill others—was discovered in soil samples from India and Indonesia in 1953. Around the same time, researchers reported that a bacterium in “heavily manured” New Jersey soil produced streptomycin, an antibiotic that became the first effective treatment for tuberculosis. (The bacterium is now New Jersey’s official state microbe.)

Different microbes thrive at different latitudes, and Brady once dreamed of collecting dirt from Alaska to Argentina. Lately, however, he has been content to stay on campus. “There’s an endless number of local bacterial products we haven’t studied yet,” he told me. “There’s plenty of good stuff right beneath our feet.” He stomped the ground playfully.

We walked down a cobblestone path until we came to an open lawn. Pigeons congregated near a fountain; a duck waddled by. Brady cleared some leaves and plunged his shovel into the earth. After dropping a few scoops into the bucket, he handed me the shovel. “Your turn,” he said.

I looked around, wondering, absurdly, where I might hide if I were the next cure for cancer. When the bucket was half full, I wiped some raindrops from my face. “That should be more than enough,” Brady said. “One gram of soil has up to ten thousand different types of bacteria. You don’t need a lot. You just need to know what you’re looking for.”

Back in the lab, I scooped some soil into a tube and added a detergent that destroys bacteria’s cell walls and membranes, causing their DNA to spill out. Then Jan Burian, a researcher in Brady’s lab, showed me how to load the DNA onto a glass plate, which slid into a sequencer like a credit card into a payment terminal. “If we were sitting here ten or fifteen years ago, sequencing all this DNA might take weeks,” Burian told me. “Now it pretty much happens in real time.” He pulled up the machine’s output on a computer: an endless string of “G”s, “T”s, “C”s, and “A”s.

Bacteria produce numerous molecules that could become medicines, but most of them aren’t easily identified or synthesized with the technology that exists today. A small percentage of them, however, can be constructed by following instructions in the bacteria’s DNA. Burian helped me search the sequence for genes that looked familiar enough to be understandable but unfamiliar enough to produce novel compounds. We settled on a string of DNA that coded for seven linked amino acids, the same number found in vancomycin. Then Burian introduced me to Robert Boer, a synthetic chemist who would help me conjure our drug candidate.

What came next was intricately choreographed. You can’t just throw amino acids into a soup and hope that they bubble into a medicine, Boer said. Building them into a potential drug—in this case, a peptide—is like assembling IKEA furniture. There’s a specific sequence in which the parts need to be connected, with specific nuts and bolts. Before the amino acids could be fastened together, they had to be dissolved into a solution that would expose their chemical hardware.

“Nobody will speak to us in French, only high-pitched whistles and clicks—is it that obvious we’re tourists?”
Cartoon by Ellie Black

We mixed one amino-acid solution, which contained tyrosine, with another, which contained serine. After waiting half an hour for the first linkage to form, we repeated the process one amino acid at a time, until all seven were connected in the correct order. Finally, the liquid was evaporated until just a few milligrams of snowy-white powder remained. I dubbed our drug candidate “NY1,” for The New Yorker, and helped Boer pipette it onto a well plate. It would now spend a night with MRSA. I imagined the start of a microscopic cage match between our molecule and the bacteria.

When I returned the next day, the liquid in the plate was thick and cloudy. NY1 had been powerless against MRSA—the plate looked so grimy that I wondered if I’d accidentally created a bacterial superfood. Brady gave me a pep talk. “If you found one on your first try, we’d probably hire you,” he joked. “You’d be our lucky charm. And, when it comes to finding a drug, a little luck never hurts.” His team, he said, sometimes tests more than a hundred molecules per month. A tiny fraction might show antibiotic activity, and a tiny fraction of those perform well enough—and are nontoxic enough—to advance to animal testing and clinical trials. The reasons that one molecule succeeds while another fails are hard to predict. Near my failed drug candidate was another contender, which had come from a neighboring patch of dirt; its well was as clear as water. Whatever was in there, it had killed MRSA—and we had no idea how.

Tori Kinamon was a freshman gymnast at Brown University when her leg started to ache. The team’s athletic trainers suspected a muscle strain, but the pain sharpened even after ice and a massage. A few days later, Kinamon awoke feverish and sweating; her leg was swelling and felt like it was on fire. Finally, an MRI revealed an abscess along a muscle. She was started on antibiotics and rushed to the operating room, where surgeons scraped out pus and necrotic tissue—the consequence of a raging MRSA infection. The surgeons operated eight times in two weeks, filleting open the back of her leg with a two-foot incision from her glute to her calf. “I was so happy the days I would have to go under for surgery, because that meant that I didn’t have to deal with what was going on around me,” she told me. The surgeons narrowly managed to save her leg, but the infection did not clear for weeks. Vancomycin harmed her kidneys, so she had to be switched to daptomycin, another antibiotic that comes from a bacterium in soil. “I am a direct beneficiary of the fact that we had an extra antibiotic in the stockpile when vancomycin was too toxic for my body to handle,” Kinamon, who is now a surgery resident in Texas, said. “Some patients are left without options.”

The number of chemicals that theoretically could prove useful as drugs has been estimated at ten to the sixtieth power—a quantity greater than the number of atoms in the solar system. Some of these potential medicines can be found in nature. Others have already been discovered but we haven’t yet found their uses. Still others have never been imagined. In “The Drug Hunters: The Improbable Quest to Discover New Medicines,” Donald R. Kirsch and Ogi Ogas compare the pursuit of novel medicines to the search for meaning in “The Library of Babel,” a short story by Jorge Luis Borges in which the author envisions the universe as an infinite library. Each book contains random letters and punctuation marks, so most of the texts are nonsensical. But, because the library is unfathomably large, it also contains every conceivable story. “Every possible drug is contained somewhere in the vast theoretical library of chemical compounds,” Kirsch and Ogas write. Drug discovery is an effort to catalogue some small part of it.

In the mid-two-thousands, Stuart Schreiber, a chemist at the Broad Institute of M.I.T. and Harvard, set out to assemble an expansive library of chemicals that might have medical applications. Schreiber was frustrated that drug discovery was so tedious and unsystematic; his colleagues could study only the chemicals that they could make from scratch or buy from a commercial vender. He started by stocking up on simple chemicals from pharmaceutical companies and research organizations—“cheap stuff based on twentieth-century chemistry,” he told me. Next, he collected a large number of “natural products,” like the ones microbes make in dirt, that had a higher likelihood of proving useful as a drug. “Any chemist could take one look at the structures and tell you which molecule belonged to which group,” he said—synthetic or natural. “It was like telling a cat from a dog.” Then Schreiber gathered a group of chemists and had them invent molecules with the features of natural products—a process that they dubbed “diversity-oriented synthesis.” Some compounds dissolved in water; others clumped. Some reacted promiscuously with one another; others kept to themselves. “The new synthetic molecules were much more sophisticated,” Schreiber told me. “They were structurally quite similar to what’s found in nature.”

In the end, the chemists concocted a hundred thousand new molecules. The library, which is housed at the Center for the Development of Therapeutics (CDoT), grew to encompass nearly a million chemicals, including existing medications, drug candidates, and strange compounds with no known use. Many research labs and universities have compiled similar libraries. Since the late twentieth century, labs have increasingly used robots and automation to comb through the libraries, reasoning that, as scientists screened more chemicals for medical applications, the number of newly found drugs would inevitably increase. But this technique, which is known as high-throughput screening, has turned out to be less revolutionary than many once hoped. If a chemical library isn’t large and diverse enough, or if the selection process is largely random, the method tends to have low hit rates and produce many false positives. So far, no useful antibiotics have been found this way; in many screens, only about one per cent of molecules show activity against a bacterium. Many are similar to existing antibiotics or toxic to humans.

In 2012, a group of drug researchers warned that the number of new drugs approved in the U.S., per dollar invested in drug discovery, was falling by half every nine years, an eightyfold reduction in efficiency since 1950. They called their observation Eroom’s Law—an inversion of Moore’s Law, which says that the number of transistors per computer chip doubles every two years or so, driving down the cost of computers. Many drug developers, the researchers wrote, had fallen victim to “basic research–brute force bias.” They were powering through as many molecules as possible, more or less at random, on the off chance that something might work. The universe of potential drugs desperately needed a filing system.

In 2017, Jon Stokes, a Canadian postdoc in microbiology, joined the lab of James J. Collins, an M.I.T. professor of biological engineering. Stokes, who has long hair and glasses, giving him the look of a scientific David Foster Wallace, decorated his office with a poster of a skull and crossbones. “I think of myself as a professional poison discoverer,” he told me. “I want to kill things that kill patients.” (He added wryly, “I don’t support piracy.”) Stokes soon ordered two sets of chemicals from a commercial vender for twenty-five thousand dollars, with the aim of scouring them for antibiotic potential. One contained eight hundred natural products; the other was made up of around seventeen hundred drugs that the F.D.A. had already approved but that might have additional uses. They arrived in a Styrofoam box the size of a microwave, packed in dry ice. Stokes was preparing to screen each compound manually—pitting them against microbes on glass plates, much as I had done—when he sat in on a meeting about biological applications of artificial intelligence. “I had no idea what was going on,” Stokes recalled. “I wasn’t an A.I. guy.”

Afterward, Collins asked Stokes if he’d try a new and provocative approach: working with computer scientists to see if A.I. could help sort his compounds. “Let’s just see what happens,” Collins said. Stokes agreed, warily. “I thought, This is going to be a complete shit show,” he told me. “For about six months, it was pretty much me trying to teach them what a gene was and them trying to teach me what a neural network was.” Neural networks, which are computer systems modelled on the brain, usually require vast amounts of information to learn; the most famous example, ChatGPT, digested the entire Internet and still struggles with basic arithmetic. But the team planned to train its model on the relatively small data set that Stokes had amassed: twenty-five hundred molecules. “We had very low expectations of this working,” he said. “Why invest a bunch of energy?”

Over a couple of days, Stokes put each of the molecules into plates with E. coli and recorded whether they killed the bacteria. In a world without A.I., he would have subjected the winners—a hundred and twenty chemicals, or about five per cent—to more tests, hoping that one might become a drug. But, in this case, he had more ambitious goals. He and his colleagues fed the results into a neural network, along with each molecule’s chemical structure. Then they asked their drug-finding model to search through a bigger data set for more hits.

CDoT includes a collection called the Drug Repurposing Hub, which contains six thousand compounds that are either in clinical trials or already approved by the F.D.A. It’s not uncommon for a molecule that’s effective at treating one condition to prove useful for another; aspirin was developed as a painkiller but also prevents heart attacks, and Viagra was originally intended to treat high blood pressure. Stokes and Collins instructed their model to rank each molecule by its likelihood of inhibiting E. coli, based on what it had learned from the compounds in Stokes’s Styrofoam box. Then they conducted real-world tests on the top ninety-nine. More than fifty per cent stopped the bacteria from growing—a nearly unprecedented hit rate. One of the molecules, which was originally investigated as a diabetes medication, also seemed to differ in structure from any antibiotic on the market. Stokes tested it on other microbes, and it eradicated several of the most pathogenic bacteria on Earth, including a strain of a bacterium called Acinetobacter baumannii which is resistant to all existing antibiotics.

Artificial intelligence had discovered a novel antibiotic that was promising enough to advance into preclinical trials. Stokes and Collins had invented a new way to catalogue the Broad Institute’s million-molecule library—a kind of deep-learning Dewey decimal system. One scientist called their breakthrough “a paradigm shift in antibiotic discovery and indeed in drug discovery more generally.” A few days later, Stokes was trying to come up with a name for his compound. He asked his office mate, Felix Wong, if he’d heard of HAL, the powerful A.I. in “2001: A Space Odyssey.”

“Yeah,” Wong said. “Why?”

“Hal-icin,” Stokes said. “We’ll call it Halicin.”

James Collins works in a book-filled office that overlooks the M.I.T. campus. He has the lean build of a runner—in college, he ran close to a four-minute mile—and his sharp nose, blue eyes, and salt-and-pepper hair make him look like Clint Eastwood in the eighties. When he was young, one of his grandfathers had a series of strokes, and the other lost his vision owing to glaucoma. Collins was troubled that science could launch men into space yet had so little to offer either grandfather. He decided to study biomedical engineering at Oxford, as a Rhodes Scholar, and went on to conduct foundational research into genes that make bacteria drug-resistant.

Collins developed an interest in A.I. around 2018, when he attended a launch event for an M.I.T. initiative called the Quest for Intelligence. The speakers included Eric Schmidt, a founder of Google, and David Siegel, the billionaire co-chairman of the quant hedge fund Two Sigma, but Collins was most taken by Regina Barzilay, a computer scientist who had once built algorithms to decode lost languages. After a breast-cancer diagnosis, Barzilay had started training algorithms to inspect mammograms. At the event, she showed the audience a world map covered with red marks, which represented cancer deaths. “With all of our strengths in machine learning, we really have a chance to wipe the red from this map,” she said. As Barzilay returned to her seat, Collins asked her if she’d also like to wipe the world of bacterial infections. A few months later, they created the Jameel Clinic for Machine Learning in Health.

Collins ushered me inside his office on an idyllic spring day. “Think of all the existential threats that humankind faces,” he instructed, before I had even sat down. “Climate change, nuclear war, asteroids—you name it. Antibiotic resistance is the one we can solve most cheaply.” The World Health Organization has warned that we are on the brink of a “post-antibiotic era,” in which drugs that humans have long depended on become less and less effective. Antibiotic-resistant infections already contribute to 1.5 million deaths annually, and by the middle of the century they could kill ten million people a year.

“How cheaply?” I asked.

“For twenty billion dollars, you could have it solved,” Collins told me. “For twenty billion, you get ten or fifteen new antibiotics. That would get you a lot of the way there.” (This year, the U.S. will spend more than that on the Space Force.)

Antibiotics face a kind of Sisyphean challenge: the more they’re used, the more bacteria become resistant to them, and so the more new drugs we need to develop. Over time, bacteria have found ways to stop drugs from entering their cells, or to pump them out if they do; some have evolved to produce enzymes that disable drugs. Yet pharmaceutical companies rarely invest in new antibiotics, in part because these drugs often make little money. (Most antibiotics are taken for only a week or two at a time.) Between 1962 and 2000, no new major classes of antibiotics came to market. In 2002, scientists isolated a strain of MRSA that had become resistant to vancomycin, the drug of choice for MRSA infections, by modifying part of its cell wall so that the drug could no longer latch on. VRSA, as the strain is known, has been spreading ever since. “With A.I., we’re getting that much more efficient at finding molecules—and in some cases creating them,” Collins said. “The cost of the search is going down. Now we really don’t have an excuse.”

Building an arsenal of new medicines is something like building a championship baseball team. Just as the Yankees scout for young players and try them out in the minor leagues, drug developers hire scientists to find promising candidates and push them through clinical trials toward F.D.A. approval. Only ten per cent of prospects ever play in a major-league game; only ten per cent of potential drugs survive clinical trials. For a long time, predicting the success of a ballplayer was largely a matter of intuition and guesswork. Brien Taylor, an élite high-school pitcher and the first over-all draft pick in 1991, injured his shoulder in a bar fight and never reached the M.L.B.; Mike Piazza, the sixth-to-last draft pick out of almost fourteen hundred players in 1988, shot through the minor leagues and became the 1993 National League Rookie of the Year. But, over time, baseball has become a data-driven game in which professional analysts study obscure metrics to estimate a player’s potential. Collins is betting that the same will be true of drug discovery.

By 2021, Collins had secured funding to expand his lab’s A.I. research, and Wong, the postdoc who shared an office with Stokes, was wondering whether an A.I. model could assemble an entire roster of drugs. Wong, who has piercing eyes and a mop of tousled hair, wanted to find a family of antibiotics that use the same biological weaponry to kill bacteria. But to do that he would need to solve the black-box problem that often hinders A.I. research. “A very obvious elephant in the room was that nobody knew what the hell was going on in these models,” he told me. Stokes had found Halicin without really knowing what made the molecule antibacterial; to find a family of antibiotics, Wong would need to figure out which parts of molecules—which atoms, in which configurations—were most lethal.

A majority of the antibiotics that we use today can be grouped into just a handful of classes. Scientists can “decorate,” or modify, drugs within a class to change their effect, like video gamers customizing their characters to gain an edge. The penicillin family contains ampicillin, which is usually injected, and amoxicillin, which is often administered as a pill. The only difference between them is that amoxicillin is decorated with an extra hydroxyl group. Both drugs, however, are powerless against MRSA. “MRSA is literally the poster child of resistance,” Wong told me. “I knew that’s where I wanted to start.”

Just as image-recognition software needs labelled images of cats and dogs to tell them apart, Wong needed data to train his A.I. to recognize anti-MRSA molecules. He and a graduate student, Erica Zheng, curated a group of thirty-nine thousand compounds: existing antibiotics, other drugs, random molecules, and natural products. In the course of a few weeks, with the help of a robot, they pitted each one against MRSA, in a more expansive version of what Stokes had done a few years earlier. Wong then instructed his model to evaluate the nearly one million molecules housed at CDoT and millions more from a commercial library. This produced a list of several thousand promising molecules. Wong visually inspected their structures for similarities—carbon rings, nitrogen groups, chlorine atoms—like an astronomer comparing constellations. When he developed an algorithm to do the same, it was able to identify what looked like a new drug class. He and his colleagues tested some of the compounds in the lab, then submitted the results to a prestigious journal.

The reviewers were not impressed. Wong’s drug class would probably kill MRSA, the reviewers said, but it might kill patients, too. (Bleach will kill bacteria, but that doesn’t mean you should inject it into your body.) Scientists look for drugs that are at least ten times as likely to harm bacteria as to harm human cells; some of Wong’s molecules had a ratio of four to one. “That’s a very dangerous compound,” he admitted. Some of his molecules also appeared to overlap with existing antibiotics. “It’s not much of an innovation if you discover what’s already been discovered,” he said. And just because a structure is shared across molecules, the reviewers went on, doesn’t mean that the structure is responsible for their activity. Almost all cars have radios, but it’s the engine that makes cars move.

Wong went back to training neural networks on his original thirty-nine thousand compounds. To teach his models about toxicity, he tested each molecule on human liver, lung, and muscle cells; he also applied a “novelty filter” to remove chemicals that were similar to known drugs. This time, his search of the chemical libraries yielded about two hundred candidates. Now he just needed to find their engines.

When computer scientists want to simplify an extremely complicated system, they often try an algorithm called a Monte Carlo tree search. The method was created by Stanisław Ulam, a Manhattan Project physicist who took up solitaire while recovering from brain surgery. Ulam realized that it’s nearly impossible to calculate one’s chances of winning solitaire, because there are too many possible moves. But he reasoned that he could estimate his odds by randomly sampling a subset of moves and then studying the outcomes of those. (Google used a Monte Carlo algorithm to design AlphaGo, an A.I. model that plays the board game Go. It beat Lee Sedol, a leading Go player, in 2016.)

Wong thought that a similar algorithm could identify the antibacterial components of his molecules, by randomly pruning atoms and bonds and predicting how that changed the molecules’ impact. This method would attempt to pry open the black box of the drug-discovery model. Wong’s first four tries crashed his computer. “Oh, shit,” he remembers thinking. “I’m going to need a lot more compute.” He dramatically upgraded his cloud storage and ran the program again. Then he spent a week playing tennis and waiting for the results.

The model ultimately rated five chemical structures as especially promising. One of them, dubbed G2, was found in multiple molecules that could kill MRSA in a petri dish. These molecules seemed to fight the bacteria in a new way, by disrupting the pH around the bacterial membrane; even after thirty days of continuous exposure, the bacteria didn’t develop meaningful resistance. When mice with MRSA in their blood were treated with the molecules, their infections essentially vanished. If the G2 family of chemicals succeeds in clinical trials and reaches the market, it could be the first new class of anti-MRSA drugs in nearly a quarter century.

The Broad Institute’s chemical library, CDoT, occupies a cavernous room in a futuristic-looking building in Cambridge, Massachusetts, near the intersection of Main Street and Galileo Galilei Way. When I stepped inside, I felt like I was boarding a spacecraft. Computer monitors flashed. Robot arms pivoted and swung in a coördinated dance. The whole place seemed to vibrate with a mechanical thrum, punctuated by clicks and beeps.

“Is my client guilty? Yes! Of being an amazing son, brother, and uncle. Of being the most consistent pitcher on his company’s softball team. Of fraud, probably. But also of having a smile so big it makes your worries melt away.”
Cartoon by Maddie Dai

Anita Vrcic, a lab manager with blue eyes and short blond hair, led me to a meticulously organized freezer the size of a semi truck. “If we didn’t have this freezer, finding a molecule would be like playing Battleship,” Vrcic told me. “You would say, ‘A4,’ ‘B6,’ or whatever. You could do it with a couple thousand compounds, but then it becomes insane.” The substances inside are stored at negative twenty degrees Celsius—so cold that, if you tossed a bucket of boiling water inside, it would freeze before hitting the floor. I peered through a window and could see dense stacks of gray trays, which were packed with vials of chemicals. There were nearly a million compounds in all.

Inside the freezer, a shiny metal robot, which looked a bit like the rolling ladders that librarians use to reach high shelves, zipped away from me, then back again. It had two little arms; one reached up while the other grabbed a tray below. Suddenly, what looked like a drive-through window on the side of the freezer, lit up by a blue light, opened and offered up a tray of vials.

Each tray is transported from the freezer to a platform at the far end of the room, where two cranelike arms—slightly longer and significantly brawnier than my own—handle the compounds. Jaime Cheah, a cell biologist in a crisp lab coat, stood in front of a computer monitor, looking like a conductor in front of a robot orchestra. One of the arms, equipped with forceps, grasped a tray of defrosted vials in the way that a crab would latch onto a mussel with its pincers. The contents were transferred to a well plate, which looked like a tiny, transparent muffin tin. Another machine generated ultrasonic sound waves to push 2.5-nanolitre droplets into a separate plate for biological testing.

Now that the plates were full of potential drugs, the robot passed them to a green-tinted room, where each chemical would be examined for toxicity to human cells. (Tinted windows help protect sensitive reagents from light.) A large robotic arm helped to mix a slurry of human cells into each little well, along with a chemical that determined whether the cells died. I watched, mesmerized. Suddenly, an arm swung toward me, and I flinched. “Don’t worry,” Cheah said, with a smile. “They won’t hurt you.”

I was astounded by the speed and scale of research in the chemical library. I also sensed its limits. A truly comprehensive library of potential drugs would require labs like this on every floor of every building in the world—and then some. A repository of that size would be unfathomable and practically unsearchable. But A.I. assistance may be able to weed out the least interesting chemicals, helping to steer scientists toward the most promising parts of the collection. “Now you don’t have to physically screen everything to find out what you’re looking for,” David McKinney, a medicinal chemist at the Broad Institute, told me. “It’s getting much easier to get to the right room, even the right shelf.”

In the years to come, A.I. may not just scour the shelves of chemical libraries but also stock them. Stokes, who is now an assistant professor at McMaster University, in Ontario, who specializes in A.I. drug discovery, has started to train a model that dreams up never-before-seen compounds. Existing models have a bad habit of hallucinating chemical structures that are bizarre or unworkable, much as ChatGPT hallucinates facts. “These models are really good at drawing beautiful molecules on paper,” Stokes said. “Then you show them to a chemist and they say, ‘Yeah, I can’t make that.’ ” To overcome this problem, Stokes constrained his model, which he calls SyntheMol, to thirteen straightforward chemical reactions and a hundred and thirty thousand familiar building blocks—enough to generate thirty billion theoretical molecules, instead of ten to the sixtieth power. SyntheMol ultimately conjured several thousand molecular structures with high antibacterial potential. Stokes’s colleagues synthesized fifty-eight that seemed especially novel and unlikely to be toxic.

When Stokes received vials of the new chemicals, he realized that he was about to test compounds that had never been studied before, and that might not exist anywhere in nature. (“We always assume that every A.I.-generated molecule that we synthesize and bring into the lab is dangerous,” he told me. “We treat them carefully and with a lot of technical precision.”) Six of them proved strikingly lethal against MRSA and other resistant bacteria. “Well, shit,” he thought. “It worked.” These molecules had not been discovered so much as imagined into existence.

There is a great distance between showing that a molecule can clear microbes from a little glass plate and proving that it can safely cure an infection in the body. “Techies often get overexcited about what it means when A.I. can identify a molecule,” Peter Lee, the head of Microsoft Research and a co-author of a book about A.I. in medicine, told me. Is the molecule potent, or do you need impractically high doses to see an effect? Is it selective, or does it attach to off-target cells and inflict collateral damage? Is it stable, or does it degrade in the body? Is it soluble, or will it clump up in your bloodstream? Sometimes medicinal chemists can tinker with a molecule to improve its performance. Often they cannot. “The techies are just waking up to the sheer magnificent complexity of human biology,” Lee said.

Lee is impressed by how much A.I. has improved drug-screening efforts, and he’s convinced that it will accelerate the scouting phase of drug discovery. Last year, scientists at Carnegie Mellon asked a large language model called Coscientist to make some compounds. It was able to search the Internet for chemical reactions, select experimental protocols, read the instruction manuals of laboratory robots, and program them to mix the right chemicals in the right order—a version of what I’d done in Sean Brady’s lab, but led by what one observer called “a non-organic intelligent system.”

One day, scientists might develop accurate A.I. models of the human body, enabling a prospective drug to be tested on a model long before it’s given to people. For the foreseeable future, however, prospects will need to keep playing minor-league games; there is no A.I. replacement for expensive and painstaking clinical trials, in which many medicines fail. Recently, a research team studied the fate of several dozen molecules that were discovered by A.I. between 2015 and 2023. The molecules performed unusually well in Phase I trials, when a drug is tested for safety in a small number of healthy people, but in Phase II trials, which measure the effectiveness of the drug, they failed at roughly the same rate as other candidates. “You always have to cross your fingers the first time you put a drug in people,” Derek Lowe, a pharmaceutical researcher and a blogger for Science, told me. “All kinds of crazy shit can happen.”

Lowe said that A.I. “could prove transformational” for drug researchers. “I’d also bet that we’re going to have some whopping failures,” he added. “We can’t just turn it loose on any problem in medicine.” A.I. has been startlingly effective in areas where lots of high-quality data are available; AlphaFold, an A.I. system developed by Google DeepMind, learned to predict the structures of proteins from an enormous catalogue called the Protein Data Bank, which took fifty years to assemble. In other areas, no such database exists—and biotech companies are still making aggressive A.I. investments. “People are throwing a ton of money at A.I.,” Lowe said. “There are waves of FOMO coursing through the industry.”

Before I left Collins’s lab at M.I.T., Andreas Luttens, a Belgian Swedish computational biologist who was wearing Converse sneakers and round glasses, beckoned me to his computer. Luttens told me that the lab has focussed more on the effect of a molecule than on the question of how it brings about that effect. He was trying the opposite tack: locating a precise target and then discovering, or designing, a molecule to interfere with it. His aim is currently fixed on beta-lactamase, an enzyme produced by some bacteria which effectively chops up and disables penicillin—a classic example of drug resistance. If A.I. helps scientists attack a target like this, drugs that have lost their potency against bacteria could be resurrected.

On a screen, Luttens pulled up an image of a tangle of purple ribbons, which reminded me of an explosion of confetti streamers. They represented beta-lactamase. “Here’s the binding site,” Luttens said, pointing to an area in the center where a weapon could strike. He clicked his mouse, and a small green rod, with a few angular branches and a hexagon at one end, appeared inside it. “That’s one of the candidate molecules,” he explained. “By occupying the binding site, it basically shuts down the ability to degrade specific antibiotics.” Luttens had surveyed eighteen million molecules to find the thousand that would best fit in the binding site. He would use these real molecules to train generative A.I. models, which could imagine new and better molecules to target beta-lactamase.

Luttens clicked again, and the angular green structure changed into a straighter one with two hexagonal rings—another candidate. Then came a boxy configuration with a few spikes. He kept clicking, as though he were swiping through Tinder for a match.

“A thousand is still too many to make and test,” he said. “I’m aiming for fifty or a hundred.”

“So now you use an algorithm to short-list the best of the best?” I asked.

“Actually, from here we use human intuition,” Luttens said. “I’m looking for the most promising fit, based on what I’ve seen and what I know.” I watched him inspect molecules in a kind of trance. Then he turned to me. “There’s still a role for us humans,” he said, smiling. “For now, anyway.” ♦