Do Generative AI Tools Ensure Green Code? An Investigative Study

📅 2024-04-16
🏛️ 2024 IEEE/ACM International Workshop on Responsible AI Engineering (RAIE)
📈 Citations: 2
Influential: 0
📄 PDF
🤖 AI Summary
It remains unclear whether generative AI programming tools inherently produce “green code” aligned with sustainability principles. Method: This study introduces the first Green Code Assessment Framework for Sustainable Software Engineering, integrating static code analysis, multi-tool comparative experiments (ChatGPT, Bard, GitHub Copilot), and compliance checking against established green coding guidelines—including energy-efficient algorithms and resource optimization. Contribution/Results: Empirical evaluation reveals that all three tools systematically violate core green coding principles across most scenarios; their generated code exhibits significantly higher energy consumption and lower resource efficiency than human-written sustainable implementations. The work exposes a critical sustainability gap in current AI programming assistants and delivers a reproducible methodology, empirical benchmarks, and actionable insights—thereby establishing foundational theoretical and technical support for advancing green AI-assisted software development and tool optimization.

Technology Category

Application Category

📝 Abstract
Software sustainability is emerging as a primary concern, aiming to optimize resource utilization, minimize environmental impact, and promote a greener, more resilient digital ecosystem. The sustainability or ’greenness’ of software is typically determined by the adoption of sustainable coding practices. With a maturing ecosystem around generative AI, many software developers now rely on these tools to generate code using natural language prompts. Despite their potential advantages, there is a significant lack of studies on the sustainability aspects of AI-generated code. Specifically, how environmentally friendly is the AI-generated code based upon its adoption of sustainable coding practices? In this paper, we present the results of an early investigation into the sustainability aspects of AI-generated code across three popular generative AI tools — ChatGPT, BARD, and Copilot. The results highlight the default non-green behavior of tools for generating code, across multiple rules and scenarios. It underscores the need for further in-depth investigations and effective remediation strategies.CCS CONCEPTS• Social and professional topics → Sustainability; • Computing methodologies → Natural language generation.
Problem

Research questions and friction points this paper is trying to address.

Assess environmental impact of AI-generated code
Evaluate green coding practices in AI tools
Investigate sustainability of ChatGPT, BARD, Copilot outputs
Innovation

Methods, ideas, or system contributions that make the work stand out.

Investigates AI-generated code sustainability
Evaluates ChatGPT, BARD, Copilot greenness
Highlights non-green default behaviors
🔎 Similar Papers
No similar papers found.