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.
Instructions to use micic-mihajlo/diffusiongemma-tweet-v5-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use micic-mihajlo/diffusiongemma-tweet-v5-lora with PEFT:
Task type is invalid.
- Transformers
How to use micic-mihajlo/diffusiongemma-tweet-v5-lora with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("micic-mihajlo/diffusiongemma-tweet-v5-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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().DiffusionGemmaModelties base weights between its causal encoder and diffusion decoder (_tied_weights_keys). Keep this adapter attached via PEFT (PeftModel.from_pretrained(...)) and generate viamodel.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,summerge,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%rawp_humanwin rate (+0.3569mean 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.4050Inkling-2-Mini reference (0.464to0.698).
Training Pipeline (Modal NVIDIA H200)
- Stage 1β3 (
v2base adapter): Block-Diffusion LoRA SFT on554audited 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). - Stage 4 (
v4bUniform-VRPO + RPO-NLL): Dual-adapter PEFT (defaultpolicy + frozenrefSFT anchor) trained1 epoch(99opt steps,bs=4x4=16) on1,573zero-leakage length-balanced(human, AI)matched-spark preference pairs with stratified logit-normalK=4double-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
Model tree for micic-mihajlo/diffusiongemma-tweet-v5-lora
Base model
google/diffusiongemma-26B-A4B-it