[Jodavaho.io]

Stuff by Josh Vander Hook

Dieting and Differential Equations: Part 3, Tracking Calories using LLM

In the fourth of a series, I discuss how to easily track calories and monitor progress view full post

Executing the strategy

I set out and used this to calculate a daily budget of food. I’ve been at it 40 days, and I’ve lost 11 lbs (average 0.275 lbs/day).

There are two very hard things about calorie restricted diets. The first actually knowing how many calories you’re eating. And the second is knowing if it’s working. Math is all well and good, but if it doesn’t match reality, it’s not useful.

Tracking calories

I’ve been using ChatGPT-4 to estimate my calorie intake from pictures, descriptions, and rough notes. It’s been amazing. Somehow, training on language has resulting in memorizing the calorie content of every food item in the world, or so it would seem.
There’s three things ChatGPT-4 does for me:

  1. It answers adhoc questions about calorie estimates with prompts like “How many calories are in this plate of food (via picture), or “How many calories are in a McDonald’s Big Mac?”. These results help me order food.
  2. It helps me track my daily intake. The initial prompt is below, then I fire off curt messages like “I ate a banana” or “I had a 20oz soda” or “new day: weight 212.2” and it accumulates data for me.
  3. Finally, at the end of every day, I can pull out the summary, put it into a file, and run a plotter on it.

The prompt is:

Here is some json that represents what I need your help tracking. I will say things like "add a bowl of cheesits" and you will estimate the calories in that food item, add it to the running total for each day, and dump the revised json. I will also provide a weight once a day, and will occasionally provide exercises, for which you must also update the exercise field. The "net" field can be ignored but please include it with value zero. Is any part of this unclear? You're helping me track diet progress every day, with additional data from activities and meals throughout each day. 

{
  "Date": "2020-01-01",
  "Weight": 0,
  "Calories": 0,
  "Exercise": 0,
  "Pushups": 0,
  "Notes": "",
  "Net": 0 
}

And a typical interaction just happened as I was writing this, here it is with typos and all:

Me: 
Add a pb sandwich, and two chicken nuggest, target brand. 
ChatGPT:
Adding a peanut butter sandwich and two Target brand chicken nuggets to your day's intake:

1. Peanut Butter Sandwich:
   - Bread (2 slices): Approximately 160 calories for two slices of wheat bread.
   - Peanut Butter: For about 2 tablespoons, it's roughly 188 calories.

   Total for the peanut butter sandwich: approximately 348 calories.

2. Two Target Brand Chicken Nuggets: Target brand (such as Market Pantry) chicken nuggets typically contain about 45-50 calories each. For two nuggets, let's use 100 calories as an estimate.

Adding these items to the day's total:

- Peanut Butter Sandwich: 348 calories
- Two Chicken Nuggets: 100 calories

Total additional intake: 448 calories

Here's the updated information:

json [copy]
{
  "Date": "2024-04-01",
  "Weight": REDACTED,
  "Calories": 1008,
  "Exercise": 0,
  "Pushups": 0,
  "Notes": "",
  "Net": 0
}

How accurate is this? The chicken nuggets are about 80 each, and the brad is 70/ slice. But I was misleading. I actually ate Good and Gather, and Market Pantry actually is about 50-60 cal each. But for my purposes, it’s so easy to use that I don’t care if we’re off by 20%, since I am also back-estimating calories from my weight loss, as we’ll see next.

At this point, I’m content with the process. But I’d like a better answer to the accuracy question. To get this, we can do some statistical magic and estimate total calories and activity levels from my weight data (and the prior estimates). This might allow us to pin down the accuracy of the ChatGPT-4 estimates and my own exercise estimates.

That’s next time!

Comments

I have not configured comments for this site yet as there doesn't seem to be any good, free solutions. Please feel free to email, or reach out on social media if you have any thoughts or questions. I'd love to hear from you!