Google logo

DiffusionGemma

Gemmav26B A4BCurrent
byGoogleGoogle(enterprise)
Released June 10, 2026
Context256K tokens
CategoryLarge Language Model

About DiffusionGemma

DiffusionGemma is Google DeepMind’s experimental open-weights text-diffusion model based on Gemma 4 26B A4B. It uses discrete diffusion and parallel canvas denoising to trade some benchmark quality for much faster local generation on dedicated GPUs.

Capabilities

textvisioncodereasoninglocal inference

Input Modalities

textimage

Output Modalities

text

Technical Details

API Identifier
google/diffusiongemma-26b-a4b-it
Category
Large Language Model
Context Window
256,000 tokens

Tags

diffusiongemmaopen-weightslocal-inferencemultimodalmixture-of-experts

Run this model yourself

Local and cloud setup for DiffusionGemma, with exact configurations, sources and clear evidence limits.

Find a model for your hardware
Local hardwareDocumented setupSources checked Oct 17, 2026

Run complete native DiffusionGemma canvases on an existing H100 host

Load all eleven publisher-native DiffusionGemma shards, including its full multimodal encoder, diffusion decoder, self-conditioning and vision tower. Run bounded text, image and timestamped image-frame video checks through the exact native template and processors. The full 256-position canvas uses the publisher entropy-bounded sampler with at most 48 denoising steps; final EOS and native padding are checked. One H100 80 GB, 256 GiB host RAM and 256 GiB disk are planning allocations, not measured fit or performance.

Hardware
Owned single NVIDIA H100 80 GB GPU host
Runtime
Native DiffusionGemma full encoder and canvas decoder Transformers 5.11.0; Torch 2.11.0 cu130; torchvision 0.26.0 cu130; Python 3.12 · CUDA
Model format
Safetensors · Complete native BF16 parameters on one H100; native operations can use FP32 intermediates · Unquantized native BF16; complete encoder, diffusion decoder, self-conditioning and vision retained
Workload
4,096 token context · 1 concurrent

Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.

Read the complete setup guide

Before you start

  • Use an existing owned single H100 80 GB x86_64 host with Ubuntu 24.04,256 GiB host RAM, 256 GiB disk, at least 160 GiB free for this chosen walkthrough, and 16 prescribed logical CPU threads. Exact CPU SKU and usable GPU bytes remain unknown; allocations are not measured minima.
  • Official native Google guidance requires more than 60 GB GPU memory and Transformers >= 5.11. Select exactly Transformers 5.11.0, Torch 2.11.0 cu130 and torchvision 0.26.0 cu130 on Python 3.12 with working NVIDIA driver >= 580.126.20. No native build, FlashAttention, offload or optional compile is used in this explicit eager/dynamic-cache route.
  • Review the exact Apache 2 grant and responsible-use guidance. Retain the complete eleven native shards, native encoder, decoder, self-conditioning and vision. Do not substitute autoregressive Gemma, a smaller checkpoint, Diffusers defaults or truncated canvas.
  • The text job uses a fixed two-turn conversation with a seeded eight-hour final answer and an independently checkable nine-hour followup; it is not a claimed prior generated result. Only original reader-generated RGB geometry and four ordered original frames are used. Publisher video-as-frames guidance is implemented through native image inputs plus authored timestamps; the native diffusion encoder explicitly lacks dedicated video tensors. No codec, recorded media or audio path is claimed.

Exact model and requirements

Artifact:
Google / Complete native DiffusionGemma 26B-A4B instruction checkpoint · checkpoint google/diffusiongemma-26B-A4B-it
Publisher revision:
f7f5b7f5fa82ffc52addd066915886d497f5517b
Artifact digest:
Eleven native parts are individually hashed; no invented whole-composition digest.
Download size:
48.1 GiB
Memory requirement (unknown):
Unknown — Full native BF16 weights, encoder cache, 256-position decoder logits/self-conditioning, vision, sampler buffers and process peak are unmeasured.
System RAM / disk:
Unknown / Unknown
Placement:
single device. All eleven native disk parts load one complete model on one H100; no device sharding. Complete model on cuda:0, no CPU/component offload, quantization or accelerator substitution.
KV cache:
Native BF16 encoder attention K/V cache, read by the diffusion decoder; full self-conditioning logits and canvas working tensors are separate. Dynamic per-request cache avoids optional static-cache compilation. Exact peak is unknown.
Workload:
4,096 token context; Unknown; Unknown; concurrency 1; batch 1; cache cold; repetitions Unknown.
Tokenizer:
Exact native DiffusionGemma tokenizer, standalone Jinja and Gemma4 image processor · f7f5b7f5fa82ffc52addd066915886d497f5517b
Sampling / reasoning:
Native full 256-position canvas; max_new_tokens=256, max_denoising_steps=48, EntropyBoundSamplerConfig entropy_bound=0.1, linear temperature 0.8 to 0.4, confidence_threshold=0.005 and stability_threshold=1. Native adaptive early stopping is preserved; 48 is a cap, not a measured or forced count. No AR do_sample/top-k/top-p substitution or Diffusers 32-step defaults. Native enable_thinking=False omits the think trigger. The native template differs from autoregressive Gemma: an exactly empty generated thought prefix is accepted, nonempty thought/tool controls are rejected. Final-only history rule is documented; the fixed harness keeps requests independent and does not persist hidden reasoning.
Runtime prerequisites:
Ubuntu 24.04 x86_64; NVIDIA Linux driver >= 580.126.20; single H100 80 GB; working CUDA visibility.

Official artifact · License

The exact native Google DiffusionGemma card declares Apache License 2.0 and links the archived actual grant. Preserve license/notices/attribution, modification and patent/termination obligations and warranty disclaimers. Publisher responsible-use guidance still applies. No prior Gemma restricted terms, provider byte-equivalence, rights acceptance or legal clearance is inferred.

  • Eleven complete serialized native shards total 51,647,701,024 bytes; active A4B naming is not full storage or GPU memory. No shards or model components are removed.
  • Official Google native Transformers guidance requires a GPU with more than 60 GB and demonstrates H100. The reused one-H100 80 GB label retains unknown exact usable bytes; it does not prove this configured workload fits.
  • 256 GiB host RAM and 256 GiB disk are planning allocations. Full BF16 parameters, native encoder cache, full 256-position canvas/logit/self-conditioning buffers, multimodal tensors, CUDA workspace and dependency/OS overhead add unknown peak requirements.

One-time setup and hardware

hardware
Unknown — Existing owned GPU/host purchase and incremental cost are unknown.
Existing owned GPU/host purchase and incremental cost are unknown. Tax: unknown.
setup
Unknown — Reader provisioning, image build and labor time/cost are unknown.
Reader provisioning, image build and labor time/cost are unknown. Tax: unknown.

Recurring costs

electricity
Unknown — Actual wall power/rate/poweredhours unknown; no GPU TDP conversion.
Actual wall power/rate/poweredhours unknown; no GPU TDP conversion. Tax: unknown.
storage
Unknown — Incremental local 256 GiB storage cost is unknown.
Incremental local 256 GiB storage cost is unknown. Tax: unknown.
egress
Unknown — Actual transfer/allowance/traffic cost unknown.
Actual transfer/allowance/traffic cost unknown. Tax: unknown.
administration
Unknown — Maintenance time/rate unknown.
Maintenance time/rate unknown. Tax: unknown.

Install the runtime

  1. 1. Prepare the exact native GPU stack

    Use only an already provisioned H100 host with a working driver. The CUDA 13 wheels bundle user-space runtime dependencies; no local model/kernel build is part of this eager path. Record resolved transitive/system versions; stop on visibility, driver, dependency or import failures.

    Command
    set -e
    sudo apt-get update
    sudo apt-get install -y python3.12 python3.12-venv curl ca-certificates openssl
    mkdir -p "$HOME/diffusiongemma-native"
    cd "$HOME/diffusiongemma-native"
    nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
    free -h
    df -h .
    python3.12 - <<'PYPREFLIGHT'
    import csv,subprocess,shutil
    rows=list(csv.reader(subprocess.check_output(['nvidia-smi','--query-gpu=name,driver_version','--format=csv,noheader'],text=True).splitlines()))
    assert len(rows)==1 and 'H100'in rows[0][0] and '80GB'in rows[0][0].replace(' ','')
    assert tuple(map(int,rows[0][1].strip().split('.'))) >= (580,126,20)
    assert shutil.disk_usage('.').free >=160*1024**3
    print('Exact reader GPU/driver/160 GiB free-disk prerequisite passed; no fit proof.')
    PYPREFLIGHT
    python3.12 -m venv .venv
    .venv/bin/python -m pip install 'https://download-r2.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=96911323dcfcd42028c7e8edde7bdf25bb187753234e8775f0f3f112e86a22db' 'https://download-r2.pytorch.org/whl/cu130/torchvision-0.26.0%2Bcu130-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=0f030a9bd8ada1a31b7111ea1589c1ecb5fa0884fee700a203e731b4cf378a98'
    .venv/bin/python -m pip install transformers==5.11.0 huggingface-hub==1.5.0 tokenizers==0.22.2 regex==2025.10.22 numpy==2.2.3 Pillow==11.1.0 safetensors==0.5.3
    .venv/bin/python -m pip check
    .venv/bin/python -m pip freeze > installed-requirements.txt

    Expected result: Record actual H100, driver, storage and environment. Any failed preflight or dependency check stops before model loading.

