Evasion Detection β€” AI Text Detection Evasion Research

Audit de sΓ©curitΓ© des dΓ©tecteurs de texte IA.
Système de réécriture qui rend le texte généré par IA indétectable, basé sur les papiers MASH, HIP, et CoPA.

HF Repo Tests Budget


🎯 Objectif

Comprendre et exploiter les faiblesses mathématiques des détecteurs de texte IA (Fast-DetectGPT, Binoculars, GPTZero, Pangram) pour construire un système de réécriture capable de les contourner.

Intuition clΓ© : Les dΓ©tecteurs exploitent la faible dispersion des tokens du texte IA. Le texte humain a plus de variance dans le choix des mots, la longueur des phrases, et la distribution de frΓ©quence. Si on augmente cette dispersion, on devient invisible.


πŸ“Š Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    PIPELINE D'Γ‰VASION                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                β”‚
β”‚  ENTRAÎNEMENT (Modal A100 80GB, ~40€)                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Phase 1: Style-SFT (~20€)                             β”‚    β”‚
β”‚  β”‚ BART-large (406M) + Style Embeddings                  β”‚    β”‚
│  │ Dataset: HC3 — 5K paires AI→Human (finance, medicine, │    │
β”‚  β”‚           open_qa, wiki_csai)                         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                        ↓                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Phase 2: DPO Adversarial (~21€)                       β”‚    β”‚
β”‚  β”‚ Reward = -score_dΓ©tecteur                             β”‚    β”‚
β”‚  β”‚ Ξ²=0.1, hard negative mining                          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                β”‚
β”‚  INFΓ‰RENCE (Modal T4, ~0.60€/h)                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
│  │ Stage 1: BART-SFT-DPO → Rewrite AI→Human              │    │
β”‚  β”‚ Stage 2: CoPA Ξ»=1.5 β†’ Token dispersion boost          β”‚    β”‚
β”‚  β”‚ P_final = (1+Ξ»)Β·log P_human - λ·log P_machine         β”‚    β”‚
β”‚  β”‚ + top-p=0.92 + rep_penalty=1.15 + diversity bonus    β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                β”‚
β”‚  Γ‰VALUATION                                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Fast-DetectGPT | Binoculars | GPTZero | Pangram      β”‚    β”‚
β”‚  β”‚ MΓ©triques: ASR, BERTScore, PPL, Token Dispersion     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Structure du repo

evasion-detection-artifacts/
β”œβ”€β”€ README.md                          ← Ce fichier
β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ style_transfer_pairs_train.jsonl   ← 4500 paires AIβ†’Human (HC3)
β”‚   β”œβ”€β”€ style_transfer_pairs_val.jsonl     ← 500 paires validation
β”‚   └── bitcoin_text.txt                   ← Texte test Bitcoin
β”œβ”€β”€ results/
β”‚   β”œβ”€β”€ copa_qwen2.5_1.5b_gpu_*.json      ← RΓ©sultats CoPA GPU (Qwen2.5)
β”‚   └── copa_real_distilgpt2.json          ← RΓ©sultats CoPA CPU (baseline)
β”œβ”€β”€ reports/
β”‚   β”œβ”€β”€ eval_statistical_qwen25_1.5b_*.json ← Γ‰valuation statistique
β”‚   └── EVASION_DETECTION_REPORT.md         ← Rapport complet
└── src/
    β”œβ”€β”€ inference_copa.py                   ← CoPA contrastive decoding
    β”œβ”€β”€ inference_combined.py               ← BART + CoPA two-stage
    β”œβ”€β”€ modal_app_copa.py                   ← Modal GPU wrapper CoPA
    β”œβ”€β”€ modal_app_sft.py                    ← Modal GPU Style-SFT training
    β”œβ”€β”€ modal_app_dpo.py                    ← Modal GPU DPO training
    β”œβ”€β”€ evaluate_detectors.py               ← Multi-detector evaluation
    β”œβ”€β”€ eval_statistical.py                 ← Statistical dispersion analysis
    β”œβ”€β”€ train_sft_modal.py                  ← Style-SFT (local/Modal)
    β”œβ”€β”€ hf_upload.py                        ← HF artifact upload adapter
    └── cost_guard.py                       ← Modal budget guard

πŸ”¬ RΓ©sultats

Prototype CoPA (Qwen2.5-1.5B, T4, 0.05€)

