Personal Prompt Engineer (Qwen2.5-1.5B LoRA)

Personal Prompt Engineer is a QLoRA fine-tuned LoRA adapter built on Qwen2.5-1.5B-Instruct. It specializes in transforming short, vague, or incomplete prompts into structured, detailed, and execution-ready prompts while preserving the user's original intent.

Unlike a general chatbot, this model is designed to rewrite prompts, not answer them.


Model Details

Property Value
Base Model Qwen2.5-1.5B-Instruct
Fine-tuning Method QLoRA
Adapter Type LoRA
Quantization 4-bit NF4
Framework Transformers + PEFT
Primary Task Prompt Rewriting

Intended Use

The model is designed for:

  • Prompt Engineering
  • AI Assistants
  • RAG Pipelines
  • Workflow Automation
  • Coding Assistants
  • Content Generation
  • Agentic AI Systems

Typical workflow:

User Prompt
      ↓
Personal Prompt Engineer
      ↓
Optimized Prompt
      ↓
GPT / Claude / Gemini / Llama / Qwen

Example

Input

make a react app with dark mode

Output

Create a modern React application with a responsive user interface that includes a dark/light mode toggle.

Requirements:
- Use React functional components.
- Implement state management using Context API.
- Persist theme preference in localStorage.
- Include accessible UI components.
- Follow clean project architecture.
- Provide complete source code with explanations.

Training Dataset

The adapter was fine-tuned on approximately 3,030 curated prompt rewriting examples spanning:

  • Software Development
  • Business
  • Marketing
  • Creative Writing
  • Education
  • Science
  • Productivity
  • General AI Prompting

Each example consists of:

  • Instruction
  • Draft Prompt
  • Rewritten Prompt

Training Configuration

Hyperparameter Value
LoRA Rank 16
LoRA Alpha 32
LoRA Dropout 0
Optimizer paged_adamw_8bit
Learning Rate 2e-4
Scheduler Cosine
Epochs 2
Sequence Length 512
Batch Size 4
Gradient Accumulation 4
Effective Batch Size 16

Evaluation

Epoch Training Loss Validation Loss Mean Token Accuracy
1 1.1990 1.1171 74.08%
2 0.9854 1.0420 76.45%

The validation loss consistently decreased during training, indicating good convergence without obvious signs of overfitting.


Installation

pip install transformers peft accelerate bitsandbytes

Usage

import warnings warnings.filterwarnings("ignore")

Bypass torchao metadata version check across all environments

import importlib.metadata _orig_version = importlib.metadata.version def _mock_version(package_name, *args, **kwargs): if package_name == "torchao": return "1.0.0" return _orig_version(package_name, *args, **kwargs) importlib.metadata.version = _mock_version

import torch from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer from peft import PeftModel

1. Hugging Face Repositories

BASE_MODEL = "Qwen/Qwen2.5-1.5B-Instruct" LORA_ADAPTER = "aiml8726737/personal-prompt-engineer-qwen1.5b"

2. Device Selection

device = "cuda" if torch.cuda.is_available() else ("mps" if hasattr(torch.backends, "mps") and torch.backends.mps.is_available() else "cpu") dtype = torch.float16 if device in ["cuda", "mps"] else torch.float32

print(f"Loading Hugging Face Pipeline on {device.upper()}...")

3. Load Tokenizer & Base Model

tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL) tokenizer.pad_token_id = tokenizer.eos_token_id

base_model = AutoModelForCausalLM.from_pretrained( BASE_MODEL, torch_dtype=dtype, device_map="auto" if device == "cuda" else None ) if device != "cuda": base_model = base_model.to(device)

4. Load Fine-Tuned Adapter

model = PeftModel.from_pretrained(base_model, LORA_ADAPTER)

5. Create Standard Hugging Face Text-Generation Pipeline

generator = pipeline( "text-generation", model=model, tokenizer=tokenizer, device_map="auto" if device == "cuda" else None )

SYSTEM_PROMPT = "You are an expert Personal Prompt Engineer. Your task is to rewrite vague user prompts into professional, execution-ready prompts."

6. Prompt Rewriter Function using Hugging Face Pipeline

def rewrite_prompt(draft_prompt: str) -> str: messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": f"Rewrite the following draft prompt into a professional, execution-ready prompt.\n\nDraft Prompt:\n<<>> {draft_prompt} <<>>"} ]

# Hugging Face Pipeline Execution
result = generator(
    messages,
    max_new_tokens=300,
    temperature=0.7,
    do_sample=True,
    return_full_text=False
)

return result[0]["generated_text"]

7. Test Example

if name == "main": draft = "create a landing page for an AI agent app" print("\n" + "="*70) print("DRAFT PROMPT:") print(draft) print("="*70) print("\nREWRITTEN BY HUGGINGFACE PIPELINE:") print(rewrite_prompt(draft)) print("="*70)

Limitations

  • Optimized for prompt rewriting rather than general question answering.
  • Performance depends on the quality and diversity of the training data.
  • May not generalize well to highly specialized domains absent from the training set.

License

This LoRA adapter is released under the Apache 2.0 License, consistent with the license of the base Qwen2.5 model.


Citation

@misc{personalpromptengineer2026,
  title={Personal Prompt Engineer: QLoRA Fine-tuning for Prompt Rewriting},
  author={Yashvardhan Agrawal},
  year={2026},
  howpublished={Hugging Face Model Hub}
}
Downloads last month
91
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for aiml8726737/personal-prompt-engineer-qwen1.5b

Adapter
(1319)
this model

Evaluation results