编程语言影响AI能耗,解释型语言最多耗能54倍。
Green AI: Which Programming Language Consumes the Most?
- 对比五种语言在七种算法上的能耗表现
- 解释型语言最高耗能达编译型54倍,训练与推理效率各异
- 算法实现比语言选择更关键,兼顾易用性与节能
人工智能对环境资源的需求持续增长。尽管编程语言可能影响AI的能源效率,但其具体作用尚不明确。本研究通过控制实验,比较了C++、Java、Python、MATLAB和R五种语言,在七种算法(KNN、SVC、AdaBoost、决策树、逻辑回归、朴素贝叶斯、随机森林)和三个数据集上,涵盖训练与推理阶段的能耗。结果表明,编译型和半编译型语言(如C++、Java)能耗显著低于解释型语言(Python、MATLAB、R),后者最高可达54倍。某些语言在训练阶段更高效,另一些在推理阶段表现更优,而具体哪种语言最耗能,取决于所使用的算法。最终发现,算法实现方式是决定绿色AI的关键因素,远超语言选择本身。因此,实现绿色AI无需颠覆现有开发实践,应在能效与开发便捷性间权衡。
原文摘要 · Abstract (English)
AI is demanding an evergrowing portion of environmental resources. Despite their potential impact on AI environmental sustainability, the role that programming languages play in AI (in)efficiency is to date still unknown. With this study, we aim to understand the impact that programming languages can have on AI environmental sustainability. To achieve our goal, we conduct a controlled empirical experiment by considering five programming languages (C++, Java, Python, MATLAB, and R), seven AI algorithms (KNN, SVC, AdaBoost, decision tree, logistic regression, naive bayses, and random forest), three popular datasets, and the training and inference phases. The collected results show that programming languages have a considerable impact on AI environmental sustainability. Compiled and semi-compiled languages (C++, Java) consistently consume less than interpreted languages (Python, MATLAB, R), which require up to 54x more energy. Some languages are cumulatively more efficient in training, while others in inference. Which programming language consumes the most highly depends on the algorithm considered. Ultimately, algorithm implementation might be the most determining factor in Green AI, regardless of the language used. As conclusion, while making AI more environmentally sustainable is paramount, a trade-off between energy efficiency and implementation ease should always be considered. Green AI can be achieved without the need of completely disrupting the development practices and technologies currently in place.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。