Skip to main content

No project description provided

Project description

promptolution

Promptolution

Promptolution is a library that provides a modular and extensible framework for implementing prompt tuning experiments. It offers a user-friendly interface to assemble the core components for various prompt optimization tasks.

In addition, this repository contains our experiments for the paper "Towards Cost-Effective Prompt Tuning: Evaluating the Effects of Model Size, Model Family and Task Descriptions in EvoPrompt".

This project was developed by Timo Heiß, Moritz Schlager and Tom Zehle.

Installation

Use pip to install our library:

pip install promptolution

Alternatively, clone the repository, run

poetry install

to install the necessary dependencies. You might need to install pipx and poetry first.

Documentation

A comprehensive documentation with API reference is availabe at https://finitearth.github.io/promptolution/.

Usage

Create API Keys for the models you want to use:

  • OpenAI: store token in openaitoken.txt
  • Anthropic: store token in anthropictoken.txt
  • DeepInfra (for Llama): store token in deepinfratoken.txt

Optimization Algorithms to choose from

Name # init population Exploration Costs Convergence Speed Parallelizable Utilizes Failure Cases
EvoPrompt DE 8-12 👍 💲 ⚡⚡
EvoPrompt GA 8-12 👍 💲 ⚡⚡
OPro 0 👎 💲💲

Core Components

  • Task: Encapsulates initial prompts, dataset features, targets, and evaluation methods.
  • Predictor: Implements the prediction logic, interfacing between the Task and LLM components.
  • LLM: Unifies the process of obtaining responses from language models, whether locally hosted or accessed via API.
  • Optimizer: Implements prompt optimization algorithms, utilizing the other components during the optimization process.
  • Exemplar Selectors: Implements algorithms for the search of few shot examples that are added to the prompt.

Key Features

  • Modular and object-oriented design
  • Extensible architecture
  • Easy-to-use interface for assembling experiments
  • Parallelized LLM requests for improved efficiency
  • Integration with langchain for standardized LLM API calls
  • Detailed logging and callback system for optimization analysis

Getting Started

Take a look at our getting started notebook: getting_started.py

Reproduce our Experiments

We provide scripts and configs for all our experiments. Run experiments based on config via:

poetry run python scripts/experiment_runs.py --experiment "configs/<my_experiment>.ini"

where <my_experiment>.ini is a config based on our templates.

This project was developed for seminar "AutoML in the age of large pre-trained models" at LMU Munich.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

promptolution-1.0.0-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

Details for the file promptolution-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: promptolution-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.10 Linux/6.5.0-1025-azure

File hashes

Hashes for promptolution-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d91ad22b6e990cc447dc37887a729018645166f6825786db6775a1380a29ba
MD5 a830e8a52631f2cc5bc47ab1daf7bc7c
BLAKE2b-256 c5317a9d86afca7c0b268e62c824fb8376375846b86d00f0898bc1dc5d715461

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page