Create README.md
Browse files
README.md
CHANGED
@@ -1,13 +1,44 @@
|
|
1 |
---
|
2 |
-
title: GEPA Prompt Tuner
|
3 |
-
emoji: 🦀
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: blue
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.38.2
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
license: mit
|
|
|
|
|
11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
+
title: GEPA Prompt Tuner
|
4 |
+
emoji: 🏢
|
5 |
---
|
6 |
+
title: GEPA Prompt Optimizer emoji: 🧬🤖 colorFrom: blue colorTo: green sdk: gradio sdk_version: 4.31.0 python_version: 3.10 app_file: app.py pinned: false license: mit
|
7 |
+
GEPA Prompt Optimizer for Hugging Face Models
|
8 |
+
This Space is a functional implementation of the GEPA (Genetic-Pareto) framework, as described in the paper "GEPA: REFLECTIVE PROMPT EVOLUTION CAN OUTPERFORM REINFORCEMENT LEARNING".
|
9 |
+
|
10 |
+
It allows you to automatically optimize a prompt for a target model (like google/gemma-2b-it) by having it "learn" from feedback on a small training set.
|
11 |
+
|
12 |
+
🧬 How It Works
|
13 |
+
The application uses an evolutionary approach to refine a "seed" prompt over several iterations:
|
14 |
+
|
15 |
+
Selection: It selects a promising prompt from its current pool of candidates using a Pareto-based strategy, which favors diversity.
|
16 |
+
|
17 |
+
Rollout: It runs the selected prompt on a task using your target Hugging Face model (e.g., Gemma).
|
18 |
+
|
19 |
+
Reflection: It uses a powerful "reflector" model (Google's Gemini 1.5 Flash) to analyze the prompt's performance, the output, and detailed feedback.
|
20 |
+
|
21 |
+
Mutation: The reflector model proposes a new, improved prompt designed to fix the observed failures.
|
22 |
+
|
23 |
+
Evaluation: The new prompt is evaluated, and if it shows improvement, it is added to the candidate pool.
|
24 |
+
|
25 |
+
This cycle repeats until the defined "rollout budget" is exhausted, leaving you with the best-performing prompt.
|
26 |
+
|
27 |
+
🚀 How to Use
|
28 |
+
Provide API Keys:
|
29 |
+
|
30 |
+
Hugging Face API Token: Enter your Hugging Face token. This is used to run inference on the target model you want to optimize for.
|
31 |
+
|
32 |
+
Google Gemini API Key: Enter your Gemini API key. This is required for the powerful "reflection" step. You can get a key from Google AI Studio.
|
33 |
+
|
34 |
+
Configure the Optimization:
|
35 |
+
|
36 |
+
Target Model ID: The Hugging Face model you want to create a prompt for (e.g., google/gemma-2b-it).
|
37 |
+
|
38 |
+
Initial Seed Prompt: The starting prompt. Your goal is to improve this!
|
39 |
+
|
40 |
+
Training Data: A small JSON dataset with input fields and evaluation criteria (e.g., expected_keywords). You must adapt this for your specific task.
|
41 |
+
|
42 |
+
Budget: The total number of times the target model will be called. Higher budgets allow for more refinement but take longer.
|
43 |
|
44 |
+
Start Optimization: Click the button and watch the logs to see the evolutionary process in action! The best prompt found will update in real-time.
|