adlk commited on
Commit
dcfd2ab
·
verified ·
1 Parent(s): 7acd7c2

Add model card from franz-email-classifier

Browse files
Files changed (1) hide show
  1. README.md +130 -0
README.md ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ - de
6
+ - multilingual
7
+ library_name: transformers
8
+ pipeline_tag: text-classification
9
+ tags:
10
+ - email
11
+ - classification
12
+ - multi-label
13
+ - onnx
14
+ - int8
15
+ - priority
16
+ base_model: microsoft/Multilingual-MiniLM-L12-H384
17
+ model-index:
18
+ - name: franz-email-classifier
19
+ results: []
20
+ ---
21
+
22
+ # Franz Email Classifier
23
+
24
+ Multi-label email classification model used by [Franz](https://meetfranz.com) to automatically prioritize emails.
25
+
26
+ Fine-tuned from [`microsoft/Multilingual-MiniLM-L12-H384`](https://huggingface.co/microsoft/Multilingual-MiniLM-L12-H384) and exported as **ONNX INT8** for fast CPU inference in Electron.
27
+
28
+ ## Labels
29
+
30
+ The model predicts 8 binary labels per email:
31
+
32
+ | Label | Meaning |
33
+ |---|---|
34
+ | `IS_URGENT` | Needs attention today |
35
+ | `NEEDS_REPLY` | Direct question or action request to the user |
36
+ | `HAS_DEADLINE` | Explicit or relative deadline mentioned |
37
+ | `IS_ACTIONABLE` | Any action required (broader than NEEDS_REPLY) |
38
+ | `IS_INFORMATIONAL` | FYI / status update, no action needed |
39
+ | `IS_AUTOMATED` | Machine-generated (CI/CD, monitoring, alerts) |
40
+ | `IS_NEWSLETTER` | Content marketing / newsletter |
41
+ | `IS_TRANSACTIONAL` | Receipt, invoice, order confirmation |
42
+
43
+ ## Priority Mapping
44
+
45
+ Labels are combined into priority tiers in the Franz app:
46
+
47
+ | Condition | Priority |
48
+ |---|---|
49
+ | IS_URGENT + NEEDS_REPLY | `urgent` |
50
+ | IS_URGENT | `important` |
51
+ | NEEDS_REPLY + IS_ACTIONABLE | `important` |
52
+ | IS_NEWSLETTER or IS_TRANSACTIONAL | `noise` |
53
+ | IS_AUTOMATED (not urgent) | `noise` |
54
+ | IS_INFORMATIONAL (not urgent/reply) | `low` |
55
+ | Everything else | `normal` |
56
+
57
+ ## Usage
58
+
59
+ ### With @huggingface/transformers (Node.js / Electron)
60
+
61
+ ```ts
62
+ import { pipeline, env } from '@huggingface/transformers'
63
+
64
+ env.allowLocalModels = true
65
+ env.localModelPath = '/path/to/models' // parent dir
66
+
67
+ const classifier = await pipeline(
68
+ 'text-classification',
69
+ 'email-classifier', // subdirectory name
70
+ { dtype: 'int8', device: 'cpu', multi_label: true }
71
+ )
72
+
73
+ const result = await classifier('Re: Urgent: Invoice #4521 due Friday')
74
+ // [
75
+ // { label: 'IS_URGENT', score: 0.94 },
76
+ // { label: 'NEEDS_REPLY', score: 0.12 },
77
+ // { label: 'HAS_DEADLINE', score: 0.91 },
78
+ // ...
79
+ // ]
80
+ ```
81
+
82
+ ### With transformers (Python)
83
+
84
+ ```python
85
+ from transformers import pipeline
86
+
87
+ classifier = pipeline(
88
+ "text-classification",
89
+ model="meetfranz/franz-models",
90
+ top_k=None
91
+ )
92
+
93
+ result = classifier("Re: Urgent: Invoice #4521 due Friday")
94
+ ```
95
+
96
+ ## Model Details
97
+
98
+ | Property | Value |
99
+ |---|---|
100
+ | Architecture | BertForSequenceClassification |
101
+ | Base model | microsoft/Multilingual-MiniLM-L12-H384 |
102
+ | Hidden size | 384 |
103
+ | Layers | 12 |
104
+ | Attention heads | 12 |
105
+ | Max sequence length | 512 |
106
+ | Vocab size | 250,037 |
107
+ | Tokenizer | XLMRobertaTokenizer (SentencePiece BPE) |
108
+ | Problem type | Multi-label classification |
109
+ | Quantization | ONNX INT8 |
110
+ | Model size | ~113 MB (quantized) |
111
+
112
+ ## Training
113
+
114
+ Trained on LLM-generated synthetic email data. No real user emails or personal data were used in training. Labels were bootstrapped via LLM annotation and human-reviewed for quality.
115
+
116
+ Fine-tuned with multi-label BCE loss, then exported to ONNX with INT8 dynamic quantization.
117
+
118
+ ## How Franz Uses This Model
119
+
120
+ This model is **Stage 2** in Franz's three-stage email classification funnel:
121
+
122
+ 1. **Stage 1 — Heuristics**: Fast rules-based classification for obvious cases
123
+ 2. **Stage 2 — ML (this model)**: ONNX inference for ambiguous emails (confidence threshold: 0.75)
124
+ 3. **Stage 3 — LLM**: Local or cloud LLM for emails below the ML confidence threshold
125
+
126
+ The model is downloaded on demand when a user first adds an email account to Franz. If unavailable, the app gracefully falls through to Stage 3.
127
+
128
+ ## License
129
+
130
+ MIT