Active readers: 1

Experiments with “AI” and Diet Logging

October 2021

I recently fell into a spell of P.G Wodehouse novels. His style inspired me [1], and I scribbled this essay to experiment with it. It’s an eccentric mix of a “true” story (heavily embellished for comic effect), with a sprinkle of some ideas that may actually be useful. I hope you enjoy it!


Sometimes, you have a period in your life where all the cards are just right and every wish seems to conjure up before you, as if the universe decided to give you special treatment. A “personal renaissance”, if you will. I had once such period a few years ago, and it precipitated a multi-year quest. I wanted to relate the tale to you.

The Sauna

Our tale starts in 2018, when I worked at Facebook. I was hacking away at a product launch for F8 (our yearly developer conference), and we were a few weeks away from the big day. The inevitable crunch led me to a kind-of-dizzying-yet-thrilling quantity of work, and I found myself ubering back from the office every night at 9PM.

On one such an occasion, an indescribable urge came over me…I absolutely needed to go to the Sauna. A stranded dog would miss their owner less than I missed the vivifying steam of the Sauna. This may sound unusual, but at least in Georgia (the country I’m from) a good hour in heat is a staple for stress relief and general grooming (even Stalin was a fan), and boy was I in need.

Now, I was hazily aware that Archimedes Banya was nearby, but the idea of calling them and making a reservation plunged my uber ride in an atmosphere of dread.

If you asked any of my friends how I felt about making appointments, even the most charitable would say that unless I had a surge of some exceptional iron will, I’d have to be dragged kicking and screaming to the task, and unless vigilantly watched, I’d figure out some way to noodle out of it.

Well, there was no iron will left that day, and threats from a KGB drill sergeant couldn’t have forced me to make a phone call. So, temporarily defeated, gazing out of the window into the twilight, I made a quiet promise to myself. Once I finished with this launch, I said, I would solve this problem once and for all. I would set things up so I could plunge into a Sauna whenever I darn well pleased — appointments and phone calls be damned.

Fast forward a few weeks, and I signed the dotted line at the local Equinox. It was an ingenious hack if I say so myself: cheaper than going to a spa, available late into the evening, and I didn’t need to make an appointment. They even had two Saunas at the market street location: a lemon-scented steam room and the traditional wooden cabin room.

Boy did I revel in this victory. Once every few days, I’d rocket into the Equinox and shoot towards the change room. Determined and with towel in hand, I’d slow down my pace to a saunter, and eye the steam room. A leisurely hour of heat and ritual of cold plunges later, I’d strut out a newer, calmer man.

The ritual complete, I’d meander to the nearby Katsu Curry Place, with the air I imagine Napolean took on when he went on an evening stroll in Versailles. I’d finish the day with the satisfaction of a man who knew he had spent an evening he wouldn’t regret.

The Habit

Now, if any person heads into the change room of a gym every day for a month, and notices that the other folks seem to be gung-ho about what happens after the change room, they’re bound to get curious. One day, the urge to explore overtook me, and I delayed my usual leg towards the curry place, and took a gander at the facilities.

Well…it wasn’t so bad! A few bicep curls later, I thought it wouldn’t hurt to delay the restaurant and fit in a workout once in a while. Some weeks of this, and I began to noticed physical and emotional changes.

The progress inspired me to work out more, which produced more progress, and the kind of habit-forming loop that James Clear [2] himself would be proud of emerged. Victory upon victory, I felt. Now I had daily access to two Saunas, and workouts had become a routine.

Discovering my Trainer

Well, the gift kept on giving. One day at the Equinox a friend and I were taking a rest after a taxing set of squats, when he whispered, “Hey, take a look at the guy behind you”.

I rotated my gaze, to see a gentleman performing a superset of pushups with the exactness of a surgeon suturing a 0.3 millimeter blood vessel.

His form was so impeccable that even the uninitiated would stagger in their track to see what was happening, much in the same way I guess a lay carpenter would have if he had seen Michelangelo sculpting away. Whatever this gentleman was doing, you could tell that he was serous about it, and that it worked.

It turned out he was a trainer at Equinox, and a person with a heart of gold too. I started working with him a few weeks later, and experienced a change in dimension for the workouts. Progress was ever-abundant.

The Problem

A few months of this, and health was going swimmingly. Well, sort of. My trainer told me that to get to the next level, I had to re-examine this Katsu-Curry et al habit of mine.

He suggested that I use MyFitnessPal to log my diet. I went ahead and installed the app.

From the login screen on I had a grim sense of foreboding. This did not look like an app where the designers pained away their nights, agonizing over user experience.

My fears were well founded. I was first plunged into ads. I realized to my horror, that I had to tap at least 6 times [3] to log anything! A few days of half-hearted effort and I dropped the app. Well, I had a problem on my hands, but, I now had a weapon to solve it. I surged straight to the sauna.

