Code Evolution Graphs: Understanding Large Language Model Driven Design of Algorithms

Authors: Niki van Stein, Anna V. Kononova, Lars Kotthoff, Thomas Bäck

Submitted to arXiv on 20 Mar. 2025
License: CC BY 4.0
Abstract

Large Language Models (LLMs) have demonstrated great promise in generating code, especially when used inside an evolutionary computation framework to iteratively optimize the generated algorithms. However, in some cases they fail to generate competitive algorithms or the code optimization stalls, and we are left with no recourse because of a lack of understanding of the generation process and generated codes. We present a novel approach to mitigate this problem by enabling users to analyze the generated codes inside the evolutionary process and how they evolve over repeated prompting of the LLM. We show results for three benchmark problem classes and demonstrate novel insights. In particular, LLMs tend to generate more complex code with repeated prompting, but additional complexity can hurt algorithmic performance in some cases. Different LLMs have different coding ``styles'' and generated code tends to be dissimilar to other LLMs. These two findings suggest that using different LLMs inside the code evolution frameworks might produce higher performing code than using only one LLM.

The papers around it, by date and closeness

Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper

How to read this map? Illustrated guide

Closest papers Prior work it builds on Papers that cite it

Papers around this one

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close
    Evolving code with a large language model
    Erik Hemberg, Stephen Moskal, U. O'Reilly · 2024 · Genetic Programming and Evolvable Machines · cited 84 times · Not summarized yet
    Abstract

    Algorithms that use Large Language Models (LLMs) to evolve code arrived on the Genetic Programming (GP) scene very recently. We present LLM_GP, a general LLM-based evolutionary algorithm designed to evolve code. Like GP, it uses evolutionary operators, but its designs and implementations of those operators significantly differ from GP’s because they enlist an LLM, using prompting and the LLM’s pre-trained pattern matching and sequence completion capability. We also present a demonstration-level variant of LLM_GP and share its code. By presentations that range from formal to hands-on, we cover design and LLM-usage considerations as well as the scientific challenges that arise when using an LL…

  2. Very close
    What is wrong with your code generated by large language models? An extensive study
    Shi-Han Dou, Haoxiang Jia, Shen-Xi Wu et al. · 2024 · Science China Information Sciences · cited 105 times · Not summarized yet
    Abstract

    The increasing development of large language models (LLMs) in code generation has drawn significant attention among researchers. To enhance LLM-based code generation ability, current efforts are predominantly directed towards collecting high-quality datasets and leveraging diverse training technologies. However, there is a notable lack of comprehensive studies examining the limitations and boundaries of existing methods. To bridge this gap, we conducted an extensive empirical study evaluating the performance of three leading closed-source LLMs and six popular open-source LLMs on three commonly used benchmarks. Our investigation, which evaluated the length, cyclomatic complexity and API numbe…

  3. Very close
    Automated Prompt Engineering for Cost-Effective Code Generation Using Evolutionary Algorithms
    Hamed Taherkhani, Melika Sepidband, H. Pham et al. · 2024 · ACM Transactions on Software Engineering and Methodology · cited 8 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) have seen increasing use in various software development tasks, especially in code generation. The most advanced recent methods attempt to incorporate feedback from code execution into prompts to help guide LLMs in generating correct code in an iterative process. While effective, these methods could be costly due to numerous interactions with the LLM and extensive token usage. To address this issue, we propose an alternative approach named Evolutionary Prompt Engineering for Code (EPiC), which leverages a lightweight evolutionary algorithm to refine the original prompts into improved versions that generate high-quality code, with minimal interactions with the LLM…

  4. Very close
    Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications
    Nam Huynh, Beiyu Lin · 2025 · arXiv.org · preprint, not peer reviewed · cited 62 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) have demonstrated their remarkable capabilities in numerous fields. This survey focuses on how LLMs empower users, regardless of their technical background, to use human languages to automatically generate executable code. We begin with understanding LLMs' limitations and challenges in automated code generation. Subsequently, we review various fine-tuning techniques designed to enhance both the performance and adaptability of LLMs in code generation tasks. We then review the existing metrics and benchmarks for evaluations to assess model performance based on fine-tuning techniques. Finally, we explore the applications of LLMs (e.g. CodeLlama, GitHub Copilot, Tool…

  5. Very close
    Comparing Large Language Models and Grammatical Evolution for Code Generation
    L. Custode, Chiara Camilla Migliore Rambaldi, Marco Roveri et al. · 2024 · GECCO Companion · cited 8 times · Not summarized yet
    Abstract

    Code generation is one of the most valuable applications of AI, as it allows for automated programming and "self-building" programs. Both Large Language Models (LLMs) and evolutionary methods, such as Genetic Programming (GP) and Grammatical Evolution (GE), are known to be capable of performing code generation with reasonable performance. However, to the best of our knowledge, little work has been done so far on a systematic comparison between the two approaches. Most importantly, the only studies that conducted such comparisons used benchmarks from the GP community, which, in our opinion, may have provided possibly GP-biased results. In this work, we perform a comparison of LLMs and evoluti…

  6. Very close
    Evolutionary thoughts: integration of large language models and evolutionary algorithms
    A. Yepes, Pieter Barnard · 2025 · arXiv.org · preprint, not peer reviewed · cited 3 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) have unveiled remarkable capabilities in understanding and generating both natural language and code, but LLM reasoning is prone to hallucination and struggle with complex, novel scenarios, often getting stuck on partial or incorrect solutions. However, the inherent ability of Evolutionary Algorithms (EAs) to explore extensive and complex search spaces makes them particularly effective in scenarios where traditional optimization methodologies may falter. However, EAs explore a vast search space when applied to complex problems. To address the computational bottleneck of evaluating large populations, particularly crucial for complex evolutionary tasks, we introduc…

  7. Very close
    From Understanding to Excelling: Template-Free Algorithm Design through Structural-Functional Co-Evolution
    Zhe Zhao, Haibin Wen, Peng-Kun Wang et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 3 times · Not summarized yet
    Abstract

    Large language models (LLMs) have greatly accelerated the automation of algorithm generation and optimization. However, current methods such as EoH and FunSearch mainly rely on predefined templates and expert-specified functions that focus solely on the local evolution of key functionalities. Consequently, they fail to fully leverage the synergistic benefits of the overall architecture and the potential of global optimization. In this paper, we introduce an end-to-end algorithm generation and optimization framework based on LLMs. Our approach utilizes the deep semantic understanding of LLMs to convert natural language requirements or human-authored papers into code solutions, and employs a t…

  8. Very close
    Holistic Evaluation of State-of-the-Art LLMs for Code Generation
    Le Zhang, S. Kothari · 2025 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet
    Abstract

    This study presents a comprehensive empirical evaluation of six state-of-the-art large language models (LLMs) for code generation, including both general-purpose and code-specialized models. Using a dataset of 944 real-world LeetCode problems across five programming languages, we assess model performance using rigorous metrics: compile-time errors, runtime errors, functional failures, and algorithmic suboptimalities. The results reveal significant performance variations, with DeepSeek-R1 and GPT-4.1 consistently outperform others in terms of correctness, efficiency, and robustness. Through detailed case studies, we identify common failure scenarios such as syntax errors, logical flaws, and s…

