PromptForge-Optimizer

LoRA adapter that rewrites weak / vague prompts into clear, specific, actionable LLM prompts while preserving the original intent and topic.

Part of PromptForge โ€” local-first prompt quality scoring + optimization.

Model Details

Model Description

PromptForge-Optimizer is a PEFT/LoRA fine-tune of Qwen/Qwen2.5-1.5B-Instruct. Given a weak user prompt (plus optional quality analysis context), it generates an improved prompt with audience, constraints, structure, and output format โ€” without changing the core topic.

  • Developed by: PromptForge contributors
  • Model type: Causal LM adapter (LoRA / PEFT)
  • Language(s): English
  • License: MIT
  • Finetuned from: Qwen/Qwen2.5-1.5B-Instruct

Model Sources

Uses

Direct Use

  • Rewrite vague prompts into production-ready LLM instructions
  • Pair with PromptForge-Quality for score โ†’ optimize โ†’ re-score workflows
  • Local / offline prompt tooling (CLI, Python API, Gradio)

Example weak โ†’ strong:

Weak Optimized (intent preserved)
Make an app about social media like facebook and stuff Social media / Facebook-like app prompt with profiles, feed, likes, constraints, output format

Downstream Use

  • Prompt engineering assistants
  • IDE / agent tooling that improves user instructions before calling an LLM
  • Synthetic data pipelines that need higher-quality prompts

Out-of-Scope Use

  • Not a general chat assistant
  • Not a substitute for domain experts (legal, medical, safety-critical advice)
  • Not guaranteed to preserve intent on topics far outside the curated training set
  • Do not use to generate harmful, deceptive, or disallowed content

Bias, Risks, and Limitations

  • Trained on curated synthetic weakโ†’strong pairs; coverage is strongest on coding apps, writing, data, research, and planning prompts
  • May invent plausible audience / stack details (e.g. โ€œproduct managersโ€, โ€œFlaskโ€) when the weak prompt is underspecified
  • Small base model (1.5B) โ€” quality is good for local use, not frontier-LLM rewrite quality
  • Inference includes validation + fallback in the PromptForge package; raw adapter output alone may still drift

Recommendations

  • Prefer the PromptForge Python package / CLI (chat template + stop tokens + validation) over raw generate
  • For new domains, add your own weakโ†’strong pairs and retrain the LoRA
  • Always review optimized prompts before sending them to production LLMs

How to Get Started with the Model

Install & use with tuneprompt (recommended)

pip install tuneprompt

python -m promptforge download \
  --quality-repo ArjunShukla/PromptForge-Quality \
  --optimizer-repo ArjunShukla/PromptForge-Optimizer

python -m promptforge run "Make an app about social media like facebook and stuff"
# or: tuneprompt run "Make an app about social media like facebook and stuff"
from promptforge import PromptForge

pf = PromptForge(
    quality_model_path="ArjunShukla/PromptForge-Quality",
    optimizer_model_path="ArjunShukla/PromptForge-Optimizer",
)
print(pf.run("Build me a website for a startup")["optimized_prompt"])

Package: tuneprompt on PyPI ยท Import: promptforge ยท CLI: tuneprompt / promptforge ยท Code: https://github.com/arjun988/promptModel

Load the adapter directly (PEFT)

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base = "Qwen/Qwen2.5-1.5B-Instruct"
adapter = "ArjunShukla/PromptForge-Optimizer"

tokenizer = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(base, trust_remote_code=True, device_map="auto")
model = PeftModel.from_pretrained(model, adapter)

Use Qwenโ€™s chat template (tokenizer.apply_chat_template) โ€” do not hand-roll <|system|> tags.

Training Details

Training Data

  • ~800 curated high-quality weak โ†’ strong prompt pairs
  • ~140 unique topic-preserving seeds (coding, writing, data, research, general)
  • Intent rule: optimized prompt must keep the same topic as the weak prompt
  • Assistant-only loss masking (system/user tokens not trained)

Training Procedure

Training Hyperparameters

Setting Value
Base model Qwen/Qwen2.5-1.5B-Instruct
Method LoRA (PEFT)
LoRA rank / alpha 16 / 32
Target modules q/k/v/o + MLP projections
Max sequence length 512
Epochs 6
Effective batch size 8 (batch 1 ร— grad accum 8)
Learning rate 1e-4
Precision fp16
Gradient checkpointing enabled
Config configs/optimizer_fast_8gb.yaml

Speeds, Sizes, Times

  • Hardware: NVIDIA GeForce RTX 5060 Laptop GPU (8 GB)
  • Wall time: ~87 minutes (6 epochs)
  • Adapter size on disk: ~82 MB
  • Train loss: ~0.47
  • Validation loss: ~0.121

Evaluation

Metrics

Signal Result
Validation loss 0.121
Example quality lift (scorer) e.g. 41.5 โ†’ 94.0 on a social-media app prompt
Intent preservation Topic keywords retained (social / Facebook)
Validation gate Rejects empty / repetitive / low-intent outputs

Evaluation is primarily: held-out SFT loss + pipeline checks (score delta, instruction preservation, repetition detection). Not a public leaderboard benchmark.

Summary

The adapter reliably expands vague prompts into structured instructions on in-distribution topics. Off-distribution prompts may fall back to a safer template when used through PromptForge.

Environmental Impact

  • Hardware Type: NVIDIA RTX 5060 Laptop (8 GB)
  • Hours used: ~1.5 h for this adapter run
  • Cloud Provider: N/A (local)
  • Compute Region: N/A
  • Carbon Emitted: Not measured

Technical Specifications

Model Architecture and Objective

  • Causal language model (Qwen2.5 Instruct) + LoRA
  • Objective: SFT to map weak prompt (+ analysis) โ†’ optimized prompt text only

Compute Infrastructure

Hardware

  • RTX 5060 Laptop GPU, 8 GB VRAM

Software

  • PyTorch (CUDA)
  • Transformers
  • PEFT / LoRA
  • PromptForge training scripts

Framework versions

  • PEFT 0.20.0

Citation

@software{promptforge_optimizer,
  title = {PromptForge-Optimizer},
  author = {PromptForge Contributors},
  year = {2026},
  url = {https://huggingface.co/ArjunShukla/PromptForge-Optimizer}
}

Model Card Contact

Open an issue on the PromptForge GitHub repository.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for ArjunShukla/PromptForge-Optimizer

Adapter
(1383)
this model