Run this model with HF Jobs

Run micic-mihajlo/diffusiongemma-tweet-v5-lora on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/micic-mihajlo/diffusiongemma-tweet-v5-lora. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/micic-mihajlo/diffusiongemma-tweet-v5-lora on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string

DiffusionGemma-26B-A4B-it Tweet-v5 LoRA (v4b β€” SFT + Adversarial ReST + Uniform-VRPO)

A Block-Diffusion LoRA adapter (r=32, lora_alpha=64, 74.82M trainable parameters / 0.289%) fine-tuned on google/diffusiongemma-26B-A4B-it using a 4-stage pipeline (Block-Diffusion SFT -> Adversarial ReST -> Joint SFT -> 1-Epoch Uniform-VRPO + RPO-NLL) to turn rough notes into direct, natural, human-sounding X/Twitter posts.

Do NOT call model.merge_and_unload(). DiffusionGemmaModel ties base weights between its causal encoder and diffusion decoder (_tied_weights_keys). Keep this adapter attached via PEFT (PeftModel.from_pretrained(...)) and generate via model.get_base_model().generate(...). For Apple Silicon local inference, use the pre-merged 4-bit MLX checkpoint: micic-mihajlo/diffusiongemma-tweet-v5-mlx-4bit (16.55 GB, sum merge, mean p_human = 0.6604).


71-Prompt Strictly Unseen Evaluation (eval_clean_v2.jsonl, 10 Unseen Authors)

Evaluated side-by-side (max_new_tokens=256, max_denoising_steps=48, t=0.4->0.8, pure single-shot --dcfg-weight 0.0). Full outputs and scores are included in eval_summary.md, eval_comparison.json, and merge_ablation.json.

Variant Mean p_human (3-model) ModernBERT / DeBERTa / RoBERTa Clean & >=0.55 Gate v6 Clean Fact-Grounded Mean Chars
Base (google/diffusiongemma-26B-A4B-it) 0.2329 0.341 / 0.062 / 0.300 0.0% 73.2% 97.2% 204.3
v4b Unmerged LoRA (this repo) 0.5898 (med 0.6036) 0.690 / 0.393 / 0.705 50.7% 85.9% 95.8% 142.6
v4b Merged sum (mlx-4bit) 0.6604 0.766 / 0.504 / 0.709 56.3% 81.7% 97.2% 160.9
Reference: poseljacob/Inkling-2-Mini-tweet-v5 0.4050 β€” β€” β€” 95.8% β€”
Reference: Real Human Tweets (n=71) 0.5950 0.687 / 0.483 / 0.606 56.3% 94.4% 98.6% 185.7
  • Head-to-Head vs. Base: 93.0% raw p_human win rate (+0.3569 mean delta), 88.7% composite win rate, 100% Taboo-free, 100% Crutch-free, 98.6% Antithesis-free.
  • Per-Author Generalization: All 10/10 strictly unseen eval authors exceed the 0.4050 Inkling-2-Mini reference (0.464 to 0.698).

Training Pipeline (Modal NVIDIA H200)

  1. Stage 1–3 (v2 base adapter): Block-Diffusion LoRA SFT on 554 audited human tweets (--eos-fill-weight 0.10, 2 ep, lr=9e-5) -> Adversarial ReST mining (400 sparks x 6 drafts, tweet_gate_v6 + HumanDetectorEnsemble + 3-axis Base DiffusionGemma JSON Judge) -> Joint SFT (2 ep, lr=5e-5).
  2. Stage 4 (v4b Uniform-VRPO + RPO-NLL): Dual-adapter PEFT (default policy + frozen ref SFT anchor) trained 1 epoch (99 opt steps, bs=4x4=16) on 1,573 zero-leakage length-balanced (human, AI) matched-spark preference pairs with stratified logit-normal K=4 double-antithetic noise sharing (beta=1.5, sft_alpha=0.45, lr=1.2e-5, encoder_ar_alpha=0.10).

How to Use

import re
import torch
from peft import PeftModel
from transformers import AutoProcessor, DiffusionGemmaForBlockDiffusion
from transformers.models.diffusion_gemma.generation_diffusion_gemma import EntropyBoundSamplerConfig

BASE_ID = "google/diffusiongemma-26B-A4B-it"
ADAPTER_ID = "micic-mihajlo/diffusiongemma-tweet-v5-lora"
SYSTEM_PROMPT = (
    "Turn a rough note into an X post that sounds like a sharp human actually typing it. "
    "Cover the whole point in the note naturally without inventing facts, handles, or numbers. "
    "Keep the rhythm casual, direct, and unscripted. Output only the post."
)

processor = AutoProcessor.from_pretrained(BASE_ID)
tokenizer = processor.tokenizer
base_model = DiffusionGemmaForBlockDiffusion.from_pretrained(
    BASE_ID, torch_dtype=torch.bfloat16, device_map={"": 0}
)
model = PeftModel.from_pretrained(base_model, ADAPTER_ID, is_trainable=False)
model.eval()

messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "Spark: MCP servers bundling own skills, Claude Code gets usage knowledge out of box, excited"},
]
enc = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True, enable_thinking=False,
    return_tensors="pt", return_dict=True,
).to(model.device)

with torch.inference_mode():
    out = model.get_base_model().generate(
        input_ids=enc["input_ids"],
        attention_mask=enc["attention_mask"],
        max_new_tokens=256,
        max_denoising_steps=48,
        t_min=0.4,
        t_max=0.8,
        sampler_config=EntropyBoundSamplerConfig(entropy_bound=0.1),
        stability_threshold=1,
        confidence_threshold=0.005,
        disable_compile=True,
        return_dict_in_generate=True,
    )

raw = tokenizer.decode(out.sequences[0, enc["input_ids"].shape[1]:].tolist(), skip_special_tokens=False)
text = re.sub(r"<\|channel>thought\b.*?<channel\|>", "", raw, flags=re.DOTALL)
text = re.sub(r"<\|channel>thought\b.*$", "", text, flags=re.DOTALL)
print(re.split(r"(?:<turn\|>|<eos>|<pad>)", text, maxsplit=1)[0].strip())
Downloads last month
35
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for micic-mihajlo/diffusiongemma-tweet-v5-lora

Adapter
(9)
this model

Dataset used to train micic-mihajlo/diffusiongemma-tweet-v5-lora