Diet -

Trying to out-stubborn a cat


Throughout my early life - elementary school, middle school, and the first part of high school - I always was short and very thin. Of course, this did not last forever. By the end of high school I had grown to an average height. Now I'm 5'10" and significantly taller than both of my parents. I always used to eat whatever I felt like, whenever I felt like. This generally consisted of pizza, pasta, cheeseburgers, and Mountain Dew. By the end of high school I weighed 150 pounds. I was perhaps a little heavy, but it wasn't extremely problematic. Then, I came to Caltech. I lived on Caltech's board plan for the first year, but by the end I had shut myself off from my evil dormitory and never attended dinner. My slightly increased ability to plan my own meals led me to gain some weight, and I reached about 160 pounds at the end of freshman year.

Then things started to accelerate. Sophomore year, I escaped evil Ruddock House, unaffiliated myself at maximum warp, and moved to Avery House. I began to exclusively eat things of my own choosing, never having entirely lost the habit of not going to the cafeteria. I kept my mini-refrigerator stocked with Mountain Dew, Minute Maid Fruit Punch, and root beer, and consumed them while working at my computer. I finished my PE requirement first term and resolved never to exercise again. My website expanded significantly during sophomore year. Unfortunately, I did too. After my summer research ended, I found that not only was I no longer short, I was no longer thin. I weighed 200 pounds, and my clothes were beginning to not fit well.

What happened? Obviously, I knew why I had started to gain weight - I had been eating whatever I liked, unconstrained by whatever my parents were choosing to make for dinner 1000 miles away. I don't really care what I look like, but I do have to live in my body, and it's not fun to be heavy. So, I decided that weighing 200 pounds was unacceptable and set off to decrease my weight.

Back in high school, I had immersed myself in a number of fields which I found interesting: cryptography, artificial life, and so forth. I believe I discovered Fourmilab in connection with radioactively generated random numbers, but it has been so long that I'm unsure how I found it. Fourmilab is the personal web site of John Walker, founder of Autodesk (makers of AutoCAD), and even back in my sophomore year of high school I admired his clear and interesting writing. I explored most of his website, but I skipped over some parts that I considered irrelevant. Four years later, being seriously overweight, I went back to Walker's website and read The Hacker's Diet.

The Hacker's Diet

The book is available freely in PDF format from John Walker's website. If you're going to bother to read the rest of this page, you must read this book, or it won't make any sense. If you get one thing out of this page, it should be that this book works. (1.3MB)

I had known about the existence of this book for years, but I had never read it, because I didn't need it. Now, I needed it, and I found to my surprise that it's one of the most stunningly insightful things I've ever read. In it, John Walker analyzes weight gain, loss, and control through empirical methods taken from science and engineering. We too are machines, just machines of a different type.

I learned that my weight gain was not a matter of "insufficient willpower", of being raised incorrectly, or just being genetically programmed to be overweight. Rather, it is like nearsightedness. I am strongly nearsighted and will wear glasses for the rest of my life. This doesn't bother me; my myopia is not caused by some failing I have as a person. I'm just broken, and I have to use technology to fix it. Similarly, the internal mechanisms that tell me when to stop eating are broken. I have to use external means to fix that. The cause of weight gain (not knowing when to stop eating) is genetic and environmental, but the weight gain itself is not.

John Walker's The Hacker's Diet has a number of central tenets, which I will briefly summarize.

The claim of "perfect weight forever" is a bold one, but it is no more bold and no less true than the claim that gravity is universal. The Hacker's Diet is so simple once you understand it, it seems like it's hardly worth explaining. Yet before I read Walker's book, I believed that weight control was beyond my capability. That is not so. Thus, I bought a scale (cost: $60 or so) and began my diet. The Hacker's Diet is remarkable because:

My implementation

This page describes my attempt to implement The Hacker's Diet. Like anything else in science and engineering, it works and it can be achieved at will. On September 25, 2002, I began measuring and averaging my weight every day and strictly measuring my food consumption. My tools consist of my scale, Microsoft Excel, and my iron will. As the book recommends, the scale I bought is digital with an accuracy to 0.5 pounds. (Analog sucks; get with the 21st century.) Walker's book is dated in only two respects; any time he refers to Excel, it's of the vintage Windows 3.1 version, and when it was written, Nutrition Facts were not required to be printed on all foods. Thanks to Microsoft and the federal government, both situations have improved. In Excel I keep track of my measured weight, my trend weight, my calories consumed, and the calories I have burned per day. (I implemented the formulae given by Walker, but didn't use his spreadsheets. I have to do things my own way, you know.) Excel also produces graphs of my measured and trend weights. Calculating the trend weight is instantaneous, since it's done by Excel. (For the first week, I used a text editor and Windows Calculator and did everything by hand, but I wanted pretty graphs and I'm lazy.) Adding up the number of calories I consume per day is as simple as typing =500 + 90 + 140 and the like into a cell.

