Analyze SMS, email, or transcribed phone-call messages and output structured JSON containing:
1from unsloth import FastLanguageModel
2
3model, tokenizer = FastLanguageModel.from_pretrained(
4 model_name="Alice0914/gemma4-e2b-scam-sentinel",
5 max_seq_length=1024,
6 load_in_4bit=True,
7)
8FastLanguageModel.for_inference(model)
9
10# (Load the full system prompt from the project repo)
11system_prompt = "..."
12
13messages = [
14 {"role": "system", "content": system_prompt},
15 {"role": "user", "content": "ANALYZE THIS INPUT:\n\nTEXT: Mom, send $500 right now\nMETADATA: {\"channel\": \"sms\"}"},
16]
17text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
18inputs = tokenizer(text=text, return_tensors="pt").to("cuda")
19outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.3)
20print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
-
Stage 1 — a fast classifier (e.g., gemma3:4b) ensures every potentially dangerous message is escalated (recall 99%+)
-
Stage 2 — this fine-tuned adapter provides high-confidence reasoning and tool calls only when action is warranted (precision 98%)
-
Stage 1 handles "catch everything"
-
Stage 2's job is to justify action — blocking payments, alerting family, demanding callback verification
-
With 1.1% FPR, when this model flags a message, downstream actions are trusted by users
-
Higher recall at this stage would re-introduce the user-trust collapse seen in the base model (FPR 97.7%), making the product unusable in real deployment regardless of recall
Project: Scam Sentinel — submission for the Gemma 4 Good Hackathon (2026).
1@misc{scam-sentinel-2026,
2 author = {Alice0914},
3 title = {Scam Sentinel: Multimodal Scam Risk Assistant with Fine-tuned Gemma 4 E2B},
4 year = {2026},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/Alice0914/gemma4-e2b-scam-sentinel}},
7 note = {Submission for the Gemma 4 Good Hackathon}
8}
9
10## Framework Versions
11- PEFT 0.19.1
12- Unsloth (latest from GitHub)
13- transformers ≥4.50
14- trl ≥1.4