The researchers also found that raw sweet potatoes inflicted an impressive amount of damage on the microbiome of the mouse gut, similar to what occurs in mice fed an antibiotic. That may result from antimicrobial compounds in the sweet potato, which may be inactivated by cooking.

If cooking, at least of starches, can alter the ecology of the gut, then have humans been shaping our microbiomes ever since we learned to put prehistoric tubers in the fire? If our ancestors did eat these kinds of foods, and switched to cooking them, it may be that some tasks that used to be handled by gut microbes were no longer necessary, says Stephanie Schnorr, a biological anthropologist at the University of Nevada, Las Vegas, who was not involved in the study. As a result, the bacteria might have lost the related genes or gained new roles.

The ability of the gut’s microbial residents to shift themselves so dramatically even in the short term may have had other benefits for their hosts. If microbiomes can retool themselves on little notice to handle changes in diet, they may have helped early humans cope with lean days where tubers were the only foods or times when only meat was on the menu.

“The microbiome could essentially help us, within 24 hours, maximize our ability to digest nutrients even on a low-quality diet,” Dr. Carmody said.

Still, the extent to which humans and their live-in digestion engines evolved together is debated. Mice given human microbiomes are generally healthy, suggesting that a host and its microbes don’t fit together like a lock and key, honed by eons of mutual evolution. However, in some situations, like when a mouse gets sick, it is more likely to recover when it has its own microbiome. That may imply that there has been some co-evolution between the organism and its microbiome, Dr. Carmody said.