As I mulled the problem over, an idea arose. Instead of this tedious task of tapping 6 times to log food, what if I started a new company, built an app were you could just take a picture of your food, and it would handle the rest?

Thrilling.

“AI”

It would be the latest and greatest in AI. In some sense this would get dangerously close to a level of complexity that no app previously had touched, but I thought — heck, why not try?

So, I did what every founder who wants to solve an AI problem verging on general intelligence would do — I started with a “human-augmented” solution. I tabbed over to Upwork, and wrote a job posting:

image

The Job posting. Admittedly the response times were a bit too optimistic

Within a day, I got a storm of responses, filtered the ones who didn’t read the “When applying” section, and gave them all a test: I asked them to log into MyFitnessPal, and show me what they saw.

This task turned out to be insurmountable for the majority, and filtered about 90% of the applicants. Some more sleuthing, and I landed on a skilled assistant.

The Initial Experience

So, following the footsteps of the great scientists, I started the next day and sent my first photo across the ether.

At the outset I was faced with a shock: I had to tap at least 5 times to send a photo on Messenger! [4]. It was frustrating, but all was not lost. I consoled myself, that at least sending a voice message was 4 taps, and in the case where I had to log some custom food, I’d be in the black with convenience. So, I trekked forwards.

A day or two in, a second shock sprung forth. I noticed that with most food, I would have preferred to have done a quick search myself, or to have picked from a “recently used” component, rather than to have gone through the “AI” process.

I co-discovered, alongside a many an AI enthusiast, that sometimes a good UX can do wonders. Here, I consoled myself again. I reasoned that I could **use the “re-send” option on Messenger, to achieve a workable UX. Plus, if this was to become a business, I could build a companion app that had this too. So, I marched on.

A more painful shock came, when I discovered myself painstakingly crafting 30 second videos to log food, putting in much the same effort that photographers do when working with Victoria’s Secret models. I made sure every detail my assistant needed to log accurately was in the frame, and this toil was inching me closer to the red when it came to convenience.

The Last Straw

Now, these changes I invented for myself where painful, but pain is much easier to bear when you inflict it on yourself, so I bit through all and trucked along for a few weeks more.

To my infinite chagrin, there was bombshell that I just couldn’t ignore.

None of it worked! My nutrition wasn’t changing.

Whether I sent photos or not, I’d discover myself at the Whole Foods in the middle of the day, contentedly inhaling a few bags of cherries. Yes, that’s right, bags (In my defense, I felt like during cherry season it’s unreasonable, every store flaunting them around so much it’s perilous for an eye to wander).

The “AI-Alternative”

So, I came back to the drawing board. After some grave reflection, one idea struck me.

Maybe I was “forcing” this AI-type-of-solution — A “hammer looking for a nail”, if you will. What if I looked at the problem with fresh eyes? Thinking “from first principles”, as Elon Musk would say.

So, I reflected on this, and a rough product spec began to materialize. I thought to myself: “Hey, maybe I don’t really need to log calories at all. What if I just took photos, and made it shareable with my trainer?”

This way, he could look over it once every few weeks, and we could make adjustments as needed.

Clojure to the Rescue

So, I shared this idea with a friend of mine, and we jumped into hacking up a solution in Clojure.

This time, we would use SMS instead of Messenger. This had the marked benefit, that it would reduce the number of taps, and open up the option of IOS shortcuts down the road. I would simply send photos, and it would log it in the database. My trainer could then open a URL, and see everything that was logged by date.

image

The AI hacker’s NLP: string/lower-case, string/trim, string/includes?

I felt like I had come across the first-principled solution alright.

I contentedly took pictures of my food, and week over week, my trainer kept telling me to lay off some variety of cherries, mandarins, plums, apricots, or Katsu Curry. Fruits was such a common pattern in the diet, that we affectionately called our project “Pluot” — a hybrid of plums and apricots (this is a real fruit).

…The Second Defeat

Well, after a month of logging, the first-principled solution also fell dead into the water.

The program itself was fine — apart from a light desire to “edit” the timestamp on photos — it worked well enough. The issue was, that this just didn’t lead to any change in my nutrition.

No matter the feedback, I found myself myself in Facebook’s “Micro Kitchen” [5], polishing off the office’s supply of mandarins. At this point, I had tried the AI solution, and I had tried the first-principles solution. I was at a loss for what to do.

So, I did what I guess every gentleman does after such a sound defeat. I put the past behind me, and joined some military excursion in Africa.

Okay, I wish — unfortunately I was a few generations too late for this kind of thing, so instead I did the millennial analogue. I plunged myself into hacking on products, went to Machu Pichu and Africa (Admittedly, with more convenience than what similar spirited youths experienced in the past. On our hike in Machu Pichu, porters were somehow able to bake a cake in the wilderness)

image

