CoolFace
Modelpublic

aiml8726737/personal-prompt-engineer-qwen1.5b

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
2likes15downloads
Model Card

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

PropertyValue
Base ModelQwen2.5-1.5B-Instruct
Fine-tuning MethodQLoRA
Adapter TypeLoRA
Quantization4-bit NF4
FrameworkTransformers + PEFT
Primary TaskPrompt 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

HyperparameterValue
LoRA Rank16
LoRA Alpha32
LoRA Dropout0
Optimizerpagedadamw8bit
Learning Rate2e-4
SchedulerCosine
Epochs2
Sequence Length512
Batch Size4
Gradient Accumulation4
Effective Batch Size16

Evaluation

EpochTraining LossValidation LossMean Token Accuracy
11.19901.117174.08%
20.98541.042076.45%

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


Installation

bash
pip install transformers peft accelerate bitsandbytes

Usage

import warnings warnings.filterwarnings("ignore")

Bypass torchao metadata version check across all environments

import importlib.metadata origversion = importlib.metadata.version def mockversion(packagename, *args, **kwargs): if packagename == "torchao": return "1.0.0" return origversion(packagename, *args, **kwargs) importlib.metadata.version = mock_version

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

1. Hugging Face Repositories

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

2. Device Selection

device = "cuda" if torch.cuda.isavailable() else ("mps" if hasattr(torch.backends, "mps") and torch.backends.mps.isavailable() 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.frompretrained(BASEMODEL) tokenizer.padtokenid = tokenizer.eostokenid

basemodel = AutoModelForCausalLM.frompretrained( BASEMODEL, torchdtype=dtype, devicemap="auto" if device == "cuda" else None ) if device != "cuda": basemodel = base_model.to(device)

4. Load Fine-Tuned Adapter

model = PeftModel.frompretrained(basemodel, 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 rewriteprompt(draftprompt: str) -> str: messages = [ {"role": "system", "content": SYSTEMPROMPT}, {"role": "user", "content": f"Rewrite the following draft prompt into a professional, execution-ready prompt.\n\nDraft Prompt:\n<<<DRAFT>>> {draftprompt} <<<END>>>"} ]

# Hugging Face Pipeline Execution result = generator( messages, maxnewtokens=300, temperature=0.7, dosample=True, returnfull_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(rewriteprompt(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

bibtex
@misc{personalpromptengineer2026,
  title={Personal Prompt Engineer: QLoRA Fine-tuning for Prompt Rewriting},
  author={Yashvardhan Agrawal},
  year={2026},
  howpublished={Hugging Face Model Hub}
}