GREEN-CODE: Learning to Optimize Energy Efficiency in LLM-based Code Generation
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 25 of its 39 references that are in the map. First posted on arXiv 19 Jan 2025.
Builds on
25 of 39 references.
References · 25
- 2017Attention Is All You Needcited by 59,932
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,355
- 2016OpenAI Gymcited by 1,684
- 2019TinyBERT: Distilling BERT for Natural Language Understandingcited by 1,153
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023LLM-Pruner: On the Structural Pruning of Large Language Modelscited by 643
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2023QuIP: 2-Bit Quantization of Large Language Models With Guaranteescited by 397
- 2020DeeBERT: Dynamic Early Exiting for Accelerating BERT Inferencecited by 322
13 more
- 2024LayerSkip: Enabling Early Exit Inference and Self-Speculative Decodingcited by 302
- 2022Confident Adaptive Language Modelingcited by 297
- 2024LaCo: Large Language Model Pruning via Layer Collapsecited by 124
- 2023Jump to Conclusions: Short-Cutting Transformers With Linear Transformationscited by 89
- 2022FP8 Quantization: The Power of the Exponentcited by 87
- 2023Evaluating the Code Quality of AI-Assisted Code Generation Tools: An Empirical Study on GitHub Copilot, Amazon CodeWhisperer, and ChatGPTcited by 71
- 2022Out of the BLEU: how should we assess quality of the Code Generation models?cited by 65
- 2023Baby Llama: knowledge distillation from an ensemble of teachers trained on a small dataset with no performance penaltycited by 57
- 2022A Simple Hash-Based Early Exiting Approach For Language Understanding and Generationcited by 32
- 2020Post-training Quantization with Multiple Points: Mixed Precision without Mixed Precisioncited by 21
- 2023ConsistentEE: A Consistent and Hardness-Guided Early Exiting Method for Accelerating Language Models Inferencecited by 13
- 2024When Neural Code Completion Models Size up the Situation: Attaining Cheaper and Faster Completion through Dynamic Model Inferencecited by 10
- 2020A Data-Driven Frequency Scaling Approach for Deadline-aware Energy Efficient Scheduling on Graphics Processing Units (GPUs)cited by 2
Built on by
Citing papers per year: 2025: 2; 2026: 1.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2025Toward Green Code: Prompting Small Language Models for Energy-Efficient Code Generation
- 2026Evaluating the Environmental Impact of using SLMs and Prompt Engineering for Code Generation ↗
- 2024Performance-Aligned LLMs for Generating Fast Code
- 2024RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning
- 2026"ENERGY STAR" LLM-Enabled Software Engineering Tools ↗
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence
- 2025Benchmarking Energy Efficiency of Large Language Models Using vLLM
- 2026Performance, Efficiency and Collapse -- Advantages and Challenges in Offline Post-training of Code LLMs