ArjunShukla commited on
Commit
fa33598
·
verified ·
1 Parent(s): 5bb7ea0

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +140 -125
README.md CHANGED
@@ -1,207 +1,222 @@
1
  ---
2
  base_model: Qwen/Qwen2.5-1.5B-Instruct
3
  library_name: peft
 
 
 
4
  pipeline_tag: text-generation
5
  tags:
6
- - base_model:adapter:Qwen/Qwen2.5-1.5B-Instruct
7
- - lora
8
- - transformers
 
 
 
 
 
 
9
  ---
10
 
11
- # Model Card for Model ID
12
-
13
- <!-- Provide a quick summary of what the model is/does. -->
14
 
 
15
 
 
16
 
17
  ## Model Details
18
 
19
  ### Model Description
20
 
21
- <!-- Provide a longer summary of what this model is. -->
22
-
23
-
24
 
25
- - **Developed by:** [More Information Needed]
26
- - **Funded by [optional]:** [More Information Needed]
27
- - **Shared by [optional]:** [More Information Needed]
28
- - **Model type:** [More Information Needed]
29
- - **Language(s) (NLP):** [More Information Needed]
30
- - **License:** [More Information Needed]
31
- - **Finetuned from model [optional]:** [More Information Needed]
32
 
33
- ### Model Sources [optional]
34
 
35
- <!-- Provide the basic links for the model. -->
36
-
37
- - **Repository:** [More Information Needed]
38
- - **Paper [optional]:** [More Information Needed]
39
- - **Demo [optional]:** [More Information Needed]
40
 
41
  ## Uses
42
 
43
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
-
45
  ### Direct Use
46
 
47
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
48
 
49
- [More Information Needed]
50
 
51
- ### Downstream Use [optional]
 
 
52
 
53
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
 
55
- [More Information Needed]
 
 
56
 
57
  ### Out-of-Scope Use
58
 
59
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
-
61
- [More Information Needed]
 
62
 
63
  ## Bias, Risks, and Limitations
64
 
65
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
-
67
- [More Information Needed]
 
68
 
69
  ### Recommendations
70
 
71
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
-
73
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
 
75
  ## How to Get Started with the Model
76
 
77
- Use the code below to get started with the model.
78
-
79
- [More Information Needed]
80
-
81
- ## Training Details
82
-
83
- ### Training Data
84
-
85
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
86
-
87
- [More Information Needed]
88
-
89
- ### Training Procedure
90
-
91
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
-
93
- #### Preprocessing [optional]
94
-
95
- [More Information Needed]
96
-
97
-
98
- #### Training Hyperparameters
99
-
100
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
-
102
- #### Speeds, Sizes, Times [optional]
103
 
104
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
 
 
105
 
106
- [More Information Needed]
 
 
107
 
108
- ## Evaluation
 
109
 
110
- <!-- This section describes the evaluation protocols and provides the results. -->
 
111
 
112
- ### Testing Data, Factors & Metrics
 
 
 
 
 
113
 
114
- #### Testing Data
115
 
116
- <!-- This should link to a Dataset Card if possible. -->
 
 
117
 
118
- [More Information Needed]
 
119
 
120
- #### Factors
 
 
 
121
 
122
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
 
124
- [More Information Needed]
125
 
126
- #### Metrics
127
 
128
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
 
 
 
129
 
130
- [More Information Needed]
131
 
132
- ### Results
133
 
134
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
- #### Summary
137
 
 
138
 
 
 
 
 
 
 
139
 
140
- ## Model Examination [optional]
141
 
142
- <!-- Relevant interpretability work for the model goes here -->
143
 
144
- [More Information Needed]
145
 
146
  ## Environmental Impact
147
 
148
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
-
150
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
 
 
151
 
152
- - **Hardware Type:** [More Information Needed]
153
- - **Hours used:** [More Information Needed]
154
- - **Cloud Provider:** [More Information Needed]
155
- - **Compute Region:** [More Information Needed]
156
- - **Carbon Emitted:** [More Information Needed]
157
-
158
- ## Technical Specifications [optional]
159
 
160
  ### Model Architecture and Objective
161
 
162
- [More Information Needed]
 
163
 
164
  ### Compute Infrastructure
165
 
166
- [More Information Needed]
167
-
168
  #### Hardware
169
 
170
- [More Information Needed]
171
 
172
  #### Software
173
 
174
- [More Information Needed]
175
-
176
- ## Citation [optional]
 
177
 
178
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
-
180
- **BibTeX:**
181
-
182
- [More Information Needed]
183
-
184
- **APA:**
185
-
186
- [More Information Needed]
187
-
188
- ## Glossary [optional]
189
-
190
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
-
192
- [More Information Needed]
193
-
194
- ## More Information [optional]
195
 
196
- [More Information Needed]
197
 