Download the model

  1. 1. Verify the complete native snapshot

    Only the reader downloads these files. SHA-256 LFS hashes and Git blob SHA-1 identities are distinct. The complete native index must reference exactly all eleven expected weight parts. Diffusers scheduler/model-index metadata is retained in the snapshot but not substituted for the native Transformers generation config.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat > artifact-manifest.json <<'MANIFEST'
    {
      "repo": "google/diffusiongemma-26B-A4B-it",
      "revision": "f7f5b7f5fa82ffc52addd066915886d497f5517b",
      "files": [
        {
          "path": "README.md",
          "bytes": 19722,
          "algorithm": "git-sha1",
          "digest": "5e69c184a47d0e83d3cd46571c7dc5ce3bbdf75f"
        },
        {
          "path": "chat_template.jinja",
          "bytes": 18575,
          "algorithm": "git-sha1",
          "digest": "8c09d23fb05c3d817d1a670fda35751f22443ffb"
        },
        {
          "path": "config.json",
          "bytes": 3469,
          "algorithm": "git-sha1",
          "digest": "d609366b2563e13f39fbad6c6ee6f7d0231aa0d0"
        },
        {
          "path": "generation_config.json",
          "bytes": 357,
          "algorithm": "git-sha1",
          "digest": "73dcc9ff4ae4e0caa1301e1cc8f07ac6e2b317da"
        },
        {
          "path": "model-00001-of-00011.safetensors",
          "bytes": 4732780476,
          "algorithm": "sha256",
          "digest": "3efe137998af7d2bde4e3ab04ab3524823699a4ac3130adace5003ef40cceeb6"
        },
        {
          "path": "model-00002-of-00011.safetensors",
          "bytes": 4884578006,
          "algorithm": "sha256",
          "digest": "4a39d68c756fb26bbd2a54f2b8d550047ea98f3152f87ec75db825c8e17934a7"
        },
        {
          "path": "model-00003-of-00011.safetensors",
          "bytes": 4913414742,
          "algorithm": "sha256",
          "digest": "ac6083e3489215ca032501714b78832e5cc4c945a8dbbb905b5292a4e95bc75e"
        },
        {
          "path": "model-00004-of-00011.safetensors",
          "bytes": 4884578030,
          "algorithm": "sha256",
          "digest": "865b66393de5a9c752e67beae1bd2c860c12786b72ad86ca9345c00b7b586e60"
        },
        {
          "path": "model-00005-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "a87e01bed77ad9d2234851267d99af583ff79c7a86d7494fe08ae0f9de9cd318"
        },
        {
          "path": "model-00006-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "077e841b3b138fbc38df2c36665abdaafa96b8c96f968e2263a7452afaa912ab"
        },
        {
          "path": "model-00007-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "13a18b3c04a7f19a16385dd8a0d7fd0b9cc89ef131e4294a063c31c7d90c58ef"
        },
        {
          "path": "model-00008-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "aca5d3bdfc84700bd55b475781cb46e5608104c4832d2abe111a119ddcb23ff7"
        },
        {
          "path": "model-00009-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "8e2418867354e5cb356c0af8ccfdcc60bc363500674d6cf395991e7d6219eb29"
        },
        {
          "path": "model-00010-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "93d564b7dd686464a5c068ff9665cd5d3bca399c2ce320aecd41bd011e3787d5"
        },
        {
          "path": "model-00011-of-00011.safetensors",
          "bytes": 2838371118,
          "algorithm": "sha256",
          "digest": "afec047176bb2a05f078566576aec6bdb71ad4d041275d0d0c89473fda6d6d87"
        },
        {
          "path": "model.safetensors.index.json",
          "bytes": 104650,
          "algorithm": "git-sha1",
          "digest": "c5c692dcc6f1cf0845a69d344d635b52d2d8b34b"
        },
        {
          "path": "model_index.json",
          "bytes": 295,
          "algorithm": "git-sha1",
          "digest": "aee996ea126b3bfbeb68875fa93af61ceac5b65f"
        },
        {
          "path": "processor_config.json",
          "bytes": 1689,
          "algorithm": "git-sha1",
          "digest": "5465974d23e1eca2c46c2809b26c997946ce0d90"
        },
        {
          "path": "scheduler/scheduler_config.json",
          "bytes": 209,
          "algorithm": "git-sha1",
          "digest": "389d26ef7e903f189e1d9f7870ae5f2f9faabc8a"
        },
        {
          "path": "tokenizer.json",
          "bytes": 32169626,
          "algorithm": "sha256",
          "digest": "cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f"
        },
        {
          "path": "tokenizer_config.json",
          "bytes": 2741,
          "algorithm": "git-sha1",
          "digest": "af7f25861136b515f4bf64d9d0a6cf9875a6d508"
        }
      ]
    }
    MANIFEST
    cat > reader-download.py <<'PYDOWNLOAD'
    import hashlib,json,pathlib,urllib.request
    root=pathlib.Path('model');root.mkdir(exist_ok=True)
    manifest=json.load(open('artifact-manifest.json'))
    base='https://huggingface.co/'+manifest['repo']+'/resolve/'+manifest['revision']+'/'
    for row in manifest['files']:
     path=root/row['path'];path.parent.mkdir(parents=True,exist_ok=True)
     if not path.exists():
      temporary=path.with_name(path.name+'.partial')
      with urllib.request.urlopen(base+row['path'],timeout=120) as src,temporary.open('wb') as dst:
       for chunk in iter(lambda:src.read(1024*1024),b''):dst.write(chunk)
      temporary.replace(path)
     if path.stat().st_size!=row['bytes']:raise SystemExit('wrong size: '+row['path'])
     digest=hashlib.sha256() if row['algorithm']=='sha256' else hashlib.sha1()
     if row['algorithm']=='git-sha1':digest.update(b'blob '+str(row['bytes']).encode()+b'\0')
     with path.open('rb')as src:
      for chunk in iter(lambda:src.read(1024*1024),b''):digest.update(chunk)
     if digest.hexdigest()!=row['digest']:raise SystemExit('wrong digest: '+row['path'])
    index=json.load(open(root/'model.safetensors.index.json'))
    expected={x['path']for x in manifest['files']if x['path'].endswith('.safetensors')}
    assert len(expected)==11 and set(index['weight_map'].values())==expected
    assert sum(x['bytes']for x in manifest['files']if x['path'].endswith('.safetensors'))==51647701024
    print('All21pinned native files and eleven complete shards verified.')
    PYDOWNLOAD
    .venv/bin/python reader-download.py

    Expected result: All 21 native files and eleven full shards verify before native imports/loading. Stop on mismatches; no model/tokenizer/media body was fetched by this author.

