大语言模型(Large Language Models, LLMs)正逐渐成为日常生活中不可或缺的一部分,在各类自然语言处理(Natural Language Processing, NLP)任务中展现出巨大潜力。除NLP领域外,LLM正越来越多地被用于软件开发任务,例如代码补全、修改、漏洞修复以及代码翻译。软件工程师广泛使用GitHub Copilot和Amazon Q等工具,以高准确率简化工作流程并实现任务自动化。尽管人们常强调LLM训练的资源与能源密集程度,但随着时间推移,推理过程的资源消耗可能更高,因为它是一个调用量极大的持续过程。因此,开发资源高效的LLM推理替代方案对可持续发展至关重要。本研究提出GREEN-CODE,一种面向LLM的能源感知代码生成框架。GREEN-CODE在LLM推理过程中执行动态早退机制。我们训练了一个强化学习(Reinforcement Learning, RL)智能体,该智能体学习平衡准确率、延迟与能源消耗之间的权衡关系。我们在两个开源LLM——Llama 3.2 3B和OPT 2.7B上,使用JavaCorpus和PY150数据集对所提方法进行了评估。结果表明,该方法在代码生成任务中可平均降低23%-50%的能源消耗,且不会显著影响准确率。
英文摘要:
Large Language Models (LLMs) are becoming integral to daily life, showcasing their vast potential across various Natural Language Processing (NLP) tasks. Beyond NLP, LLMs are increasingly used in software development tasks, such as code completion, modification, bug fixing, and code translation. Software engineers widely use tools like GitHub Copilot and Amazon Q, streamlining workflows and automating tasks with high accuracy. While the resource and energy intensity of LLM training is often highlighted, inference can be even more resource-intensive over time, as it's a continuous process with a high number of invocations. Therefore, developing resource-efficient alternatives for LLM inference is crucial for sustainability. This work proposes GREEN-CODE, a framework for energy-aware code generation in LLMs. GREEN-CODE performs dynamic early exit during LLM inference. We train a Reinforcement Learning (RL) agent that learns to balance the trade-offs between accuracy, latency, and energy consumption. Our approach is evaluated on two open-source LLMs, Llama 3.2 3B and OPT 2.7B, using the JavaCorpus and PY150 datasets. Results show that our method reduces the energy consumption between 23-50 % on average for code generation tasks without significantly affecting accuracy.
Learn to Code Sustainably: An Empirical Study on LLM-based Green Code Generation
TWT GmbH Science & Innovation(TWT 科学与创新有限公司);National Technical University of Athens(雅典国立技术大学);Massachusetts Institute of Technology(麻省理工学院);Harvard University(哈佛大学);Mercedes-Benz(梅赛德斯-奔驰)
A Detailed Study on LLM Biases Concerning Corporate Social Responsibility and Green Supply Chains
Research Center Trustworthy Data Science and Security, University Alliance Ruhr(可信数据科学与安全研究所以及鲁尔大学联盟);Department of Computer Science, University of Duisburg-Essen(杜伊斯堡- Essen大学计算机科学系);Department of Computer Science, Technical University Dortmund(图恩大学计算机科学系);Chair of Mathematical Statistics and Applications in Industry, Technical University Dortmund(工业数学统计与应用教授职位,图恩大学)
Less is More: Towards Green Code Large Language Models via Unified Structural Pruning
Nanjing University of Aeronautics and Astronautics(南京航空航天大学);Singapore Management University(新加坡国立管理学院);National University of Defense Technology(国防科技大学);Nantong University(南通大学);Monash University and CSIRO’s Data61(莫纳什大学和CSIRO Data61);Birkbeck, University of London(伦敦大学伯贝克学院)
Separating Engineering Reasoning from DEXPI Serialization in LLM-Based Greenfield Surface-Process Design: A Three-Case Study for Underground Gas Storage
GA4GC: Greener Agent for Greener Code via Multi-Objective Configuration Optimization
University of Leeds(利兹大学);TurinTech AI(都灵科技AI);Harbin Normal University(哈尔滨师范大学);Universidad Politécnica de Madrid(马德里理工大学);University of Trieste(特里este大学);King’s College London(伦敦国王学院);University College London(伦敦大学学院)
School of Computer Science, Fudan University(复旦大学计算机科学学院);Tencent AI Lab(腾讯AI实验室);Institute of Modern Languages and Linguistics, Fudan University(复旦大学现代语言与语言学研究所)
Generalizable Heuristic Generation Through LLMs with Meta-Optimization
Nanyang Technological University(南洋理工大学);Shandong University(山东大学);Singapore Management University(新加坡国立大学);Eindhoven University of Technology(埃因霍温理工大学)
More Text, Less Point: Towards 3D Data-Efficient Point-Language Understanding
Huazhong University of Science and Technology(华中科技大学);Guangdong Intelligent Robotics Institute(广东省智能机器人研究院);Guangdong HUST Industrial Technology Research Institute(广东华中科技大学工业技术研究院);South China University of Technology(华南理工大学);Pazhou Laboratory(琶洲实验室)
Can Large Language Models Be Trusted as Evolutionary Optimizers for Network-Structured Combinatorial Problems?
Division of Mathematical Sciences, School of Physical and Mathematical Sciences, Nanyang Technological University(数学科学系,物理与数学科学学院,南洋理工大学);School of Computer Science and Engineering, Nanyang Technological University(计算机科学与工程学院,南洋理工大学)
Developing a Tutoring Dialog Dataset to Optimize LLMs for Educational Use
Graduate School of Information Science and Electrical Engineering(信息科学与电气工程研究生院);Kyushu University(九州大学);Faculty of Information Science and Electrical Engineering(信息科学与电气工程学部)
Listening, Imagining & Refining: A Heuristic Optimized ASR Correction Framework with LLMs
School of Information Science and Technology, Tibet University(信息科学与技术学院,西藏大学);Department of Ophthalmology, University of Texas Southwestern Medical Center(眼科部门,德克萨斯西南医学中心)
MoFO: Momentum-Filtered Optimizer for Mitigating Forgetting in LLM Fine-Tuning
The Chinese University of Hong Kong, Shenzhen, China(香港中文大学(深圳));Shenzhen Research Institute of Big Data(深圳大数据研究院);Huawei Technologies Co.,Ltd, China(华为技术有限公司);Shenzhen International Center for Industrial and Applied Mathematics(深圳国际工业与应用数学中心)
Time series forecasting based on optimized LLM for fault prediction in distribution power grid insulators
Center of Technology and Systems (UNINOVA-CTS)(技术与系统中心(UNINOVA-CTS));Associated Lab of Intelligent Systems (LASI)(智能系统联合实验室(LASI));Faculty of Engineering and Applied Sciences, University of Regina(里贾纳大学工程与应用科学学院)