Transformer-Based Contextual Modeling for Predicting Calories From Recipes

Md. Siam Ansary, Amina Brinto
{"title":"Transformer-Based Contextual Modeling for Predicting Calories From Recipes","authors":"Md. Siam Ansary,&nbsp;Amina Brinto","doi":"10.1002/ail2.70036","DOIUrl":null,"url":null,"abstract":"<p>Accurate estimation of calorie content from text-based recipes is a challenging and non-trivial problem in automated dietary analysis and nutrition-aware computing. Existing methodstypically rely on shallow lexical features, sentence-level embeddings, or modular regression pipelines that struggle to capture fine-grained contextual and compositional information present in culinary text. In this paper, we propose an enhanced transformer-based regression framework that leverages contextual token representations and token-level attention pooling to directly predict calorie values from unstructured recipe descriptions. Unlike stacking-based or embedding-only approaches, the proposed model is fine-tuned end-to-end, enabling task-specific adaptation of representations and explicit weighting of calorie-relevant tokens. Extensive experiments conducted using five-fold cross-validation demonstrate that the proposed model significantly outperforms traditional lexical baselines, pretrained sentence embedding methods, and the previously introduced stacking-based transformer regression framework across all evaluation metrics. The proposed model achieves lower prediction error and higher explained variance, indicating superior calibration and generalization. These findings highlight the importance of token-level modeling and attention-based aggregation for text-based nutritional prediction. The proposed framework establishes a new state of the art in text-based caloric estimation and provides a strong foundation for future research in automated nutritional analysis and intelligent dietary support systems.</p>","PeriodicalId":72253,"journal":{"name":"Applied AI letters","volume":"7 3","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2026-07-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://onlinelibrary.wiley.com/doi/epdf/10.1002/ail2.70036","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Applied AI letters","FirstCategoryId":"1085","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1002/ail2.70036","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Accurate estimation of calorie content from text-based recipes is a challenging and non-trivial problem in automated dietary analysis and nutrition-aware computing. Existing methodstypically rely on shallow lexical features, sentence-level embeddings, or modular regression pipelines that struggle to capture fine-grained contextual and compositional information present in culinary text. In this paper, we propose an enhanced transformer-based regression framework that leverages contextual token representations and token-level attention pooling to directly predict calorie values from unstructured recipe descriptions. Unlike stacking-based or embedding-only approaches, the proposed model is fine-tuned end-to-end, enabling task-specific adaptation of representations and explicit weighting of calorie-relevant tokens. Extensive experiments conducted using five-fold cross-validation demonstrate that the proposed model significantly outperforms traditional lexical baselines, pretrained sentence embedding methods, and the previously introduced stacking-based transformer regression framework across all evaluation metrics. The proposed model achieves lower prediction error and higher explained variance, indicating superior calibration and generalization. These findings highlight the importance of token-level modeling and attention-based aggregation for text-based nutritional prediction. The proposed framework establishes a new state of the art in text-based caloric estimation and provides a strong foundation for future research in automated nutritional analysis and intelligent dietary support systems.

Abstract Image

从食谱中预测卡路里的基于变压器的上下文建模
在自动化饮食分析和营养感知计算中,从基于文本的食谱中准确估计卡路里含量是一个具有挑战性和重要的问题。现有的方法通常依赖于肤浅的词汇特征、句子级嵌入或模块化回归管道,这些方法难以捕获烹饪文本中呈现的细粒度上下文和组合信息。在本文中,我们提出了一个增强的基于转换器的回归框架,该框架利用上下文令牌表示和令牌级注意力池来直接预测非结构化食谱描述的卡路里值。与基于堆栈或仅嵌入的方法不同,所提出的模型是端到端微调的,支持特定于任务的表示适应和显式的卡路里相关令牌加权。使用五重交叉验证进行的大量实验表明,所提出的模型在所有评估指标上都明显优于传统的词汇基线、预训练的句子嵌入方法和先前引入的基于堆栈的转换回归框架。该模型具有较低的预测误差和较高的解释方差,具有较好的校正性和泛化性。这些发现强调了标记级建模和基于注意力的聚合对于基于文本的营养预测的重要性。提出的框架为基于文本的热量估算奠定了新的技术水平,为未来的自动化营养分析和智能饮食支持系统的研究奠定了坚实的基础。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书