Configure

  1. 1. Create a stable private key

    Create the reader-generated secret only when absent, keep it private and refuse an empty existing file. No key is generated or executed by the author.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    umask 077
    if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key; fi
    test -s .api-key
    chmod 600 .api-key

    Expected result: A stable private 64-character hexadecimal key exists with restricted permissions; later reader startup checks its exact format.

  2. 2. Write corrected canvas and final-output guards

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat > diffusion_server.py <<'PYCODE'
    """Reader-authored private DiffusionGemma full-native educational harness; not publisher server."""
    import hashlib
    import hmac
    import json
    import math
    import pathlib
    from http.server import BaseHTTPRequestHandler, HTTPServer
    ROOT = pathlib.Path(__file__).resolve().parent
    PORT = 9007
    PIN = 'f7f5b7f5fa82ffc52addd066915886d497f5517b'
    PROMPTS = {'text':'The library opens at 09:00 and closes at 17:00 on the same day. How many hours is it open? Answer briefly.',
    'image':'Describe the visible colors and shapes in this original geometry image. Answer briefly.',
    'video':'Describe how the red rectangle changes position from the first frame to the last. Answer briefly; do not invent events outside the frames.'}
    
    def validate_result(job, d):
        if type(d) is not dict or set(d) != {'job','text','input_tokens','output_tokens','media_tokens','frames','stop_id','canvas_length','denoising_steps_cap'}:
            raise ValueError('result_schema')
        if d['job'] != job or type(d['text']) is not str or not d['text'].strip() or len(d['text'])>16384:
            raise ValueError('result_text')
        for k in ('input_tokens','output_tokens','media_tokens','frames','stop_id','canvas_length','denoising_steps_cap'):
            if type(d[k]) is not int:
                raise ValueError('result_integer')
        if not 1<=d['input_tokens']<=3840 or not 1<=d['output_tokens']<=256 or d['input_tokens']+d['output_tokens']>4096:
            raise ValueError('result_context')
        if d['canvas_length']!=256 or type(d['canvas_length'])is not int or d['denoising_steps_cap']!=48 or type(d['denoising_steps_cap'])is not int: raise ValueError('native_diffusion_budget')
        if d['stop_id'] not in (1,106) or d['frames'] != (4 if job=='video' else 0):
            raise ValueError('result_stop_or_frames')
        if (job=='text' and d['media_tokens']!=0) or (job=='image' and not 1<=d['media_tokens']<=70) or (job=='video' and not 4<=d['media_tokens']<=280):
            raise ValueError('result_media')
        # Fixed-fixture final answers permit plain text only. This fail-closed
        # reader boundary rejects full and truncated control fragments uniformly.
        if '<' in d['text'] or '>' in d['text']:
            raise ValueError('unexpected_native_control')
        return d
    
    def parse_canvas(tokens, mask_token_id):
        if type(mask_token_id) is not int or mask_token_id < 0 or mask_token_id in (0,1,106,50):
            raise ValueError('native_mask_identity')
        if type(tokens)is not list or len(tokens)!=256 or any(type(x)is not int or x<0 for x in tokens):
            raise ValueError('full_native_canvas_required')
        stops=[i for i,t in enumerate(tokens)if t in (1,106,50)]
        if not stops:raise ValueError('no_true_final_eos')
        end=stops[0]
        if tokens[end]==50 or any(t!=0 for t in tokens[end+1:]):raise ValueError('nonfinal_stop_or_nonpad_tail')
        if any(t in (0,mask_token_id) for t in tokens[:end]):
            raise ValueError('native_pad_or_mask_before_eos')
        return tokens[:end],end+1,tokens[end]
    
    def parse_final_text(text):
        prefix='<|channel>thought\n<channel|>'
        if text.startswith(prefix):text=text[len(prefix):]
        if not text.strip() or '<' in text or '>' in text:raise ValueError('nonempty_thought_tool_or_invalid_final')
        return text.strip()
    
    def checked_manifest(data):
        if hashlib.sha256(data).hexdigest()!='d2a360c724f99d4d102a61427c78ec38961f5699fd651098d5a0586eb181a969':raise ValueError('manifest_hash')
        manifest=json.loads(data)
        if manifest['repo']!='google/diffusiongemma-26B-A4B-it' or manifest['revision']!=PIN:raise ValueError('manifest_identity')
        return manifest
    
    def check_loading(info):
        expected={'missing_keys','unexpected_keys','mismatched_keys','error_msgs'}
        if type(info) is not dict or set(info)!=expected or any(info[k] for k in expected):
            raise RuntimeError('incomplete_or_incompatible_checkpoint')
    
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  3. 3. Write complete native H100 adapter with mask identity

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat >> diffusion_server.py <<'PYCODE'
    def make_engine():
        # Only the reader invokes this path. Fake protocol tests never import native libraries.
        model_dir=ROOT/'model'
        manifest=checked_manifest((ROOT/'artifact-manifest.json').read_bytes())
        for row in manifest['files']:
            path=model_dir/row['path']
            if path.stat().st_size!=row['bytes']: raise RuntimeError('artifact_size')
            digest=hashlib.sha256() if row['algorithm']=='sha256' else hashlib.sha1()
            if row['algorithm']=='git-sha1': digest.update(b'blob '+str(row['bytes']).encode()+b'\0')
            with path.open('rb') as handle:
                for chunk in iter(lambda:handle.read(1024*1024),b''): digest.update(chunk)
            actual=digest.hexdigest()
            if actual!=row['digest']: raise RuntimeError('artifact_hash')
        config=json.loads((model_dir/'config.json').read_text())
        if config['architectures']!=['DiffusionGemmaForBlockDiffusion'] or config.get('canvas_length')!=256:
            raise RuntimeError('wrong_native_architecture')
        import numpy as np
        import torch
        from PIL import Image, ImageDraw
        from transformers import AutoProcessor, DiffusionGemmaForBlockDiffusion, LogitsProcessor, LogitsProcessorList
        torch.set_num_threads(16)
        if torch.cuda.device_count()!=1 or 'H100'not in torch.cuda.get_device_name(0) or not torch.cuda.is_bf16_supported():raise RuntimeError('single_h100_bf16_required')
        processor=AutoProcessor.from_pretrained(model_dir,local_files_only=True,trust_remote_code=False)
        model, info=DiffusionGemmaForBlockDiffusion.from_pretrained(model_dir,local_files_only=True,trust_remote_code=False,
            dtype=torch.bfloat16,device_map=None,attn_implementation='eager',experts_implementation='eager',
            use_safetensors=True,ignore_mismatched_sizes=False,output_loading_info=True)
        check_loading(info)
        model=model.to('cuda:0').eval()
        if model.config.canvas_length!=256 or len(model.model.decoder.layers)!=30 or not hasattr(model.model.encoder,'vision_tower'): raise RuntimeError('full_native_diffusion_architecture')
        gc=model.generation_config
        if gc.max_denoising_steps!=48 or gc.t_max!=0.8 or gc.t_min!=0.4 or gc.confidence_threshold!=0.005 or gc.stability_threshold!=1 or gc.sampler_config.entropy_bound!=0.1: raise RuntimeError('native_sampler_config')
        for p in model.parameters():
            if p.device.type!='cuda' or p.device.index!=0 or p.dtype!=torch.bfloat16 or not torch.isfinite(p).all():
                raise RuntimeError('native_full_gpu_parameter_dtype_or_finiteness')
        if model.get_input_embeddings().weight.data_ptr()!=model.get_output_embeddings().weight.data_ptr():
            raise RuntimeError('native_tied_embeddings')
        tokenizer=processor.tokenizer
        if tokenizer.bos_token_id!=2 or tokenizer.convert_tokens_to_ids('<|image|>')!=config['image_token_id']:
            raise RuntimeError('native_token_identity')
        mask_token_id=tokenizer.convert_tokens_to_ids(tokenizer.mask_token)
        if tokenizer.mask_token!='<mask>' or type(mask_token_id) is not int or not 0<=mask_token_id<model.config.text_config.vocab_size or tokenizer.convert_ids_to_tokens(mask_token_id)!='<mask>':
            raise RuntimeError('native_mask_token_identity')
        fixture=ROOT/'fixtures';fixture.mkdir(exist_ok=True)
        image=Image.new('RGB',(256,256),'white');draw=ImageDraw.Draw(image)
        draw.rectangle((20,30,110,220),fill='red');draw.ellipse((140,70,230,160),fill='blue');image.save(fixture/'image.png')
        frames=[]
        for n in range(4):
            frame=Image.new('RGB',(256,256),'white');ImageDraw.Draw(frame).rectangle((16+48*n,80,64+48*n,176),fill='red')
            frame.save(fixture/f'frame-{n}.png');frames.append(np.asarray(frame))
        class FiniteLogits(LogitsProcessor):
            def __call__(self, input_ids, scores):
                # Negative infinity can be a native mask; NaN/+infinity or no finite choice is invalid.
                if torch.isnan(scores).any() or torch.isposinf(scores).any() or not torch.isfinite(scores).any(dim=-1).all():
                    raise RuntimeError('invalid_generation_logits')
                return scores
        def engine(job):
            content=[]; kwargs={}
            if job=='image': content.append({'type':'image'});kwargs['images']=[image]
            if job=='video':
                # Publisher video-as-frames path: native Diffusion encoder has image inputs, not dedicated video tensors.
                for i in range(4):
                    content.extend([{'type':'text','text':f'Frame at authored 00:0{i}: '},{'type':'image'}])
                kwargs['images']=[Image.fromarray(frame)for frame in frames]
            content.append({'type':'text','text':PROMPTS[job]})
            messages=[{'role':'user','content':content}]
            # Fixed two-turn text history: seeded final answer only, not a claimed prior model result.
            if job=='text':
                messages.extend([{'role':'assistant','content':'The library is open for eight hours.'},{'role':'user','content':'Now it closes at 18:00, with the same opening time. How many hours is it open?'}])
            prompt=processor.apply_chat_template(messages,tokenize=False,add_generation_prompt=True,enable_thinking=False)
            inputs=processor(text=[prompt],add_special_tokens=False,return_tensors='pt',
                images_kwargs={'max_soft_tokens':70},**kwargs)
            # Keep every native model tensor: text, attention, multimodal type, pixel and position inputs.
            if any(not torch.is_tensor(v) for v in inputs.values()): raise RuntimeError('unexpected_non_tensor_processor_output')
            ids=inputs['input_ids'];n=int(ids.shape[-1])
            if ids.ndim!=2 or ids.shape[0]!=1 or not 1<=n<=3840 or int(ids[0,0])!=2 or int((ids==2).sum())!=1:
                raise RuntimeError('full_expanded_input_budget_or_bos')
            media_id=config['image_token_id']
            media=int((ids==media_id).sum()) if job!='text' else 0
            if job=='image' and (not 1<=media<=70 or 'pixel_values' not in inputs or list(inputs['pixel_values'].shape)!=[1,630,768] or list(inputs['image_position_ids'].shape)!=[1,630,2]): raise RuntimeError('image_expansion')
            if job=='video' and (not 4<=media<=280 or list(inputs['pixel_values'].shape)!=[4,630,768] or list(inputs['image_position_ids'].shape)!=[4,630,2]):raise RuntimeError('ordered_native_image_frames')
            for v in inputs.values():
                if v.is_floating_point() and not torch.isfinite(v).all(): raise RuntimeError('nonfinite_processor_tensor')
            inputs=inputs.to('cuda:0')
            with torch.inference_mode():
                generated=model.generate(**inputs,max_new_tokens=256,max_denoising_steps=48,t_max=0.8,t_min=0.4,
                    confidence_threshold=0.005,stability_threshold=1,cache_implementation='dynamic',
                    eos_token_id=[1,106,50],pad_token_id=0,logits_processor=LogitsProcessorList([FiniteLogits()]))
            if list(generated.sequences.shape)!=[1,n+256] or not torch.equal(generated.sequences[0,:n],inputs['input_ids'][0]):raise RuntimeError('native_output_sequence')
            final_ids,output_count,stop=parse_canvas(generated.sequences[0,n:].tolist(),mask_token_id)
            text=parse_final_text(tokenizer.decode(final_ids,skip_special_tokens=False))
            return validate_result(job,{'job':job,'text':text,'input_tokens':n,'output_tokens':output_count,'media_tokens':media,'frames':4 if job=='video' else 0,'stop_id':stop,'canvas_length':256,'denoising_steps_cap':48})
        return engine
    
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  4. 4. Write unchanged private serial transport

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat >> diffusion_server.py <<'PYCODE'
    def create_server(engine, key, port=PORT):
        if not isinstance(key, str) or len(key) != 64 or any(c not in '0123456789abcdef' for c in key):
            raise ValueError('key_format')
    
        class Handler(BaseHTTPRequestHandler):
            def setup(self):
                super().setup()
                self.connection.settimeout(5)
    
            def log_message(self, *_):
                pass  # Do not log Bearer keys or request bodies.
    
            def reply(self, status, obj):
                data = json.dumps(obj, allow_nan=False, separators=(',', ':')).encode()
                self.send_response(status)
                self.send_header('Content-Type', 'application/json')
                self.send_header('Content-Length', str(len(data)))
                self.send_header('Connection', 'close')
                self.end_headers()
                self.wfile.write(data)
                self.close_connection = True
    
            def authorized(self):
                values = self.headers.get_all('Authorization', [])
                return len(values) == 1 and hmac.compare_digest(values[0].encode(), ('Bearer ' + key).encode())
    
            def do_GET(self):
                if not self.authorized():
                    return self.reply(401, {'error': 'unauthorized'})
                if self.path != '/health':
                    return self.reply(404, {'error': 'not_found'})
                return self.reply(200, {'ready': True, 'model': 'google/diffusiongemma-26B-A4B-it', 'jobs': ['text','image','video'], 'context_limit': 4096, 'max_new_tokens':256})
    
            def do_POST(self):
                if not self.authorized():
                    return self.reply(401, {'error': 'unauthorized'})
                if self.path != '/v1/fixed-multimodal':
                    return self.reply(404, {'error': 'not_found'})
                if self.headers.get('Transfer-Encoding') is not None:
                    return self.reply(400, {'error': 'transfer_encoding_unsupported'})
                lengths = self.headers.get_all('Content-Length', [])
                if len(lengths) != 1:
                    return self.reply(411, {'error': 'content_length_required'})
                raw = lengths[0]
                if not raw or len(raw) > 4 or any(c not in '0123456789' for c in raw):
                    return self.reply(413, {'error': 'invalid_or_excessive_length'})
                n = int(raw)
                if n < 1 or n > 256:
                    return self.reply(413, {'error': 'body_limit'})
                if self.headers.get_content_type() != 'application/json':
                    return self.reply(415, {'error': 'json_required'})
                try:
                    body = self.rfile.read(n)
                except (TimeoutError, OSError):
                    return self.reply(408, {'error': 'body_timeout'})
                if len(body) != n:
                    return self.reply(400, {'error': 'incomplete_body'})
                try:
                    def unique(pairs):
                        obj = {}
                        for k, v in pairs:
                            if k in obj:
                                raise ValueError('duplicate_key')
                            obj[k] = v
                        return obj
                    request = json.loads(body.decode('utf-8'), object_pairs_hook=unique,
                                         parse_constant=lambda _: (_ for _ in ()).throw(ValueError('constant')))
                except (ValueError, UnicodeError, RecursionError):
                    return self.reply(400, {'error': 'invalid_json'})
                if type(request) is not dict or set(request) != {'job'} or type(request['job']) is not str or request['job'] not in ('text','image','video'):
                    return self.reply(400, {'error': 'fixed_job_required'})
                try:
                    result = validate_result(request['job'], engine(request['job']))
                except Exception:
                    return self.reply(500, {'error': 'native_generation_or_validation_failure'})
                return self.reply(200, result)
    
        return HTTPServer(('127.0.0.1', port), Handler)
    
    
    if __name__ == '__main__':
        secret=(ROOT/'.api-key').read_text().strip()
        engine=make_engine()
        with create_server(engine,secret) as server:
            server.serve_forever()
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  5. 5. Check exact wrapper bytes

    Compile syntax only, then verify the whole helper digest.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    .venv/bin/python -m py_compile diffusion_server.py
    sha256sum --check <<'SHA256'
    b2e1aa89fe48f1c9926ce121adc14a151c37aeb34958df63e8aa97bbffffa1ce  diffusion_server.py
    SHA256

    Expected result: Syntax and whole-wrapper hash pass without importing native libraries.