I had to estimate how many Calories I was burning per day. From Walker's tables and my height, I estimated 1800, since I am fairly inactive and I'm not quarterback material. So, the first day, I consumed 1800 Calories to get a feel for how much food it was. Then I restricted myself to 1400 Calories a day. This is the "iron will" part of the diet. I now have to realize that food has two costs: monetary and caloric. I don't care about the monetary cost, but I do care about the caloric cost. Remember: I can eat whatever I want, virtually whenever I want, I simply cannot eat as much as I want. I get 1400 Calories a day to spend. I can spend them rapidly, I can spend them on tuna and Lunchables Pizza, I can spend them on slices of turkey or pizza, I can spend them on anything I know the quantitative cost of - I simply must not spend more than 1400. Unlike with money, the only thing stopping me from consuming more than 1400 Calories per day is my willpower.

My foods

Now, I said above that The Hacker's Diet doesn't require me to change my lifestyle. However, I have changed what I eat. This is not because it's necessary to lose weight. It's because if I spend Calories unwisely, I will run out of them, and then I can't eat anything else for the rest of the day. I have rearranged my intake to provide me with the maximum amount of tasty food possible, and this has had some effects: On my Excel spreadsheet, I maintain a list of foods I usually consume, with their calorie counts. These include:

Things I've learned

After measuring my intake and weight loss for over a month, I discovered that my initial estimate of 1800 Calories burned per day was incorrect. I actually was burning around 2700 Calories a day. I hadn't been doing anything other than walking to class, either. Perhaps this just explains why I've always thought I have a high metabolism. Anyways, this is welcome news. It means that by eating 1400 Calories a day, I have a 1300 Calorie a day deficit, which makes me lose weight extremely rapidly (about 2.5 pounds per week). Is that healthy? Probably not, but being overweight is even less healthy. Furthermore, burning so much means that when I do finish my diet, I will be able to consume a large amount of food and still not gain weight. I will still need to watch my intake, of course.

In The Hacker's Diet, John Walker shows some graphs which relate how much food a person is eating with how happy they are. If you eat too little, you become hungry (and unhappy); if you eat too much, you become full (and unhappy). Thus, a "happiness" curve will be concave. Walker demonstrates that people who have no problems with weight control have a curve with steep sides centered around the origin, where the amount of Calories consumed is equal to the amount of Calories burned and no weight change happens. People who gain weight either have a mis-centered curve, or a shallow right wall. From my experience with the diet, I have learned that my problem is different from any of the ones Walker lists. Over my sophomore year at Caltech, my standard order at McDonald's was two plain double cheeseburgers, a SuperSize fries, and a large orange juice. This is about 2000 Calories worth of food, and it wouldn't be my only meal of the day! I would eat that and not feel especially full afterwards. Thus, the right side of my happiness curve is very flat. However, there is a flip side. On this diet, I am consuming 1400 Calories a day while burning 2700 Calories. That's a massive deficit (larger than the one Walker himself used to lose weight) but there's something more - I don't feel bad at all. I'm a little hungry when I wake up, but that's corrected in short order. I'm a little hungry by the time I go to bed, but that's okay, because I'm tired by then anyways. My curve is thus extremely flat - I don't get signals whether I eat too little or too much. Thus, I may as well continue eating only 1400 Calories a day; it doesn't bother me too much. If I were seriously hungry all the time, I would change my limit and consume more, while losing weight more slowly.


Diet: Days 1-138

This is a graph of the first 138 days of my diet. The red line is my measured weight, the green line is my trend weight (my "true" weight), and the blue line is the calories I burn. Once I decided to start losing weight, the green line started dropping in a nearly linear fashion, and continued doing so. No matter if my measured weight makes large changes in the space of a couple of days, or stubbornly refuses to move for a while, the trend weight behaves rationally. Note that, since the beginning of my diet, almost every day the measured weight has been less than the trend weight. This means that every day I have been losing weight.

When I reached the end of first term, I began seeing nonlinear effects; my burn rate dropped dramatically. This was in part due to changing activity levels, but some of it is probably also due to my more normal weight. I'm still losing weight, just more slowly. Unlike with a "normal" diet, I can quantify everything that's happening. My burn rate dropped, but the joke's on it; I'm the sentient one, and I'll win in the end.


I made a conscious decision to lose weight using the principles of engineering, and it is working. You can use these very same principles yourself, should the need ever arise. Even if you're one of the lucky people to have a perfectly calibrated inner sense of when to stop eating, you should read Walker's book anyways, because it's an illuminating look at a problem which is generally considered to be intractable. (updated a long time ago)
Stephan T. Lavavej
This is my personal website. I work for Microsoft, but I don't speak for them.