flashcoder commited on
Commit
e9a42e8
·
verified ·
1 Parent(s): 2e60560

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - intent-classification
5
+ - lead-mining
6
+ - distillation
7
+ - embeddinggemma
8
+ - cpu
9
+ metrics:
10
+ - precision
11
+ - accuracy
12
+ ---
13
+
14
+ # Tweet Buy-Intent Head (embeddinggemma-2 + MLP)
15
+
16
+ A 199 KB classification head distilled from a Gemini 2.5 Flash teacher:
17
+ scores X/Twitter posts 0-1 for **buying intent** ("is there an app that…",
18
+ "anyone recommend…", "I wish there was…").
19
+
20
+ Base embedder (frozen): **google/embeddinggemma-2** (768-d, Apache-2.0).
21
+ The head itself is an MLP 768→64→1 (49k params) — runs on CPU.
22
+
23
+ ## Results (held-out test, n=1,179)
24
+
25
+ | metric | score |
26
+ | --- | --- |
27
+ | precision@5 | 1.00 |
28
+ | precision@10 | 1.00 |
29
+ | accuracy @0.5 | 0.877 |
30
+
31
+ ⚠️ Labels are Gemini 2.5 Flash-generated (no human gold set yet): the scores
32
+ measure agreement with the teacher (~90% human agreement per a 50-sample
33
+ audit), not ground truth. Complaint-based intent is under-detected (safe
34
+ direction for lead queues: misses recall, not purity).
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ import torch
40
+ from huggingface_hub import hf_hub_download
41
+ from sentence_transformers import SentenceTransformer
42
+
43
+ embedder = SentenceTransformer("google/embeddinggemma-2", device="cpu",
44
+ model_kwargs={"dtype": torch.float32})
45
+ head_path = hf_hub_download("flashclub/tweet-buy-intent", "head.pt")
46
+ head = torch.nn.Sequential(
47
+ torch.nn.Linear(768, 64), torch.nn.ReLU(), torch.nn.Dropout(0.2), torch.nn.Linear(64, 1))
48
+ head.load_state_dict(torch.load(head_path, map_location="cpu"))
49
+ head.eval()
50
+
51
+ with torch.no_grad():
52
+ emb = torch.tensor(embedder.encode(["is there an app for invoicing"], normalize_embeddings=True))
53
+ score = torch.sigmoid(head(emb)).item()
54
+ print(score) # 0.82
55
+ ```
56
+
57
+ Trained on 7,866 X posts (2,850 intent) distilled from a Gemini teacher.
58
+ Pipeline: github.com/flashclub/x-lead-intent-pipeline