FoodVitals: A Diagnostic Benchmark for LLMs on Nutritional Literacy, Nutrient-Health Relations, and Food Safety
Large Language Models (LLMs) are increasingly deployed in high-stakes, food-facing roles such as nutrition counselling, dietary planning, cooking assistants, or food-safety chatbots. FoodVitals provides a unified diagnostic benchmark for evaluating the foundational food knowledge of these models.
Intended diagnostic use: FoodVitals is intended as a pre- and post-deployment auditing tool. Practitioners can run the released harness on a candidate or fine-tuned model to locate failure modes (e.g., the magnitude-reasoning gap or format-induced safety regression) before exposing end-users to them, and to re-run the same audit after fine-tuning to verify that domain adaptation has not introduced new high-stakes errors.
Evaluating six instruction-tuned LLMs using FoodVitals reveals two consistent patterns:
- Magnitude-Reasoning Gap (Nutritional Literacy): Models that correctly identify the highest-nutrient food in a multiple-choice setting cannot reliably rank or threshold-check the same nutrients. This exposes a gap between associative recall and quantitative reasoning.
- Format-Induced Regression (Food Safety): Food-safety performance varies substantially across answer formats (MCQ, Y/N, Short Answer) even when all formats draw from the same regulatory topic set. This means a high score in one format does not reflect uniform competence across that topic area, motivating the need for multi-format auditing.
The full dataset and auxiliary files for FoodVitals are hosted on Figshare: 10.6084/m9.figshare.32455959.
To run the evaluation, you must download specific files from the link above and place them into the corresponding folders in this repository. See the detailed instructions below for each aspect.
This repository is organized into distinct folders corresponding to the aspects of food knowledge described in our paper.
This aspect tests the model's ability to recall nutrient density and rank foods based on nutritional content, grounded in USDA FoodData Central.
Setup Instructions:
- Download the
nutrient_datafolder (contains raw files with food names and nutrient density lists used to build the QA). - Download
a1_nutritional_literacy_qa.csv(the final QA benchmark dataset). - Place both the
nutrient_datafolder anda1_nutritional_literacy_qa.csvinsidea1_nutritional_literacy/.
Code Usage:
- Inference: Use
infer_qwen.py,infer_flan.py, orinfer_llama.pyto generate answers. To switch model sizes, modify theMODEL_IDvariable inside the script. - Evaluation: Use
eval_qwen.py,eval_flan.py, oreval_llama.py. These scripts contain the cleaning logic and metric calculations. - Robustness:
shuffle_mc.ipynbis provided for shuffling Multiple Choice Questions to ensure anti-bias evaluation.
Evaluates the understanding of health claims based on the EFSA Food Health Claims Knowledge Graph.
Setup Instructions:
- Download
a2_health-nutrient_qa.csv(the final QA dataset). - Place it inside
a2_functional_health/.
Code Usage:
- Generation Logic:
gpt_prompt.pycontains the logic used to create the dataset. - Inference: Run
infer_health_qwen.py,infer_health_llama.py, orinfer_health_flan.py. - Evaluation: Run
evaluate_health.pyafter inference to compute metrics. - Robustness:
shuffle_mc.pyhandles MCQ shuffling.
Assesses adherence to food safety guidelines using a dataset created via GPT generation and manual filtering, grounded in USDA FSIS guidelines.
Setup Instructions:
- Download
a3_food_safety.jsonl(the final QA dataset). - Place it inside
a3_food_safety/.
Code Usage:
- Inference: Run
infer_flan.py,infer_llama.py, orinfer_qwen.py. Ensure thea3_food_safety.jsonlfile is present. - Generation:
gpt_qa.pycontains the code used to generate the initial QA pairs before manual filtering.
FoodVitals, its the evaluation harness are publicly released at https://github.com/niluminous/FoodVitals.
The release of FoodVitals follows FAIR-aligned practices:
- Findable: Items are discoverable via a persistent Digital Object Identifier (DOI) and indexed repository metadata.
- Accessible: Data is retrievable over HTTPS via the open repository platform with no authentication requirements.
- Interoperable: The dataset utilizes a unified typed schema across CSV and JSONL formats.
- Reusable: The repository includes a Datasheet for Datasets, open-source construction pipelines, and comprehensive upstream provenance manifests detailing the source mappings.
All upstream sources (USDA FoodData Central, USDA FSIS, and the EFSA-derived Health Claims KG) permit redistribution for research under their original terms.
Ethics: FoodVitals is a diagnostic benchmark and not a substitute for clinical, dietary, or food-safety advice, as stated in the datasheet. The current benchmark is grounded primarily in Western regulatory sources (USDA/EFSA). Future work will extend coverage to non-Western regulatory frameworks.
