Code optimisation: The key to a more sustainable future for AI

By Dr Leslie Kanthan, CEO of TurinTech.

  • 1 month ago Posted in

Google's recent disclosure of a 48% increase in emissions over the past five years, largely due to the energy demands of its data centres, has highlighted the environmental impact of artificial intelligence. While this issue was previously underreported, the substantial computing power and energy consumption required by the rapidly advancing AI industry are now coming into focus.

As companies increasingly integrate AI into their products, processes, and services, the significant environmental consequences can no longer be overlooked. It's important to note that it's not only the training of AI models that adds to the carbon footprint; the continuous inference required to process requests and generate responses is also a major contributor.

To mitigate AI's environmental impact, comprehensive strategies are needed, including the use of green energy and advancements in hardware. However, one crucial yet often neglected factor is the efficiency of AI code.

While leadership teams, particularly ESG teams, are deeply concerned with reducing the institution’s overall energy footprint, developers are focused on delivering functional code on time. 

In this situation, simply encouraging developers to be mindful of energy use isn’t enough; what’s really needed is a process that can help reduce cloud bills while also enhancing the capabilities of developers.

By prioritising code optimisation, companies can achieve immediate reductions in the carbon footprint of their AI systems. This involves refining code to enhance performance and decrease energy usage, offering environmental and financial advantages.

What is code optimisation?

Code optimisation is the process of improving the efficiency of code so that it runs faster, uses less memory, or consumes fewer computational resources. However, it isn't just about making your software run faster; it's also a key lever for sustainability, especially in the age of AI. 

We recently worked on a QuantLib project, where we uploaded an optimised version of their code and saw a remarkable 30% improvement in execution speed.

But how does this affect the environment? Take cloud computing as an example. If a company spends £100,000 annually on cloud resources, optimised code could reduce that cost to £80,000. Not only does this mean significant savings, but it also translates to lower energy consumption and reduced carbon footprints.

However, most developers, even the best ones, often write code with tight deadlines in mind, not with efficiency or sustainability as a priority. While a developer might refine their code if given unlimited time, they rarely consider aspects such as whether they’re maximising CPU usage or allocating memory efficiently. 

This lack of focus on optimisation is understandable, particularly when managing codebases that span millions of lines. It could take years for teams to manually refine such code. 

So, how do we make optimised code attainable? 

How can it work?

One way that this can be achieved is through automation. By leveraging the power of large language models (LLMs), businesses can now streamline code optimisation and generation processes. The key advantage is the significant reduction in time—companies not only achieve more efficient software but do so in just minutes, greatly alleviating the typical time constraints of these processes.

This approach optimises code to perform more tasks with fewer computational resources. As a result, tasks that traditionally require substantial energy now consume much less power. Since energy consumption is closely linked to software efficiency, adopting this method can lead to substantial energy savings.

These energy savings translate into lower carbon emissions from data processing, storage, and software operation, directly reducing a company’s scope one and scope two emissions. Code optimisation can also help lower scope three emissions, such as those associated with products sold. 

Additionally, businesses can obtain specific CO2 reduction percentages and energy consumption metrics, which can be used to demonstrate a tangible commitment to sustainability – a crucial factor in light of upcoming regulatory requirements.

The bottom line

The AI industry must adopt comprehensive, all-encompassing strategies to ensure it advances sustainability, rather than undermining it with each new development. Automating code optimisation could be the key to delivering immediate, sustainable solutions for AI.

As innovation becomes a necessity and organisations race to integrate transformative technology into their services, the reliance on and emissions from data centres will continue to rise. Our planet cannot afford to let data centres operate inefficiently.

Code optimisation offers a solution to this challenge. When considering the additional benefits of reduced costs, improved reliability, and increased flexibility, it is evident that this is the right path forward.

By Yiannis Antoniou, Head of Data, AI, and Analytics at Lab49.
By Shaked Reiner, Principal Cyber Researcher, CyberArk Labs.
By James Fisher, Chief Strategy Officer, Qlik.
By Kamlesh Patel, VP Data Center Market Development at CommScope.
By Brandon Green, Senior Solutions Architect & Threat Modeling SME, IriusRisk.