Start the model

  1. 1. Start the complete native diffusion model

    The reader verifies all assets before native imports, loads all model parts with strict diagnostics, explicitly selects eager attention/experts, moves complete BF16 parameters to the single H100 and checks device/dtype/finiteness and tied embeddings. Dynamic cache preserves native diffusion while avoiding optional torch.compile. Startup success, fit and speed are unmeasured.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 CUDA_VISIBLE_DEVICES=0
    .venv/bin/python diffusion_server.py

    Expected result: Only after complete native loading and checks succeed does loopback 127.0.0.1:9007 serve authenticated health. Stop rather than relaxing diagnostics or deleting components.

Connect to your endpoint

http://127.0.0.1:9007/v1/fixed-multimodal

Trusted same-host loopback only; no remote flow is configured.

Access: loopback. Use the stable private Bearer key for health and fixed text, image or video jobs. Responses include final text, native input/output/media positions, frames, final stop ID, full canvas length and denoising step cap. No arbitrary prompts, files, URLs, uploads, tools or audio. This is a reader-authored fixed schema, not an OpenAI-compatible or publisher production endpoint.

Verify the setup

  1. 1. Check full canvas finalization and all native modalities

    Request the three fixed jobs from a second server terminal. Full expanded input <= 3840 plus a full 256-position output canvas stays inside 4096. A real final EOS is mandatory; all remaining positions must be native pad 0. Inspect the text grounding, original image and ordered moving rectangle frames manually. Empty thought prefix is accepted exactly; nonempty reasoning/tool output is rejected, not silently stripped. Native pad0 and the actual tokenizer-resolved mask token are forbidden before EOS; after EOS only native pad0 is valid. Remaining decoded angle/control fragments fail closed for these fixed plain-text tasks.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    DIFFUSION_KEY="$(cat .api-key)"
    curl --fail http://127.0.0.1:9007/health -H "Authorization: Bearer $DIFFUSION_KEY"
    for JOB in text image video; do
     curl --fail http://127.0.0.1:9007/v1/fixed-multimodal -H "Authorization: Bearer $DIFFUSION_KEY" -H 'Content-Type: application/json' -d "{\"job\":\"$JOB\"}" -o "$JOB-result.json"
    done
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:9007/health
    unset DIFFUSION_KEY
    .venv/bin/python - <<'PYVERIFY'
    import json
    from diffusion_server import validate_result
    for job in ('text','image','video'):print(validate_result(job,json.load(open(job+'-result.json'))))
    print('Inspect original image and four frame PNGs. Check nine hours for the seeded two-turn text history, shapes/colors and rightward temporal motion; record failures without a quality or performance guarantee.')
    PYVERIFY

    Expected result: Authorized requests return strict final text/count metadata only after actual reader execution; missing authorization returns 401. Output counts end at true EOS, while canvas_length 256 is distinct from actual non-pad output length.

Performance evidence

No compatible measurement available. Documented support and estimated memory do not establish response speed.

Limits and troubleshooting

  • The full native eleven-shard model retains multimodal encoder, diffusion decoder, self-conditioning and vision. Active 4B naming is not storage or device memory; no autoregressive Gemma, smaller checkpoint or component-deletion substitute.
  • Native canvas length 256 is preserved. One full canvas uses up to 48 denoising steps with entropy bound 0.1, temperature 0.8 to 0.4, confidence 0.005 and stability 1. Adaptive stopping may end sooner; no actual step count, speed or token-per-forward result is claimed.
  • The native result is a DiffusionGemmaGenerationOutput object whose sequences contain prompt plus the full canvas. The harness verifies the unchanged prompt, finds first native final EOS 1 or 106, rejects tool stop 50 and requires pad 0 after EOS. Actual output token count is not the 256-position canvas width or 48-step count.
  • Thinking is disabled using the exact native template. The native diffusion template does not prefill the autoregressive Gemma empty-thought suffix; an exactly empty generated thought prefix is parsed explicitly. Nonempty thought/tool/control text is rejected. Historical assistant turns must contain final responses only; the text fixture has a fixed seeded final-answer history and no persistent history or prior generated-result claim.
  • The configured total 4096 includes full native processor-expanded text/media input <= 3840 and a full 256-position canvas. Native 262144 maximum positions and card 256K guidance are not a measured long-context or resource capability.
  • The native diffusion encoder explicitly accepts text/image but lacks dedicated audio/video tensors. Publisher video-as-frames guidance is retained through four ordered native images with explicit authored 00:00 through 00:03 timestamps, not GemmaAR pixel_values_videos. No codec, recorded-video or audio claim.
  • One image or each video frame uses native max_soft_tokens set to 70. All actual expanded placeholder IDs and padded 630-patch × 768-pixel tensors are checked; four frames are four images. Full native multimodal tensors are passed, not dropped to fit a text-only limit.
  • Official native tutorial requires more than 60 GB GPU memory and shows H100. The shared H100 80 GB vendor label has unknown exact usable byte capacity. 256 GiB host RAM/disk are planning allocations, not measured minima or proof that this whole model/workload fits.
  • BF16 model parameters, native encoder cache, full vocabulary logits, FP32 sampler/self-conditioning intermediates, vision, CUDA workspaces and load copies have unknown peak. No CPU offload, quantization, custom-kernel or static compile shortcut is claimed.
  • Strict all-file verification and native loading diagnostics precede service readiness. Native conversion errors are fatal; missing/unexpected/mismatched/error keys reject startup. Never relax these checks or load an arbitrary replacement checkpoint.
  • Private serial HTTPServer provides stable Bearer auth, bounded framing and fixed jobs but no native inference deadline, TLS or multiuser resilience. Keep loopback private; no deployment/safety/quality clearance is established.
  • Exact released direct GPU stack and wheel identities are source-qualified; transitive/system versions resolve at reader install and must pass pip check and be recorded. No native imports, tokenizer/media processing, install/build or inference was executed by the author; fake tests prove protocol guards only.
  • Other context sizes, multi-canvas long responses, thinking/history, backends, audio and full family scope remain open; required total is null. Complete private candidates are not publication or eligibility credit until actual distinct review and owner/publicQA gates.
  • The fixed-fixture final answer boundary is deliberately conservative: raw pad/mask before EOS and remaining angle-bracket/control fragments are rejected, including truncated markers. Only the exact native empty-thought prefix is allowed. This is reader validation, not a claim that native generation cannot emit those tokens.
Artifact, load diagnostic, device or dtype failure
Stop and restore the exact complete native snapshot, H100 driver and pinned GPU environment. Do not drop shards, relax loading checks, change architecture or silently offload components.
Canvas has no final EOS or invalid padding
Record failure. Require the full 256-position canvas and true final EOS with native pad-only tail. Do not truncate a canvas, strip arbitrary control text or call max-length termination complete.
Media or context failure
Use only the exact one-image/four-ordered-image fixtures and native 70 soft-token preprocessing. Preserve full native image tensors and count every expanded input token; do not pass unsupported dedicated video tensors.
Unexpected thought, tool or incorrect content
Record errors honestly. Only an exactly empty native thought prefix is removed; nonempty thought/tools are rejected. No grounded correctness or temporal quality is guaranteed.
Memory or GPU runtime failure
Stop and save errors, actual resources and installed-requirements.txt. Official hardware guidance and planning allocations do not prove this workload fits; a different supported configuration needs separate qualification.

Stop the model

  1. 1. Stop the private service

    Use Ctrl-C in the server terminal.

    Command
    set -e
    curl -s -o /dev/null -w '%{http_code}\n' --max-time 3 http://127.0.0.1:9007/health || true

    Expected result: After Ctrl-C the private listener no longer responds. No model service remains running.

Uninstall

  1. 1. Remove the dedicated reader workspace

    Delete only this explicitly named workspace after preserving desired reader results.

    Command
    set -e
    rm -rf -- "$HOME/diffusiongemma-native"

    Expected result: The dedicated environment, complete model files, original fixtures, results and private key are removed. Shared system packages remain.

Sources and verification

Sources checked Oct 17, 2026. Verification source

Compare this configuration
Cloud serverDocumented setupSources checked Oct 17, 2026

Run complete native DiffusionGemma canvases on a private H100 cloud VM

Load all eleven publisher-native DiffusionGemma shards, including its full multimodal encoder, diffusion decoder, self-conditioning and vision tower. Run bounded text, image and timestamped image-frame video checks through the exact native template and processors. The full 256-position canvas uses the publisher entropy-bounded sampler with at most 48 denoising steps; final EOS and native padding are checked. One H100 80 GB, 256 GiB host RAM and 256 GiB disk are planning allocations, not measured fit or performance.

Hardware
AWS p5.4xlarge with one NVIDIA H100 80 GB
Runtime
Native DiffusionGemma full encoder and canvas decoder Transformers 5.11.0; Torch 2.11.0 cu130; torchvision 0.26.0 cu130; Python 3.12 · CUDA
Model format
Safetensors · Complete native BF16 parameters on one H100; native operations can use FP32 intermediates · Unquantized native BF16; complete encoder, diffusion decoder, self-conditioning and vision retained
Workload
4,096 token context · 1 concurrent

Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.

Read the complete setup guide

