A framework for prompt optimization and a zoo of prompt optimization algorithms.
Project description
🚀 What is Promptolution?
Promptolution is a unified, modular framework for prompt optimization built for researchers and advanced practitioners who want full control over their experimental setup. Unlike end-to-end application frameworks with high abstraction, promptolution focuses exclusively on the optimization stage, providing a clean, transparent, and extensible API. It allows for simple prompt optimization for one task up to large-scale reproducible benchmark experiments.
Key Features
- Implementation of many current prompt optimizers out of the box.
- Unified LLM backend supporting API-based models, Local LLMs, and vLLM clusters.
- Built-in response caching to save costs and parallelized inference for speed.
- Detailed logging and token usage tracking for granular post-hoc analysis.
Have a look at our Release Notes for the latest updates to promptolution.
📚 Scientific Publications Powered by Promptolution
- CANTANTE: Optimizing Agentic Systems via Contrastive Credit Attribution — Zehle, 2026. arXiv
- MO-CAPO: Multi-Objective Cost-Aware Prompt Optimization — Büssing et al., 2026. arXiv
- promptolution: A Unified, Modular Framework for Prompt Optimization — Zehle et al., 2026. EACL 2026
- Can Calibration of Positional Encodings Enhance Long Context Utilization? — Zehle & Aßenmacher, 2026. EACL 2026
- Disambiguation-Centric Finetuning Makes Enterprise Tool-Calling LLMs More Realistic and Less Risky — Hathidara et al., 2025. arXiv
- CAPO: Cost-Aware Prompt Optimization — Zehle et al., 2025. AutoML 2025
🔧 Installation and Quickstart
pip install promptolution[api]
For local inference, add [transformers] (HuggingFace) or [vllm] (vLLM serving), or both.
import pandas as pd
from promptolution.utils import ExperimentConfig
from promptolution.helpers import run_experiment
# DataFrame with columns "x" (input) and "y" (label)
df = pd.read_csv("your_data.csv")
config = ExperimentConfig(
optimizer="capo",
task_description="Classify each sentence as subjective or objective.",
prompts=["Classify the text as objective or subjective."],
n_steps=10,
api_url="https://api.openai.com/v1",
model_id="gpt-4o-mini",
api_key="YOUR_API_KEY",
)
best_prompts = run_experiment(df, config)
print(best_prompts)
Full tutorial: Getting Started notebook · Docs
🧠 Featured Optimizers
| Name | Paper | Init prompts | Exploration | Costs | Parallelizable | Few-shot |
|---|---|---|---|---|---|---|
CAPO |
Zehle et al., 2025 | required | 👍 | 💲 | ✅ | ✅ |
EvoPromptDE |
Guo et al., 2023 | required | 👍 | 💲💲 | ✅ | ❌ |
EvoPromptGA |
Guo et al., 2023 | required | 👍 | 💲💲 | ✅ | ❌ |
OPRO |
Yang et al., 2023 | optional | 👎 | 💲💲 | ❌ | ❌ |
🏗 Components
Task– Manages the dataset, evaluation metrics, and subsampling.Predictor– Defines how to extract the answer from the model's response.LLM– A unified interface handling inference, token counting, and concurrency.Optimizer– The core component that implements the algorithms that refine prompts.ExperimentConfig– A configuration abstraction to streamline and parametrize large-scale scientific experiments.
🤝 Contributing
Contributions are welcome! See CONTRIBUTING.md for the workflow, code quality guidelines, and how to run tests.
📄 Citation
If you use Promptolution in your research, please cite:
@inproceedings{zehle2026promptolution,
title={promptolution: A unified, modular framework for prompt optimization},
author={Zehle, Tom and Hei{\ss}, Timo and Schlager, Moritz and A{\ss}enmacher, Matthias and Feurer, Matthias},
booktitle={Proceedings of the 19th Conference of the European Chapter of the Association for Computational Linguistics (Volume 3: System Demonstrations)},
pages={282--296},
year={2026}
}
Developed by Timo Heiß, Moritz Schlager, Tom Zehle, and Henri Oberpaur (LMU Munich, MCML, ELLIS, TUM, Uni Freiburg).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptolution-2.2.3-py3-none-any.whl.
File metadata
- Download URL: promptolution-2.2.3-py3-none-any.whl
- Upload date:
- Size: 66.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1013-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fd77ff3fd9d6a78cba81648c099ddfb9cbc6543450c2a93f4cc06293fbff11e
|
|
| MD5 |
9c3d80a8a8c25828ca5833d5e5b81440
|
|
| BLAKE2b-256 |
f89c38a7b102d1033245b6051363b059fb64b0d20eb650bc74cba58d018255b3
|