Smaug-AI-Text-Detector-E4B

Homepage Hugging Face
License

Demo · Technical blog

Smaug-AI-Text-Detector-E4B is an open-weight AI text detector. It labels every sentence of a text as human, AI-generated, or AI-assisted (written by a person, then edited by an AI), and gives one label for the whole text. A larger, more accurate model is also available: Smaug-AI-Text-Detector-35B-A3B.

  • A label for every sentence. You get which parts of the text carry which label, and how much of the text falls under each label.
  • One label for the whole text. Human if at least 90% of the text is labelled human, AI if at least 80% is labelled AI-generated, Mixed otherwise.

Usage

pip install torch "transformers>=5.23" numpy
from transformers import AutoModel, AutoTokenizer

model_id = "abacusai/Smaug-AI-Text-Detector-E4B"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(model_id, trust_remote_code=True).to("cuda").eval()

text = """I took a pail of water that stood near the rail, and, leaning far out, poured it over my head and shoulders. As I turned, dripping, Jones, relieved of the wheel, touched me on the arm. "Go back to sleep, boy," he said kindly. "We need you, and we're goin' to need you more when we get ashore. You've been talkin' in your sleep till you plumb scared me." But I was wide awake by that time, and he had had as little sleep as I had.

Remote work has fundamentally transformed the modern workplace, offering both significant advantages and notable challenges for organizations and employees alike. One of the most compelling benefits is the flexibility it provides, allowing individuals to design their schedules around personal commitments and peak productivity hours. This autonomy often leads to improved work-life balance and higher overall job satisfaction."""

result = model.analyze(text, tokenizer)
print(result["verdict"])     # 'Human', 'Mixed' or 'AI'
print(result["share"])
for part in result["segments"]:
    print(part["label"], "|", result["text_scored"][part["start"]:part["end"]].strip())

Output:

Mixed
{'human': 0.5006, 'ai_assisted': 0.0, 'ai_generated': 0.4994}
human | I took a pail of water that stood near the rail, and, leaning far out, poured it over my head and shoulders. As I turned, dripping, Jones, relieved of the wheel, touched me on the arm. "Go back to sleep, boy," he said kindly. "We need you, and we're goin' to need you more when we get ashore. You've been talkin' in your sleep till you plumb scared me." But I was wide awake by that time, and he had had as little sleep as I had.
ai_generated | Remote work has fundamentally transformed the modern workplace, offering both significant advantages and notable challenges for organizations and employees alike. One of the most compelling benefits is the flexibility it provides, allowing individuals to design their schedules around personal commitments and peak productivity hours. This autonomy often leads to improved work-life balance and higher overall job satisfaction.

start and end count characters in result["text_scored"]. That is your input after a light clean-up: line breaks and repeated spaces become one space, and curly quotes and long dashes become plain ones. The model reads the first 12,000 tokens of a text. Under 50 words the label is unreliable, and result["short"] is set to true.

Benchmarks

All numbers are percentages, and lower is better.

False positive rate (FPR): human text wrongly labelled

Benchmark Texts Smaug-AI-Text-Detector-E4B Pangram (4 or 4.1)
FineWeb: web pages, 2015 to 2021 132,617 0.010 0.009*
PERSUADE: student essays 25,994 0.004 0.00
PELIC: essays by English learners 15,000 0.23 0.01
ELLIPSE: school essays by English learners 3,909 0.00 0.00
Liang et al., TOEFL: essays by non-native speakers 91 0.00 0.00
UChicago (Jabarian and Imas): human texts 1,992 0.05‡ 0.00
Epoch AI Style Imitation: skilled human prose 495 0.00 0.00
Saha Peer Review: human reviews 468 0.0 0.0
Saha Peer Review, easy: human reviews polished by AI 915 3.0‡ 1.4
Saha Peer Review, hard: human reviews polished by AI 1,887 8.7‡ 2.5

False negative rate (FNR): AI text wrongly labelled

Benchmark Texts Smaug-AI-Text-Detector-E4B Pangram (4 or 4.1)
MELD-eval, no attack: AI text 31,448 0.00† 0.00
MELD-eval, six attacks: AI text with character and word substitutions 188,688 0.10† 0.01
Sem-Detect: peer reviews written by AI 6,744 0.00† 4.5
UChicago: AI text 7,968 0.29† 0.00
GEDE: essays written by AI 190 0.53† 0.0
Epoch AI Style Imitation: AI that imitates real authors 594 1.68 2.86
VUB: academic papers written by AI 39 5.1‡ 0.0
Saha Peer Review, easy, AI from a basic prompt 274 0.0‡ 1.8
Saha Peer Review, easy, AI from an expert prompt 274 0.0‡ 0.0
Saha Peer Review, easy, AI from human key points 936 0.6‡ 3.7
Saha Peer Review, hard, AI from a basic prompt 750 0.0‡ 0.0
Saha Peer Review, hard, AI from an expert prompt 600 0.0‡ 0.0
Saha Peer Review, hard, AI from human key points 2,000 0.3‡ 1.1

† FNR at 1% FPR (0.1% FPR for Sem-Detect).

‡ Counted by the rule the Pangram 4 report uses for this benchmark.

* Pangram's number is on its own sample of web pages, which is not public.

Model

Base model google/gemma-4-E4B-it, language model only (no vision or audio parts), with our LoRA adapter merged into the weights
Parameters 7.5B (Google counts the base model, Gemma 4 E4B, as 4B effective parameters)
Precision bfloat16
Training data Human text from the web, news, reviews, forums, Wikipedia and books. AI text from models of OpenAI, Anthropic, Google, Z.ai, DeepSeek, MiniMax. The technical blog lists the models

The design follows the Pangram 4 Technical Report. The technical blog covers the architecture, the training data and how each benchmark is counted.

Architecture: a text is cut into 512-token windows; each window is written twice and passed through the language model with a LoRA adapter; a token head labels each token of the second copy and a window head estimates the AI share of the window; each sentence takes the label of most of its tokens; the shares of the text under each label give one label for the whole text.

  • Windows. The text is split into windows of 512 tokens with a stride of 256.
  • Two copies. The base model reads left to right, so a token cannot see what comes after it. Each window is therefore written twice, and the labels are read from the second copy, where every token has seen the whole window.
  • Token head. A linear layer gives every token one of three labels: human, AI-assisted or AI-generated.
  • Window head. A second linear layer estimates the AI share of the whole window, in 15 buckets from 0% to 100%.
  • Sentences and the whole text. Each sentence takes the label of most of its tokens. The share of the text under each label then gives the label for the whole text.

Limitations

  • Humanizer tools. These rewrite AI text so that detectors miss it. The model was not trained on such text.
  • Short texts. Under 50 words there is too little to go on.
  • English only.

License

Apache 2.0, the same license as the base model.

Downloads last month
140
Safetensors
Model size
7B params
Tensor type
BF16
·
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for abacusai/Smaug-AI-Text-Detector-E4B

Finetuned
(514)
this model

Space using abacusai/Smaug-AI-Text-Detector-E4B 1