Logo image
Intelligent Code Optimisation: Genetic, Multi-LLM, and Agent-based Methods
Doctoral Thesis   Open access

Intelligent Code Optimisation: Genetic, Multi-LLM, and Agent-based Methods

Rafail Giavrimis
University of Surrey
Doctor of Philosophy (PhD), University of Surrey
30/10/2026
DOI:
https://doi.org/10.15126/thesis.902300

Abstract

Search-based software engineering Code optimisation Large language models Genetic improvement Multi-objective optimisation Prompt engineering Meta-prompting LLM agents

Software performance optimisation remains critical as systems grow in complexity. Cloud costs, energy consumption, and user expectations create pressure to improve efficiency, yet manual optimisation requires deep expertise, extensive profiling, and significant time investment, which does not scale. This thesis investigates how software optimisation can be automated across increasing levels of abstraction, from low-level data structure selection to high-level LLM agent configuration. Four contributions address this question. Artemis++ introduces a genetic algorithm-based tool for C++ data structure optimisation, achieving runtime improvements of up to 27.69% through syntax-based substitution and NSGA-II search. Artemis AI presents a multi-LLM search framework for code optimisation, which combines candidate optimisations from multiple models and selects optimal combinations using NSGA-II, with improvements ranging from 14.8% to 56.9% across diverse codebases. MPCO introduces a meta-prompting approach for cross-model prompt engineering, designed for industrial efficiency, generating high-quality task-specific prompts and achieving improvements of up to 19.06% at approximately $0.003 per prompt. Artemis Agents presents a framework for evolutionary optimisation of LLM agent configurations, jointly optimising prompts, tool descriptions, and parameters, achieving relative improvements of 9.4% to 37.3% in task performance, and a 39.1% reduction in token cost, across different agent systems. Search-based methods proved effective for data structures, LLM outputs, and agent configurations, while for prompt engineering, meta-prompting offered an efficient alternative that leverages LLM generalisation rather than iterative search. This research was developed in collaboration with TurinTech AI, and the Artemis platform is deployed in production, serving enterprise customers in finance, hardware, and other performance-critical domains.

pdf
Rafail_Giavrimis_PhD_Thesis2.81 MBDownloadView
Version of Record (ETD) Open Access CC BY-NC-SA V4.0

Metrics

1 File views/ downloads
1 Record Views

Details

Logo image

Usage Policy