Before you start

  • Use an existing authorized AWS p5.4xlarge with one H100 80 GB, 256 GiB RAM and 256 GiB gp3 volume in us-east-1, Ubuntu 24.04 x86_64 and existing SSH. Keep service port 9007 closed.
  • Official native Google guidance requires more than 60 GB GPU memory and Transformers >= 5.11. Select exactly Transformers 5.11.0, Torch 2.11.0 cu130 and torchvision 0.26.0 cu130 on Python 3.12 with working NVIDIA driver >= 580.126.20. No native build, FlashAttention, offload or optional compile is used in this explicit eager/dynamic-cache route.
  • Review the exact Apache 2 grant and responsible-use guidance. Retain the complete eleven native shards, native encoder, decoder, self-conditioning and vision. Do not substitute autoregressive Gemma, a smaller checkpoint, Diffusers defaults or truncated canvas.
  • The text job uses a fixed two-turn conversation with a seeded eight-hour final answer and an independently checkable nine-hour followup; it is not a claimed prior generated result. Only original reader-generated RGB geometry and four ordered original frames are used. Publisher video-as-frames guidance is implemented through native image inputs plus authored timestamps; the native diffusion encoder explicitly lacks dedicated video tensors. No codec, recorded media or audio path is claimed.

Exact model and requirements

Artifact:
Google / Complete native DiffusionGemma 26B-A4B instruction checkpoint · checkpoint google/diffusiongemma-26B-A4B-it
Publisher revision:
f7f5b7f5fa82ffc52addd066915886d497f5517b
Artifact digest:
Eleven native parts are individually hashed; no invented whole-composition digest.
Download size:
48.1 GiB
Memory requirement (unknown):
Unknown — Full native BF16 weights, encoder cache, 256-position decoder logits/self-conditioning, vision, sampler buffers and process peak are unmeasured.
System RAM / disk:
Unknown / Unknown
Placement:
single device. All eleven native disk parts load one complete model on one H100; no device sharding. Complete model on cuda:0, no CPU/component offload, quantization or accelerator substitution.
KV cache:
Native BF16 encoder attention K/V cache, read by the diffusion decoder; full self-conditioning logits and canvas working tensors are separate. Dynamic per-request cache avoids optional static-cache compilation. Exact peak is unknown.
Workload:
4,096 token context; Unknown; Unknown; concurrency 1; batch 1; cache cold; repetitions Unknown.
Tokenizer:
Exact native DiffusionGemma tokenizer, standalone Jinja and Gemma4 image processor · f7f5b7f5fa82ffc52addd066915886d497f5517b
Sampling / reasoning:
Native full 256-position canvas; max_new_tokens=256, max_denoising_steps=48, EntropyBoundSamplerConfig entropy_bound=0.1, linear temperature 0.8 to 0.4, confidence_threshold=0.005 and stability_threshold=1. Native adaptive early stopping is preserved; 48 is a cap, not a measured or forced count. No AR do_sample/top-k/top-p substitution or Diffusers 32-step defaults. Native enable_thinking=False omits the think trigger. The native template differs from autoregressive Gemma: an exactly empty generated thought prefix is accepted, nonempty thought/tool controls are rejected. Final-only history rule is documented; the fixed harness keeps requests independent and does not persist hidden reasoning.
Runtime prerequisites:
Ubuntu 24.04 x86_64; NVIDIA Linux driver >= 580.126.20; single H100 80 GB; working CUDA visibility.

Official artifact · License

The exact native Google DiffusionGemma card declares Apache License 2.0 and links the archived actual grant. Preserve license/notices/attribution, modification and patent/termination obligations and warranty disclaimers. Publisher responsible-use guidance still applies. No prior Gemma restricted terms, provider byte-equivalence, rights acceptance or legal clearance is inferred.

  • Eleven complete serialized native shards total 51,647,701,024 bytes; active A4B naming is not full storage or GPU memory. No shards or model components are removed.
  • Official Google native Transformers guidance requires a GPU with more than 60 GB and demonstrates H100. The reused one-H100 80 GB label retains unknown exact usable bytes; it does not prove this configured workload fits.
  • 256 GiB host RAM and 256 GiB disk are planning allocations. Full BF16 parameters, native encoder cache, full 256-position canvas/logit/self-conditioning buffers, multimodal tensors, CUDA workspace and dependency/OS overhead add unknown peak requirements.

One-time setup and hardware

hardware
Unknown — Hardware acquisition is part of instance rental; separate purchase cost not applicable.
Hardware acquisition is part of instance rental; separate purchase cost not applicable. Tax: unknown.
setup
Unknown — Provisioning/imagebuild/labor cost unknown.
Provisioning/imagebuild/labor cost unknown. Tax: unknown.

Recurring costs

compute
$6.88 / hour
Exact us-east-1 Linux On-Demand quote USD 6.88/hour, original publication 2026-10-15T19:13:16Z. Eight hours USD 55.04 compute only; running idle hours bill. No Spot/reservation discount or capacity guarantee. Storage/egress/tax/labor/IP resources separate. Region: us-east-1. SKU: p5.4xlarge Linux On-Demand. Tax: excluded. Price dated Oct 15, 2026. Price source
storage
$0.08 / GB month
US East gp3 baseline USD 0.08 per AWS binary GB-month. Chosen 256 GiB root volume USD 20.48 per full month, prorated independently of compute hours; baseline 3000 IOPS / 125 MB/s. Local 1 × 3,840 GB SSD is included instance storage, not retained EBS; snapshots and public IPs separate. Region: us-east-1. SKU: EBS gp3 baseline. Tax: excluded. Price dated Oct 17, 2026. Price source
egress
Unknown — Actual transfer, public IPv4/IP and associated service charges depend on usage/resources; unknown.
Actual transfer, public IPv4/IP and associated service charges depend on usage/resources; unknown. Tax: unknown.
administration
Unknown — Maintenance time/rate unknown.
Maintenance time/rate unknown. Tax: unknown.

Install the runtime

  1. 1. Prepare the exact native GPU stack

    Use only an already provisioned H100 host with a working driver. The CUDA 13 wheels bundle user-space runtime dependencies; no local model/kernel build is part of this eager path. Record resolved transitive/system versions; stop on visibility, driver, dependency or import failures.

    Command
    set -e
    sudo apt-get update
    sudo apt-get install -y python3.12 python3.12-venv curl ca-certificates openssl
    mkdir -p "$HOME/diffusiongemma-native"
    cd "$HOME/diffusiongemma-native"
    nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
    free -h
    df -h .
    python3.12 - <<'PYPREFLIGHT'
    import csv,subprocess,shutil
    rows=list(csv.reader(subprocess.check_output(['nvidia-smi','--query-gpu=name,driver_version','--format=csv,noheader'],text=True).splitlines()))
    assert len(rows)==1 and 'H100'in rows[0][0] and '80GB'in rows[0][0].replace(' ','')
    assert tuple(map(int,rows[0][1].strip().split('.'))) >= (580,126,20)
    assert shutil.disk_usage('.').free >=160*1024**3
    print('Exact reader GPU/driver/160 GiB free-disk prerequisite passed; no fit proof.')
    PYPREFLIGHT
    python3.12 -m venv .venv
    .venv/bin/python -m pip install 'https://download-r2.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=96911323dcfcd42028c7e8edde7bdf25bb187753234e8775f0f3f112e86a22db' 'https://download-r2.pytorch.org/whl/cu130/torchvision-0.26.0%2Bcu130-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=0f030a9bd8ada1a31b7111ea1589c1ecb5fa0884fee700a203e731b4cf378a98'
    .venv/bin/python -m pip install transformers==5.11.0 huggingface-hub==1.5.0 tokenizers==0.22.2 regex==2025.10.22 numpy==2.2.3 Pillow==11.1.0 safetensors==0.5.3
    .venv/bin/python -m pip check
    .venv/bin/python -m pip freeze > installed-requirements.txt

    Expected result: Record actual H100, driver, storage and environment. Any failed preflight or dependency check stops before model loading.