Prior work it builds on

  1. Close
    In-the-loop Hyper-Parameter Optimization for LLM-Based Automated Design of Heuristics
    Niki van Stein, D. Vermetten, T. Bäck · 2024 · ACM Transactions on Evolutionary Learning and Optimization · cited 53 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) have shown great potential in automatically generating and optimizing (meta)heuristics, making them valuable tools in heuristic optimization tasks. However, LLMs are generally inefficient when it comes to fine-tuning hyper-parameters of the generated algorithms, often requiring excessive queries that lead to high computational and financial costs. This paper presents a novel hybrid approach, LLaMEA-HPO, which integrates the open source LLaMEA (Large Language Model Evolutionary Algorithm) framework with a Hyper-Parameter Optimization (HPO) procedure in the loop. By offloading hyper-parameter tuning to an HPO procedure, the LLaMEA-HPO framework allows the LLM to fo…

  2. Related*
    Programming by optimization
    H. Hoos · 2012 · Communications of the ACM · cited 231 times · Not summarized yet
  3. Related*
    Source code metrics: A systematic mapping study
    Alberto Nunez-Varela, H. Pérez-González, F. Martínez-Pérez et al. · 2017 · Journal of Systems and Software · cited 162 times · Not summarized yet
  4. Related
    Search trajectory networks: A tool for analysing and visualising the behaviour of metaheuristics
    Gabriela Ochoa, K. Malan, C. Blum · 2021 · Applied Soft Computing · cited 95 times · Not summarized yet
    Abstract

    Abstract A large number of metaheuristics inspired by natural and social phenomena have been proposed in the last few decades, each trying to be more powerful and innovative than others. However, there is a lack of accessible tools to analyse, contrast and visualise the behaviour of metaheuristics when solving optimisation problems. When the metaphors are stripped away, are these algorithms different in their behaviour? To help to answer this question, we propose a data-driven, graph-based model, search trajectory networks (STNs) in order to analyse, visualise and directly contrast the behaviour of different types of metaheuristics. One strength of our approach is that it does not require an…

  5. Related*
    Cyclomatic Complexity
    C. Ebert, J. Cain, G. Antoniol et al. · 2016 · IEEE Software · cited 151 times · Not summarized yet

