For those who don’t know Soylent is a meal replacement shake. Actually that’s a bit of an under-sell. It’s a shake that (supposedly) contains everything you need to be healthy consuming nothing but Soylent and water, which its creator Rob Rhinehart actually did for several months leading up to the crowd funding campaign. It’s a reductionist silicon valley start-up approach to food, and as of this writing shipments of the official product are just beginning to go out.
I’m not here to talk about the official product though. What I’m here to talk about is the do it yourself community that has sprung up around the idea, and the Auto-Soylent app which is my contribution. In particular there is a DIY Soylent website which is designed to help DIYers build, share, and critique meal replacement recipes. I spoke briefly with its creator Nick Poulden on the Soylent forums, and he created a code skeleton making it easy for others to attempt to build automatic recipe generators. As far as I know I’m the only one who has done so with much success.
The skeleton was named auto-soylent, and since what I wrote was a relatively simple solver I didn’t feel the need to do any rebranding. I believe the basic version of my code has been merged into the skeleton itself, but my latest version can be found here. It’ a node.js app so you’ll need that but nothing else to run it. All of the variables (like the base recipe and target nutrition profile) are at the top of the file and labeled. It shouldn’t be too hard to figure out but feel free to contact me if you need help with it.
The problem of optimizing a Soylent recipe at its simplest is a linear programming problem. You have minimum and maximum values for each nutrient, there’s a linear relationship between ingredient amounts and nutrients meaning those bounds are linear inequalities you have to satisfy. Within that feasible nutrition region you also want to minimize cost, which is also a linear function on the ingredient amounts. Thus, a linear programming problem. That being said, I didn’t do it that way at all.
It can be rather tricky to get a perfect 100% in every nutrient, and there are other practical concerns like recipe complexity. At the same time if it is possible to get those 100%’s , particularly in the macro nutrients like protein, fat, and carbohydrates, you’ll want to do so. The approach I took was to use quadratic penalties for every nutrient out of range, and then weight that against cost to get a single fitness function that could be optimized over. Two nice things about this approach are A) it’s convex so a local optimum is a global optimum and B) the combination of a linear cost, non-negative amounts, and quadratic penalties is akin to lasso regularization which induces sparseness in the solution. Sparseness means if you put a long list of potential ingredients into the optimization most of them won’t be used, and you’ll get a simpler, easier to make recipe.
For the optimization I just used gradient descent with a rather simple (and kind of hacky) parabolic interpolation line search. If I were doing this professionally I’d probably use L-BFGS with a line-search that provably guarantees convergence, but I’m not getting paid so I went with what I could write quickly off the top of my head. The function being optimized is well behaved as I mentioned, so speed and convergence don’t really seem to be significant problems. It usually completes within a couple of seconds.
Ok, so I had this piece of software for optimizing single recipes. I figured, why not try optimizing several recipes together and see if I can combine some of the best ideas into a single better, by which I mean cheaper, recipe. So I took all of the ingredients from the 5 most favorited recipes on the DIY site, and crunched out a recipe that was supposedly close to one dollar per day. It seemed like a good idea in theory, but when I began looking at the specifics it became clear that it was impossible to get all of those ingredients at those prices in one place. Shipping costs were rarely taken into account in the listed prices.
I decided to add some restrictions to generate a recipe that was actually meaningful. Since many of the ingredients I was able to get were on Amazon, I made a recipe where all of the ingredients could be ordered from Amazon. Not only that, but the prices I used would include the cost of shipping if the item wasn’t eligible for free shipping . This knocked the price up to about 4.50$/day, but you save big on labor. Also, I guess the listed price not being a lie is important.
I designed a recipe that could be ordered from Amazon. Then I ordered it from Amazon. Well, except for the salt and canola oil. I got those at a local grocery store. I didn’t buy things in as much bulk as the recipe suggests, so I ended up paying more per gram for a few things.
My battle station and tools for Soylent mixing are minimal. A covered table, plates, spoons, bowls, bags. I used a jewelry scale (8$) and a pill-cutter (5$) to measure out the ingredients.
Initially I only made 2 days worth as I wasn’t sure if it’d be remotely palatable. I tried to get someone to record my spiel and first sample of the concoction, but alas it’s so hard to find good free help on a Monday afternoon these days. Here’s what I did get of my initial reaction:
After I consumed the first two batches over three days, I decided it was pretty good (it tastes rather bland and oaty and the texture is a bit gritty but not terrible) and went ahead and mixed up as much as I could with my remaining stores. I had enough for 13 batches total. I gave up eating it plain almost immediately in favor of adding various kinds of chocolate. It throws off the perfectly balanced nutrients a bit with extra sugar, but hey, it’s a nutritionally complete chocolate shake, so that’s pretty cool.
As of this writing I’ve consumed about 6 days worth. I’ve been getting somewhere between 50 and 75 percent of my daily calories from the soylent. I haven’t had any grand revelations, but I have noticed a few things. For one, it’s surprisingly filling, but it takes a few minutes to kick in. I felt a bit bloated one day after consuming too much at once. It’s not really much food by volume, but once my stomach started digesting my body could tell I’d eaten a lot. I’d also note that while it does suppress my hunger it doesn’t suppress appetite. I still found myself craving pizza and meat even though I wasn’t hungry. It makes for a very simple diet, but that doesn’t necessarily mean it will be an easy one for someone trying to lose weight.
I do think I have more energy while drinking soylent, but it’s not super pronounced. However, I shared a glass for lunch with one of my friends and he said it made him feel better than he had in a long time. It might be partially psychological, and it probably depends a lot on how good your diet was before. What I can say is that I’ve been drinking soylent for most of my meals for several days, and I haven’t gotten sick or suffered any significant problems. I did have one minor issue. Suffice to say I’m not used to consuming 100% of my daily value of fiber, but that went away after the first day.
I’ve only been eating it for a few days and not at the exclusion of other food. My batches are 2000 calories. My diet is quite obviously more than that. So I really can’t say anything about the long term effects, but in the short term it’s been pleasant. I have high hopes for the official Soylent. I’m not convinced it’ll change the world, but I do think it’ll change my breakfast.
P.S. I’m now operating as an independent consultant and accepting contracts under Inductive Bias LLC. I’m trained as a software engineer and an expert in optimization and artificial intelligence. I don’t so much write software as solve problems that need to be solved with science.