A modern byronic adventure

The Haze

In the same way the military man back from Africa is no longer the diffident young English lord he once was at the outset, I think my friends would all agree, that this period had changed me: I had “bloomed”, if you will.

All the travel and the hacking had its effect, but, perhaps even more importantly, I had continued my reading habit, and it evolved to unnatural proportions. I think if Amazon had been a local store, they would have been suspicious about me being a reseller of sorts.

You see, the time a gentleman consumes waiting in line for coffee (especially in San Francisco coffee shops) and airport delays adds up. Combine that with a predisposition to lounge around on Sundays, and you have a person with a formidable library.

A Lebanese Light

Over those years, Nassim Taleb was one of the two authors who I found myself addictively re-reading. His work is the kind that protests at being read while waiting in line at a coffee shop, and forces you to find a chair to sit and nurse an Americano too in rapt attention.

The experience is similar to visiting an eccentric grandfather at his luxurious country house, to discover him lounging in the veranda, a half-finished bottle of self-made wine on the table, ready to impart you with wisdom and wit.

Now, I had already read Nassim’s work in the outset of the story, but as I said, his work changes with you, and I had undergone some change. Plus, you’re bound to understand a work differently after the sixth re-read.

On one such a Sunday, I was perusing over his ideas on Phenomenology and Theory, when I had a breakthrough. He says that Phenomenology (the study of “what works”) is more robust than Theory (the study of “why” things work).

This plays out intuitively. In finance for example, you can be sure that there are going to be market cycles and sharp swings in price. But why? Well, the answer changes every year. You’ll find many an economist with strong opinions, but without consensus in sight.

The nub is, we love theories, to the point where we can’t help but be fooled by them. You pick some theory about why foreign bonds should cost what they cost for example, and proceed to plunge down a highway to bankruptcy, while you tell yourself how the “market is irrational” along each setback [6].

We never get apprised of this lesson. Each time, a new economist integrate the “data point” that got away (a euphemism for bankruptcy in this case), and comes up with a new theory. Moving forward, this new theory seems indestructible and accurately predicts the past. Of course, the future is another thing.

Phenomenology of Nutrition

From there I grasped the errors of my youthful adventure. When I started on my quest, I had never successfully changed my nutrition before….yet, there I was, confidently picking theories, hiring assistants, and plunging straight towards defeat.

With my new wordly wisdom under my belt, I reconsidered the problem. What was the phenomenology behind good nutrition?

Instead of starting off with theory, I started by looking at what my friends who had succeeded in losing weight had actually done. I went back to the advice my trainer gave me. My best friend and co-founder Joe had achieved success here, and I took a closer look at what he did.

Before, when I saw him log his diet for example, I was certain that he had either an inordinate amount of self-discipline, or a Mother Theresa-like patience when it came to poorly-designed iPhone apps.

But that wasn’t the case. He simply logged differently. When in a crowded place for example, he’d take pictures so he could log at a later time. If it would be particularly tedious to log a specific food (say he was stranded in the middle of Mexico, and got pollo con idunno), he’d find something analogous (Chipotle) and log that.

A series of these optimizations had led him to log consistently, with enough accuracy to diagnose issues as they came along. To steal the story from Nassim, it made me feel I like the way the first weary traveler lugging his luggage must have felt, when he discovered the invention of the wheeled suitcase.

The Intangible

At a glance, the ideas seemed simple and theorizable. For example: maybe it’s all about the balance of accuracy and consistency in your logging. But, before we move too fast: what about the adjacent skills that it created? As I logged more for example, in the same way a horse-whisperer learns to communicate with the animal, I felt like I began to “sense” the nutritional makeup of food. The schelps I underwent attuned me to how certain foods made me feel, and how it would affect the rest of my day. Where do we include this in the theory?

The most judicious path, I learned, was to rely on experimentation. Start with what works, and tweak from there. Joe and I continued to experiment, ended up hacking up a business in the process.

Group 1 (5)

That realization in one sense completed the quest, but in another, kicked off a whole new one. There’s so much more to observe and learn.

[1] Here’s one to start with: Leave it to Psmith.
[2] Check out Atomic Habits
[3] Tap MFP → Tap (+) → Tap Food → Tap time period → Tap item → Tap checkmark
[4] Tap Messenger → Tap Conversation → Tap Camera → Take Photo → Send
[5] A small kitchen stocked with goodies of all kinds, situated a thirty second saunter away from any desk.
[6] An instructive story.


Are you thinking seriously about your health and fitness? Want to take it to the next level? Joe and I are hacking on consistent.fit. The current cohort is closed, but sign up for the waitlist, if you’d like to be notified when we finish this one!


Thanks to Joe Averbukh, Daniel Woelfel, Ian Sinnott, Jacky Wang, Mark Shlick, for reviewing drafts of this essay

Powered by Instant