Download the model

  1. 1. Verify the complete native snapshot

    Only the reader downloads these files. SHA-256 LFS hashes and Git blob SHA-1 identities are distinct. The complete native index must reference exactly all eleven expected weight parts. Diffusers scheduler/model-index metadata is retained in the snapshot but not substituted for the native Transformers generation config.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat > artifact-manifest.json <<'MANIFEST'
    {
      "repo": "google/diffusiongemma-26B-A4B-it",
      "revision": "f7f5b7f5fa82ffc52addd066915886d497f5517b",
      "files": [
        {
          "path": "README.md",
          "bytes": 19722,
          "algorithm": "git-sha1",
          "digest": "5e69c184a47d0e83d3cd46571c7dc5ce3bbdf75f"
        },
        {
          "path": "chat_template.jinja",
          "bytes": 18575,
          "algorithm": "git-sha1",
          "digest": "8c09d23fb05c3d817d1a670fda35751f22443ffb"
        },
        {
          "path": "config.json",
          "bytes": 3469,
          "algorithm": "git-sha1",
          "digest": "d609366b2563e13f39fbad6c6ee6f7d0231aa0d0"
        },
        {
          "path": "generation_config.json",
          "bytes": 357,
          "algorithm": "git-sha1",
          "digest": "73dcc9ff4ae4e0caa1301e1cc8f07ac6e2b317da"
        },
        {
          "path": "model-00001-of-00011.safetensors",
          "bytes": 4732780476,
          "algorithm": "sha256",
          "digest": "3efe137998af7d2bde4e3ab04ab3524823699a4ac3130adace5003ef40cceeb6"
        },
        {
          "path": "model-00002-of-00011.safetensors",
          "bytes": 4884578006,
          "algorithm": "sha256",
          "digest": "4a39d68c756fb26bbd2a54f2b8d550047ea98f3152f87ec75db825c8e17934a7"
        },
        {
          "path": "model-00003-of-00011.safetensors",
          "bytes": 4913414742,
          "algorithm": "sha256",
          "digest": "ac6083e3489215ca032501714b78832e5cc4c945a8dbbb905b5292a4e95bc75e"
        },
        {
          "path": "model-00004-of-00011.safetensors",
          "bytes": 4884578030,
          "algorithm": "sha256",
          "digest": "865b66393de5a9c752e67beae1bd2c860c12786b72ad86ca9345c00b7b586e60"
        },
        {
          "path": "model-00005-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "a87e01bed77ad9d2234851267d99af583ff79c7a86d7494fe08ae0f9de9cd318"
        },
        {
          "path": "model-00006-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "077e841b3b138fbc38df2c36665abdaafa96b8c96f968e2263a7452afaa912ab"
        },
        {
          "path": "model-00007-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "13a18b3c04a7f19a16385dd8a0d7fd0b9cc89ef131e4294a063c31c7d90c58ef"
        },
        {
          "path": "model-00008-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "aca5d3bdfc84700bd55b475781cb46e5608104c4832d2abe111a119ddcb23ff7"
        },
        {
          "path": "model-00009-of-00011.safetensors",
          "bytes": 4913414814,
          "algorithm": "sha256",
          "digest": "8e2418867354e5cb356c0af8ccfdcc60bc363500674d6cf395991e7d6219eb29"
        },
        {
          "path": "model-00010-of-00011.safetensors",
          "bytes": 4884578070,
          "algorithm": "sha256",
          "digest": "93d564b7dd686464a5c068ff9665cd5d3bca399c2ce320aecd41bd011e3787d5"
        },
        {
          "path": "model-00011-of-00011.safetensors",
          "bytes": 2838371118,
          "algorithm": "sha256",
          "digest": "afec047176bb2a05f078566576aec6bdb71ad4d041275d0d0c89473fda6d6d87"
        },
        {
          "path": "model.safetensors.index.json",
          "bytes": 104650,
          "algorithm": "git-sha1",
          "digest": "c5c692dcc6f1cf0845a69d344d635b52d2d8b34b"
        },
        {
          "path": "model_index.json",
          "bytes": 295,
          "algorithm": "git-sha1",
          "digest": "aee996ea126b3bfbeb68875fa93af61ceac5b65f"
        },
        {
          "path": "processor_config.json",
          "bytes": 1689,
          "algorithm": "git-sha1",
          "digest": "5465974d23e1eca2c46c2809b26c997946ce0d90"
        },
        {
          "path": "scheduler/scheduler_config.json",
          "bytes": 209,
          "algorithm": "git-sha1",
          "digest": "389d26ef7e903f189e1d9f7870ae5f2f9faabc8a"
        },
        {
          "path": "tokenizer.json",
          "bytes": 32169626,
          "algorithm": "sha256",
          "digest": "cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f"
        },
        {
          "path": "tokenizer_config.json",
          "bytes": 2741,
          "algorithm": "git-sha1",
          "digest": "af7f25861136b515f4bf64d9d0a6cf9875a6d508"
        }
      ]
    }
    MANIFEST
    cat > reader-download.py <<'PYDOWNLOAD'
    import hashlib,json,pathlib,urllib.request
    root=pathlib.Path('model');root.mkdir(exist_ok=True)
    manifest=json.load(open('artifact-manifest.json'))
    base='https://huggingface.co/'+manifest['repo']+'/resolve/'+manifest['revision']+'/'
    for row in manifest['files']:
     path=root/row['path'];path.parent.mkdir(parents=True,exist_ok=True)
     if not path.exists():
      temporary=path.with_name(path.name+'.partial')
      with urllib.request.urlopen(base+row['path'],timeout=120) as src,temporary.open('wb') as dst:
       for chunk in iter(lambda:src.read(1024*1024),b''):dst.write(chunk)
      temporary.replace(path)
     if path.stat().st_size!=row['bytes']:raise SystemExit('wrong size: '+row['path'])
     digest=hashlib.sha256() if row['algorithm']=='sha256' else hashlib.sha1()
     if row['algorithm']=='git-sha1':digest.update(b'blob '+str(row['bytes']).encode()+b'\0')
     with path.open('rb')as src:
      for chunk in iter(lambda:src.read(1024*1024),b''):digest.update(chunk)
     if digest.hexdigest()!=row['digest']:raise SystemExit('wrong digest: '+row['path'])
    index=json.load(open(root/'model.safetensors.index.json'))
    expected={x['path']for x in manifest['files']if x['path'].endswith('.safetensors')}
    assert len(expected)==11 and set(index['weight_map'].values())==expected
    assert sum(x['bytes']for x in manifest['files']if x['path'].endswith('.safetensors'))==51647701024
    print('All21pinned native files and eleven complete shards verified.')
    PYDOWNLOAD
    .venv/bin/python reader-download.py

    Expected result: All 21 native files and eleven full shards verify before native imports/loading. Stop on mismatches; no model/tokenizer/media body was fetched by this author.

