MacroIQ
Problem & Motivation
Ask a large language model to create a recipe for "high-protein carbonara" and you usually get something that reads like a recipe, but falls apart in the kitchen. Traditional nutrition tools can tell you whether a meal meets your goals, but not how to redesign it without compromising the dish. The hard problem sits in between:
People want meals that satisfy their nutrition goals without sacrificing quality.
In practice, AI-generated recipes often fall flat once they leave the chat window. They miss the user's nutrition targets, drift so far from the original dish that the recipe no longer resembles what was requested, or recommend ingredient combinations that don't hold up in the kitchen. Underneath these failures is a lack of grounded reasoning: vague ingredient descriptions, inconsistent quantities, and nutrition estimates that don't reliably map to real values. Health-oriented home cooks need recommendations they can trust, not recipes that merely sound plausible.
MacroIQ treats this as a data science problem: start with real human-tested recipes and nutrition markers, propose data-driven ingredient edits, and leverage an LLM to check every candidate against the user’s goals before producing a recommendation.
Our Solution
MacroIQ is an agentic recipe design system that bridges the gap between language models and structured food science. Rather than asking an LLM to invent a recipe in one pass, MacroIQ grounds recipe generation in millions of human-created recipes, authoritative nutrition databases, and mathematical optimization. The system treats recipe design as an iterative decision-making problem: propose ingredient changes, measure their nutritional and culinary consequences, and continue refining until the recipe satisfies user constraints.
This approach allows MacroIQ to generate recipes that simultaneously satisfy macronutrient targets, accommodate dietary restrictions, and preserve dish identity while remaining explainable to the user. Every recommendation is accompanied by evidence showing how ingredient choices compare with similar real recipes and whether nutrition goals have actually been achieved.
Users interact with MacroIQ by naming a dish, specifying nutritional targets and dietary preferences, and observing the agent progressively redesign the recipe. Rather than producing a single opaque answer, the system exposes each optimization step, allowing users to both understand and trust why a recommendation was made.
Data Sources & Approach
Data
We used the following data sources to build our application:
- RecipeNLG: A dataset of over 2 million recipes complete with titles, ingredient lists/amounts, and cooking instructions.
- USDA FoodData Central: A repository of over 100,000 ingredients containing millions of macro and micronutrient markers, as well as portion and unit conversions.
- FoodOn: An ontology that indexes over 36,000 food concepts into hierarchical categories.
Our agent combines large public recipe collections (RecipeNLG) with the U.S. government’s food composition database (USDA FoodData Central), plus an ontology to link functionally similar ingredients (FoodOn) . Ingredient lines like "1 cup all-purpose flour" from recipes are linked to specific foods and gram amounts so that protein, carbohydrates, and fat can be calculated consistently across millions of recipes.
Together, this data let us model a large, diverse set of recipes not only as ingredient lists, but as distributions of taste and nutrients across several layers of abstraction.
Approach
For a given dish family (e.g. Spaghetti Carbonara), we look at many related human-generated recipes to learn what “typical” ingredient proportions look like. This gives us a grounded sense of which ingredients can change and by how much without losing the character of the dish, as well as what nutrition targets are realistic for a given set of ingredients.
On top of that, we use an agent loop that repeatedly:
- Checks whether the current recipe can hit the user’s nutrition and diet goals
- Proposes a small number of concrete edits (swap, insert, or delete ingredients)
- Re-scores the result with a mathematical optimizer that chooses amounts
- Keeps going only while the suggestion improves metrics
Language models help brainstorm recipe changes based on a user's request text input, and can loosely approximate nutrition and taste data by themselves. However, our food modeling based on verified, authoritative data holds the LLM's hand through each step of the recipe creation process to give users the creative power of an LLM coupled with the accuracy of USDA data. Metrics detailing whether the meal is actually in the user’s nutrient target range or whether ingredient proportions still resemble similar dishes come from structured datasets and optimization rather than the depths of old LLM training data. The result is a revolutionary agent armed with analytics to create meals grounded in the real world.
Evaluation
We compared MacroIQ to one-shot responses from a frontier language model (GPT-5.5) on the same recipe requests and nutrition targets. Both sides were scored the same way: map output ingredients to the nutrition database, calculate macros and ingredient ratios, then judge success. Evaluation covered three settings that matter to users: general recipe requests, accommodating dietary restrictions, and preserving dish identity under stretch nutrition goals.
Any single metric to measure a recipe's practicality can be misleading. You can hit nutrition targets and ruin the dish, or create something tasty that completely ignores a user's dietary and nutrition preferences. Thus, we report several scores together:
- Holistic Score (higher is better): LLM-judge overall quality score from 1-10
- Ingredient Ratio Loss (lower is better): how far ingredient proportions drift from typical recipes for that dish
- Nutrient Loss (lower is better): L1 how far the meal misses the user’s nutrition targets
| Suite | Model | Holistic ↑ | Ratio ↓ | Nutrient ↓ |
|---|---|---|---|---|
| Dietary Restrictions | MacroIQ | 3.25 | 0.202 | 0.161 |
| GPT-5.5 | 2.70 | 0.303 | 0.273 | |
| Preserve Identity | MacroIQ | 5.80 | 0.235 | 0.054 |
| GPT-5.5 | 3.92 | 0.290 | 0.130 | |
| General Quality | MacroIQ | 4.25 | 0.215 | 0.037 |
| GPT-5.5 | 4.50 | 0.286 | 0.122 |
Table 1: MacroIQ vs. GPT-5.5 on 3 sets of 50 recipe requests across 23 cuisine categories. For LLM-judge calibration, μ = 5.85 ± 1.40 holistic score on N = 150 human-generated recipes, with Spearman ρ=0.72 on N = 30 output recommendations vs. 4-human user study.
MacroIQ wins on Ratio and Nutrient in every suite. On Preserve Identity, its holistic score (5.80) nearly matches the human-recipe reference mean (5.85), while GPT-5.5 lags (3.92). Under Dietary Restrictions, MacroIQ leads on all three metrics. On General Quality, GPT-5.5 edges holistic slightly (4.50 vs 4.25), but MacroIQ remains clearly better on ratio and nutrient fit and produced promising results across a wide array of constraints.
Concrete failure modes for one-shot raw LLM drafts show up in head-to-head cases against our agent. Such GPT-5.5 errors include missing a protein target range, drifting far from typical dish proportions, or suggestion quality collapsing under a dietary ban so the “resolved” recipe is no longer anything like the meal the user asked for. MacroIQ’s edit-and-remeasure optimization loop is built to catch those failures before a suggestion is shown to the end user. This reduces the risk of hallucination and improves user confidence that a list of ingredients will actually work together in the real world.
Key Learnings & Impact
- Linking ingredient text to measurable food entries is half the battle. A polished recipe draft is not useful until ingredients resolve to real foods and amounts that match their function in the recipe. Bad linking caps all performance downstream. The nutrition embedding pipeline was the primary challenge of our project.
- Hitting nutrient marks is not the same as offering practical recipes. Without an explicit sense of what similar recipes look like, raw LLMs invent “macro plates” that no longer feel like the meal the user requested. MacroIQ gives access to meal plans users will actually want to stick to.
- Iterating with checks beats one-shot guesses Proposing small edits and re-measuring them beats asking a model for a finished recipe in one pass, especially under constraints. With our backend analytics, this is more than just Chain-of-Thought prompting, though. It is a data-driven agent that is both accurate and flexible enough to reliably balance a wide variety of user needs.
- Explainability builds trust. The core weaknesses of using LLMs for recipe suggestions are their lack of explainability and reputation for hallucination. MacroIQ compiles data from verified sources and shows how each output ingredient's amounts stack up against similar dishes that fellow humans have made and enjoyed. This gives users unprecedented transparency into the quality of their recommendations, and shifts the basis of trust from an opaque AI to the collective experience of real people.
If cooking suggestions become safer and more faithful, people get less “LLM theater” that looks great in chat and fails in the kitchen, and more practical recipes that are enjoyable and encourage users to pursue their goals. MacroIQ’s impact is that recipe design becomes auditable: dish identity, nutrition fit, and dietary rules are visibly checked against hard data rather than just convincingly claimed by a sycophantic LLM.
Our Contributions
- First-of-its-Kind food index We introduce an end-to-end pipeline that maps free-form recipe text to USDA FoodData Central entries, standardized gram quantities, and FoodOn ontology concepts, enabling recipes to be reasoned about quantitatively rather than purely as text. MacroIQ provides a truly novel model of food that more closely captures how recipes materialize in the real world.
- Grounded recipe optimization framework We model dish identity using ingredient distributions learned from large collections of human-created recipes, allowing nutritional modifications while preserving the defining characteristics of each dish.
- An analytics-guided agent architecture for recipe generation Instead of relying on one-shot LLM outputs, MacroIQ combines the best parts of language model creativity, mathematical optimization, and structured validation to iteratively improve recipes.
- An interpretable recipe recommendation interface Every recommendation exposes measurable evidence, including nutrition accuracy, ingredient similarity, and optimization progress. This allows users to audit rather than blindly trust the generated recipe.
- A benchmark demonstrating the value of grounded generation We compare MacroIQ against GPT-5.5 across nutrition accuracy, ingredient fidelity, and holistic recipe quality, showing that structured optimization substantially improves reliability for constrained recipe generation.
Future Work
MacroIQ demonstrates that grounding language models with structured nutrition data substantially improves recipe generation, but several opportunities remain.
- Beyond macros Future work could incorporate additional nutritional objectives such as micronutrients, glycemic index, allergen severity, and food cost, enabling optimization across a richer set of health and practical constraints.
- Richer culinary reasoning Including cooking techniques, ingredient chemistry, and flavor compatibility models—could improve recipe quality beyond ingredient-level optimization and enable increasingly ambitious redesigns of traditional dishes.
- Broader dish coverage Refining the nutritional resolution pipeline to cache common ingredient mappings and reduce LLM inference costs could greatly expand our usable recipe corpus from 10K+ to 1M+ recipes, improving recipe neighborhood relevance and providing even more fine-grained representations of how humans cook.
- Faster interactive loops: Reduce latency so multi-step recipe redesign feels as immediate as a chat reply without sacrificing grounded optimization and validation. This would make the system more responsive while preserving the iterative checks that ensure recipes remain nutritionally accurate and faithful to the original dish.
- Interactive optimization Between the FoodOn ontology, our modular optimization framework, and LLM reasoning, we could give the user a virtually unlimited number of ways to optimize their dish. Asking for recipes with more of a specific ingredient, optimizing joint ratios between subsets of ingredients, and strategizing how to prep modular food components for nutrition, feasibility, and scale are just a few possibilities our current framework could be extended to support.
Acknowledgements
We thank the UC Berkeley I School / MIDS Capstone program and the instructors of Data Science 210 for guidance and evaluation structure. This project relies on public recipe and nutrition resources such as USDA FoodData Central and open recipe corpora, and on classmates and partners who cooked, tasted, and critiqued suggestions during development.
