As the thought of getting in a bathing suit looms, quick-fix diets can be tempting. A few weeks of restrictive eating and cutting calories and you’ll be to your ideal shape, right?

Unfortunately, short-term diets — no matter what kind they are — tend to backfire pretty easily.

“The hormonal and neural control of weight loss is incredibly complicated, which is why weight loss can be so easy in theory, and yet so difficult in practice,” explains Dr. Elizabeth Lowden, bariatric endocrinologist at the Northwestern Medicine Metabolic Health and Surgical Weight Loss Center at Delnor Hospital.

“Our brains are incredibly sophisticated when it comes to managing our energy balance, and weight gain tends to be a maladaptive response,” she explains.

Your body doesn’t want to lose weight

This is due in part to a “set point” and “settling point” weight, says Dana Hunnes, PhD, RD, senior dietitian at Ronald Reagan UCLA Medical Center. “We have a genetic predisposition to be a certain weight — a set point — but, there is some wiggle room when it comes to how our environment interacts with our genetic predispositions.”

This wiggle room is our “settling point,” and can be affected by things like the foods we eat and our exercise habits.

Think of it like a thermostat that’s set on a program to be 70 degrees at all times, explains Lowden.

“You can change the thermostat down to 65 degrees, but eventually that program is going to kick in that bumps the temperature back up,” Lowden says.

That’s why it might not be so difficult to lose a couple of pounds, but lose too many and you set off the thermostat.

When you’re below the weight that your body is most comfortable with, you’ll be fighting your hormones to maintain it, says Lowden.

Your hormones know when you’re dieting

When you start to restrict your food intake, the hypothalamus and pituitary parts of the brain receive signals from various organs, recognizing the decreased energy sources coming in to the body, and adjusting hormone levels as a way to counteract this decrease, Lowden explains.

“Your hunger hormones can go up and fullness hormones go down, leading to a very significant drive to eat more food, particularly those very palatable foods that are high in energy density — aka, everything you have been trying to avoid while dieting,” she said.

Dr. Bartolome Burguera, endocrinologist and director of obesity programs at the Endocrinology & Metabolism Institute at Cleveland Clinic explains that the body has ways of rebelling.

“After you get below 4 to 5 percent of your original body weight, there are different compensatory mechanisms that are set off in the periphery, like the gut and brain, that try to bring you back to that original body weight,” says Burguera.

In 2007, a study in the International Journal of Obesity found that among women on a calorie restricted diet, those that lost more weight craved higher energy-dense foods after six months of dieting.

“It can be incredibly frustrating to lose 5 to 10 percent of your body weight only to have your body start to seemingly work against you,” says Lowden.

We’re equipped with a survival response that makes weight loss tricky

On top of your hormones being thrown out of whack, if you’re extremely restrictive with your food intake, your body can go into starvation mode — where your body starts to conserve energy rather than burn it.

Your body burns energy two ways, Burguera says. One through physical activity, the other through all of the vital functions your body performs just to stay alive, like respiration and digestion.

This is called your basal metabolic rate. When you start to lose weight, your brain tries to prevent this by changing your basal metabolic rate, so you end up burning fewer calories.

“Before, maybe it took 1,200 calories to keep your body running,” explains Burguera. “Now, your body gets nervous because you are losing weight and it says ‘let’s try to do the same work, just by burning 1,000 calories.”

You become more efficient — which would have been great if you were a caveman hunting for your next meal, less so when you’re just trying to look good in a swimsuit.

Severely restricted dieting also causes people to lose muscle mass, which contributes heavily to metabolic rate, further slowing the metabolism.

Even if you’re able to maintain lean mass through exercise, research shows it’s not enough to mitigate the changes in resting metabolic rate.

You can still lose weight, just without “dieting”

So how are humans supposed to lose weight when our very physiology is stacked against us?

“There is no way to trick our brains into not having these responses, but there are certainly healthier ways to diet,” says Lowden.

Hunnes recommends eating high-fiber, water-rich foods like fruits, vegetables, and whole grains in bulk.

“The fiber keeps you fuller longer, and the water content increases the volume of the foods you are eating while keeping the calorie intake lower,” Hunnes says.

Eating healthy fats such as avocado, olive oil, and nuts will also increase satiety, she adds. In fact, a long-term high-fat Mediterranean diet — rich in nuts and olive oil — is linked to weight loss.

Burguera says the key to weight loss is a long-term lifestyle approach, not short-term diets.

He also recommends looking at some of the other environmental factors that can modulate your “set point.”

Getting sufficient sleep (a minimum of six hours), decreasing your stress levels, consuming enough vitamin D, getting regular exercise, and maintaining a healthy gut microbiota can all help.