https://github.com/alfa-group/tutorial_gp-llm

Code for Tutorial on Genetic Programming and Large Language Models

https://github.com/alfa-group/tutorial_gp-llm

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Code for Tutorial on Genetic Programming and Large Language Models

Basic Info
  • Host: GitHub
  • Owner: ALFA-group
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 40 KB
Statistics
  • Stars: 4
  • Watchers: 4
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Created over 2 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

Tutorial-LLM_GP

Simple implementation of Evolutionary Computation with LLMs. It is an extension of https://github.com/flexgp/pony_gp with addition of LLM based operators. The LLM based operators are based on https://arxiv.org/abs/2401.07102. It uses python3.

Install

Install requirements ```

Create virtual environment. Here named venv_tutorial_llm_gp

python3 -m venv ~/.venvs/venvtutorialllm_gp

Activate virtual environment. Here venv_tutorial_llm_gp

source ~/.venvs/venvtutorialllm_gp/bin/activate

Install requirements

pip install -r ./requirements.txt ```

Install as a package e.g. pip install -e .

OpenAI API

Set the environment variable for OPENAI_API_KEY to your API key. E.g. export OPENAI_API_KEY = "Some long and safe hash"

Run

Paths are relative the repository root.

Symbolic Regression

You can run tutorial.ipynb

Run GP

python main.py -f tests/configurations/tutorial_gp_sr.yml -o results_gp --algorithm=tutorial_gp

Run LLM-GP

python main.py -f tests/configurations/tutorial_llm_gp_sr.yml -o results_llm_gp --algorithm=tutorial_llm_gp_mu_xo

tutorial_llm_gp output

tutorial_llm_gp prints some information to stdout regarding settings and search progress for each iteration, see tutorial_llm_gp.py:print_stats.

The output files have each generation as a list element, and each individual separated by a ,. They are written to: tutorial_llm_gp_*_fitness_values.json tutorial_llm_gp_*_length_values.json tutorial_llm_gp_*_size_values.json tutorial_llm_gp_*_solution_values.json

Usage

``` usage: main.py [-h] -f CONFIGURATION_FILE [-o OUTPUTDIR] [--algorithm {tutorialgp,tutorialllmgpmuxo}]

Run Tutorial_LLM-GP

options: -h, --help show this help message and exit -f CONFIGURATIONFILE, --configurationfile CONFIGURATIONFILE YAML configuration file. E.g. configurations/tutorialllmgpsr.yml -o OUTPUTDIR, --outputdir OUTPUTDIR Path to directory for output files. E.g. tutorialllmgpoutput --algorithm {tutorialgp,tutorialllmgpmu_xo} Algorithms ```

Settings

Configurations are in .yml format, see examples in folder configurations.

Test

Tests are in tests folder. E.g run with python -m unittest tests.test_main

Owner

  • Name: Anyscale Learning For All (ALFA)
  • Login: ALFA-group
  • Kind: organization
  • Email: alfa-apply@csail.mit.edu
  • Location: Cambridge, MA, USA

Scalable machine learning technology, Adversarial AI, Evolutionary algorithms, and data science frameworks.

GitHub Events

Total
  • Watch event: 4
  • Fork event: 1
Last Year
  • Watch event: 4
  • Fork event: 1

Dependencies

requirements.txt pypi
  • black *
  • flake8 *
  • matplotlib >=3.0.1
  • mypy *
  • networkx >=2.2
  • numpy >=1.15.3
  • openai *
  • pandas *
  • pytest *
  • python-dotenv *
  • pyyaml *
  • recommonmark >=0.4.0
  • seaborn *
  • sympy *
  • typing >=3.6.6
  • wheel *