Instructions to use kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK") 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("kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK") model = AutoModelForMultimodalLM.from_pretrained("kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK", 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 kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK", "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/kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK
- SGLang
How to use kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK 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 "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK" \ --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": "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK", "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 "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK" \ --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": "kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK", "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 kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK with Docker Model Runner:
docker model run hf.co/kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK
diffusiongemma-26B-A4B-it-ALWAYS-THINK
Weights are an unmodified copy of google/diffusiongemma-26B-A4B-it.
The only intended difference is chat_template.jinja: thinking should be on by
default, without the caller having to ask for it in the system prompt.
Thinking
The stock template gates reasoning behind an enable_thinking kwarg that injects a
<|think|> marker into the system turn. Probing the base model, that marker is the
switch — the model emits <|channel>thought on its own either way, but without the
marker it closes the channel immediately and answers directly.
Pre-filling <|channel>thought into the generation prompt instead does not work:
the model emits its own opener on top of the prefilled one, duplicating the token.
Caveat: the marker is necessary but not sufficient. On 14 held-out prompts the base model still produced an empty thought block every time, so "always think" is not yet reliably achieved by the template alone.
Finetuning attempt (abandoned)
Tried LoRA SFT on sriq-ai/sriq-sft-v1.5 to move reasoning into compressed Chinese. It did not work and no adapter is published.
DiffusionGemmaForBlockDiffusion.forward takes no labels and returns no loss, so the
block-diffusion objective has to be written by hand: corrupt the 256-token canvas with
uniform-random tokens at rate t, cross-entropy on the content tokens, padding tail
ignored. r=64, alpha=128 on attention + dense MLP across the text backbone (the
fused 3D MoE experts cannot be targeted by PEFT).
Measured on 14 held-out prompts, adapter loaded unmerged:
| base | 30 steps | 100 steps | |
|---|---|---|---|
| mean CJK of generation | 7.8% | 5.1% | 3.3% |
| non-empty thought blocks | 0/14 | 6/14 | 4/14 |
The training objective improved cleanly every run (hardest corruption bucket 3.89 → 2.82), but the target behaviour did not transfer — Chinese reasoning moved down. The CJK figures rest on the 2 of 14 rows that produce any Chinese at all, so treat them as "no transfer" rather than as a measured decline.
Best guess at why: the architecture refines a 256-token canvas in parallel, which suits global-constraint tasks — Unsloth's Sudoku notebook reaches 89.5%, but needed 4000 steps on targets that fit a single canvas. Thousand-token sequential chain-of-thought is a poor fit, and LoRA cannot reach the MoE experts where most of the capacity lives.
Notes
- Do not
merge_and_unload()a LoRA adapter here.Gemma4ClippableLinearwraps thenn.Linear; merging corrupts it. Load unmerged and generate through thePeftModel. - Weight loading needs a
transformersbuild that ships the DiffusionGemma classes.
- Downloads last month
- -
Model tree for kaivoss/diffusiongemma-26B-A4B-it-ALWAYS-THINK
Base model
google/diffusiongemma-26B-A4B-it