Enhancing Program Synthesis with Large Language Models Using Many-Objective Grammar-Guided Genetic Programming

被引:1
|
作者
Tao, Ning [1 ]
Ventresque, Anthony [2 ,4 ]
Nallur, Vivek [1 ]
Saber, Takfarinas [3 ,4 ]
机构
[1] Univ Coll Dublin, Sch Comp Sci, Dublin D04 V1W8, Ireland
[2] Trinity Coll Dublin, Sch Comp Sci & Stat, Dublin D02 PN40, Ireland
[3] Univ Galway, Sch Comp Sci, Galway H91 TK33, Ireland
[4] SFI Lero Irish Software Res Ctr, Limerick V94 NYD3, Ireland
基金
爱尔兰科学基金会;
关键词
program synthesis; large language models; grammar-guided genetic programming; grammar; multi-objective; CODE;
D O I
10.3390/a17070287
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
The ability to automatically generate code, i.e., program synthesis, is one of the most important applications of artificial intelligence (AI). Currently, two AI techniques are leading the way: large language models (LLMs) and genetic programming (GP) methods-each with its strengths and weaknesses. While LLMs have shown success in program synthesis from a task description, they often struggle to generate the correct code due to ambiguity in task specifications, complex programming syntax, and lack of reliability in the generated code. Furthermore, their generative nature limits their ability to fix erroneous code with iterative LLM prompting. Grammar-guided genetic programming (G3P, i.e., one of the top GP methods) has been shown capable of evolving programs that fit a defined Backus-Naur-form (BNF) grammar based on a set of input/output tests that help guide the search process while ensuring that the generated code does not include calls to untrustworthy libraries or poorly structured snippets. However, G3P still faces issues generating code for complex tasks. A recent study attempting to combine both approaches (G3P and LLMs) by seeding an LLM-generated program into the initial population of the G3P has shown promising results. However, the approach rapidly loses the seeded information over the evolutionary process, which hinders its performance. In this work, we propose combining an LLM (specifically ChatGPT) with a many-objective G3P (MaOG3P) framework in two parts: (i) provide the LLM-generated code as a seed to the evolutionary process following a grammar-mapping phase that creates an avenue for program evolution and error correction; and (ii) leverage many-objective similarity measures towards the LLM-generated code to guide the search process throughout the evolution. The idea behind using the similarity measures is that the LLM-generated code is likely to be close to the correct fitting code. Our approach compels any generated program to adhere to the BNF grammar, ultimately mitigating security risks and improving code quality. Experiments on a well-known and widely used program synthesis dataset show that our approach successfully improves the synthesis of grammar-fitting code for several tasks.
引用
收藏
页数:20
相关论文
共 22 条
  • [1] Grammar-obeying program synthesis: A novel approach using large language models and many-objective genetic programming
    Tao, Ning
    Ventresque, Anthony
    Nallur, Vivek
    Saber, Takfarinas
    COMPUTER STANDARDS & INTERFACES, 2025, 92
  • [2] Extending Program Synthesis Grammars for Grammar-Guided Genetic Programming
    Forstenlechner, Stefan
    Fagan, David
    Nicolau, Miguel
    O'Neill, Michael
    PARALLEL PROBLEM SOLVING FROM NATURE - PPSN XV, PT I, 2018, 11101 : 197 - 208
  • [3] Multi-objective Grammar-guided Genetic Programming with Code Similarity Measurement for Program Synthesis
    Tao, Ning
    Ventresque, Anthony
    Saber, Takfarinas
    2022 IEEE CONGRESS ON EVOLUTIONARY COMPUTATION (CEC), 2022,
  • [4] Assessing Similarity-Based Grammar-Guided Genetic Programming Approaches for Program Synthesis
    Tao, Ning
    Ventresque, Anthony
    Saber, Takfarinas
    OPTIMIZATION AND LEARNING, OLA 2022, 2022, 1684 : 240 - 252
  • [5] Predicting Defects in Software Using Grammar-Guided Genetic Programming
    Tsakonas, Athanasios
    Dounias, Georgios
    ARTIFICIAL INTELLIGENCE: THEORIES, MODELS AND APPLICATIONS, SETN 2008, 2008, 5138 : 413 - 418
  • [6] Modelling medical time series using grammar-guided genetic programming
    Alonso, Fernando
    Martinez, Loic
    Perez, Aurora
    Santamaria, Agustin
    Pedro Valente, Juan
    ADVANCES IN DATA MINING, PROCEEDINGS: MEDICAL APPLICATIONS, E-COMMERCE, MARKETING, AND THEORETICAL ASPECTS, 2008, 5077 : 32 - 46
  • [7] A Comparison of Multi-objective Grammar-Guided Genetic Programming Methods to Multiple Instance Learning
    Zafra, Amelia
    Ventura, Sebastian
    HYBRID ARTIFICIAL INTELLIGENCE SYSTEMS, 2009, 5572 : 450 - 458
  • [8] Multi-objective approach based on grammar-guided genetic programming for solving multiple instance problems
    Amelia Zafra
    Sebastián Ventura
    Soft Computing, 2012, 16 : 955 - 977
  • [9] Automatic generation of algorithms for robust optimisation problems using Grammar-Guided Genetic Programming
    Hughes, Martin
    Goerigk, Marc
    Dokka, Trivikram
    COMPUTERS & OPERATIONS RESEARCH, 2021, 133
  • [10] Multi-objective approach based on grammar-guided genetic programming for solving multiple instance problems
    Zafra, Amelia
    Ventura, Sebastian
    SOFT COMPUTING, 2012, 16 (06) : 955 - 977