198
- ## Model Card Authors [optional]
199
 
200
- [More Information Needed]
 
 
 
 
 
 
 
201
 
202
  ## Model Card Contact
203
 
204
- [More Information Needed]
205
- ### Framework versions
206
-
207
- - PEFT 0.20.0
 
1
  ---
2
  base_model: Qwen/Qwen2.5-1.5B-Instruct
3
  library_name: peft
4
+ license: mit
5
+ language:
6
+ - en
7
  pipeline_tag: text-generation
8
  tags:
9
+ - promptforge
10
+ - prompt-optimization
11
+ - prompt-engineering
12
+ - lora
13
+ - peft
14
+ - qwen2.5
15
+ - text-generation
16
+ - base_model:adapter:Qwen/Qwen2.5-1.5B-Instruct
17
+ - transformers
18
  ---
19
 
20
+ # PromptForge-Optimizer
 
 
21
 
22
+ LoRA adapter that rewrites **weak / vague prompts** into **clear, specific, actionable LLM prompts** while preserving the original intent and topic.
23
 
24
+ Part of [PromptForge](https://github.com/YOUR_USER/promptModel) — local-first prompt quality scoring + optimization.
25
 
26
  ## Model Details
27
 
28
  ### Model Description
29
 
30
+ PromptForge-Optimizer is a **PEFT/LoRA** fine-tune of [`Qwen/Qwen2.5-1.5B-Instruct`](https://huggingface.co/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.
 
 
31
 
32
+ - **Developed by:** PromptForge contributors
33
+ - **Model type:** Causal LM adapter (LoRA / PEFT)
34
+ - **Language(s):** English
35
+ - **License:** MIT
36
+ - **Finetuned from:** [`Qwen/Qwen2.5-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct)
 
 
37
 
38
+ ### Model Sources
39
 
40
+ - **Repository:** https://github.com/YOUR_USER/promptModel
41
+ - **Companion model:** PromptForge-Quality (ModernBERT multi-dimension prompt scorer)
42
+ - **Demo:** Gradio app in the PromptForge repo (`demo/app.py`)
 
 
43
 
44
  ## Uses
45
 
 
 
46
  ### Direct Use
47
 
48
+ - Rewrite vague prompts into production-ready LLM instructions
49
+ - Pair with **PromptForge-Quality** for score → optimize → re-score workflows
50
+ - Local / offline prompt tooling (CLI, Python API, Gradio)
51
 
52
+ Example weak → strong:
53
 
54
+ | Weak | Optimized (intent preserved) |
55
+ |------|------------------------------|
56
+ | `Make an app about social media like facebook and stuff` | Social media / Facebook-like app prompt with profiles, feed, likes, constraints, output format |
57
 
58
+ ### Downstream Use
59
 
60
+ - Prompt engineering assistants
61
+ - IDE / agent tooling that improves user instructions before calling an LLM
62
+ - Synthetic data pipelines that need higher-quality prompts
63
 
64
  ### Out-of-Scope Use
65
 
66
+ - Not a general chat assistant
67
+ - Not a substitute for domain experts (legal, medical, safety-critical advice)
68
+ - Not guaranteed to preserve intent on topics far outside the curated training set
69
+ - Do not use to generate harmful, deceptive, or disallowed content
70
 
71
  ## Bias, Risks, and Limitations
72
 
73
+ - Trained on **curated synthetic** weak→strong pairs; coverage is strongest on coding apps, writing, data, research, and planning prompts
74
+ - May invent plausible audience / stack details (e.g. “product managers”, “Flask”) when the weak prompt is underspecified
75
+ - Small base model (**1.5B**) — quality is good for local use, not frontier-LLM rewrite quality
76
+ - Inference includes validation + fallback in the PromptForge package; raw adapter output alone may still drift
77
 
78
  ### Recommendations
79
 
80
+ - Prefer the **PromptForge Python package / CLI** (chat template + stop tokens + validation) over raw `generate`
81
+ - For new domains, add your own weak→strong pairs and retrain the LoRA
82
+ - Always review optimized prompts before sending them to production LLMs
83
 
84
  ## How to Get Started with the Model
85
 
86
+ ### With PromptForge (recommended)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
+ ```bash
89
+ pip install promptforge
90
+ # or from source: pip install -e ".[demo]"
91
 
92
+ python -m promptforge download \
93
+ --quality-repo YOUR_HF_USERNAME/PromptForge-Quality \
94
+ --optimizer-repo YOUR_HF_USERNAME/PromptForge-Optimizer
95
 
96
+ python -m promptforge run "Make an app about social media like facebook and stuff"
97
+ ```
98
 
99
+ ```python
100
+ from promptforge import PromptForge
101
 
102
+ pf = PromptForge(
103
+ quality_model_path="YOUR_HF_USERNAME/PromptForge-Quality",
104
+ optimizer_model_path="YOUR_HF_USERNAME/PromptForge-Optimizer",
105
+ )
106
+ print(pf.run("Build me a website for a startup")["optimized_prompt"])
107
+ ```
108
 
109
+ ### Load the adapter directly (PEFT)
110
 
111
+ ```python
112
+ from peft import PeftModel
113
+ from transformers import AutoModelForCausalLM, AutoTokenizer
114
 
115
+ base = "Qwen/Qwen2.5-1.5B-Instruct"
116
+ adapter = "YOUR_HF_USERNAME/PromptForge-Optimizer"
117
 
118
+ tokenizer = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
119
+ model = AutoModelForCausalLM.from_pretrained(base, trust_remote_code=True, device_map="auto")
120
+ model = PeftModel.from_pretrained(model, adapter)
121
+ ```
122
 
123
+ Use Qwen’s chat template (`tokenizer.apply_chat_template`) do not hand-roll `<|system|>` tags.
124
 
125
+ ## Training Details
126
 
127
+ ### Training Data
128
 
129
+ - **~800** curated high-quality **weak strong** prompt pairs
130
+ - **~140** unique topic-preserving seeds (coding, writing, data, research, general)
131
+ - Intent rule: optimized prompt must keep the same topic as the weak prompt
132
+ - Assistant-only loss masking (system/user tokens not trained)
133
 
134
+ ### Training Procedure
135
 
136
+ #### Training Hyperparameters
137
 
138
+ | Setting | Value |
139
+ |---------|-------|
140
+ | Base model | `Qwen/Qwen2.5-1.5B-Instruct` |
141
+ | Method | LoRA (PEFT) |
142
+ | LoRA rank / alpha | 16 / 32 |
143
+ | Target modules | q/k/v/o + MLP projections |
144
+ | Max sequence length | 512 |
145
+ | Epochs | 6 |
146
+ | Effective batch size | 8 (batch 1 × grad accum 8) |
147
+ | Learning rate | 1e-4 |
148
+ | Precision | fp16 |
149
+ | Gradient checkpointing | enabled |
150
+ | Config | `configs/optimizer_fast_8gb.yaml` |
151
+
152
+ #### Speeds, Sizes, Times
153
+
154
+ - **Hardware:** NVIDIA GeForce RTX 5060 Laptop GPU (8 GB)
155
+ - **Wall time:** ~87 minutes (6 epochs)
156
+ - **Adapter size on disk:** ~82 MB
157
+ - **Train loss:** ~0.47
158
+ - **Validation loss:** ~0.121
159
 
160
+ ## Evaluation
161
 
162
+ ### Metrics
163
 
164
+ | Signal | Result |
165
+ |--------|--------|
166
+ | Validation loss | **0.121** |
167
+ | Example quality lift (scorer) | e.g. **41.5 → 94.0** on a social-media app prompt |
168
+ | Intent preservation | Topic keywords retained (social / Facebook) |
169
+ | Validation gate | Rejects empty / repetitive / low-intent outputs |
170
 
171
+ Evaluation is primarily: held-out SFT loss + pipeline checks (score delta, instruction preservation, repetition detection). Not a public leaderboard benchmark.
172
 
173
+ ### Summary
174
 
175
+ 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.
176
 
177
  ## Environmental Impact
178
 
179
+ - **Hardware Type:** NVIDIA RTX 5060 Laptop (8 GB)
180
+ - **Hours used:** ~1.5 h for this adapter run
181
+ - **Cloud Provider:** N/A (local)
182
+ - **Compute Region:** N/A
183
+ - **Carbon Emitted:** Not measured
184
 
185
+ ## Technical Specifications
 
 
 
 
 
 
186
 
187
  ### Model Architecture and Objective
188
 
189
+ - Causal language model (Qwen2.5 Instruct) + LoRA
190
+ - Objective: SFT to map weak prompt (+ analysis) → optimized prompt text only
191
 
192
  ### Compute Infrastructure
193
 
 
 
194
  #### Hardware
195
 
196
+ - RTX 5060 Laptop GPU, 8 GB VRAM
197
 
198
  #### Software
199
 
200
+ - PyTorch (CUDA)
201
+ - Transformers
202
+ - PEFT / LoRA
203
+ - PromptForge training scripts
204
 
205
+ ### Framework versions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
+ - PEFT 0.20.0
208
 
209
+ ## Citation
210
 
211
+ ```bibtex
212
+ @software{promptforge_optimizer,
213
+ title = {PromptForge-Optimizer},
214
+ author = {PromptForge Contributors},
215
+ year = {2026},
216
+ url = {https://huggingface.co/YOUR_HF_USERNAME/PromptForge-Optimizer}
217
+ }
218
+ ```
219
 
220
  ## Model Card Contact
221
 
222
+ Open an issue on the PromptForge GitHub repository.