PromptAgent  by XinyuanWangCS

CLI tool for automated prompt optimization via strategic planning

created 1 year ago
304 stars

Top 88.9% on sourcepulse

GitHubView on GitHub
Project Summary

PromptAgent is an open-source framework for automatically optimizing language model prompts to achieve expert-level performance on complex tasks. It targets researchers and practitioners seeking to enhance LLM capabilities without manual prompt engineering. The core benefit is its ability to autonomously generate highly effective prompts, reducing the need for extensive human effort and expertise.

How It Works

PromptAgent employs a Monte Carlo Tree Search (MCTS) algorithm to strategically explore the prompt space. It iteratively samples model errors, generates feedback, simulates rewards, and searches for high-reward paths that lead to optimized prompts. This approach allows it to discover complex prompt structures and strategies that mimic expert-level prompt engineering, moving beyond simple prompt variations.

Quick Start & Requirements

  • Installation: Clone the repository, create a conda environment (conda create -n prompt_agent), activate it (conda activate prompt_agent), and install dependencies (pip install -r requirements.txt).
  • Prerequisites: OpenAI API key (for default setup), Python 3.x. Supports OpenAI, PaLM, and Hugging Face models (including vllm and mistralai/Mistral-7B-Instruct-v0.2). CUDA is recommended for Hugging Face models.
  • Setup: Requires API key configuration in example_config.yaml. Running the example for a BIG-bench task takes approximately two hours and costs around $5 with OpenAI APIs.
  • Links: arXiv, LLM Reasoners Integration

Highlighted Details

  • Supports local inference with vllm for faster execution.
  • Integrates with the LLM Reasoners library.
  • Configuration managed via YAML files.
  • Accepted to ICLR 2024.

Maintenance & Community

The project is actively maintained, with recent updates including vllm support and YAML configuration. Contact information and an email are provided for questions and contributions.

Licensing & Compatibility

The repository does not explicitly state a license in the README. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The primary example requires an OpenAI API key and incurs costs. While Hugging Face models are supported, optimal performance is noted for instruction-tuned models, and users may need to adjust model-specific parameters. The optimization process is non-deterministic, meaning exact prompt outputs may vary.

Health Check
Last commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
0
Star History
34 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.