Repository navigation
Qwen3-Embedding on Metal: 0.6B, 4B and 8B through /v1/embeddings - #3494
Merged
Merged
Conversation
This was referenced Nov 16, 2026
ashhart
added a commit
that referenced
this pull request
Nov 16, 2026
Extend the dense BF16 forward with projected Q/K head norms and last-row pooling. Reuse the shared embedding admission and HTTP route, refuse reranking and unsupported options, and add contract controls plus a checkpoint-only FP32 reference and served qualification.
ashhart
force-pushed
the
lead/qwen3-embedding-metal
branch
from
November 16, 2026 11:55
f46044e to
07661c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metal serves no embedding model today;
/v1/embeddingsserves Qwen3-Embedding on CUDA (#2285) and HIP. This serves Qwen3-Embedding 0.6B, 4B and 8B on Metal through the same route, with the same refusals and MRL widths.How: the closest Metal forward is Llama's BF16 dense GQA/SwiGLU path. It gains a compile-time embedding branch that adds Qwen3's per-head Q/K RMSNorm before RoPE and returns the last row's normalized hidden state without the output head. Llama generation takes the original branch, with the same dispatches and kernel sources.
zig/src/native/qwen3_metal.zigreuses the shared Qwen3 folder admission, prompt lane, memory-fit planner and lane host; no second server path. The first commit plants the Llama GEMM layout control in its macro instance, which the new contract entries need.Checked on an M5 Ultra at the tested head:
zig/tests/qwen3_metal/reference.pyandreference.c) runs from the checkpoints' stored BF16 weights. The 0.001 cosine-distance ceiling was fixed before measuring.Not covered yet: chips without tensor units (M1-M4) are refused by name until they are qualified, other Qwen3 geometries are unchecked, and there is no CUDA vector comparison on the same inputs. A batch's members run one after another.
Board card OE-6. Checkpoints: Qwen/Qwen3-Embedding-0.6B 97b0c614be, -4B 5cf2132abc, -8B 1d8ad4ca9b (Apache-2.0).