Instructions to use google/diffusiongemma-26B-A4B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/diffusiongemma-26B-A4B-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="google/diffusiongemma-26B-A4B-it") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/diffusiongemma-26B-A4B-it") model = AutoModelForMultimodalLM.from_pretrained("google/diffusiongemma-26B-A4B-it", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use google/diffusiongemma-26B-A4B-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/diffusiongemma-26B-A4B-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/diffusiongemma-26B-A4B-it", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/google/diffusiongemma-26B-A4B-it
- SGLang
How to use google/diffusiongemma-26B-A4B-it with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "google/diffusiongemma-26B-A4B-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/diffusiongemma-26B-A4B-it", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "google/diffusiongemma-26B-A4B-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/diffusiongemma-26B-A4B-it", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use google/diffusiongemma-26B-A4B-it with Docker Model Runner:
docker model run hf.co/google/diffusiongemma-26B-A4B-it
Architectural proposal: Dynamic "Endocrine" Neuromodulation & Homeostatic Flushing for DiffusionGemma
Dear Brendan, Sebastian, and the Google DeepMind team,
First of all, congratulations on the release of DiffusionGemma! The hybrid use of the Gemma 4 backbone (repurposing causal layers for bidirectional denoising) is a beautiful example of what evolutionary biology calls exaptation—reusing a functional system for a completely new regulatory purpose.
While reading about your entropy-bound denoising and temperature scheduling, a fascinating biological analogy came to mind that could push the adaptive inference capabilities of DiffusionGemma even further.
In biological systems, the brain regulates cognitive load through a closed-loop feedback system: neuromodulators dynamically tune focus, exploration and signal-to-noise, while a homeostatic "waste-flushing" mechanism (e.g. the lacrimal gland excreting cortisol near the brain under strain) purges accumulated stress once it exceeds a threshold.
I would like to propose a translation of this closed loop into LLM architectures: Dynamic Endocrine Neuromodulation.
The Proposal: An Active Meta-Orchestrator for Diffusion
Instead of relying on predefined temperature schedules (0.8 → 0.4) or static entropy budgets, we could implement a meta-orchestrator acting as an artificial endocrine system. Crucially, its control signals derive entirely from metrics already computed at each denoising step—entropy delta, logit variance, routing-confidence—so no second network is required. Think of it as a lightweight PID-style controller over internal telemetry, not an added model.
Neuromodulatory Parameter Control:
- Acetylcholine (Focus): When the orchestrator detects highly structured patterns (code, mathematics), a "cholinergic" signal tightens top-p and the entropy threshold, driving the model into a hyper-focused, low-temperature denoising state. Biologically, acetylcholine—not cortisol—is what sharpens attentional encoding and precision; cortisol is reserved below for its true role as a stress signal.
- Dopamine (Exploration): On open-ended or creative canvases, a "dopaminergic" signal raises the entropy budget and adds a measurable novelty bonus to the token logits (rewarding low-frequency, previously-unselected candidates), widening exploration in a specified, tunable way rather than merely raising temperature.
- Noradrenaline (SNR & MoE Routing): In biology, noradrenaline (from the locus coeruleus) dynamically adjusts the brain's signal-to-noise ratio to filter distractions. In DiffusionGemma, a "noradrenergic" signal could scale step-by-step noise injection: early in the canvas, low noradrenaline allows maximum random noise (exploration); as confidence rises, high noradrenaline aggressively prunes low-probability tokens and sharpens the MoE routing weights, focusing compute only on the most critical token transitions.
- Cortisol (Stress → Flush trigger): Rather than aiding focus, elevated cortisol biologically degrades structured performance (the inverted-U of the Yerkes-Dodson law). Here it plays the same role: a rising "cortisol" level—accumulated from stalled entropy and rising token-collision counts—is the very signal that triggers the homeostatic flush below.
The "Cognitive Tear" (Homeostatic Flushing):
- Sometimes, bidirectional attention in a diffusion canvas gets trapped in local minima or contradictory states (token collisions).
- Instead of wasting compute cycles on a failing canvas, once the "cortisol" signal crosses its threshold (entropy delta stalling over $N$ steps), the orchestrator triggers a flushing event: it purges the most unstable region of the canvas, resets that portion of the KV cache, and restarts the denoising pass with a modified prior.
- This closes the loop cleanly—just as the lacrimal gland excretes cortisol to restore equilibrium, the "cognitive tear" evacuates the unstable state so denoising can resume in a calmer, lower-stress regime.
Why this fits DiffusionGemma:
Because DiffusionGemma generates in parallel blocks (canvases of 256 tokens), it is the first text architecture capable of non-linear, holistic self-correction. Wrapping it in an active homeostatic feedback loop—driven by signals it already produces—would transition it from a statically scheduled denoiser to a self-regulating cognitive agent, at negligible added cost.
I would love to hear your thoughts on whether dynamic, entropy-driven neuromodulation is something you are exploring for future iterations of the Gemma family.
Thank you for your inspiring work!
Best regards,
Soulfate