Nemotron-Labs-Image 30B-A3B text-to-image on a 12 GB card25.4 GB of Q4_K_M (mostly Q5_0 and Q8_0) on 12 GB

NVIDIA's autoregressive text-to-image MoE (AtomicChat Q4_K_M, 25.4 GB) on stock llama.cpp with every routed expert in RAM, a 7000 MiB MoE cache and GPU-side sampling: a 1024x1024 image in 61.5 s (68.7 tok/s) against 108.6 s for stock --fit; NVIDIA's decoder adds 0.23 s on the GPU. Non-commercial licence.

Decode · 1024x1024 image, median of 8 prompts, seed 42
68.69tok/sstock 38.7
Context
6k tokens
VRAM peak
10,250MiB
PLATE 1 · TUNED VS STOCK, TOK/S2026-11-29
DECODE1024X1024 IMAGE, MEDIAN O…68.69STOCK 38.7CEILING 87DECODE · 1024X1024 IMAGE, MEDIAN OF 8 PR…68.69STOCK 38.7CEILING 87

TUNED STOCK FLAGS CEILING FROM MEASURED BANDWIDTH

Decode and prefill share no scale; each metric is drawn to its own maximum. Stock means the engine's default flags on the same file.
→Exact file, build and flags

Run it

Serve · from nemotron-labs-image/ in a clone of the repo
./generate.sh "prompt"
Modelnvidia/Nemotron-Labs-Image-30B-A3B on Hugging Face · NVIDIA OneWay Noncommercial License
WeightsGGUF Q4_K_M (mostly Q5_0 and Q8_0), 25.4 GB from AtomicChat/Nemotron-Labs-Image-30B-A3B-GGUF
Nemotron-Labs-Image-30B-A3B-Q4_K_M.gguf at f0d9baa3ead2
Decoder and tokenizer code from nvidia/Nemotron-Labs-Image-30B-A3B at d7c2ba6a59a384080f0bdd5b1e846da03804cdd1 (Nemotron-Labs-Image-Tokenizer, run in bf16 with the encoder dropped).
Enginellama.cpp b671865c7 (stock; AtomicChat's patch only changes the converter) · CUDA sm_86 build
PlacementEvery routed expert in RAM (21.3 GiB, page cache); non-expert weights, the LM head and a 7000 MiB cache of hot experts on the GPU. The decoder runs on the GPU after the server stops.
HardwareNVIDIA GeForce RTX 3060 12 GB · 62 GB RAM · Intel Core i5-12500 · NVMe SSD
The desktop and an idle ComfyUI hold about 1.3 GB of the card; at most 10,965 MiB was free for a job.
APIllama-server /completion with raw prompt ids (tools/nli.py), PNG out on port 8107
Key flags-ngl 99 --cpu-moe --fit off --moe-cache-mib 7000 --moe-cache-cpu-share 0.95 --backend-sampling -c 6144 -np 1 -fa on NL_PROFILE=stock for the baseline
Trap
  • Non-commercial use only (NVIDIA OneWay Noncommercial License, section 3.3), for the model, the decoder, the GGUF and the images.
  • The model card's -ngl 99 line does not load on 12 GB; the baseline is the same line without -ngl (llama.cpp --fit).
  • The same seed gives a different image on a different config (the first visual token flips at temperature 0.9); one same-config pair also diverged, cause not found.
  • Drift against BF16 is not measured.
  • 512x512 gives broken grids; use the card's sizes.
  • The -np 4 throughput figure is from capped 1,200-token samples, not full images.
10Every number links to its line

Measured results

MetricConditionsMeasuredStockCeilingSource line
Decode1024x1024 image, median of 8 prompts, seed 4268.69 tok/s38.787RESULTS.md:61
Otherwall time per 1024x1024 image (generation)61.5 s108.6RESULTS.md:62
Decode1248x832 image (fox)70.75 tok/sRESULTS.md:63
Otherdecoder, 1024x1024, GPU bf160.228 sRESULTS.md:66
Decodeaggregate with -np 4, capped samples127 tok/sRESULTS.md:51
Qualityvalid images at 1024x1024, all inspected8/8 imagesRESULTS.md:32
VRAM peakllama-server while generating10,250 MiBRESULTS.md:68
RAM peakRSS high-water25.1 GBRESULTS.md:69
Startupserver ready, warm page cache2-3 sRESULTS.md:67
Time to first token85-token prompt, warm0.69-0.73 sRESULTS.md:65
0Other 3060s

Reproductions

None yet. If you ran this on your own 3060, report your numbers and they appear here with your hardware.

7This recipe stands on

Thanks

→README from the repo

Full write-up

Text to image with nvidia/Nemotron-Labs-Image-30B-A3B on the RTX 3060 12 GB, using stock llama.cpp.

The model is autoregressive. A 30B mixture-of-experts language model (3B active per token, hybrid Mamba-2 / MoE / attention) writes the picture as a grid of visual codes, one row at a time: 4,176 tokens for 1024×1024. NVIDIA's L24SQ decoder then turns the codes into pixels. Making an image is one long decode, so image time is decode speed.

The weights are AtomicChat's Q4_K_M GGUF (25.4 GB). That is twice the card, so the routed experts stay in RAM. Two flags do most of the work: - llama.cpp's MoE cache keeps the experts that image tokens use most on the GPU (7000 MiB of the card); - --backend-sampling draws each token from the 327,680-entry vocabulary on the GPU instead of the CPU.

Numbers and image notes are in RESULTS.md. The experiment log is PLAN.md, the ceilings are in THEORY.md, and the raw data is in runs/.

Licence: NVIDIA OneWay Noncommercial License. Section 3.3 allows use of the model, the decoder and anything derived from them (this GGUF and the images included) only non-commercially, meaning for research or evaluation. AtomicChat's GGUF carries the same licence. See LICENSE in either Hugging Face repo, or NVIDIA's licence PDF.

Result

One 1024×1024 image Stock llama.cpp --fit This recipe
Visual-token decode 38.7 tok/s 68.7 tok/s (1.77×)
Generation time per image 108.6 s 61.5 s
Decoder (codes to pixels, GPU bf16) 0.23 s 0.23 s
1248×832 image not run 57–59 s (70.8–73.6 tok/s)
VRAM / RAM 9.8 GB / 24.7 GB 10.25 GB / 25.1 GB
  • 8/8 prompts gave valid images at 1024×1024 and 2/2 at 1248×832 (median of the 8 at seed 42; range 57–64 s).
  • The model card's line (-ngl 99 -c 6144 -np 1) does not load on 12 GB: it tries to allocate 23.7 GB on the card. The stock column is the same line without -ngl, so llama.cpp's --fit picks the split.
  • 68.7 tok/s is 79 % of the bandwidth ceiling for a cache with 85 % hits (87 tok/s, THEORY.md). The rest is the fixed per-layer cost of 46 MoE and Mamba layers and the cache misses computed on the CPU. The last flag levers gave under 2 %, so tuning stopped there.
  • For comparison, PedroMarinhoDev's ComfyUI port reports 77.2 s per 1024² image for a 12 GB budget with W4A8 weights. That figure was emulated on an RTX 4090 and was not run here.
  • Four images at once: -np 4 reaches 127 tok/s in aggregate, 1.65× the images per hour, but each image takes about 2.4× as long (32.5 tok/s per stream). It was measured on capped samples only and is not a shipped profile (RESULTS.md).
fox sign stack kite
fox sign stack kite

Seed 42, the tuned default, no cherry-picking: these are the only seed-42 images of those prompts. The sign reads "FRESH BREAD AD / DAILY", which is wrong. Every image's defects are listed in RESULTS.md.

Use it

# 1. weights (pinned; sha256 checked)
#    AtomicChat/Nemotron-Labs-Image-30B-A3B-GGUF @ f0d9baa3 -> $MODELS/nemotron-labs-image/atomicchat/
#      Nemotron-Labs-Image-30B-A3B-Q4_K_M.gguf (sha256 3ff36f96…)
#    nvidia/Nemotron-Labs-Image-30B-A3B @ d7c2ba6a -> $MODELS/nemotron-labs-image/nvidia/
#      model.safetensors (the visual tokenizer/decoder, sha256 1d94c3f7…) + the small files under hf/ in repo layout
#      (tokenizer, chat template, Nemotron-Labs-Image-Tokenizer/ remote code)
# 2. engine: stock llama.cpp b671865c7 (AtomicChat's tested revision), CUDA build
#    -> $SCRATCH/llama.cpp/master-b671865c7/bin
# 3. decoder env (CPU tokenizer + GPU decoder): uv venv, python 3.12, torch 2.11.0+cu128, transformers 5.23.0
#    -> $SCRATCH/envs/nemotron-image (runs/env-nemotron-image-freeze.txt)

./generate.sh "A cinematic photograph of a red fox in a snowy pine forest at dawn."      # -> ./output.png
./generate.sh -s 1248x832 -S 7 -n 4 -o shots/fox.png "..."                               # 4 seeds, one server start
NL_DECODE_DEVICE=cpu ./generate.sh "..."                                                 # decode on the CPU (8 s)

generate.sh does the following: 1. Builds the prompt ids with NVIDIA's tokenizer: the system prompt plus Generate a {W}x{H} image. and your text, with thinking off. 2. Takes one gpu_run hold and starts serve.sh (port 8107). 3. Writes the visual tokens with the card's sampling (temperature 0.9, top-p 1.0, top-k off). 4. Stops the server and decodes on the freed GPU. 5. Writes out.png with an out.txt that records the prompt, size, seed and sampling.

Each grid is checked before decoding. Use the card's sizes: 1024×1024, 1184×880, 1248×832 or 880×1184. At 512×512 the model writes broken grids.

serve.sh alone gives a llama-server that takes raw prompt ids (tools/nli.py gen is the client). Its launch line:

llama-server -m Nemotron-Labs-Image-30B-A3B-Q4_K_M.gguf --alias nemotron-labs-image \
  -ngl 99 --cpu-moe --fit off -c 6144 -np 1 --host 127.0.0.1 --port 8107 \
  --moe-cache-mib 7000 --moe-cache-cpu-share 0.95 --backend-sampling -fa on

Every knob has an NL_* override (see the header of serve.sh). NL_PROFILE=stock runs the baseline line.

Limits

  • Same seed, different config, different image. Changing the placement, cache size or sampler changes the float sums slightly. At temperature 0.9 that changes the first visual token and so the whole picture. A seed reproduces an image on the same config. One pair of same-config runs did diverge, though, so do not rely on a seed across restarts (RESULTS.md, Determinism).
  • Drift against BF16 was not measured. No BF16 run fits on this box.
  • Text in images is hit and miss: one of the two sign prompts misspelled. One of the two 1248×832 posters had a broken layout.
  • While an image is being made, the server holds 10.25 GB of VRAM and the GPU lock.

Files

Path What
generate.sh prompt to PNG, one GPU-lock hold (holds the lock while serving)
serve.sh llama-server with the tuned flags; NL_PROFILE=stock for the baseline
tools/nli.py tokenize (NVIDIA tokenizer), gen (llama-server client + grid check + ledger), decode (NVIDIA decoder)
tools/py.sh runs the decoder env's python with -I, offline
tools/gate.sh, tools/run.sh, tools/batch.sh, tools/summ.py the A/B harness: one server start per run, control/candidate/control per lock hold, medians
tools/decoder_bench.py decoder speed, memory and round-trip PSNR
prompts/set.json the 8 fixed prompts
configs/ one JSON per tried config; best-config.json is the shipped one
runs/ ledger.jsonl (every measurement), batch scripts and logs, server logs, images/ (every image with its tokens and prompt)

Credits

  • NVIDIA: the model, the L24SQ visual tokenizer and decoder, and the tokenizer code.
  • AtomicChat: the GGUF conversion (their converter patch exports the visual codebook as vocabulary), the Q4_K_M file, and the tested llama.cpp revision.
  • llama.cpp (ggml-org and contributors): the engine, including the MoE cache and backend sampling.
  • PedroMarinhoDev: the ComfyUI port and its 12 GB figure, used as the comparison point.
  • inference-optimisation-skill by 0xSero / Sybil Solutions: the method (ceilings first, one change per run between controls, a plateau rule, quality gates).
  • PyTorch and Hugging Face transformers run the decoder; the Hugging Face Hub hosts the pinned weights.

recipe.json · Markdown · Folder with scripts and raw runs · Full results log