benjac8/bio-bite-recovery-nutrition
Bio-Bite — Recovery Nutrition Dataset A synthetic dataset of 10,000 recovery profiles paired with matching recovery recipes. Each row links a physiological state (strain, sleep, HRV) to a rule-grounded nutritional target and a generated recipe intended to address it. Built for the Bio-Bite project: an app that reads the recovery data a smartwatch already collects — strain, sleep, HRV — and turns it into a personalized recovery meal and a next-day plan. Dataset… See the full description on the dataset page: https://huggingface.co/datasets/benjac8/bio-bite-recovery-nutrition.
Bio-Bite — Recovery Nutrition Dataset
A synthetic dataset of 10,000 recovery profiles paired with matching recovery recipes. Each row links a physiological state (strain, sleep, HRV) to a rule-grounded nutritional target and a generated recipe intended to address it.
Built for the Bio-Bite project: an app that reads the recovery data a smartwatch already collects — strain, sleep, HRV — and turns it into a personalized recovery meal and a next-day plan.
Dataset summary
Features
How it was built (and why it's defensible)
The physiology → nutrition mapping is encoded in code, not invented by the model. For each of the 6 recovery categories, recovery-nutrition heuristics (protein-containing foods after resistance exercise, carbohydrate-containing foods after endurance work, nutrient-dense foods for general recovery, and fluids/electrolytes after heavy sweating) define the Nutritional_Need and plausible ranges for strain/sleep/HRV. The language model writes the recipe against that target.
Two deterministic generation-time guardrails reject many non-compliant outputs before they enter the dataset:
- Dietary guardrail — regex rejection of any recipe containing an ingredient disallowed by its
diet_tag(with plant-compound exceptions so "almond milk" and "peanut butter" aren't false positives). - Language guardrail —
langdetectrejection of any non-English output.
EDA findings
Size & balance
10,000 rows × 17 features. All three categorical dimensions are well balanced, with no dominant class:
- Recovery goals: sleep-deprived (1,778) → strength-recovery (1,549); max/min ratio 1.15
- Cuisines: Italian (1,329) → Mexican (1,138); ratio 1.17
- Diets: vegetarian (2,143) → vegan (1,787); ratio 1.20
Recovery goals, cuisines and diets are evenly represented — no dominant class.
Distributions of every numeric feature. Note the long right tails on `magnesium_mg` and `calories`, discussed under limitations below.
Data quality
The stricter audit was added after the original EDA. It conservatively flags 5 vegan-tagged recipes containing `ghee` and 90 gluten-free-tagged rows that name at least one potentially gluten-containing grain (wheat, barley, farro, spelt, bulgur, or seitan). These flags expose a real limitation of the first regex checker; they are not silently removed because doing so would invalidate the published embedding row order. The app applies a broader downstream guardrail, and the dataset must not be treated as allergen-certified.
The encoded science shows up in the data
Mean values per recovery goal — every prediction from the encoded principles is borne out:
- Strength-recovery has the highest protein (24.1 g) — 65% above the next-highest category. Muscle repair signal is clear.
- Endurance-recovery has the highest carbs (58.0 g) — glycogen replenishment.
- Sleep-deprived and high-stress have the highest magnesium (179.8 / 180.9 mg) — this reflects an encoded dataset heuristic, not evidence that a meal treats insomnia, anxiety, stress, or cortisol levels.
- Sleep-deprived has by far the shortest prep (14.7 min) vs 32.3 for rest-day — exhausted users get fast meals.
The encoded rules are visible in the data: protein peaks for strength-recovery, carbohydrate for endurance-recovery, and magnesium for the sleep-deprived and high-stress states.
Prep-time distribution per goal. The sleep-deprived band is both lower and tighter — the generation constraint held.
Ingredient profiles differ by recovery state: protein sources dominate strength-recovery, while greens, seeds and nuts dominate the sleep-deprived and high-stress meals.
Correlations — and an important nuance
Pairwise correlations with the physiological inputs are weak: strain_level ↔ protein_g = 0.21 and sleep_hours ↔ magnesium_mg = −0.12.
The directions are correct (more strain → more protein; less sleep → more magnesium), but the magnitudes are small because the relationship is mediated by `recovery_category`, not linear in the raw numbers. Strain ranges overlap across categories by design (a strain of 13 could be strength-recovery or sleep-deprived), so the grouped means above are the honest measure of effect — a 65% protein difference between categories that a linear correlation of 0.21 badly understates. This is why the recommender matches on the state description, not on raw numeric distance.
Stronger structural correlations appear where you'd expect within recipes: calories ↔ protein_g = 0.57, calories ↔ fat_g = 0.44, calories ↔ carbs_g = 0.43, and sleep_hours ↔ hrv = 0.55 (both encoded as recovery indicators).
The two targeted relationships. The trend directions are correct but the slopes are shallow — the effect is carried by `recovery_category`, not by the raw numbers.
Model artifacts flagged (limitations)
Being sceptical of synthetic data, the following generator artifacts were identified and are documented rather than hidden:
- Macros are LLM estimates, not computed from ingredient nutrition tables. Relative patterns across categories are reliable; absolute values are approximate.
- Implausible extremes survive validation:
protein_gandfat_greach a minimum of 0, andmagnesium_mgreaches 970 mg (far above a realistic single-meal amount). Range bounds caught gross errors but not all edge cases. - 240 meals under 250 kcal — light for a recovery meal; some outputs are snacks rather than full meals.
- Outliers (IQR): calories 607, protein 504, magnesium 220, carbs 76, fat 170, prep time 3. Retained deliberately — culinary variety produces genuinely wide macro ranges — but flagged for downstream use.
- Minor formatting inconsistency in instruction numbering (
1.vs#1). - Diet-label conflicts require manual review: a stricter 5 Aug 2026 audit flagged 95 rows that the original checker missed (5 vegan/ghee and 90 gluten-free/potentially gluten-containing grain conflicts). This is documented rather than hidden; correcting the rows requires a versioned dataset release and regenerated embeddings.
Intended use & limitations
⚠️ Educational prototype — not medical or nutritional advice. This dataset is synthetic and generated by a language model; it has not been reviewed by a registered dietitian. It is intended for research and educational use in recommendation and generation systems. Consult a qualified professional for personal nutrition or training guidance.
Scientific claim boundaries and sources are documented in SCIENTIFIC_BASIS.md.
Assignment alignment
The Space contains the saved embedding file, recommendation code, generation code and three one-click Quick Starters required by the brief. The Dataset, Model and Space are kept as three separate, linked Hugging Face repositories.
Retrieval and generation evaluation v2
Method scope: classification, regression and clustering
Bio-Bite is primarily a retrieval and recommendation system, not a classical supervised-learning pipeline. It does not train K-Means clusters or a regression model. The six recovery_category values are predefined, rule-grounded labels; they were not discovered by clustering. In the app, a classification-like router selects one of those six categories by combining semantic retrieval (65%) with an explainable wearable-range fit (35%). This is a deterministic hybrid routing decision, not a separately trained classifier. Correlation and grouped-mean analyses are reported in the EDA, but no continuous nutrition target is predicted with regression.
The repository includes a leakage-free retrieval benchmark with 72 balanced queries (12 per recovery category). recovery_category and Nutritional_Need are excluded from the embedded corpus text. Results include precision@3 with a bootstrap 95% confidence interval, MRR, nDCG@10, per-category metrics and latency. TF-IDF scored precision@3 = 0.634; e5-small-v2 was the best neural retriever at 0.551 and is published as the clearly attributed, non-fine-tuned `benjac8/biobite-retriever` deployment snapshot.
Generation was evaluated deterministically on 18 cases spanning all six categories, diets, ingredient exclusions and preparation-time limits. Qwen/Qwen2.5-3B-Instruct won with a 66.7% overall pass rate, 77.8% valid JSON and a 100% science-claim pass rate. Invalid generations are rejected by the app and handled through its documented graceful-degradation path.
After deployment, the live ZeroGPU Space passed all eight required end-to-end scenarios functionally: Strength, Endurance, Sleep, Stress, Rest, Hydration, conflicting text/structured sleep values, and Vegan/no-nuts/15-minute constraints. The latest saved run returned three recommendations, a validated recipe and a next-day plan in every case. On 4 Aug 2026 the model generated 1/8 recipes and the constraint-preserving deterministic fallback served 7/8 after the free daily ZeroGPU quota was exhausted. Screenshot OCR was separately verified with Sleep 5.5 h, Strain 18.2 and HRV 32. The test artifact records generator use separately from functional success.
Reproducibility
All randomness is seeded (SEED = 42; chunk seeds 1–6). The generation notebook (data_generation.ipynb) and the EDA notebook (Part2_EDA.ipynb) are included in this repository and run top-to-bottom on a free Colab GPU.
Files
biobite_full_clean.csv— the dataset (10,000 rows)data_generation.ipynb— synthetic data generationPart2_EDA.ipynb— exploratory data analysisnotebooks/Part3_Embeddings_RecSys.ipynb— executed model comparison and recommender checksnotebooks/Part4_Generation.ipynb— executed generation-model comparisoneda_plots/— all figures from the EDA (displayed above)evaluation/— v2 benchmark scripts and fixed evaluation casesartifacts/evaluation_v2/— generated comparison tables and configurationsevaluation/dietary_audit_20260805.py— reproducible stricter diet-label auditartifacts/dietary_audit_20260805.csv— the 95 rows flagged for manual reviewartifacts/live_space_tests_20260804.json— latest recorded 8/8 live verification
