Imagine if when you tried to learn something new, whether a person’s name or your 15th e-mail password, your brain received an electrical boost. This little jolt of electricity would shock neurons into action and make them pay attention, increasing your likelihood of being able to recall the information when you needed it.

This type of implantable neural device is no longer purely science fiction—or an episode of Black Mirror. Scientists have developed an apparatus that will electrically nudge the brain when it seems at risk of forgetting new information. The technology, which combines a technique called deep-brain stimulation (DBS) with real-time monitoring of neural activity, improved participants’ performance on a memory task by as much as 15 percent.

In DBS an electrical current is delivered to the brain via electrodes implanted at strategic locations. The device has helped to control tremors in patients with Parkinson’s disease and stop seizures in those with severe epilepsy. Scientists are now exploring whether DBS might even help treat Alzheimer's disease. But early studies of DBS’s effect on memory have been mixedsome tests led to a boost in performance whereas others resulted in impairment.

The different outcomes seem to depend largely on where and when the stimulation occurs. In the new study, published in Nature Communications, senior author Michael Kahana wanted to let the brain’s own activity guide the stimulation. “I've been studying the electrophysiology of memory processes for many years, and it seemed to me that [we should] use the electrical signals of the brain that predict good memory to help teach us how to stimulate the brain,” says Kahana, who is a professor of psychology at the University of Pennsylvania.

Kahana’s team first had to determine what good memory function looked like. To do so, the researchers enlisted 25 epilepsy patients who already had electrodes implanted in their brains to monitor their seizures. The researchers used the electrodes to measure neural activity while the patients memorized lists of words. They then compared brain activity for words the patients recalled correctly versus words they forgot. Activity in an area of the brain called the lateral temporal cortex, which is part of the core memory network, seemed to predict whether or not a patient would later remember the word.

The researchers then developed software that could tell in real time whether activity in this part of the brain was optimal for remembering or not. If the software detected the brain was in a poor learning state, it triggered a small electrical pulse to stimulate the area. The electrical current in DBS is typically constant, but this “closed loop” system acts more like a pacemaker, only zapping the brain when stimulation is needed. “We're inducing neural activity within the core memory network at a time when the network has quieted down but it should not have,” Kahana says.

Although the study was done in patients without memory impairment, hope for using DBS to treat dementia is mounting—especially because the most promising pharmaceutical clinical trials for Alzheimer’s continue to disappoint. “I think it’s a really exciting finding,” says Gwenn Smith, a professor of psychiatry and behavioral sciences at Johns Hopkins University who was not involved in the work. “The study was very methodologically elegant and has a lot of potential for treating memory disorders.”

Itzhak Fried, a professor of neurosurgery at the University of California, Los Angeles, who also did not participate in the study, agreed the findings were promising but wanted to see more evidence for clinical impact. “In principle, stimulation which is based on some neural feedback from the brain offers advantages over ‘standard DBS,’ which is a one-way street,” he wrote in an e-mail. “However, it remains to be seen if this method will yield better results.”

Andres Lozano, chair of neurosurgery at the University of Toronto who, with Smith, has conducted several clinical trials using DBS in Alzheimer’s patients, says the advantages of using intermittent versus constant stimulation depend on the desired outcome. “The closed loop is good for things that occur over a short time frame—seconds. If you’re interested in things that occur over days or years, then it’s not entirely clear that closed loop is the most beneficial,” he says.

In one trial by Lozano and Smith, Alzheimer’s patients over the age of 65 who received continuous DBS had less cognitive decline over the course of a year than patients who did not receive it. DBS also resulted in higher brain glucose metabolism, which Lozano says is a sign of improved functioning in neurons. Another study in mice showed DBS can reduce the presence of amyloid plaques and tau tangles in the brain—the neurological signatures of Alzheimer’s that are thought to be behind neurodegeneration. “If the objective is to slow down the progress of Alzheimer’s, then we may want to stimulate continuously,” Lozano says. “We're tapping into the brain's endogenous repair and growth mechanisms, and stimulation can mobilize those mechanisms.”

Other researchers want to take brain implants even further. Scientists at the University of Southern California and Wake Forest University are attempting to build a “memory prosthesis” to produce the electrical signals associated with memories and feed them to the brain. Using electrodes, computers and complex mathematical models, they are working to decode the brain activity during learning and memory so they can re-create the signals if they’re forgotten. So far, the scientists have succeeded in creating memory-related signals from learning activity in rats and monkeys, but they have not yet tested the technology in humans.

In the meantime closed-loop stimulation systems are becoming a reality. The company NeuroPace offers an FDA-approved device to treat epilepsy. The implants detect activity in the brain that predicts a seizure and then delivers an electrical pulse to stop the seizure immediately.

Although the research to date has all been framed around improving memory in patients, the idea of enhancing cognition in those of us who just need a little boost is not far behind. Bryan Johnson, CEO of neurotech company Kernel, has said these types of brain prostheses could one day improve cognition in all of us.

Fried, the U.C.L.A. neurosurgeon, dismisses the idea of using deep-brain stimulation for something as trivial as remembering names at a cocktail party. “This is invasive technology designed to treat impairment and alleviate suffering of neurological patients, and is a medical procedure which should be guided and regulated by stringent clinical criteria,” he wrote.

Kahana was more open to the idea, however. “I think there’s a lot of concern that invasive technology is too risky to imagine being deployed at a very large scale. You could imagine that people would be reluctant to have brain surgery to get a device that would improve their cognitive function,” he says. “But brain surgery for this kind of technology is becoming safer and safer and safer every year. [One day] the so-called invasive technologies could become sufficiently low-risk [so] that we won’t even think about them as being that invasive anymore.” Cosmetic surgery is ho-hum routine—and so is LASIK. It still may take some time to get used to the idea of elective brain surgery. Who wants to go first?