Downloads · 30 days
5
10% of all-time downloads
DarrenJiaImbue/ai-detection-demo-gemma_4_e4b
ai-detection-demo-gemma_4_e4b is a text classification model from DarrenJiaImbue. Use it when you need a label for a piece of text. It is set up for pytorch. The card lists the license as cc-by-nc-sa-4.0.
A tiny (~1.6 M param) classification head trained on top of frozen google/gemma-4-E4B-it last-token logits, for AI-vs-human text classification.
Downloads · 30 days
5
10% of all-time downloads
All-time downloads
49
Public
Repo size
18.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors6.3 MB · 100%
From the Hugging Face model README
A tiny (~1.6 M param) classification head trained on top of frozen
google/gemma-4-E4B-it
last-token logits, for AI-vs-human text classification.
Same task and label convention as the EditLens paper, except the backbone is never adapted — only this tiny probe is trained.
raw_logits[262144] → LayerNorm → Dropout(0.3) → Linear → cls_logits[4]
Total params: ~1.57 M.
| file | size | purpose |
|---|---|---|
head.safetensors | 6.3 MB | LayerNorm + Linear weights (fp32) |
config.json | <1 KB | vocab_size, dropout, training metrics |
import json
import torch
from safetensors.torch import load_file
from huggingface_hub import snapshot_download
# See ai-detection-demo repo for the LinearDropoutHead class definition.
from gemma_4_e4b.head import LinearDropoutHead, score_from_logits
local = snapshot_download("DarrenJiaImbue/ai-detection-demo-gemma_4_e4b")
with open(f"{local}/config.json") as f:
cfg = json.load(f)
head = LinearDropoutHead(
vocab_size=cfg["vocab_size"], n_classes=cfg["n_classes"], dropout=cfg["dropout"]
)
head.load_state_dict(load_file(f"{local}/head.safetensors"))
head.eval()
# raw_logits: (batch, 262144) fp32 tensor of Gemma's last-token vocabulary logits.
with torch.no_grad():
logits = head(raw_logits)
bucket = logits.argmax(dim=-1) # 0..3
ai_score = score_from_logits(logits) # continuous [0, 1]
Trained on
DarrenJiaImbue/ai-detection-demo-gemma-logits —
pre-computed int4 Gemma 4 E4B logits over
DarrenJiaImbue/ai-detection-demo-dataset.
CC BY-NC-SA 4.0. Non-commercial research use only.