Model support & formats
dlm loads Hugging Face safetensors checkpoints, llama.cpp’s GGUF files, and 4-bit GPTQ exports of decoder models — dense and Mixture-of-Experts. Here’s exactly what’s supported, and what gets refused with a clear message.
Architecture
dlm implements the Llama-style decoder block — dense and Mixture-of-Experts — and reads the standard model.layers.{i}.* tensor names, with the per-family variations below. Geometry (layers, hidden size, q/kv heads, head dim) is read from config.json, or from the metadata of a GGUF file.
| Family | Status |
|---|---|
| Llama 2 / 3 / 3.1 / 3.2 | supported (incl. llama3 RoPE scaling, GQA, tied embeddings) |
| Mistral | supported (incl. sliding-window attention) |
| Qwen2 / Qwen2.5 | supported (incl. the Q/K/V attention biases) |
| Qwen3 (dense) | supported — per-head Q/K RMSNorm |
| Gemma (v1) | supported — (1+w) RMSNorm, GeGLU, sqrt(hidden) embedding scaling |
| Gemma 2 | supported — attention and final logit softcapping, alternating local/global attention layers, query_pre_attn_scalar, and the pre/post-FFN norm pair |
| Gemma 3 | supported — 270M and 1B, and 4B/12B/27B with image input: the SigLIP vision tower is read from the checkpoint, or for a GGUF from llama.cpp’s mmproj file. See Images |
| Gemma 4 E2B / E4B | supported, text only — safetensors or llama.cpp’s gemma4 GGUF, CPU and GPU, resident only (--stream, --gpu-layers and multi-GPU refuse it). The MoE and attention_k_eq_v variants are refused |
| Qwen3.5 / Qwen3.6 MoE | supported, text only — the hybrid Gated DeltaNet / full-attention layout, e.g. Qwen3.6-35B-A3B, from safetensors or llama.cpp’s qwen35moe GGUF. CPU and GPU, resident or streamed. Its own MTP head drafts with --speculative mtp. Dense Qwen3.5 and Qwen3-Next are refused |
| Mixtral (and Mixtral-layout MoE) | supported — top-k routing over block_sparse_moe.experts.* |
| Qwen2-MoE / Qwen3-MoE | supported — routed experts + optional sigmoid-gated shared expert |
| Phi-3 / Phi-3.5 | supported — fused qkv_proj and gate_up_proj are split at load. The 128k longrope variant is refused |
| GPT-2 | supported — LayerNorm, learned position embeddings, an ungated MLP, biases on every projection. Checked against the real openai-community/gpt2, CPU and GPU, resident and streamed |
| Falcon | supported, config-verified, not run — the smallest RoPE Falcon is 14 GB. alibi: true (falcon-rw-*) and new_decoder_architecture (Falcon-40B) are refused rather than mis-decoded |
| DeepSeek-V2 / V3 (MLA) | supported — Multi-head Latent Attention (compressed-latent KV, decoupled RoPE, YaRN), CPU and GPU, resident or streamed. Routes as V2 (softmax top-k, group_limited_greedy) and as V3/R1 (sigmoid scores, correction bias, group-limited top-k). An unknown scoring_func or topk_method is refused. V3’s MTP layer is not used |
| anything else | not supported — errors on unknown tensor names |
An unsupported architecture fails with a clear UnknownTensor error at load rather than producing garbage. A config declaring a rope_scaling type dlm does not implement is likewise refused, not silently ignored — the model was trained with that scaling, so running without it yields fluent nonsense.
Mixture-of-Experts
MoE models route each token through the top-k experts the router selects, on every backend. On the GPU they run either way round: resident (the default) holds every expert in VRAM, for a model that fits; streamed (--stream) holds only each layer’s attention, router and shared expert, and pulls the top-k routed experts on demand, cached per (layer, expert). The GPU expert cache is a VRAM budget, --expert-cache-gb (default: the VRAM left after the resident layer window). Expert weights honor --quant like dense weights; watch dlm_stream_expert_* in /metrics for the hit rate.
A streamed MoE layer computes attention for every token first, then fetches each selected expert once and runs it over all the tokens that chose it. The expert cache keeps the experts the router picks most often, and the worker preloads the next layer’s likely experts using that layer’s own router. On a decode miss, an expert can run on the CPU from host RAM when that has been measured faster than uploading it. This is how Qwen3.6-35B-A3B (a 22 GB GGUF) runs on a 4 GB GTX 1650 with 16 GB of RAM, at 2.5–2.9 tok/s decode.
Images (Gemma 3)
Gemma 3 4B, 12B and 27B take PNG and JPEG images. A safetensors checkpoint carries its own vision tower. For a GGUF, pass --mmproj <file>, or leave the file beside the model as the only mmproj*.gguf there. Each image becomes 256 embeddings in the prompt. The tower runs on the CPU, or on the GPU layer by layer with its buffers freed afterwards, so it fits beside a resident or streamed text model.
dlm generate --model-path models/gemma-3-4b-it-Q4_K_M.gguf --image photo.jpg --text "Describe this image."dlm serve --model-path models/gemma-3-4b-it-Q4_K_M.gguf --mmproj models/mmproj-model-f16.ggufOver the API, send OpenAI image_url parts as base64 data: URLs; remote URLs are refused, not fetched. On a GTX 1650, Gemma 3 4B Q4_K_M encodes an image in about 16 s, then prefills at 82 tok/s and decodes at 27 tok/s. Pan-and-scan is not implemented.
Weight formats
| Format | Supported | Notes |
|---|---|---|
safetensors | Yes | Float checkpoints (F32 / F16 / BF16), standard HuggingFace-named .weight tensors, memory-mapped from disk; streamed layers are read directly. |
.gguf | Yes | llama.cpp’s files, read natively: F32, F16, BF16, Q4_0, Q4_1, Q5_0, Q5_1, Q8_0, Q2_K, Q3_K, Q4_K, Q5_K, Q6_K, IQ2_XXS, IQ2_XS, IQ2_S, IQ3_XXS, IQ3_S, IQ4_NL, IQ4_XS. The 1.6-bit IQ1 types are refused by name. The file is self-contained — config and tokenizer come from its metadata. --quant is refused (the weights are already quantized). MoE .gguf files load only for Qwen3.5/3.6 (qwen35moe); other MoE GGUF files are refused. |
| GPTQ 4-bit | Yes | desc_act: false, classic gptq format — validated end-to-end against a real export. No --quant needed or accepted. |
| GPTQ act-order / AWQ | Experimental | Load with a loud warning, decoded to f32 (~8x the VRAM of an int4 layer); checked only by dlm’s own round-trip, not against a real export. |
gptq_v2 / non-4-bit | No | Refused at load. |
| PyTorch-only (.bin) | No | Rejected — provide a safetensors (or GGUF) variant. |
A GGUF file runs like a safetensors checkpoint — CPU or GPU, resident or --stream. Every quantized tensor of a Qwen2.5-0.5B Q4_K_M decodes to within 4.8e-8 of llama.cpp’s own dequantization, and a Q8_0 one to the bit. A GPTQ checkpoint’s codes are relabeled into dlm’s int4 layout, not re-quantized, so the export’s calibration survives. See Quantization.
LoRA adapters
--lora <adapter-dir> (on serve, bench and score) merges a PEFT adapter (adapter_config.json + adapter_model.safetensors) into the weights as they load, before --quant, so the adapted model runs at the base model’s speed and size. One adapter per process; it cannot be swapped per request.
Plain LoRA (and rsLoRA scaling) on a decoder layer’s seven projections of a safetensors checkpoint. Everything else is refused when the adapter is attached, not skipped: DoRA, adapter biases, modules_to_save, fused projections, GPTQ and GGUF weights.
dlm serve --model-path ./models/Qwen2.5-0.5B-Instruct --lora ./my-adapterTokenizers
dlm detects the tokenizer, in order:
- A
.gguffile — the vocabulary embedded in its metadata (byte-level or SentencePiece). tokenizer.json— HF tokenizer with special tokens.vocab.json+merges.txt— byte-level BPE.- Neither present — a raw byte tokenizer.
Required files
A GGUF model is the single .gguf file — point --model-path at it. A safetensors model directory contains:
config.json— the model geometry.- one or more
*.safetensorsshards — the weights. - a tokenizer (one of the forms above).
Getting models
Search and pull straight from the Hugging Face hub — pull fetches only the files dlm loads. A GGUF repo holds the same model at a dozen quantizations, so --file names the one to fetch, by its full name or any part of it; leave it off and dlm lists what the repo has, with sizes.
dlm search llama-3.2dlm pull Qwen/Qwen2.5-0.5B-Instructdlm search qwen2.5 --ggufdlm pull Qwen/Qwen2.5-0.5B-Instruct-GGUF --file q4_k_mSee the CLI reference for search/pull flags, and Troubleshooting if a checkpoint won’t load.