MΓ©trique Original (IA) Réécrit (CoPA) Ξ”
Word freq dispersion 0.36 1.68 +366%
Sentence length CV 0.154 0.327 +113%
Readability (Flesch) 25 32 +28%
Human-likeness 0.500 0.548 +0.048

Exemple Bitcoin (CoPA v2 β€” few-shot, Ξ»=1.5)

Original (AI-style):

Bitcoin, often called BTC, is the first and most well-known cryptocurrency in the world. It was created in 2009 by an unknown person or group using the name Satoshi Nakamoto...

Réécrit (CoPA Human-style):

Hey there! Bitcoin, or BTC, is the big bang of all the cool cyber currencies. It was born in 2009. An unknown dude or gals go by the name Satoshi Nakamoto. Unlike the money that grown-ups have, Bitcoin isn't controlled by anyone, or a central bank. Coincidence? Not a bit!...


πŸš€ Utilisation

Quick start β€” Rewrite a text (Modal GPU)

# Single text
modal run -q src/modal_app_copa.py --text "Your AI-generated text here" --gpu T4

# From file
modal run -q src/modal_app_copa.py --text-file data/bitcoin_text.txt --gpu T4

# Batch (10 samples, synthetic templates)
modal run -q src/modal_app_copa.py --num-samples 10 --gpu T4

Style-SFT Training (Modal A100 80GB, ~20€)

# Dry-run first (validates pipeline, ~0€)
modal run src/modal_app_sft.py --dry-run

# Real training (6-8h, ~20€)
modal run src/modal_app_sft.py --data datasets/style_transfer_pairs_train.jsonl

DPO Adversarial Training (Modal A100 80GB, ~21€)

modal run src/modal_app_dpo.py --sft-model simonlesaumon/evasion-detection-models/bart-sft-style-humanization

Statistical Evaluation (local, no GPU)

# Analyze any CoPA output
python src/eval_statistical.py output/copa_modal_results.json output/eval_report.json

Run Tests (13 unit tests, 0 GPU)

pytest tests/test_inference.py -v

πŸ“š Base thΓ©orique

Papiers fondateurs

Papier ConfΓ©rence Contribution clΓ©
MASH (2025) arXiv:2601.08564 BART-base 139M + Style-SFT + DPO = 92% ASR
HIP (2026) CMU Modèles base = 96.7% "humains" (GPTZero)
CoPA (2025) EMNLP Contrastive decoding training-free
Fast-DetectGPT (2024) ICLR Courbure de probabilitΓ©, 340x plus rapide
Binoculars (2024) ICML Cross-perplexitΓ©, >90% TPR @ 0.01% FPR
Pangram (2025) COLING Mistral NeMo 12B + active learning

Comment marchent les dΓ©tecteurs

Famille Principe Exemple
Statistique PerplexitΓ© + burstiness GPTZero
Courbure Score = LogP - E[LogP] Fast-DetectGPT
Cross-PPL Ratio perplexité 2 modèles Binoculars
Watermark Signature dans les tokens SynthID-Text

Ce qu'ils ont en commun : Le texte IA a des tokens groupΓ©s en zones de haute probabilitΓ© β†’ faible dispersion. Notre approche maximise cette dispersion.


πŸ›‘οΈ Γ‰thique

Ce projet est une recherche en sΓ©curitΓ© dΓ©fensive.

  • βœ… Audit de dΓ©tecteurs β€” comprendre leurs faiblesses pour les amΓ©liorer
  • βœ… Tous les outputs sont labellisΓ©s comme artefacts de recherche
  • ❌ Pas d'API publique d'Γ©vasion
  • ❌ Pas de produit "undetectable AI"
  • ⚠️ Usage acadΓ©mique et Γ©ducatif uniquement

πŸ“Š Budget

Phase GPU CoΓ»t
CoPA prototype T4 ~0.30€
Dataset HC3 CPU 0€
Style-SFT A100 80GB ~20€
DPO adversarial A100 80GB ~21€
InfΓ©rence combinΓ©e T4 ~1.20€
Γ‰valuation A100 80GB ~7.50€
Ablations A100 80GB ~50€
Total ~100€

πŸ”— Liens


Built with Modal, PyTorch, HuggingFace Transformers. Budget: 200€ Modal credits.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Paper for simonlesaumon/evasion-detection-artifacts