CoolFace
Modelpublic

rodraco/Qwen3-Embedding-4B-F16-GGUF

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes26downloads
Model Card

Qwen3-Embedding-4B — F16 GGUF (provenance-documented conversion)

An F16 GGUF conversion of [Qwen/Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B) for serving with llama-server, published with a complete, verifiable provenance chain — source revision, converter version, and output checksum.

Why this repo exists

Qwen3-Embedding GGUFs have a known conversion-vintage trap: llama.cpp's Qwen3-Embedding conversion fixes (EOS/sep handling, pooling metadata — definitive fix #15023, 2025-08-02) live in convert_hf_to_gguf.py, so a GGUF converted before the fix has the bug baked in permanently — a current runtime cannot repair it (see #14234). Many third-party conversions have squashed histories, making their conversion vintage unprovable.

This conversion is documented at commit level so you don't have to trust — you can check:

Provenance factValue
Source repoQwen/Qwen3-Embedding-4B (official, Apache-2.0)
Source revision5cf2132abc99cad020ac570b19d031efec650f2b
Source shard sha256model-00001…: e70bfe3c970523fb7ef4eddffed2254ce3f1e7150c3de2af4342de129dd756f8 · model-00002…: ed1b87c8e9eb7e535a1a155e4fd00d9f4dba80e58a6db48a4c9f82cede7079c1 (verified pre-conversion)
Converterconvert_hf_to_gguf.py from the official ghcr.io/ggml-org/llama.cpp:full-cuda13 image, digest sha256:500f241b5d7e27846bdda69ce6f4889db8de859ea3988d4265e5d9d7b7f1079b — post-#15023
Conversion date2026-07-05
OutputQwen3-Embedding-4B-F16.gguf, 8,049,889,760 bytes, sha256 aae9f588cb47cba4503d5a0c71f64c90ade6a207dff2ff874972e2db6b099d35
Pooling metadataqwen3.pooling_type = 3 (LAST) present in the GGUF header — the #15023 fix's marker

The exact conversion command:

sh
docker run --rm -v "$PWD/src:/src:ro" -v "$PWD/out:/out" \
  ghcr.io/ggml-org/llama.cpp:full-cuda13@sha256:500f241b5d7e27846bdda69ce6f4889db8de859ea3988d4265e5d9d7b7f1079b \
  --convert /src --outtype f16 --outfile /out/Qwen3-Embedding-4B-F16.gguf

Fidelity check

Verified against the official safetensors pipeline (sentence-transformers, same revision): cosine(reference, served) over a 66-probe multilingual set (Romanian, three diacritic-variant forms) — min cosine 0.99976, i.e. the served GGUF endpoint reproduces the reference embeddings.

Serving

sh
llama-server -m Qwen3-Embedding-4B-F16.gguf --embeddings --pooling last -ngl 999 \
  --ctx-size 8192 --ubatch-size 2048
  • —`--pooling last` must be explicit. Qwen3-Embedding is a causal decoder — CLS/mean pooling produces silently wrong embeddings. Bring-up check: the verbose server log should print pooling type = 3, and any returned vector should have L2 norm ≈ 1.0 (normalization is server-side by default).
  • —Never combine `--embeddings` with `--reranking` on one instance (llama.cpp #20085: all-zero embeddings).
  • —VRAM guidance: F16 weights are ~8.0 GiB; on a 16 GiB card use --ubatch-size 2048 (a 8192 ubatch allocates a ~4.9 GiB compute buffer and OOMs). Ubatch is throughput-only for causal decoders — it never changes embedding values.

Query instruction protocol (client-side)

Per the official model card, queries should be instruction-formatted while documents are embedded plain:

Instruct: {task_description}
Query:{query}

The server embeds whatever text it receives — applying the instruction prefix is the caller's job. Skipping it typically costs 1–5% retrieval quality.

License & attribution

Apache-2.0, same as the base model. All model weights are © the Qwen team (Qwen/Qwen3-Embedding-4B); this repo contributes only the format conversion and its provenance documentation.