RT journal article T1 Energy-efficient large language models A1 Jareño Dorado, Javier A1 Aragón Jurado, José Miguel A1 Torre Macías, Juan Carlos de la A1 Ruiz Villalobos, Patricia A1 Dorronsoro Díaz, Bernabé A2 Ingeniería Informática A2 Ingeniería Mecánica y Diseño Industrial K1 Large language models K1 Green AI K1 Energy efficiency K1 Compiler optimization K1 Llama 3.2 K1 Quantization K1 Genetic algorithms AB Large Language Models (LLMs) have become widely used tools across domains such as education and scientific research, following recent progress in computing infrastructure, data availability, and training techniques. However, their increasing deployment raises significant concerns about their high computational and energy demands at inference time. This work tackles the problem from a software-stack perspective, presenting an automatic optimization pipeline for LLM inference engines. This task is formulated as a combinatorial optimization problem and addressed using a cellular genetic algorithm that evolves variable-length sequences of code optimizations. The algorithm proposes a novel density-guided mutation and a longest common subsequence crossover operator. Experiments conducted on a Mac Mini with Apple Silicon M4 using llama.cpp demonstrate that, for two Llama 3.2 variants (with 1 and 3 billion parameters) quantized to 4-bit precision, the optimized engine reduces total energy consumption by 13.5% and runtime by 19.5% for the 1-billion-parameter model, compared to the non-optimized version, while the corresponding reductions for the 3-billion-parameter model were 5.3% in energy and time. If we compare against the aggressive -O3 compilation optimization flag, 4.4% and 2.7% energy savings are achieved for the two optimized engines, respectively, with comparable runtimes. It was also studied how the optimized engines generalize to their 8-bit versions, and their improvements over the non-optimized baseline were around 12% in energy consumption and 11.5% in runtime. These results demonstrate cross-quantization generalization and confirm that hardware-aware optimizations can deliver energy savings without modifying the neural model, offering a portable optimization methodology toward greener LLM deployment. PB Elsevier SN 0167-739X YR 2026 FD 2026-03-19 LK http://hdl.handle.net/10498/41000 UL http://hdl.handle.net/10498/41000 LA eng DS Repositorio Institucional de la Universidad de Cádiz RD 04-dic-2026