Before long, the shortest route has the strongest chemical signature, helping other ants learn to use it, said Tshilidzi Marwala, an artificial intelligence engineer and rector of United Nations University.
The "ant-based algorithm" and other learning systems, studied by data scientists, are now being used to reduce inefficiencies in manufacturing processes - one way to cut planet-warming emissions.
"Today we have ant-based artificial intelligence algorithms, because (they) are quite efficient," said Marwala, who is also a U.N. Under-Secretary General, in an interview at the COP28 U.N. climate summit in Dubai.
From making solar panels work better to more accurately predicting weather, machine learning tools could accelerate action on everything from reducing fossil fuel emissions to preparing for disaster threats.
With the promise - and risks - of AI quickly moving up the political agenda, COP28 is the first UN climate summit to hold high-level discussions on use of the technology for climate action.
AI IN SOLAR POWER SYSTEMS?
The meeting, which runs until mid-December, has seen a flurry of new emissions-cutting pledges, with 118 nations on Saturday promising to triple the world's renewable energy by 2030.
AI could help turn some of them into a reality, Marwala said.
For instance, IT can be embedded within solar energy systems to maximise absorption, by helping solar panels determine the optimum position to catch the sun's rays, much like sunflowers do.
Machine learning can also help to more accurately predict climate-driven impacts like floods and wildfires, with powerful computers testing likely scenarios at a fine scale.
But tech experts warn that a severe lack of data and AI tools in developing nations can make algorithms less accurate.
Sinead Bovell, a U.S.-based tech commentator and 'futurist', said a lack of adequate data collection in the Global South means weather prediction systems are not necessarily accurate.
"If AI is going to work as a tool to combat climate change, it has to be a global group project," she said in an interview.
Bovell said high-level talks at the summit showed leaders recognise AI is a "critical tool" in reaching global climate goals.
"We're going to need to have some of these technologies implemented to really achieve the objectives that we want in time," she said.
AI could be a vital support, in particular, in achieving new pledges to triple renewable energy and double energy efficiency by 2030, its backers said.
At UiT The Arctic University of Norway in Tromso - the most northerly university in the world - materials scientist Matteo Chiesa and many of his PhD students work with companies on challenges deploying electricity in remote Arctic communities.
Power lines nearer the end of a grid connection are more vulnerable to faults, he noted - but data on things like wind power and direction, or how electricity is transported, can be passed through an algorithm to proactively identify weak points.
"That helps, for example, in managing the resources that (you have)," said Chiesa, who also works at the UAE's Khalifa University.
He also uses AI to improve forecasts of energy supply and demand so firms can reduce the price of power at off-peak times and cut demand during peaks.
"The idea is how do you regulate and how do you incentivise to shift... the use of electricity?" Chiesa asked.
Managing demand on grids is also getting more important with global increases in wind and solar power, which vary with the weather - and as electricity demand grows in response to new technologies such as electric vehicles.
CHALLENGES FACING AI USE
So far, AI tools and data for climate action are concentrated in only a small number of nations, dominated by the United States and China.
According to data gathered by the Institute for Human-Centered AI at Stanford University, in 2022 private investment in AI hit $47 billion in the United States - more than the next 14 nations combined, including China which had $13 billion.
The big amounts of energy AI uses to run is another big worry, as are the large volumes of water needed to cool data centres.
Training GPT-3 - the model used by the firm OpenAI to power OpenAI's ChatGPT in Microsoft's U.S. data centres - may have directly consumed 700,000 liters (154,000 gallons) of clean freshwater, according to an estimate published by the University of California, Riverside, in April.
Marwala, of U.N. University, said tackling these issues will require finding better methods of training AI systems, and ensuring the systems run on renewable energy.
"How much energy or carbon does the world have to pay for us to have those models?" he asked.