Configure

  1. 1. Create a stable private key

    Create the reader-generated secret only when absent, keep it private and refuse an empty existing file. No key is generated or executed by the author.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    umask 077
    if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key; fi
    test -s .api-key
    chmod 600 .api-key

    Expected result: A stable private 64-character hexadecimal key exists with restricted permissions; later reader startup checks its exact format.

  2. 2. Write corrected canvas and final-output guards

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat > diffusion_server.py <<'PYCODE'
    """Reader-authored private DiffusionGemma full-native educational harness; not publisher server."""
    import hashlib
    import hmac
    import json
    import math
    import pathlib
    from http.server import BaseHTTPRequestHandler, HTTPServer
    ROOT = pathlib.Path(__file__).resolve().parent
    PORT = 9007
    PIN = 'f7f5b7f5fa82ffc52addd066915886d497f5517b'
    PROMPTS = {'text':'The library opens at 09:00 and closes at 17:00 on the same day. How many hours is it open? Answer briefly.',
    'image':'Describe the visible colors and shapes in this original geometry image. Answer briefly.',
    'video':'Describe how the red rectangle changes position from the first frame to the last. Answer briefly; do not invent events outside the frames.'}
    
    def validate_result(job, d):
        if type(d) is not dict or set(d) != {'job','text','input_tokens','output_tokens','media_tokens','frames','stop_id','canvas_length','denoising_steps_cap'}:
            raise ValueError('result_schema')
        if d['job'] != job or type(d['text']) is not str or not d['text'].strip() or len(d['text'])>16384:
            raise ValueError('result_text')
        for k in ('input_tokens','output_tokens','media_tokens','frames','stop_id','canvas_length','denoising_steps_cap'):
            if type(d[k]) is not int:
                raise ValueError('result_integer')
        if not 1<=d['input_tokens']<=3840 or not 1<=d['output_tokens']<=256 or d['input_tokens']+d['output_tokens']>4096:
            raise ValueError('result_context')
        if d['canvas_length']!=256 or type(d['canvas_length'])is not int or d['denoising_steps_cap']!=48 or type(d['denoising_steps_cap'])is not int: raise ValueError('native_diffusion_budget')
        if d['stop_id'] not in (1,106) or d['frames'] != (4 if job=='video' else 0):
            raise ValueError('result_stop_or_frames')
        if (job=='text' and d['media_tokens']!=0) or (job=='image' and not 1<=d['media_tokens']<=70) or (job=='video' and not 4<=d['media_tokens']<=280):
            raise ValueError('result_media')
        # Fixed-fixture final answers permit plain text only. This fail-closed
        # reader boundary rejects full and truncated control fragments uniformly.
        if '<' in d['text'] or '>' in d['text']:
            raise ValueError('unexpected_native_control')
        return d
    
    def parse_canvas(tokens, mask_token_id):
        if type(mask_token_id) is not int or mask_token_id < 0 or mask_token_id in (0,1,106,50):
            raise ValueError('native_mask_identity')
        if type(tokens)is not list or len(tokens)!=256 or any(type(x)is not int or x<0 for x in tokens):
            raise ValueError('full_native_canvas_required')
        stops=[i for i,t in enumerate(tokens)if t in (1,106,50)]
        if not stops:raise ValueError('no_true_final_eos')
        end=stops[0]
        if tokens[end]==50 or any(t!=0 for t in tokens[end+1:]):raise ValueError('nonfinal_stop_or_nonpad_tail')
        if any(t in (0,mask_token_id) for t in tokens[:end]):
            raise ValueError('native_pad_or_mask_before_eos')
        return tokens[:end],end+1,tokens[end]
    
    def parse_final_text(text):
        prefix='<|channel>thought\n<channel|>'
        if text.startswith(prefix):text=text[len(prefix):]
        if not text.strip() or '<' in text or '>' in text:raise ValueError('nonempty_thought_tool_or_invalid_final')
        return text.strip()
    
    def checked_manifest(data):
        if hashlib.sha256(data).hexdigest()!='d2a360c724f99d4d102a61427c78ec38961f5699fd651098d5a0586eb181a969':raise ValueError('manifest_hash')
        manifest=json.loads(data)
        if manifest['repo']!='google/diffusiongemma-26B-A4B-it' or manifest['revision']!=PIN:raise ValueError('manifest_identity')
        return manifest
    
    def check_loading(info):
        expected={'missing_keys','unexpected_keys','mismatched_keys','error_msgs'}
        if type(info) is not dict or set(info)!=expected or any(info[k] for k in expected):
            raise RuntimeError('incomplete_or_incompatible_checkpoint')
    
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  3. 3. Write complete native H100 adapter with mask identity

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat >> diffusion_server.py <<'PYCODE'
    def make_engine():
        # Only the reader invokes this path. Fake protocol tests never import native libraries.
        model_dir=ROOT/'model'
        manifest=checked_manifest((ROOT/'artifact-manifest.json').read_bytes())
        for row in manifest['files']:
            path=model_dir/row['path']
            if path.stat().st_size!=row['bytes']: raise RuntimeError('artifact_size')
            digest=hashlib.sha256() if row['algorithm']=='sha256' else hashlib.sha1()
            if row['algorithm']=='git-sha1': digest.update(b'blob '+str(row['bytes']).encode()+b'\0')
            with path.open('rb') as handle:
                for chunk in iter(lambda:handle.read(1024*1024),b''): digest.update(chunk)
            actual=digest.hexdigest()
            if actual!=row['digest']: raise RuntimeError('artifact_hash')
        config=json.loads((model_dir/'config.json').read_text())
        if config['architectures']!=['DiffusionGemmaForBlockDiffusion'] or config.get('canvas_length')!=256:
            raise RuntimeError('wrong_native_architecture')
        import numpy as np
        import torch
        from PIL import Image, ImageDraw
        from transformers import AutoProcessor, DiffusionGemmaForBlockDiffusion, LogitsProcessor, LogitsProcessorList
        torch.set_num_threads(16)
        if torch.cuda.device_count()!=1 or 'H100'not in torch.cuda.get_device_name(0) or not torch.cuda.is_bf16_supported():raise RuntimeError('single_h100_bf16_required')
        processor=AutoProcessor.from_pretrained(model_dir,local_files_only=True,trust_remote_code=False)
        model, info=DiffusionGemmaForBlockDiffusion.from_pretrained(model_dir,local_files_only=True,trust_remote_code=False,
            dtype=torch.bfloat16,device_map=None,attn_implementation='eager',experts_implementation='eager',
            use_safetensors=True,ignore_mismatched_sizes=False,output_loading_info=True)
        check_loading(info)
        model=model.to('cuda:0').eval()
        if model.config.canvas_length!=256 or len(model.model.decoder.layers)!=30 or not hasattr(model.model.encoder,'vision_tower'): raise RuntimeError('full_native_diffusion_architecture')
        gc=model.generation_config
        if gc.max_denoising_steps!=48 or gc.t_max!=0.8 or gc.t_min!=0.4 or gc.confidence_threshold!=0.005 or gc.stability_threshold!=1 or gc.sampler_config.entropy_bound!=0.1: raise RuntimeError('native_sampler_config')
        for p in model.parameters():
            if p.device.type!='cuda' or p.device.index!=0 or p.dtype!=torch.bfloat16 or not torch.isfinite(p).all():
                raise RuntimeError('native_full_gpu_parameter_dtype_or_finiteness')
        if model.get_input_embeddings().weight.data_ptr()!=model.get_output_embeddings().weight.data_ptr():
            raise RuntimeError('native_tied_embeddings')
        tokenizer=processor.tokenizer
        if tokenizer.bos_token_id!=2 or tokenizer.convert_tokens_to_ids('<|image|>')!=config['image_token_id']:
            raise RuntimeError('native_token_identity')
        mask_token_id=tokenizer.convert_tokens_to_ids(tokenizer.mask_token)
        if tokenizer.mask_token!='<mask>' or type(mask_token_id) is not int or not 0<=mask_token_id<model.config.text_config.vocab_size or tokenizer.convert_ids_to_tokens(mask_token_id)!='<mask>':
            raise RuntimeError('native_mask_token_identity')
        fixture=ROOT/'fixtures';fixture.mkdir(exist_ok=True)
        image=Image.new('RGB',(256,256),'white');draw=ImageDraw.Draw(image)
        draw.rectangle((20,30,110,220),fill='red');draw.ellipse((140,70,230,160),fill='blue');image.save(fixture/'image.png')
        frames=[]
        for n in range(4):
            frame=Image.new('RGB',(256,256),'white');ImageDraw.Draw(frame).rectangle((16+48*n,80,64+48*n,176),fill='red')
            frame.save(fixture/f'frame-{n}.png');frames.append(np.asarray(frame))
        class FiniteLogits(LogitsProcessor):
            def __call__(self, input_ids, scores):
                # Negative infinity can be a native mask; NaN/+infinity or no finite choice is invalid.
                if torch.isnan(scores).any() or torch.isposinf(scores).any() or not torch.isfinite(scores).any(dim=-1).all():
                    raise RuntimeError('invalid_generation_logits')
                return scores
        def engine(job):
            content=[]; kwargs={}
            if job=='image': content.append({'type':'image'});kwargs['images']=[image]
            if job=='video':
                # Publisher video-as-frames path: native Diffusion encoder has image inputs, not dedicated video tensors.
                for i in range(4):
                    content.extend([{'type':'text','text':f'Frame at authored 00:0{i}: '},{'type':'image'}])
                kwargs['images']=[Image.fromarray(frame)for frame in frames]
            content.append({'type':'text','text':PROMPTS[job]})
            messages=[{'role':'user','content':content}]
            # Fixed two-turn text history: seeded final answer only, not a claimed prior model result.
            if job=='text':
                messages.extend([{'role':'assistant','content':'The library is open for eight hours.'},{'role':'user','content':'Now it closes at 18:00, with the same opening time. How many hours is it open?'}])
            prompt=processor.apply_chat_template(messages,tokenize=False,add_generation_prompt=True,enable_thinking=False)
            inputs=processor(text=[prompt],add_special_tokens=False,return_tensors='pt',
                images_kwargs={'max_soft_tokens':70},**kwargs)
            # Keep every native model tensor: text, attention, multimodal type, pixel and position inputs.
            if any(not torch.is_tensor(v) for v in inputs.values()): raise RuntimeError('unexpected_non_tensor_processor_output')
            ids=inputs['input_ids'];n=int(ids.shape[-1])
            if ids.ndim!=2 or ids.shape[0]!=1 or not 1<=n<=3840 or int(ids[0,0])!=2 or int((ids==2).sum())!=1:
                raise RuntimeError('full_expanded_input_budget_or_bos')
            media_id=config['image_token_id']
            media=int((ids==media_id).sum()) if job!='text' else 0
            if job=='image' and (not 1<=media<=70 or 'pixel_values' not in inputs or list(inputs['pixel_values'].shape)!=[1,630,768] or list(inputs['image_position_ids'].shape)!=[1,630,2]): raise RuntimeError('image_expansion')
            if job=='video' and (not 4<=media<=280 or list(inputs['pixel_values'].shape)!=[4,630,768] or list(inputs['image_position_ids'].shape)!=[4,630,2]):raise RuntimeError('ordered_native_image_frames')
            for v in inputs.values():
                if v.is_floating_point() and not torch.isfinite(v).all(): raise RuntimeError('nonfinite_processor_tensor')
            inputs=inputs.to('cuda:0')
            with torch.inference_mode():
                generated=model.generate(**inputs,max_new_tokens=256,max_denoising_steps=48,t_max=0.8,t_min=0.4,
                    confidence_threshold=0.005,stability_threshold=1,cache_implementation='dynamic',
                    eos_token_id=[1,106,50],pad_token_id=0,logits_processor=LogitsProcessorList([FiniteLogits()]))
            if list(generated.sequences.shape)!=[1,n+256] or not torch.equal(generated.sequences[0,:n],inputs['input_ids'][0]):raise RuntimeError('native_output_sequence')
            final_ids,output_count,stop=parse_canvas(generated.sequences[0,n:].tolist(),mask_token_id)
            text=parse_final_text(tokenizer.decode(final_ids,skip_special_tokens=False))
            return validate_result(job,{'job':job,'text':text,'input_tokens':n,'output_tokens':output_count,'media_tokens':media,'frames':4 if job=='video' else 0,'stop_id':stop,'canvas_length':256,'denoising_steps_cap':48})
        return engine
    
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  4. 4. Write unchanged private serial transport

    Reader-authored fixed-input harness retains complete native DiffusionGemma. Mandatory raw pad/mask and decoded control-fragment rejection is a conservative fixed-fixture boundary; exact empty thought handling remains. No model import occurs while writing this source.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    cat >> diffusion_server.py <<'PYCODE'
    def create_server(engine, key, port=PORT):
        if not isinstance(key, str) or len(key) != 64 or any(c not in '0123456789abcdef' for c in key):
            raise ValueError('key_format')
    
        class Handler(BaseHTTPRequestHandler):
            def setup(self):
                super().setup()
                self.connection.settimeout(5)
    
            def log_message(self, *_):
                pass  # Do not log Bearer keys or request bodies.
    
            def reply(self, status, obj):
                data = json.dumps(obj, allow_nan=False, separators=(',', ':')).encode()
                self.send_response(status)
                self.send_header('Content-Type', 'application/json')
                self.send_header('Content-Length', str(len(data)))
                self.send_header('Connection', 'close')
                self.end_headers()
                self.wfile.write(data)
                self.close_connection = True
    
            def authorized(self):
                values = self.headers.get_all('Authorization', [])
                return len(values) == 1 and hmac.compare_digest(values[0].encode(), ('Bearer ' + key).encode())
    
            def do_GET(self):
                if not self.authorized():
                    return self.reply(401, {'error': 'unauthorized'})
                if self.path != '/health':
                    return self.reply(404, {'error': 'not_found'})
                return self.reply(200, {'ready': True, 'model': 'google/diffusiongemma-26B-A4B-it', 'jobs': ['text','image','video'], 'context_limit': 4096, 'max_new_tokens':256})
    
            def do_POST(self):
                if not self.authorized():
                    return self.reply(401, {'error': 'unauthorized'})
                if self.path != '/v1/fixed-multimodal':
                    return self.reply(404, {'error': 'not_found'})
                if self.headers.get('Transfer-Encoding') is not None:
                    return self.reply(400, {'error': 'transfer_encoding_unsupported'})
                lengths = self.headers.get_all('Content-Length', [])
                if len(lengths) != 1:
                    return self.reply(411, {'error': 'content_length_required'})
                raw = lengths[0]
                if not raw or len(raw) > 4 or any(c not in '0123456789' for c in raw):
                    return self.reply(413, {'error': 'invalid_or_excessive_length'})
                n = int(raw)
                if n < 1 or n > 256:
                    return self.reply(413, {'error': 'body_limit'})
                if self.headers.get_content_type() != 'application/json':
                    return self.reply(415, {'error': 'json_required'})
                try:
                    body = self.rfile.read(n)
                except (TimeoutError, OSError):
                    return self.reply(408, {'error': 'body_timeout'})
                if len(body) != n:
                    return self.reply(400, {'error': 'incomplete_body'})
                try:
                    def unique(pairs):
                        obj = {}
                        for k, v in pairs:
                            if k in obj:
                                raise ValueError('duplicate_key')
                            obj[k] = v
                        return obj
                    request = json.loads(body.decode('utf-8'), object_pairs_hook=unique,
                                         parse_constant=lambda _: (_ for _ in ()).throw(ValueError('constant')))
                except (ValueError, UnicodeError, RecursionError):
                    return self.reply(400, {'error': 'invalid_json'})
                if type(request) is not dict or set(request) != {'job'} or type(request['job']) is not str or request['job'] not in ('text','image','video'):
                    return self.reply(400, {'error': 'fixed_job_required'})
                try:
                    result = validate_result(request['job'], engine(request['job']))
                except Exception:
                    return self.reply(500, {'error': 'native_generation_or_validation_failure'})
                return self.reply(200, result)
    
        return HTTPServer(('127.0.0.1', port), Handler)
    
    
    if __name__ == '__main__':
        secret=(ROOT/'.api-key').read_text().strip()
        engine=make_engine()
        with create_server(engine,secret) as server:
            server.serve_forever()
    PYCODE

    Expected result: Exact corrected helper section is written without native execution.

  5. 5. Check exact wrapper bytes

    Compile syntax only, then verify the whole helper digest.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    .venv/bin/python -m py_compile diffusion_server.py
    sha256sum --check <<'SHA256'
    b2e1aa89fe48f1c9926ce121adc14a151c37aeb34958df63e8aa97bbffffa1ce  diffusion_server.py
    SHA256

    Expected result: Syntax and whole-wrapper hash pass without importing native libraries.

Start the model

  1. 1. Start the complete native diffusion model

    The reader verifies all assets before native imports, loads all model parts with strict diagnostics, explicitly selects eager attention/experts, moves complete BF16 parameters to the single H100 and checks device/dtype/finiteness and tied embeddings. Dynamic cache preserves native diffusion while avoiding optional torch.compile. Startup success, fit and speed are unmeasured.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 CUDA_VISIBLE_DEVICES=0
    .venv/bin/python diffusion_server.py

    Expected result: Only after complete native loading and checks succeed does loopback 127.0.0.1:9007 serve authenticated health. Stop rather than relaxing diagnostics or deleting components.

Connect to your endpoint

http://127.0.0.1:9007/v1/fixed-multimodal

VM loopback only. Keep port 9007 closed. Existing SSH may tunnel with ssh -N -L 9007:127.0.0.1:9007 USER@VM_IP; checks shown run on the server.

Access: loopback. Use the stable private Bearer key for health and fixed text, image or video jobs. Responses include final text, native input/output/media positions, frames, final stop ID, full canvas length and denoising step cap. No arbitrary prompts, files, URLs, uploads, tools or audio. This is a reader-authored fixed schema, not an OpenAI-compatible or publisher production endpoint.

Verify the setup

  1. 1. Check full canvas finalization and all native modalities

    Request the three fixed jobs from a second server terminal. Full expanded input <= 3840 plus a full 256-position output canvas stays inside 4096. A real final EOS is mandatory; all remaining positions must be native pad 0. Inspect the text grounding, original image and ordered moving rectangle frames manually. Empty thought prefix is accepted exactly; nonempty reasoning/tool output is rejected, not silently stripped. Native pad0 and the actual tokenizer-resolved mask token are forbidden before EOS; after EOS only native pad0 is valid. Remaining decoded angle/control fragments fail closed for these fixed plain-text tasks.

    Command
    set -e
    cd "$HOME/diffusiongemma-native"
    DIFFUSION_KEY="$(cat .api-key)"
    curl --fail http://127.0.0.1:9007/health -H "Authorization: Bearer $DIFFUSION_KEY"
    for JOB in text image video; do
     curl --fail http://127.0.0.1:9007/v1/fixed-multimodal -H "Authorization: Bearer $DIFFUSION_KEY" -H 'Content-Type: application/json' -d "{\"job\":\"$JOB\"}" -o "$JOB-result.json"
    done
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:9007/health
    unset DIFFUSION_KEY
    .venv/bin/python - <<'PYVERIFY'
    import json
    from diffusion_server import validate_result
    for job in ('text','image','video'):print(validate_result(job,json.load(open(job+'-result.json'))))
    print('Inspect original image and four frame PNGs. Check nine hours for the seeded two-turn text history, shapes/colors and rightward temporal motion; record failures without a quality or performance guarantee.')
    PYVERIFY

    Expected result: Authorized requests return strict final text/count metadata only after actual reader execution; missing authorization returns 401. Output counts end at true EOS, while canvas_length 256 is distinct from actual non-pad output length.

Performance evidence

No compatible measurement available. Documented support and estimated memory do not establish response speed.

Limits and troubleshooting

  • The full native eleven-shard model retains multimodal encoder, diffusion decoder, self-conditioning and vision. Active 4B naming is not storage or device memory; no autoregressive Gemma, smaller checkpoint or component-deletion substitute.
  • Native canvas length 256 is preserved. One full canvas uses up to 48 denoising steps with entropy bound 0.1, temperature 0.8 to 0.4, confidence 0.005 and stability 1. Adaptive stopping may end sooner; no actual step count, speed or token-per-forward result is claimed.
  • The native result is a DiffusionGemmaGenerationOutput object whose sequences contain prompt plus the full canvas. The harness verifies the unchanged prompt, finds first native final EOS 1 or 106, rejects tool stop 50 and requires pad 0 after EOS. Actual output token count is not the 256-position canvas width or 48-step count.
  • Thinking is disabled using the exact native template. The native diffusion template does not prefill the autoregressive Gemma empty-thought suffix; an exactly empty generated thought prefix is parsed explicitly. Nonempty thought/tool/control text is rejected. Historical assistant turns must contain final responses only; the text fixture has a fixed seeded final-answer history and no persistent history or prior generated-result claim.
  • The configured total 4096 includes full native processor-expanded text/media input <= 3840 and a full 256-position canvas. Native 262144 maximum positions and card 256K guidance are not a measured long-context or resource capability.
  • The native diffusion encoder explicitly accepts text/image but lacks dedicated audio/video tensors. Publisher video-as-frames guidance is retained through four ordered native images with explicit authored 00:00 through 00:03 timestamps, not GemmaAR pixel_values_videos. No codec, recorded-video or audio claim.
  • One image or each video frame uses native max_soft_tokens set to 70. All actual expanded placeholder IDs and padded 630-patch × 768-pixel tensors are checked; four frames are four images. Full native multimodal tensors are passed, not dropped to fit a text-only limit.
  • Official native tutorial requires more than 60 GB GPU memory and shows H100. The shared H100 80 GB vendor label has unknown exact usable byte capacity. 256 GiB host RAM/disk are planning allocations, not measured minima or proof that this whole model/workload fits.
  • BF16 model parameters, native encoder cache, full vocabulary logits, FP32 sampler/self-conditioning intermediates, vision, CUDA workspaces and load copies have unknown peak. No CPU offload, quantization, custom-kernel or static compile shortcut is claimed.
  • Strict all-file verification and native loading diagnostics precede service readiness. Native conversion errors are fatal; missing/unexpected/mismatched/error keys reject startup. Never relax these checks or load an arbitrary replacement checkpoint.
  • Private serial HTTPServer provides stable Bearer auth, bounded framing and fixed jobs but no native inference deadline, TLS or multiuser resilience. Keep loopback private; no deployment/safety/quality clearance is established.
  • Exact released direct GPU stack and wheel identities are source-qualified; transitive/system versions resolve at reader install and must pass pip check and be recorded. No native imports, tokenizer/media processing, install/build or inference was executed by the author; fake tests prove protocol guards only.
  • Other context sizes, multi-canvas long responses, thinking/history, backends, audio and full family scope remain open; required total is null. Complete private candidates are not publication or eligibility credit until actual distinct review and owner/publicQA gates.
  • The fixed-fixture final answer boundary is deliberately conservative: raw pad/mask before EOS and remaining angle-bracket/control fragments are rejected, including truncated markers. Only the exact native empty-thought prefix is allowed. This is reader validation, not a claim that native generation cannot emit those tokens.
Artifact, load diagnostic, device or dtype failure
Stop and restore the exact complete native snapshot, H100 driver and pinned GPU environment. Do not drop shards, relax loading checks, change architecture or silently offload components.
Canvas has no final EOS or invalid padding
Record failure. Require the full 256-position canvas and true final EOS with native pad-only tail. Do not truncate a canvas, strip arbitrary control text or call max-length termination complete.
Media or context failure
Use only the exact one-image/four-ordered-image fixtures and native 70 soft-token preprocessing. Preserve full native image tensors and count every expanded input token; do not pass unsupported dedicated video tensors.
Unexpected thought, tool or incorrect content
Record errors honestly. Only an exactly empty native thought prefix is removed; nonempty thought/tools are rejected. No grounded correctness or temporal quality is guaranteed.
Memory or GPU runtime failure
Stop and save errors, actual resources and installed-requirements.txt. Official hardware guidance and planning allocations do not prove this workload fits; a different supported configuration needs separate qualification.

Stop the model

  1. 1. Stop the private service

    Use Ctrl-C in the server terminal. Close any optional SSH tunnel separately.

    Command
    set -e
    curl -s -o /dev/null -w '%{http_code}\n' --max-time 3 http://127.0.0.1:9007/health || true

    Expected result: After Ctrl-C the private listener no longer responds. Stopping the Python process does not stop EC2 billing.

Uninstall

  1. 1. Remove the dedicated reader workspace

    Delete only this explicitly named workspace after preserving desired reader results. Stop or terminate the EC2 instance separately, inspect retained EBS volumes/snapshots and delete unwanted billable resources in the existing AWS console. Verify the terminal state and retained resources; stopping an instance retains EBS charges.

    Command
    set -e
    rm -rf -- "$HOME/diffusiongemma-native"

    Expected result: The dedicated environment, complete model files, original fixtures, results and private key are removed. EC2 and retained storage cleanup must be confirmed independently in the existing console.

Shut down cloud resources

  1. 1. End instance and retained-resource billing

    In EC2 us-east-1, stop for later reuse or terminate this exact instance. Review Delete on termination for its 256 GiB root volume; delete unwanted detached EBS volumes, snapshots and retained public or Elastic IP resources. Local NVMe contents are ephemeral. Check Bills/Cost Explorer for final usage; no cloud actions were performed here.

    Expected result: Compute ends only after actual instance lifecycle transition; retained volumes/snapshots/IPs may still bill. Stopping the container alone ends no VM/storage bill.

Sources and verification

Sources checked Oct 17, 2026. Verification source

Compare this configuration

Benchmarks

Performance scores for DiffusionGemma across standard benchmarks.

MMLU Proofficial-google-model-card · Jun 2026
77.6
GPQA Diamondofficial-google-model-card · Jun 2026
73.2
LiveCodeBench v6official-google-model-card · Jun 2026
69.1
MMMLUofficial-google-model-card · Jun 2026
81.5
HLE no toolsofficial-google-model-card · Jun 2026
11

Pricing and access

Google publishes open weights for local deployment. A hosted API price has not been verified; hosting and infrastructure costs depend on the provider or deployment.

Google logo
Googleenterprise

Organizing the world's information with AI

14 Tools6 MCP Servers9 ModelsFounded 1998Mountain View, CA
View full profile

Tools by Google

Other AI tools from the same organization.

AI Models by Google

AI models from the same organization.

ModelContext WindowPrice (In / Out per M)
Gemini Omni 1.1 FlashCurrent1.0M$1.50 / $17.50
Gemini 3.7 FlashCurrent1.0M$0.75 / $3.75
Gemini 3.5 Flash-LiteCurrent1.0M$0.30 / $2.50
Gemini 3.6 FlashCurrent1.0M$1.50 / $7.50
Gemma 4 26B A4BCurrent262K-- / --
Gemma 4 26B A4BCurrent262K$0.08 / $0.35

MCP Servers by Google

Connect this tool to AI assistants via the Model Context Protocol.

Related News

Latest coverage and updates.