About eight or nine years ago, she said, “I ran across this paper on caffeine in floral nectar.” And then, she said, she thought, “ ‘This could be quite interesting because there might be some ecological interaction between the plants and the pollinator.’ That’s how it started.”

Several varieties of coffee and citrus plants have toxic concentrations of caffeine in leaves and other tissues, but low concentrations, similar to that in weak coffee, in the nectar itself. The toxic concentrations help plants fend off predators.

But Dr. Raguso pointed out a well-known axiom that “The dose makes the poison,” a principle that Dr. Wright and her colleagues followed in lab experiments. She conducted learning experiments with bees to see if they associated a reward with an odor, the reward being either sugar water or a combination of sugar water and caffeine in the same concentrations found in the nectar of coffee and citrus plants.

The effect of caffeine was not obvious at first, but as Dr. Wright refined her experiments, it became more clear that the chemical had a profound effect on memory. “If you put a low dose of caffeine in the reward when you teach them this task, and the amount is similar to what we drink when we have weak coffee, they just don’t forget that the odor is associated with the reward,” she said.

After 24 hours, three times as many bees remembered the connection between odor and reward if the reward contained caffeine. After 72 hours, twice as many remembered. They then tested the effect of caffeine on neurons in the bee brain and found that its action could lead to more sensitivity in neurons called Kenyon cells, which are involved in learning and memory. Dr. Wright said that this was one plausible route for enhancing memory, but was not definitive.

Insect and human brains are vastly different, and although caffeine has many effects in people, like increasing alertness, whether it improves memory is unclear. But the excitation of the Kenyon cells was similar to the action of caffeine on cells in the hippocampus in a recent experiment on rats, Dr. Wright said.

Such similarities in neurochemistry that allow caffeine to affect mammalian and insect brains in similar ways may seem surprising, but insects like fruit flies and the nervous systems of even more primitive organisms like nematodes have been used to study learning at the level of individual cells and the chemistry that changes their activities.

Cori Bargmann of Rockefeller University, who studies the brain and behavior of a microscopic roundworm called Caenorhabditis elegans, said that the bee findings added more support to the idea that some very ancient behaviors like learning must have very deep evolutionary roots. Finding the common neurochemistry in such diverse creatures, she said, is like “learning the vocabulary of the brain.”