Papers that cite it

  1. Very close
    A Systematic Survey on Large Language Models for Evolutionary Optimization: From Modeling to Solving
    Yi-Song Zhang, Ran Cheng, Guo-Xing Yi et al. · 2025 · IEEE Computational Intelligence Magazine · cited 19 times · Not summarized yet
    Abstract

    Large language models (LLMs) are increasingly integrated with evolutionary computation to support optimization tasks. This survey primarily focuses on evolutionary optimization, i.e., optimization based on evolutionary computation. For brevity, we use the term optimization throughout to denote this scope. However, existing surveys typically examine isolated roles of LLMs and do not provide a unified view that connects optimization modeling with optimization solving. To address this gap, we systematically review recent developments through a workflow-oriented framework. First, we organize the literature into two primary stages: LLMs for optimization modeling and LLMs for optimization solving …

  2. Very close
    Fitness Landscape of Large Language Model-Assisted Automated Algorithm Search
    Fei Liu, Qing-Fu Zhang, Jia-Long Shi et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 13 times · Not summarized yet
    Abstract

    Using Large Language Models (LLMs) in an evolutionary or other iterative search framework have demonstrated significant potential in automated algorithm design. However, the underlying fitness landscape, which is critical for understanding its search behavior, remains underexplored. In this paper, we illustrate and analyze the fitness landscape of LLM-assisted Algorithm Search (LAS) using a graph-based approach, where nodes represent algorithms and edges denote transitions between them. We conduct extensive evaluations across six algorithm design tasks and six commonly-used LLMs. Our findings reveal that LAS landscapes are highly multimodal and rugged, particularly in combinatorial optimizat…

  3. Close
    A Systematic Survey on Large Language Models for Algorithm Design
    Fei Liu, Yi-Ming Yao, Ping Guo et al. · 2024 · ACM Computing Surveys · cited 138 times · Not summarized yet
    Abstract

    Algorithm design is crucial for effective problem-solving across various domains. The advent of Large Language Models (LLMs) has notably enhanced the automation and innovation within this field, offering new perspectives and promising solutions. In just a few years, this integration has yielded remarkable progress in areas ranging from combinatorial optimization to scientific discovery. Despite this rapid expansion, a holistic understanding of the field is hindered by the lack of a systematic review, as existing surveys either remain limited to narrow sub-fields or with different objectives. This article seeks to provide a systematic review of algorithm design with LLMs. We introduce a taxon…

  4. Very close
    Towards Variation via Foundation Model: An Empirical Study of a Problem-Agnostic No-Code LLM-Guided Evolutionary Algorithm
    Sarah Gerner, Gerhard Stenzel, Thomas Gabor · 2026 · GECCO Companion · Not summarized yet
    Abstract

    The natural-language-based genetic algorithm (NaLaGA) shows that a generic, problem-independent genetic algorithm (GA) can function by utilizing large language models (LLMs) for all interactions with the solution candidates without ever running any LLM-generated code. We analyze inherent biases in the function of a NaLaGA approach from prior work and propose some architectural changes to increase its generalizability.

  5. Close
    Mutation Without Variation: Convergence Dynamics in LLM-Driven Program Evolution
    Can Gurkan, F. Stonedahl, Uri Wilensky · 2026 · GECCO Companion · cited 5 times · Not summarized yet
    Abstract

    When an LLM repeatedly mutates a program, does it explore new forms or circle back to the same ones? We study this question by analyzing LLM-driven mutation chains in the absence of selection pressure within a domain-specific language, varying prompt design, model family, and stochastic replication. We find that LLM-based mutation consistently converges toward restricted attractor regions in program space. Convergence is especially severe at the structural level: in 87% of chains, over 93% of mutations revisit a previously seen structural form, with most variation confined to terminal substitutions within recurring templates. Cycle analysis reveals short cycles and self-loops dominating the …

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 1 November 2026.

The illustrated guide to the papers around a paper