95 lines
3.5 KiB
Markdown
95 lines
3.5 KiB
Markdown
|
|
---
|
||
|
|
license: apache-2.0
|
||
|
|
language:
|
||
|
|
- en
|
||
|
|
tags:
|
||
|
|
- email
|
||
|
|
- cold-outreach
|
||
|
|
- text-generation
|
||
|
|
- qwen3
|
||
|
|
- fine-tuned
|
||
|
|
base_model: Qwen/Qwen3-0.6B
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
---
|
||
|
|
|
||
|
|
# Email-Qwen3-0.6B — Fine-tuned for Email Generation
|
||
|
|
|
||
|
|
A fine-tuned Qwen3 0.6B model specialized in generating professional emails from simple prompts. Trained on 130k curated email examples with 5 rounds of rejection sampling alignment.
|
||
|
|
|
||
|
|
## Model Details
|
||
|
|
|
||
|
|
- **Base model:** Qwen/Qwen3-0.6B
|
||
|
|
- **Training:** SFT on 130k prompt-email pairs + 5 rounds rejection sampling fine-tuning
|
||
|
|
- **Quantized version:** Q4_K_M (378MB) available for local inference via llama.cpp
|
||
|
|
- **Use case:** Cold outreach, thank-you, request, apology, invitation, congratulations, and 10+ other email types
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### With llama.cpp (recommended)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Download the GGUF quantized version
|
||
|
|
# Start the server
|
||
|
|
llama-server -m email-qwen3-06b-q4_k_m.gguf --host 127.0.0.1 --port 8081 -c 2048
|
||
|
|
|
||
|
|
# Generate an email
|
||
|
|
curl http://127.0.0.1:8081/v1/chat/completions \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{
|
||
|
|
"messages": [
|
||
|
|
{"role": "system", "content": "You are an email writing assistant. Write a polished email body for the given request."},
|
||
|
|
{"role": "user", "content": "Cold outreach to the CTO at Stripe about our developer tools platform"}
|
||
|
|
],
|
||
|
|
"max_tokens": 256,
|
||
|
|
"temperature": 0.7
|
||
|
|
}'
|
||
|
|
```
|
||
|
|
|
||
|
|
### With Transformers
|
||
|
|
|
||
|
|
```python
|
||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||
|
|
|
||
|
|
model = AutoModelForCausalLM.from_pretrained("CharlieGreenman/email-qwen3-0.6b")
|
||
|
|
tokenizer = AutoTokenizer.from_pretrained("CharlieGreenman/email-qwen3-0.6b")
|
||
|
|
|
||
|
|
messages = [
|
||
|
|
{"role": "system", "content": "You are an email writing assistant. Write a polished email body for the given request."},
|
||
|
|
{"role": "user", "content": "Thank Sarah for helping with the presentation last week"},
|
||
|
|
]
|
||
|
|
|
||
|
|
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||
|
|
inputs = tokenizer(text, return_tensors="pt")
|
||
|
|
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
|
||
|
|
print(tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True))
|
||
|
|
```
|
||
|
|
|
||
|
|
## Tips for Best Results
|
||
|
|
|
||
|
|
- **One paragraph at a time:** This model performs best when asked to generate individual paragraphs rather than full multi-paragraph emails. Generate each paragraph with a focused prompt, then assemble.
|
||
|
|
- **Keep prompts specific:** Include the recipient's name, company, role, and topic for better personalization.
|
||
|
|
- **Use best-of-N:** Generate 3-5 variants and pick the best one. Small models benefit significantly from selection.
|
||
|
|
- **Temperature 0.7-0.8** works well for email generation.
|
||
|
|
|
||
|
|
## Training Data
|
||
|
|
|
||
|
|
- 50,000 diverse email prompts across 17 email types
|
||
|
|
- 34,055 high-quality prompt-email pairs (scored 80+ by our quality scorer)
|
||
|
|
- 96,034 section-level examples (individual email paragraphs)
|
||
|
|
- 5 rounds of rejection sampling using best-of-5 selection with quality scoring
|
||
|
|
|
||
|
|
## Supported Email Types
|
||
|
|
|
||
|
|
Cold outreach, follow-up, newsletter, transactional, welcome, personal, request, meeting, FYI, thank-you, confirmation, apology, introduction, invitation, deadline, congratulations, and freeform.
|
||
|
|
|
||
|
|
## Limitations
|
||
|
|
|
||
|
|
- Best for common email types; may struggle with unusual or highly creative prompts
|
||
|
|
- Generates email body text; subject lines should be handled separately
|
||
|
|
- Small model (0.6B) — quality improves significantly with best-of-N selection and post-processing
|
||
|
|
- May occasionally hallucinate company names or statistics
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
Apache 2.0
|