Skip to content
WeightLabPublic

About

Fast, byte-identical DFloat11 compressor for BF16 models (LLMs, diffusers, ComfyUI). Single static binary, no GPU, no Python.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

df11pack

AI-built, human-directed: Claude Code (Anthropic) did most of the coding, debugging and test runs; the author chose what to build and measure, and decides what is published.

A fast, independent compressor for DFloat11: lossless compression of BF16 model weights to about 70% of their size, decoded on the GPU by the official CUDA kernel.

df11pack writes the same files the official compressor writes — byte for byte — so every existing DFloat11 loader works unchanged: DFloat11Model for LLMs and diffusers, and ComfyUI-DFloat11-Extended for ComfyUI. It is just much faster and lighter, and needs no GPU and no Python.

Measured

Qwen3-8B, compressed on the same 8-vCPU machine:

official compressor df11pack
time 37 min 40 s
peak RAM 27.3 GiB 6.6 GiB
output 39 .safetensors files, 11.16 GB the same 39 files, byte-identical

All 39 files are also byte-identical to the published DFloat11/Qwen3-8B-DF11 release (SHA-256 compared file by file). On an old dual-core laptop with no GPU, Qwen3-0.6B (layers only) takes 11 s against the official 13 min. Details and every other measurement: docs/FINDINGS.md, raw run data in gpu_session/qwen3_8b/results/.

Install

Download the archive for your platform from Releases, unpack, and run df11pack. One static binary; nothing else to install. Linux (x86_64, aarch64), Windows (x86_64) and macOS (Apple Silicon).

Or build from source (Rust 1.85+): cargo build --release -p df11pack.

Use

df11pack architectures                      # what it can compress

ComfyUI — a single .safetensors for ComfyUI-DFloat11-Extended:

df11pack compress flux1-schnell.safetensors --arch flux-schnell-comfyui -o out/
# -> out/model.safetensors

diffusers — a directory DFloat11Model.from_pretrained loads:

df11pack compress FLUX.1-schnell/transformer/ --arch flux-dev-diffusers -o out/

LLMs (transformers):

df11pack compress Qwen3-8B/ --arch qwen3-8b -o Qwen3-8B-DF11/

Useful options:

  • --safe decodes every unit and checks it against the source before writing it;
  • --ram 4G sizes the worker count to fit a memory budget (by default, what is free on Linux; elsewhere one worker per core);
  • --io sequential for spinning hard drives (auto-detected on Linux).

Check any output, including ones you did not make:

df11pack verify out/                                        # structure, no source needed
df11pack verify out/ --source model/ --arch qwen3-8b        # + 1000 sampled chunks decoded
df11pack verify out/ --source model/ --arch qwen3-8b --level full

verify exits 0 on pass, 1 when a check fails, 2 when it could not check.

Models

39 definitions ship built in (df11pack architectures):

  • every official DFloat11 release with a dfloat11_config — 40 of the 45 in the DFloat11 Hugging Face organisation: Qwen3, Qwen2.5, Llama, Mistral, Phi-4, Gemma-3, DeepSeek-R1 distills, FLUX.1 (dev/schnell/Kontext/Krea/Fill/Depth/Canny), Chroma, HiDream, Qwen-Image, Wan 2.1/2.2, SD3.5, OmniGen2, BAGEL;
  • every model in ComfyUI-DFloat11-Extended (ComfyUI files): Flux, Flux.2, Chroma, Chroma-Radiance, Qwen-Image 2.1, Z-Image, Lumina 2, Cosmos-Predict2, Anima, ERNIE-Image, LongCat, Ovis, Krea-2, Lens, SDXL, ACE-Step 1.5;
  • mingyi456's multimodal releases (transformers, one file): Qwen3-VL-8B, Qwen2.5-VL-7B, Qwen2.5-Omni-7B, Qwen3.5-9B.

Some releases hold BF16 where their source has F32 or F16 tensors: mingyi456's Krea-2 and Qwen3.5, and, judging from their dtypes only, the official HiDream, OmniGen2 (both parts) and Wan 2.1. df11pack compresses BF16 only and copies other tensors unchanged. To reproduce those releases, cast the source first: python phase0/cast_bf16.py SRC OUT_DIR (torch's .to(torch.bfloat16)); that reproduced the Krea-2 and Qwen3.5 releases byte for byte. Not every release was made this way: Qwen2.5-Omni's keeps its 809 F32 tensors, and casting its source would not reproduce it. (Our explanation, not checked: ComfyUI and transformers cast when they load a model in BF16.)

From Python: python/README.md (a built-in name or a pattern_dict at call time; tensors in memory are written to a temporary file first). Not on PyPI.

