A Constraint-Aware Knowledge Graph RAG Framework for Personalized Food Recommendation

A Constraint-Aware Knowledge Graph RAG Framework for Personalized Food Recommendation

Authors

  • Jia Yu School of Computer and Artificial Intelligence, Beijing Technology and Business University, Beijing 102488, China
  • Tong Ji School of Computer and Artificial Intelligence, Beijing Technology and Business University, Beijing 102488, China
  • Jiamin Zheng School of Computer and Artificial Intelligence, Beijing Technology and Business University, Beijing 102488, China

DOI:

https://doi.org/10.63808/fewn.v2i3.428

Keywords:

Food Recommendation, Knowledge Graph, Retrieval-Augmented Generation, Large Language Models, Constraint Satisfaction

Abstract

To address the issues of knowledge hallucination, insufficient constraint satisfaction, and opaque recommendation rationale in Large Language Models (LLMs) during food recommendation tasks, this paper proposes a personalized food recommendation method based on Constraint-Aware Knowledge Graph Retrieval-Augmented Generation (RAG). First, the method performs intent recognition and constraint extraction on users' natural language requirements, transforming meal types, calorie limits, nutritional goals, allergy contraindications, and user preferences into structured query conditions. Subsequently, it retrieves relevant candidate dishes, ingredients, and nutritional subgraphs within the food knowledge graph. On this basis, a recommendation ranking function is designed, incorporating constraint matching, nutritional balance, user preferences, graph path relevance, and risk penalties. Finally, the ranked results and evidence subgraphs are input into the LLM as retrieval-augmented context to generate interpretable meal suggestions.  Experimental results show that, compared with existing methods, the proposed method achieves superior performance in recommendation accuracy, constraint satisfaction rate, and response faithfulness. Furthermore, sensitivity analyses, performance evaluations and case studies provide further evidence that constraint-aware knowledge graph RAG can significantly enhance the reliability and explainability of food recommendation.

References

[1] Ceccaldi, E., Niewiadomski, R., Mancini, M., & Volpe, G. (2022). What's on your plate? Collecting multimodal data to understand commensal behavior. Frontiers in Psychology, 13, Article 911000. https://doi.org/10.3389/fpsyg.2022.911000

[2] Misra, N. N., Dixit, Y., Al-Mallahi, A., Bhullar, M. S., Upadhyay, R., & Martynenko, A. (2020). IoT, big data, and artificial intelligence in agriculture and the food industry. IEEE Internet of Things Journal, 9(9), 6305–6324. https://doi.org/10.1109/JIOT.2020.2998584

[3] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems (Vol. 30, pp. 5998–6008). https://doi.org/10.48550/arXiv.1706.03762

