Personalized Food Recommendation as Constrained Question Answering over a Large-scale Food Knowledge Graph

Yu Chen, Ananya Subburathinam, Ching-Hua Chen, Mohammed J. Zaki

TL;DR

Researchers have reframed personalized food recommendation as a constrained Question Answering (QA) problem over a massive knowledge graph. Their system, pFoodReQ (pronounced "FoodRec"), outperforms standard recommendation baselines by nearly 60% by treating a user's health guidelines and allergies as explicit logical constraints rather than just "preferences."

What Problem Does This Paper Address?

Most food recommendation systems treat the problem as a "black box" of matrix completion: if you liked pizza, you might like lasagna. However, food is high-stakes. A good recommendation must balance three often-conflicting pillars:

  1. Explicit Intent: "I want a breakfast dish with bread."
  2. Personal Preferences: "I hate onions."
  3. Health Constraints: "I have type 2 diabetes and need low-carb options."

Traditional systems struggle to integrate these. They often ignore explicit queries, fail to account for crucial health factors (like allergies), or miss out on the rich, structured data available in food ontologies. This paper addresses the gap by moving from "matching" to "reasoning" over a Knowledge Graph (KG).

Methods

The authors introduce pFoodReQ, a framework that treats personalization as a set of additional constraints appended to a natural language query. The architecture consists of three core innovations:

  • Query Expansion (QE): It takes a raw query and automatically appends the user's "persona" (e.g., "does not have peanuts, contains 5g-30g carbs").
  • KG Augmentation (KA): Neural networks are notoriously bad at math (e.g., "is 25 between 5 and 30?"). To fix this, the system performs symbolic numerical comparisons on the KG before the neural model sees it, tagging nodes that meet the health guidelines.
  • Constraint Modeling (CM): Standard models often confuse "contains X" with "does not contain X." The authors use a specialized embedding-based markup to explicitly signal to the model which words are positive constraints, negative constraints (negations), or just padding.
  • Food Log Integration: To maintain the "classic" recommendation feel, they use recipe embeddings to calculate similarity between the user's eating history and potential candidates, blending this score with the KBQA confidence score.

Datasets

The authors created a new benchmark for this task:

  • FoodKG: A large-scale knowledge graph containing over 1 million recipes, ingredients, and nutritional data.
  • Personalized KBQA Benchmark: They analyzed ~200 Reddit submissions (from subreddits like r/1200isplenty and r/diabetes) to create 56 realistic question templates. They then generated a dataset of 4,621 training and 2,269 test instances, incorporating American Diabetes Association (ADA) lifestyle guidelines as health constraints.

Key Insights and Ideas

  • Recommendation as QA: The biggest "aha" moment is that recommendation isn't just about similarity; it's about satisfiability. By treating it as a QA task, the system can provide "hard" guarantees (e.g., "this recipe definitely doesn't have your allergen").
  • The Negation Problem: Neural models often treat "no peanuts" and "peanuts" similarly because the word "peanuts" appears in both. The Constraint Modeling markup is a simple but highly effective way to force the model to respect negations.
  • Hybrid Reasoning: The system combines symbolic reasoning (for numbers and logic) with neural embedding (for semantic similarity), getting the best of both worlds.

Key Results

  • Massive Performance Gains: pFoodReQ achieved a 62.7% MAP (Mean Average Precision), representing a 59.7% absolute improvement over non-personalized KBQA baselines.
  • Personalization is the Key: Even simple models (like Bag-of-Words) saw performance jumps when the personalized constraints were added via Query Expansion, proving that context is king in food recs.
  • Human Validation: In a blind study, human evaluators rated pFoodReQ's recommendations significantly higher (7.76/10) than the state-of-the-art BAMnet baseline (3.82/10).

Limitations and Future Work

While impressive, the system currently relies on template-based question generation, which might not capture the full linguistic variety of real-world users. Additionally, the "persona" (allergies and guidelines) is currently provided as structured data.

The authors suggest that future work should focus on automatically mining these preferences and health constraints from a user's historical behavior or natural language food logs, rather than requiring manual input. There is also room to improve the "reasoning" depth for complex queries that require multi-hop navigation across the Knowledge Graph.

Summary updated

Abstract

Food recommendation has become an important means to help guide users to adopt healthy dietary habits. Previous works on food recommendation either i) fail to consider users' explicit requirements, ii) ignore crucial health factors (e.g., allergies and nutrition needs), or iii) do not utilize the rich food knowledge for recommending healthy recipes. To address these limitations, we propose a novel problem formulation for food recommendation, modeling this task as constrained question answering over a large-scale food knowledge base/graph (KBQA). Besides the requirements from the user query, personalized requirements from the user's dietary preferences and health guidelines are handled in a unified way as additional constraints to the QA system. To validate this idea, we create a QA style dataset for personalized food recommendation based on a large-scale food knowledge graph and health guidelines. Furthermore, we propose a KBQA-based personalized food recommendation framework which is equipped with novel techniques for handling negations and numerical comparisons in the queries. Experimental results on the benchmark show that our approach significantly outperforms non-personalized counterparts (average 59.7% absolute improvement across various evaluation metrics), and is able to recommend more relevant and healthier recipes.
BibTeX
@inproceedings{chen2021personalized,
  author = {Yu Chen and Ananya Subburathinam and Ching-Hua Chen and Mohammed J. Zaki},
  title = {{Personalized Food Recommendation as Constrained Question Answering over a Large-scale Food Knowledge Graph}},
  booktitle = {WSDM},
  year = {2021},
  url = {https://openreview.net/forum?id=wss70pnpHt},
}

Loading related content...

Figure