A new model is a small TOML file; pass its path to --arch, or put it in a folder named by DF11PACK_ARCH_DIR (the file name without .toml is then the name --arch takes). Format and how to add one: docs/DEFINITIONS.md.

What is checked, and what is not

  • Byte-identity with the official compressor is tested per architecture, on small models run through the official tool, and on real Qwen3 models (0.6B, 8B).
  • 32 of the 39 definitions were checked against the tensor names, shapes and dtypes of real checkpoints and real published DF11 files; 25 of 32 match exactly. 6 releases hold BF16 where their source does not (above: 2 shown by reproducing them, 4 inferred from dtypes). In Chroma-Radiance's release the empty __x0__ marker tensor is F32 (BF16 in the source), so its file cannot be reproduced byte for byte; every other tensor's name, shape and dtype match (values not compared). (Corrected 2026-09-29: this said 23 of 28 exact, counting Chroma-Radiance; the check did not compare the dtypes of uncompressed tensors then.) The Llama definition was checked through Mistral-Nemo, which shares it. Not checked: Gemma-3, SD3.5 and FLUX.1-dev/Kontext diffusers (gated repositories), and the ComfyUI flux, flux2-alt and zimage-pixel-space definitions.
  • Eight of mingyi456's releases were rebuilt from their sources and compared, file SHA-256 included (2026-09-28/29, phase0/check_comfyui_release.sh): Lumina-Image-2.0, Chroma1-HD, Krea-2 (source cast to BF16) in the ComfyUI layout (phase0/results/comfyui/); Qwen3-VL-8B-Instruct and -Thinking, Qwen2.5-VL-7B, Qwen2.5-Omni-7B and Qwen3.5-9B (cast) in one file (phase0/results/multimodal/). Every model file is byte-identical. The five single-file transformers releases also carry a config.json holding only dfloat11_config, as the official compressor writes one file; df11pack wrote the source's model_type too until 2026-09-29 (fixed, phase0/results/multimodal/config_json_check_before_fix.txt). Now each equals df11pack's except for line endings (the releases' have CRLF), with the real source's config (phase0/check_release_configs.sh, config_json_check.txt). These 8 releases cover 7 definitions (Qwen3-VL's two share one); the other 25 checked definitions were checked by header (names, shapes, dtypes) only; 7 were not checked (above).
  • Loaded in ComfyUI on a GPU (A40, 2026-09-29): df11pack's Lumina-Image-2.0 file with ComfyUI-DFloat11-Extended's DFloat11ModelLoader gives exactly the BF16 model's image, pixel for pixel: one prompt, one seed, 768 x 768, 20 steps; with ComfyUI's cache off, each model twice gives the same pixels and another seed differs (phase0/results/multimodal/followup/, and again on the final code: phase0/results/multimodal/final/). The file is byte-identical to mingyi456's release, so this shows his loader reads it, as expected. The other image models were not loaded; reports welcome.

Beyond the official format, all opt-in and clearly marked:

  • --luts=correct — zero-fills LUT entries the official encoder leaves as leftovers; unreachable by construction, and measured so with the official kernel on the one real leak (docs/COMPATIBILITY.md).
  • --hashes — per-tensor SHA-256 in the header, so verify catches corruption without the source; tensor bytes unchanged.
  • --index idx8 — an experimental 8-bit block index, 0.66% smaller. Not DFloat11: no current loader reads it (docs/INDEX_SCHEMES.md).

Documents

How this was made

Written with Claude Code (Anthropic), under the author's direction. Claude Code wrote most of the code and documentation and ran the tests and measurements; the author chose what to build and measure, and decided what to publish. Every commit carries a Co-Authored-By trailer, so who did what can be checked in the git history.

The rules the work follows (evidence, wording, logs, tests, publishing) are in NORMS.md, shared by all the repos of this project.

Contributing

Testing a model on a GPU and reporting how it went helps most right now. See CONTRIBUTING.md; questions go to Discussions, vulnerabilities to SECURITY.md. Everyone taking part follows the Code of Conduct.

Reporting a problem

Found a problem, or a number that does not match? Please tell us: REPORTING.md says what helps.

Licence

MIT — see LICENSE. Free to use, modify and redistribute; keep the copyright notice.

df11pack reimplements the DFloat11 file format and its codebook construction from the official implementation (Apache-2.0, https://github.com/LeanModels/DFloat11, by the DFloat11 authors) and reads model definitions derived from ComfyUI-DFloat11-Extended (by mingyi456; its repository has no licence file). It contains no code from either and does not redistribute decode.ptx. All credit for the format goes to them.

About

Fast, byte-identical DFloat11 compressor for BF16 models (LLMs, diffusers, ComfyUI). Single static binary, no GPU, no Python.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages