NutriPepper: Grounded RAG Backend for Food Safety & Nutrition

- 810
- verified knowledge chunks indexed
- 1.00
- Kenya-specific relevance (target 0.80)
- 0.79
- mean grounding score across 64 interactions
- 75%
- answers with inline source citations
Large language models can answer a nutrition question in seconds, but they answer from memory, and in a health-adjacent domain, a confident wrong answer is worse than no answer. General-purpose tools also tend to be global and text-only, with little grounding in Kenyan foods, dietary habits or public-health guidance. Put that model inside a humanoid robot and the risk grows: people instinctively trust a machine that speaks, gestures and looks them in the eye.
NutriPepper is a RAG backend that grounds every answer in 810 indexed chunks from six authoritative sources: the FAO/Kenya Food Composition Tables, Kenya's Nutrient Profile Model, the Kenya Nutrition Action Plan, national healthy-diet guidelines, the WHO Healthy Diet Fact Sheet and the FAO/WHO Codex hygiene principles. Retrieval runs before any generation, so the model may only reason from the passages it returns. Every answer carries inline citations, a rule-based guard blocks diagnosis and prescription requests, and an asynchronous NLI verifier checks each claim against its source after the response has been sent. The same backend serves the Pepper humanoid robot: one endpoint returns beat-by-beat lessons with speech, gesture and tablet cues for NAOqi, and another produces long-form narrative lessons for facilitators.
Evaluated on 30 retrieval queries and 64 verified interactions:
810 chunks indexed from six authoritative sources
1.00 Kenya-specific relevance, against a 0.80 target
0.79 mean grounding score (42 grounded, 17 partial, 5 ungrounded)
75% of answers included an inline citation
Precision@3 0.77 and MRR 0.68; food-safety retrieval (MRR 0.80) clearly outperformed nutrition (0.57), exposing a PDF-cleaning problem with tabular nutrient data
Latency is the honest weak point: mean 12.8s and P95 35s, driven by synchronous LLM calls. Streaming, async generation and caching are the first items on the roadmap.
Retrieval is deliberately hybrid. Dense semantic search with all-mpnet-base-v2 finds conceptually related passages; BM25 catches exact food and nutrient terms that embeddings blur; reciprocal rank fusion merges the two lists, and a cross-encoder (ms-marco-MiniLM-L-6-v2) reranks the top candidates. The whole pipeline is hand-orchestrated in FastAPI instead of hidden behind a framework, so every stage can be inspected, tested and measured.
Two endpoints serve the robot: one returns beat-by-beat lessons (speech, gesture tags and tablet visuals for NAOqi), and the other produces long-form narrative lessons for facilitators. Every interaction is logged asynchronously with its retrieved chunks, latency, citations and grounding scores, which is what made a real evaluation possible.
For a health-critical system, orchestration and grounding guarantees matter more than raw model capability. Hand-building the pipeline made each failure mode visible: a retrieval miss, an unsupported claim and a slow response are different problems, and they need different fixes. The biggest lesson was that evaluation is what turns a demo into an engineering result; measuring retrieval, grounding, citation and latency separately showed exactly where the system was strong and where the next iteration had to go.


- NutriPepper: Feeding a Robot What It Knows12 November 2026
- NutriPepper: Building an AI Robot That Cannot Lie25 August 2026
Gift