Instructions to use Proteinrequired/email-triage-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Proteinrequired/email-triage-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-3B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Proteinrequired/email-triage-lora") - Notebooks
- Google Colab
- Kaggle
Add model card with honest held-out results
Browse files
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.2
|
| 3 |
+
base_model: unsloth/Llama-3.2-3B-Instruct
|
| 4 |
+
library_name: peft
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- peft
|
| 8 |
+
- email-triage
|
| 9 |
+
- tool-calling
|
| 10 |
+
- text-classification
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Email-Triage LoRA (Llama-3.2-3B-Instruct)
|
| 15 |
+
|
| 16 |
+
A LoRA adapter (`r=16`) fine-tuned via Behavioral Cloning to triage corporate emails by
|
| 17 |
+
selecting one of three tools — `route_to_human`, `auto_reply`, or `ask_for_clarification` —
|
| 18 |
+
returned as a strict JSON tool call.
|
| 19 |
+
|
| 20 |
+
- **Base model:** `unsloth/Llama-3.2-3B-Instruct`
|
| 21 |
+
- **Method:** Behavioral Cloning (Unsloth + Hugging Face TRL), 60 steps
|
| 22 |
+
- **Adapter:** LoRA, `r=16`
|
| 23 |
+
- **Project:** [Enterprise Email Triage Simulator](https://github.com/vaishali-strategy/email-triage)
|
| 24 |
+
- **Live demo (Gemini-backed UI):** https://huggingface.co/spaces/Proteinrequired/enterprise-email-triage-v2
|
| 25 |
+
|
| 26 |
+
## Results — held-out tool-selection accuracy
|
| 27 |
+
|
| 28 |
+
Evaluated on a **21-email held-out test set** (canonical 100-email dataset, intent-stratified
|
| 29 |
+
80/20 split, seed 42; BC trained only on the 79 train emails). Metric = did the policy pick the
|
| 30 |
+
reward system's optimal tool for each email.
|
| 31 |
+
|
| 32 |
+
| Policy | Held-out accuracy (N=21) |
|
| 33 |
+
| :--- | :---: |
|
| 34 |
+
| Random choice | 33.0% |
|
| 35 |
+
| Always `route_to_human` | 47.6% |
|
| 36 |
+
| Rule-based heuristic | **76.2%** (16/21) |
|
| 37 |
+
| **This adapter** | **71.4%** (15/21) |
|
| 38 |
+
|
| 39 |
+
The adapter is **perfect on every `route_to_human` intent** but **over-escalates** routine
|
| 40 |
+
(`auto_reply`) and ambiguous (`ask_for_clarification`) mail — a known Behavioral-Cloning artifact
|
| 41 |
+
(trained on reward-positive rollouts skewed toward escalation). It lands within one example of a
|
| 42 |
+
hand-tuned rule baseline and far above the random / always-escalate floors. Reproduce with
|
| 43 |
+
[`run_trained_eval.py`](https://github.com/vaishali-strategy/email-triage/blob/v2-rebuild/run_trained_eval.py).
|
| 44 |
+
|
| 45 |
+
## Usage
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
+
from peft import PeftModel
|
| 50 |
+
|
| 51 |
+
base = "unsloth/Llama-3.2-3B-Instruct"
|
| 52 |
+
adapter = "Proteinrequired/email-triage-lora"
|
| 53 |
+
|
| 54 |
+
tok = AutoTokenizer.from_pretrained(base)
|
| 55 |
+
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
|
| 56 |
+
model = PeftModel.from_pretrained(model, adapter)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
The model expects the system/user prompt format defined in
|
| 60 |
+
[`run_trained_eval.py`](https://github.com/vaishali-strategy/email-triage/blob/v2-rebuild/run_trained_eval.py)
|
| 61 |
+
and responds with a JSON object: `{"tool": "<route_to_human|auto_reply|ask_for_clarification>"}`.
|
| 62 |
+
|
| 63 |
+
## Limitations
|
| 64 |
+
|
| 65 |
+
- Trained on synthetic corporate emails; not validated on real inboxes or other domains.
|
| 66 |
+
- 3B model — needs a GPU for low-latency inference. The live demo uses Gemini via API for
|
| 67 |
+
CPU-only hosting; this adapter is the project's open-weights research artifact.
|
| 68 |
+
- Optimizes the project's reward policy; not a general-purpose safety/abuse classifier.
|