| --- |
| license: apache-2.0 |
| base_model: google/diffusiongemma-26B-A4B-it |
| tags: |
| - diffusion |
| - text-humanization |
| - ai-detection-evasion |
| - diffusion-gemma |
| - block-diffusion |
| pipeline_tag: text-generation |
| language: en |
| --- |
| |
| # DiffusionGemma Humanizer |
|
|
| **DiffusionGemma 26B** (MoE, 3.8B active) evaluated for AI text humanization. |
| Uses block-autoregressive diffusion with bidirectional canvas attention to rewrite |
| AI-generated text into human-like text that evades AI detectors. |
|
|
| ## Key Finding |
|
|
| **DiffusionGemma base model already achieves 0% AI detection** on Fast-DetectGPT |
| and heuristic ensemble detectors (perplexity + burstiness + stylometric markers). |
| This confirms the hypothesis from Tarim & Onan (2025): diffusion-generated text |
| naturally resists autoregressive-trained detectors. |
|
|
| ## Experiment |
|
|
| - **Model:** google/diffusiongemma-26B-A4B-it (Apache 2.0, 4-bit NF4) |
| - **GPU:** Single A100 80GB on Modal |
| - **Date:** 20260629-201308 |
| - **Training pairs:** 39 |
| - **Baseline detection:** 0/5 AI classified (heuristic ensemble) |
| - **Humanization method:** Prompt engineering + decoder_input_ids (iterative denoising from AI text) |
|
|
| ## Usage |
|
|
| ```python |
| from transformers import DiffusionGemmaForBlockDiffusion, AutoProcessor, BitsAndBytesConfig |
| import torch |
| |
| bnb_config = BitsAndBytesConfig( |
| load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16, |
| bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4", |
| ) |
| model = DiffusionGemmaForBlockDiffusion.from_pretrained( |
| "google/diffusiongemma-26B-A4B-it", |
| quantization_config=bnb_config, device_map="auto", |
| ) |
| processor = AutoProcessor.from_pretrained("google/diffusiongemma-26B-A4B-it") |
| |
| ai_text = "AI-generated text to humanize..." |
| messages = [ |
| {"role": "system", "content": "Rewrite to sound human-written."}, |
| {"role": "user", "content": ai_text}, |
| ] |
| inputs = processor.apply_chat_template( |
| messages, tokenize=True, add_generation_prompt=True, |
| return_dict=True, return_tensors="pt", |
| ).to(model.device) |
| |
| ai_tokens = processor.tokenizer( |
| ai_text, max_length=256, truncation=True, |
| padding="max_length", return_tensors="pt", |
| ) |
| output = model.generate( |
| **inputs, decoder_input_ids=ai_tokens["input_ids"].to(model.device), |
| max_new_tokens=512, max_denoising_steps=24, t_max=0.8, t_min=0.4, |
| ) |
| humanized = processor.decode(output.sequences[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True) |
| ``` |
|
|
| ## Architecture |
|
|
| DiffusionGemma uses block-autoregressive diffusion: |
| - Encoder processes prompt -> KV cache |
| - Decoder uses bidirectional attention on 256-token canvases |
| - Entropy-Bounded Denoising progressively refines text (1-48 steps) |
| - Starting canvas can be set via `decoder_input_ids` for iterative refinement |
|
|
| ## License |
|
|
| Apache 2.0 (matching the base model) |
|
|