Skip to main content

Synthesize Execute Instruct Debug Rank

A framework for AI-assisted program synthesis. Given a problem description and some input-output examples, the framework generates a program that solves the problem.

Paper

You can find an in-depth discussion of this tool, the philosophy it implements and its usage in our paper, Fully Autonomous Programming with Large Language Models. Consider citing it if you use SEIDR in your research.

Usage

from seidr import dev
help(dev)

Reproducing the experiments from our paper

The experiments are contained in benchmark.py and benchmark_humaneval.py files. When you run this file, the AI-generated programs are commited to a dedicated github repository, while the metrics (i.e. how many tests every program passes) will be logged in your Weights and Biases

Prerequisites

Set up Weights and Biases

  1. Create an account on Weights and Biases
  2. Install the Weights and Biases library
  3. Run wandb login and follow the instructions

Set up a GitHub repository

  1. Go to github, log in to the account that's going to push AI-generated code. Remember the $username and $email for that account.
  2. Go here and generate an access $token
  3. Set GIT_USER to "Bot" or whatever the name of the committer shall be
  4. Set GIT_EMAIL to $email
  5. Set GIT_REMOTE to https://$username:$token@github.com/$repo

Note that you can use a non-GitHub git hosting.

Set up OpenAI access

OpenAI account is needed with access to gpt-3.5-turbo and an OPENAI_API_KEY environment variable set to your OpenAI API access token.

Set up Ollama

Run Ollama with Llama 3-8B or another model locally or on a server. In the latter case, start the Ollama server with the following commands and note the URL:PORT pair:

OLLAMA_HOST=URL:PORT ollama serve &
OLLAMA_HOST=URL:PORT ollama pull llama3 &

Example .config file layout:

# Github
export GIT_REMOTE=https://USERNAME:KEY@github.com/SOLUTIONS_REPO
export GIT_USER=...
export GIT_EMAIL=...

# Data
export DATA_PATH=...

# OpenAI
export OPENAI_API_KEY=...
export OPENAI_ORG=...

# WandB
export WANDB_ENTITY=...
export WANDB_DIR=...

Run the experiments

If you're using Slurm, write a run.sh file with python benchmark.py and run it with sbatch run.sh --array=1-500. If not, run TASK_ID=n python benchmark.py to re-run one of our experiments exactly, or set the parameters yourself as below.

For example, for basement problem in PSB2, run SEIDR without lexicase selection as follows:

python3 benchmark.py \
    --task_id 0 \
    --problem bowling \
    --language Python \
    --branching_factor 2 \
    --max_programs 100 \
    --drafts_per_prompt 2 \
    --explanations_per_program 2 \
    --repairs_per_explanation 2 \
    --beam_width 2 \
    --log INFO \
    --lexicase_selection False \
    --dataset humaneval \
    --model_name gpt-3.5-turbo \
    --valid_examples 50 \
    --experiment_id 0

To run an example with SEIDR with Llama 3 served by Ollama at URL:PORT on HumanEval with lexicase, run the following:

python3 benchmark_humaneval.py \
    --task_id 0 \
    --problem Python/0 \
    --language Python \
    --branching_factor 2 \
    --max_programs 100 \
    --drafts_per_prompt 2 \
    --explanations_per_program 2 \
    --repairs_per_explanation 2 \
    --beam_width 2 \
    --log INFO \
    --lexicase_selection True \
    --dataset humaneval \
    --model_name llama3 \
    --experiment_id 0 \
    --ollama_url "http://URL:PORT"

Example Slurm scripts are stored in scripts/ and tables with hyperparameters in /config

Metadata

Release files for seidr 3.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seidr 3.5.0
File Size Uploaded Provenance Actions
seidr-3.5.0.tar.gz 16.0 kB Without provenance Details for seidr-3.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seidr 3.5.0
File Interpreter ABI Platform Actions
seidr-3.5.0-py3-none-any.whl Python 3 none any Details for seidr-3.5.0-py3-none-any.whl

Total release size: 35.1 kB

Release files / seidr-3.5.0.tar.gz

Download URL seidr-3.5.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a22fb242813106f6450e49a1a32e114d5983dd1ff03d1df8e16d29ab7552805c
BLAKE2b-256 checksum
How to use checksums
b9bf2d1e0f145a6480ab5612e1fa3889154540b3bd24abe4c928551b0a21f70b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.1 Linux/6.8.0-1021-azure

Release files / seidr-3.5.0-py3-none-any.whl

Download URL seidr-3.5.0-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a89c5d7ffd57fadc8e725b50e46edc4742cd35830ae3975c78a39513b09974a6
BLAKE2b-256 checksum
How to use checksums
e9d4ce27a8149ce7bf587d4b7c2444c8608ec7a4dbd14e72ffa9bacfc9aff216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.1 Linux/6.8.0-1021-azure

Security for seidr 3.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page