代码漏洞导致模型训练能耗飙升,影响环境可持续性。
The Hidden Environmental Cost of Poor Coding Practices in TensorFlow and Keras Applications: A Study on Resource Leaks and Carbon Emissions

- 检测并量化了两种常见代码缺陷对资源的隐性泄漏
- 资源泄漏使电力消耗上升32%~46%,碳排放相应增加
- 适合关注绿色AI与代码质量的开发者和研究者
在机器学习应用开发与部署中,效率与可持续性至关重要。资源泄漏会引入隐藏的低效问题,导致能耗与二氧化碳排放升高。尽管如此,其环境影响尚缺乏实证数据。本文首次对两种常见的资源泄漏模式——不当模型复用(IMR)与未释放张量引用(UTR)进行了实证研究,分析其在TensorFlow和Keras工作负载中的能源消耗与碳排放影响。通过控制实验,在相同训练任务下对比无缺陷基线,结果表明:IMR和UTR分别使电力消耗增加约32%和46%,碳排放同比上升。配对统计检验显示差异系统且显著,初步证实资源泄漏会降低机器学习能效与环境可持续性。研究强调应将资源生命周期管理与能效考量纳入机器学习开发流程。
原文摘要 · Abstract (English)
Efficiency and sustainability are critical considerations in the development and deployment of machine learning (ML) applications. Among the factors influencing sustainability, resource leaks in ML code can introduce hidden inefficiencies that elevate energy consumption and CO2 emissions. Despite this, empirical evidence quantifying their environmental impact remains limited. This emerging results paper presents an initial empirical investigation of two common resource-leak smells, namely Improper Model Reuse (IMR) and Unreleased Tensor References (UTR), and their impact on energy consumption and CO2 emissions in TensorFlow and Keras workloads. Controlled experiments were conducted for each smell by executing identical training tasks while comparing against a smell-free baseline. Our preliminary results show that both smells consistently increase estimated electricity usage and carbon emissions. IMR and UTR increased electricity consumption by approximately 32% and 46%, respectively, with proportional increases in CO2 emissions. Paired statistical tests indicate that these differences are systematic and statistically significant, providing initial empirical evidence that resource-leak smells may degrade ML energy efficiency and environmental sustainability. These findings suggest that resource-leak smells pose measurable risks to both software quality and sustainability, emphasizing the importance of integrating resource-lifecycle management and energy-efficiency considerations into ML development.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。