PromptAgent  by XinyuanWangCS

CLI tool for automated prompt optimization via strategic planning

Created 1 year ago
325 stars

Top 83.6% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
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 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
10 stars in the last 30 days

Explore Similar Projects

Starred by Edward Sun Edward Sun(Research Scientist at Meta Superintelligence Lab), Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), and
2 more.

ama_prompting by HazyResearch

0%
547
Language model prompting strategy research paper
Created 3 years ago
Updated 2 years ago
Starred by Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research) and Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems").

PromptWizard by microsoft

0.4%
4k
Agent-driven framework for task-aware prompt optimization
Created 1 year ago
Updated 1 month ago
Feedback? Help us improve.