mlsanityData to 7 Oct 2026

An Initial Exploration of Contrastive Prompt Tuning to Generate Energy-Efficient Code

arXiv 2604.02352 ↗First posted 3 Mar 2026cs.LG cs.AI cs.SEcited by 0

Not on the map. Why?

Abstract (arXiv)

Although LLMs are capable of generating functionally correct code, they also tend to produce less energy-efficient code in comparison to human-written solutions. As these inefficiencies lead to higher computational overhead, they are in direct conflict with Green Software Development (GSD) efforts, which aim to reduce the energy consumption of code. To support these efforts, this study aims to investigate whether and how LLMs can be optimized to promote the generation of energy-efficient code. To this end, we employ Contrastive Prompt Tuning (CPT). CPT combines Contrastive Learning techniques, which help the model to distinguish between efficient and inefficient code, and Prompt Tuning, a Parameter-Efficient Fine Tuning (PEFT) approach that requires only a fraction of the cost of traditional fine tuning. This study evaluates CPT on Python, Java and C++ coding problems across three different models to provide a comprehensive evaluation. The method achieves consistent improvements in code accuracy for two models but efficiency gains vary by model, language and task complexity, indicating that improvements are not uniformly reliable.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 18 of its 29 references that are in the map. First posted on arXiv 3 Mar 2026.

Builds on

18 of 29 references.

References · 18

  1. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
  4. 2022Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learningcited by 886
  5. 2020Keystroke Dynamics as Part of Lifeloggingcited by 334
  6. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
  7. 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 199
  8. 2022The Carbon Footprint of Machine Learning Training Will Plateau, Then Shrinkcited by 183
  9. 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
  10. 2023Model Tuning or Prompt Tuning? A Study of Large Language Models for Clinical Concept and Relation Extractioncited by 32
  11. 2024ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?cited by 25
  12. 2022ContraCLM: Contrastive Learning For Causal Language Modelcited by 18
6 more
  1. 2024Distinguishing LLM-generated from Human-written Code by Contrastive Learningcited by 16
  2. 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimizationcited by 14
  3. 2025AI-Powered, But Power-Hungry? Energy Efficiency of LLM-Generated Codecited by 8
  4. 2025Generating Energy-Efficient Code via Large-Language Models -- Where are we now?cited by 5
  5. 2023Measuring the Runtime Performance of C++ Code Written by Humans using GitHub Copilotcited by 4
  6. 2024CodeFort: Robust Training for Code Generation Modelscited by 4

Built on by

Not cited yet.