(Updated) It’s the rare psychological experiment that is both informative and invariably hilarious to observe, but the “marshmallow test” — the one in which young children are asked to resist the sweet treat in front of them for the promise of a bigger, better treat later — fits the bill. Kids squirm, wriggle, sing aloud and cover their eyes to distract themselves from the temptation; they’ll even allow themselves to sniff or slyly stroke the yummy dessert, but not pick it up: their cuteness is often irresistible.

This apparently trivial challenge has serious implications, however. Children who are able to restrain themselves the longest in the marshmallow test are generally those who end up more successful later on in life: they grow up to achieve higher SAT scores (a 210 point difference), earn higher incomes, and have a lower chance of obesity, a lower risk of drug misuse and better health overall.

So, what determines which children will fall among the lucky 25% who can successfully resist the marshmallow? Is it an inherited genetic advantage that produces greater impulse control? Is delaying gratification a learned behavior? Or could children be making conscious choices about this specific task based on similar prior experiences — involving adults who promise better rewards later — of whether waiting really pays off?

Researchers led by Celeste Kidd at the University of Rochester devised a clever way to find out. They brought 28 children, aged 3 to 5, into the lab, purportedly for an art project. Half of the children were subjected to a situation in which adults did what they said they would do, and delaying gratification paid off. The rest had a frustrating experience in which they waited for art supplies promised by an adult, but never received them. Afterward, all children participated in the marshmallow test.

Here’s how the experiment worked: the first group of children were placed in a room with a sealed jar of worn crayons and told they could either use them to draw on paper that would later be made into a cup, or they could wait for better supplies, which would be provided a few minutes later. All of the children managed to wait the two and a half minutes required and then received a tray containing many varieties of new and exciting art supplies.

Next, this group was allowed to draw their pictures and then were given another chance to delay gratification: either by deciding to use a small, not particularly nice sticker in their drawing now, or waiting to get several larger stickers later, bearing characters from Toy Story or Disney princesses, which their parents had designated would be especially appealing.

The unfortunate kids in the second group were subjected to the same situations, but although they waited patiently just like the other children, in both situations, the adult researchers ended up apologizing and said they were out of the promised supplies, leaving the kids with the worn or boring original items.

These experiences profoundly affected the children’s performance in the subsequent marshmallow test. Quite rationally, the kids who had previously waited and been disappointed twice held out only three minutes before deciding to eat the marshmallow in front of them, figuring the researchers might again fail to deliver on their promise to bring a second marshmallow.

In contrast, the kids whose waiting had previously paid off successfully held out an average of 12 minutes — a full four times longer than their peers — before yielding to the siren call of the white fluffy stuff.

Only one of the 14 kids who had been disappointed waited the full 15 minutes (before actually receiving the second marshmallow), while nine of the other 14 successfully waited and were rewarded.

As the researchers detail, these results have important implications for understanding the effects of poverty, abuse and neglect on child development. They write:

Consider the mindset of a 4-year-old living in a crowded shelter, surrounded by older children with little adult supervision. For a child accustomed to stolen possessions and broken promises, the only guaranteed treats are the ones you have already swallowed. At the other extreme, consider the mindset of an only-child in a stable home whose parents reliably promise and deliver small motivational treats for good behavior. From this child’s perspective, the rare injustice of a stolen object or broken promise may be so startlingly unfamiliar that it prompts an outburst of tears.

People who are unable to resist immediate temptation to get later, greater rewards are often seen as impulsive and irrational, but this new take on the marshmallow test suggests it’s not so simple. For kids growing up in chaotic neighborhoods where promised rewards often don’t materialize and violence threatens to cut life itself short at any time, delayed gratification often doesn’t seem like a rational choice. Instead, getting what you can while it’s there feels far more sensible.

And yet this seemingly rational decision-making can keep children who are raised in unstable homes and communities from making the choices that would allow them a better life. Favoring short-term pleasures over delayed rewards is not typically a recipe for educational or business success, after all.

The good news here is that these choices seem context-dependent: the children involved in the study responded to the researchers’ behavior, which, presumably, was quite different from the way their parents or others around them typically treated them. The findings suggest that daycare programs, schools and afterschool programs might be able to provide settings where rewards do appear as promised and where impulse control is modeled and taught.

Prior research has also shown that the marshmallow test isn’t destiny: some children who can’t resist initially have been shown to develop excellent self-control later on. Moreover, the children who do delay successfully have been found to use specific, potentially teachable techniques — for example, imagining that the marshmallow is a cloud or just a picture — to distract themselves and encourage patience. Researchers are studying whether these strategies can be taught to children who don’t develop them spontaneously.