tshaik1990/qwen3.5-2b-prompt-compiler
Qwen3.5-2B Prompt Compiler (LoRA)
A LoRA adapter fine-tuned on unsloth/Qwen3.5-2B that turns a short, underspecified request into a clear, structured, implementation-ready prompt — instead of answering the request directly.
Example
Model Details
- Base model:
unsloth/Qwen3.5-2B - Method: LoRA, rank 16, alpha 32, target modules: attention + MLP projections (
q/k/v/o_proj,gate/up/down_proj) - Hardware: 1x Tesla T4
- Framework versions:
unsloth 2026.8.22,transformers 5.2.0,trl 0.22.2,peft 0.20.0,torch 2.8.0
Intended use
Given a system prompt instructing the model to act as a prompt compiler, e.g.:
"You are a prompt compiler. Convert the user's request into a clear, structured, implementation-ready prompt while preserving all stated requirements."
...the model converts a terse user request into a well-specified prompt suitable for handing to a stronger model or downstream pipeline. It is trained to elicit missing context (ask for it) rather than invent facts, prices, or requirements that weren't given.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3.5-2B", device_map="auto")
model = PeftModel.from_pretrained(base, "tshaik1990/qwen3.5-2b-prompt-compiler")
tok = AutoTokenizer.from_pretrained("tshaik1990/qwen3.5-2b-prompt-compiler")
messages = [
{"role": "system", "content": "You are a prompt compiler. Convert the user's request into a clear, structured, implementation-ready prompt while preserving all stated requirements."},
{"role": "user", "content": "should i rent or buy a home"},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=512, temperature=0.2, top_p=0.95, top_k=20)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))A quantized GGUF build (for Ollama / llama.cpp) is available at tshaik1990/qwen3.5-2b-prompt-compiler-GGUF.
Training data
Single epoch, 50 steps, on an instruction-style dataset of paired (raw request → compiled prompt) examples.
Evaluation
Evaluated on a 20-prompt held-out benchmark spanning categories such as coding, business, travel, financial research, and agent/tool-use safety, each prompt tagged with the specific failure mode it probes (e.g. missing_context, invented_requirements, destructive_action_safety).
Compared against the base model under identical sampling settings (temperature 0.2, topp 0.95, topk 20, same system prompt):
Shorter output on 18 of 20 benchmark prompts (avg. ~2.8x more compact); the model was also verified to reload correctly from a fresh checkpoint and reproduce the same behavior.
Limitations
- Trained for a single epoch on a small, self-authored dataset — not evaluated against a third-party benchmark.
- The 20-prompt evaluation above is self-authored by the model's creator, not an independent benchmark.
- Formal human-preference review of the evaluation outputs is still pending at the time of this release.
- Small model (2B parameters); may not generalize to prompt domains far outside the training distribution (e.g. multi-turn agent workflows, non-English input).
License
Inherits the license of the base model, unsloth/Qwen3.5-2B.