[4] Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D., Wu, J., Winter, C., … Amodei, D. (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems (Vol. 33, pp. 1877–1901). https://doi.org/10.5555/3495724.3495883

[5] Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., & Chen, W. (2022). LoRA: Low-rank adaptation of large language models. In Proceedings of the 10th International Conference on Learning Representations. https://openreview.net/forum?id=nZeVKeeFYf9

[6] Dettmers, T., Pagnoni, A., Holtzman, A., & Zettlemoyer, L. (2023). QLoRA: Efficient finetuning of quantized large language models [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2305.14314

[7] Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W.-t., Rocktäschel, T., Riedel, S., & Kiela, D. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems (Vol. 33, pp. 9459–9474). https://doi.org/10.5555/3495724.3496517

[8] Borgeaud, S., Mensch, A., Hoffmann, J., Cai, T., Rutherford, E., Millican, K., Van Den Driessche, G., Lespiau, J.-B., Damoc, B., Clark, A., de Las Casas, D., Guy, A., Menick, J., Ring, R., Hennigan, T., Huang, S., Maggiore, L., Jones, C., Cassirer, A., … Sifre, L. (2022). Improving language models by retrieving from trillions of tokens. In Proceedings of the 39th International Conference on Machine Learning (Vol. 162, pp. 2206–2240). PMLR. https://proceedings.mlr.press/v162/borgeaud22a.html

[9] Nakano, R., Hilton, J., Balaji, S., Wu, J., Ouyang, L., Kim, C., Hesse, C., Jain, S., Kosaraju, V., Saunders, W., Jiang, X., Cobbe, K., Eloundou, T., Krueger, G., Button, K., Knight, M., Chess, B., & Schulman, J. (2021). WebGPT: Browser-assisted question-answering with human feedback [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2112.09332

[10] Wang, Z., Teo, S. X., Chew, J. J., & Lim, Y. (2025). InstructRAG: Leveraging retrieval-augmented generation on instruction graphs for LLM-based task planning. In Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval (pp. 1413–1422). Association for Computing Machinery. https://arxiv.org/abs/2504.13032

[11] Min, W. Q., Liu, C. L., Xu, L. Y., & Jiang, S. Q. (2022). Applications of knowledge graphs for food science and industry. Patterns, 3(5), Article 100484. https://doi.org/10.1016/j.patter.2022.100484

[12] Ma, P., Tsai, S., He, Y., Jia, X., Zhen, D., Yu, N., Wang, Q., Ahuja, J. K. C., & Wei, C.-I. (2024). Large language models in food science: Innovations, applications, and future. Trends in Food Science & Technology, 148, Article 104488. https://doi.org/10.1016/j.tifs.2024.104488

[13] Pan, S., Luo, L., Wang, Y., Chen, C., Wang, J., & Wu, X. (2024). Unifying large language models and knowledge graphs: A roadmap. IEEE Transactions on Knowledge and Data Engineering, 36(7), 3580–3599. https://doi.org/10.1109/TKDE.2024.3352100

[14] Yang, W., Some, L., Bain, M., & Wang, Y. (2025). A comprehensive survey on integrating large language models with knowledge-based methods. Knowledge-Based Systems, Article 113503. https://doi.org/10.1016/j.knosys.2025.113503

[15] Peng, C. Y., Xia, F., Naseriparsa, M., & Osborne, F. (2023). Knowledge graphs: Opportunities and challenges. Artificial Intelligence Review, 56(11), 13071–13102. https://doi.org/10.1007/s10462-023-10465-9

[16] Hogan, A., Blomqvist, E., Cochez, M., d'Amato, C., de Melo, G., Gutierrez, C., Kirrane, S., Labra Gayo, J. E., Navigli, R., Neumaier, S., Ngonga Ngomo, A.-C., Polleres, A., Roomp, K., Sack, H., Sequeda, J., & Simperl, E. (2021). Knowledge graphs. ACM Computing Surveys, 54(4), 1–37. https://doi.org/10.1145/3447772

[17] Bao, J., Duan, N., Yan, Z., & Zhao, W. (2016). Constraint-based question answering with knowledge graph. In Proceedings of the 26th International Conference on Computational Linguistics (COLING) (pp. 2503–2514). Association for Computational Linguistics.

[18] Wang, X., He, X., Cao, Y., Liu, M., & Chua, T.-S. (2019). KGAT: Knowledge graph attention network for recommendation. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (pp. 950–958). Association for Computing Machinery. https://doi.org/10.1145/3292500.3330989

[19] Chen, Y., Guo, Y., Fan, Q., Zhang, Q., & Dong, Y. (2023). Health-aware food recommendation based on knowledge graph and multi-task learning. Foods, 12(10), Article 2079. https://doi.org/10.3390/foods12102079

[20] Ma, W., Li, M., Dai, J., Ding, J., Chu, Z., & Chen, H. (2024). Nutrition-related knowledge graph neural network for food recommendation. Foods, 13(13), Article 2144. https://doi.org/10.3390/foods13132144

[21] Felfernig, A., Friedrich, G., Jannach, D., & Zanker, M. (2015). Constraint-based recommender systems. In F. Ricci, L. Rokach, B. Shapira, & P. B. Kantor (Eds.), Recommender systems handbook (2nd ed., pp. 161–197). Springer. https://doi.org/10.1007/978-1-4899-7637-6_5

[22] Hoekstra, A. Y., & Chapagain, A. K. (2008). Globalization of water: Sharing the planet's freshwater resources. Blackwell Publishing.

[23] U.S. Department of Agriculture, Agricultural Research Service, Beltsville Human Nutrition Research Center. (n.d.). FoodData Central. https://fdc.nal.usda.gov/

Downloads

Published

2026-08-16
Loading...