Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌊 PromptFlow

A Dual-Agent AI Research System for Automated Prompt Refinement using the RISE Framework

License: MIT Python 3.10+ FastAPI React

PromptFlow is a research-driven, dual-agent AI system designed to evaluate whether automated prompt refinement improves the quality of responses generated by Large Language Models (LLMs).

Instead of directly sending a user's raw query to an LLM, PromptFlow first refines the query into a structured prompt using the RISE framework (Role, Instruction, Steps, Expectation). The refined prompt is then passed to a generator LLM. By running an A/B test pipeline, the project directly measures the impact of prompt engineering on output quality.


⚠️ Problem Statement

Users interacting with LLMs often submit queries that are:

  • Incomplete
  • Ambiguous
  • Unstructured
  • Missing critical constraints

These raw inputs significantly degrade the quality of LLM responses. PromptFlow solves this by automatically transforming raw inputs into optimized, structured prompts without altering the user's original intent.


🏗️ System Architecture

PromptFlow uses a lightweight, dual-agent architecture optimized for local inference.

🧠 Agent 1: The Prompt Refiner

  • Model: Gemma 3 1B Instruction
  • Purpose: Automatically structures raw user queries into the RISE format.
  • Fine-Tuning: Supervised Fine-Tuning (QLoRA) on a custom dataset of ~2,100+ RISE prompt samples.
  • Input: Raw user query.
  • Task: Understand intent, preserve constraints, infer missing structure, apply RISE.

🤖 Agent 2: The Response Generator

  • Model: Gemma 4 E2B Instruction GGUF
  • Purpose: Generates the final output response. No additional fine-tuning.
  • Execution: Runs efficiently via llama.cpp for local CPU inference.

⚖️ The Judge

  • Model: Nemotron Ultra 3
  • Purpose: An automated evaluator model that compares the direct response versus the refined response across six specific metrics.

📐 The RISE Framework

Every prompt refined by Agent 1 strictly adheres to the RISE structure:

  • Role: Assigns an expert persona relevant to the query.
  • Instruction: Provides a clear, unambiguous task description.
  • Steps: Outlines a logical workflow or methodology for solving the problem.
  • Expectation: Defines the exact formatting and output requirements.

🔬 Research Methodology & Evaluation

The core contribution of this project is investigating the hypothesis: Does automatic prompt refinement improve LLM response quality?

For every user query, the system evaluates two parallel generation tracks:

  • 🔴 Left Panel (Control): Raw Query → Agent 2 → Baseline Response
  • 🟢 Right Panel (Variable): Raw Query → Agent 1 → Refined RISE Prompt → Agent 2 → Optimized Response

Evaluation Metrics

The Judge Model quantitatively scores both outputs using the following six criteria:

  1. Relevance
  2. Clarity
  3. Completeness
  4. Actionability
  5. Structure
  6. Depth

🚀 Technologies Used

  • Backend: FastAPI, Python
  • AI / Inference: Hugging Face Transformers, llama.cpp, GGUF models
  • Fine-Tuning: PEFT (QLoRA)
  • Frontend: React
  • Hardware Profile: Designed for 100% Local Inference (CPU/Consumer GPU)

✨ Novelty & Expected Outcomes

Unlike traditional prompt engineering tools that act merely as wrappers, PromptFlow:

  1. Operates completely offline with open-source local LLMs.
  2. Preserves constraints while intelligently filling contextual gaps.
  3. Quantitatively validates outcomes using an automated judge.

Expected Outcome: The refined prompt pipeline should consistently produce responses that are significantly more relevant, complete, structured, actionable, deeper, and easier to understand than responses generated from raw user input.


💻 Installation & Quick Start

(Placeholder for future deployment instructions)

# 1. Clone the repository
git clone (https://github.com/Devansh-Mankad/promptflow.git)
cd promptflow

# 2. Setup Python Virtual Environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Start the FastAPI Backend
uvicorn main:app --reload

# 5. Start the React Frontend
cd frontend
npm install
npm start

👨‍💻 Author

Devansh Mankad

Computer Engineering Student


⭐ Support

If you found this project useful, consider giving it a ⭐ Star on GitHub.


📄 License

This project is licensed under the MIT License.

About

PromptForge is a dual-agent AI system that enhances LLM responses through automated prompt refinement. A fine-tuned Gemma 3 1B model converts raw user input into structured RISE prompts, which are then processed by a Gemma 4 E2B model to generate high-quality responses. Built with FastAPI and React, it runs entirely locally without external AI APIs

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages