Downloads · 30 days
8
10% of all-time downloads
Adityasharma4287/email-triage-grpo
email-triage-grpo is a text generation model from Adityasharma4287. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as llama3.1.
A LoRA adapter for meta-llama/Llama-3.1-8B-Instruct, trained using GRPO (Group Relative Policy Optimization) to autonomously triage emails — assigning priority, category, and action with human-level accuracy.
Downloads · 30 days
8
10% of all-time downloads
All-time downloads
79
Public
Repo size
44.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors27.3 MB · 61%
From the Hugging Face model README
A LoRA adapter for meta-llama/Llama-3.1-8B-Instruct, trained using GRPO (Group Relative Policy Optimization) to autonomously triage emails — assigning priority, category, and action with human-level accuracy.
GRPO is the same RL technique used in DeepSeek-R1. Instead of supervised labels, the model learns by receiving reward signals from an environment — just like how humans learn from feedback.
Given an email (subject + sender + body), the model outputs:
| Output | Values |
|---|---|
| Priority | urgent / high / medium / low / spam |
| Category | billing / technical / customer_support / sales / legal / hr / internal / spam / other |
| Action | reply / escalate / forward / archive / delete / snooze |
| Tags | VIP / churn-risk / legal-review / follow-up |
| Reply text | Auto-drafted reply (when action = reply) |
| Property | Value |
|---|---|
| Base model | meta-llama/Llama-3.1-8B-Instruct |
| Training method | GRPO (Reinforcement Learning from Environment Reward) |
| PEFT method | LoRA |
| LoRA rank | r=16, alpha=32 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Task type | Causal LM |
| Score improvement | 0 → 1 (full reward range) |
| Training environment | Email Triage OpenEnv v2.0 |
The model was trained on a reward signal (not supervised labels):
reward = priority_score × 0.35
+ category_score × 0.25
+ action_score × 0.30
+ sentiment_bonus (up to +0.08)
+ tag_bonus (up to +0.08)
- sla_breach_penalty (-0.15 if urgent email archived)
- urgent_archive_penalty (-0.35)
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "meta-llama/Llama-3.1-8B-Instruct"
adapter = "Adityasharma4287/email-triage-grpo"
tokenizer = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
model = PeftModel.from_pretrained(model, adapter)
email = """
Subject: URGENT - Server is DOWN
From: [email protected]
Body: Our entire application is down. 50,000 users affected.
Need immediate response from engineering.
"""
messages = [
{"role": "system", "content": "You are an expert email triage agent. Classify the email and decide the best action."},
{"role": "user", "content": f"Triage this email:\n{email}\n\nRespond with JSON: priority, category, action, notes"}
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
output = model.generate(input_ids, max_new_tokens=256, temperature=0.1)
print(tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True))
Expected output:
{
"priority": "urgent",
"category": "technical",
"action": "escalate",
"notes": "Production outage affecting 50k users. Immediate engineering response needed.",
"custom_tags": ["VIP"]
}
| Task | Difficulty | Score |
|---|---|---|
task_easy_spam | 🟢 Easy | ~0.85+ |
task_medium_triage | 🟡 Medium | ~0.70+ |
task_hard_ambiguous | 🔴 Hard | ~0.55+ |
Scores measured on Email Triage OpenEnv v2.0 with seed=42
| Link | Description |
|---|---|
| 📧 Live App | Interactive email triage UI |
| 🔗 Environment API | REST API for training agents |
| 📂 Environment Code | OpenEnv-compliant source |
The model was trained on an advanced environment with:
email-triage-grpo/
├── adapter_config.json ← LoRA config
├── adapter_model.safetensors ← Trained weights (27.3 MB)
├── tokenizer.json ← Llama-3.1 tokenizer
├── tokenizer_config.json
├── chat_template.jinja ← Chat prompt template
├── env/ ← Training environment
│ └── email_triage_env.py ← OpenEnv environment
├── smart_agent.py ← Agent inference script
└── inference.py ← Inference utilities
The full training environment is included. Run your own GRPO training:
git clone https://huggingface.co/Adityasharma4287/email-triage-grpo
cd email-triage-grpo
pip install -r requirements.txt
# Set env vars
export API_KEY="your-openai-or-local-key"
export MODEL_NAME="gpt-4o-mini" # or your local model
export ENV_BASE_URL="http://localhost:7860"
# Start the environment server
python app.py &
# Run the smart agent
python smart_agent.py
@misc{email-triage-grpo-2026,
title = {Email Triage Agent: RL Fine-tuning with GRPO on Llama-3.1-8B},
author = {Adityasharma4287},
year = {2026},
url = {https://huggingface.co/Adityasharma4287/email-triage-grpo},
note = {LoRA adapter trained with Group Relative Policy Optimization}
}
Built with ❤️ using GRPO + LoRA + OpenEnv