Skip to content

Experimental vibecoded Gguf map tool - #118

Draft
amd-satre wants to merge 3 commits into
vllm-project:mainfrom
amd-satre:gguf-map-tool
Draft

Experimental vibecoded Gguf map tool#118
amd-satre wants to merge 3 commits into
vllm-project:mainfrom
amd-satre:gguf-map-tool

Conversation

@amd-satre

@amd-satre amd-satre commented Aug 21, 2026

Copy link
Copy Markdown

Edit 08/21/2026: \_" " _/ haven't verified with my eyes yet, save yourselves the trouble to review.

amd-satre and others added 3 commits August 21, 2026 16:03
Adding an architecture starts by diffing two lists of ~1000 tensor names to
find which map to which, what is left over on each side, and where shapes
disagree. This does that mechanically and prints a WeightsMapper skeleton.

Matching is a global assignment, not per-tensor greedy: locally, Qwen3.5's
attn_output and ssm_out are both plausible matches for linear_attn.out_proj
and have identical shapes, so whichever is considered first wins and the
other is left wrong. Resolving highest-confidence pairs first leaves the
loser its uncontested second choice. Layer occupancy is the signal that
separates them -- the two occupy disjoint layer index sets.

Shape incompatibility disqualifies a pairing outright rather than merely
penalising it, so an unmappable tensor is reported as unmatched instead of
being carried by name similarity into a bogus "transform needed".

--target vllm reconstructs the names load_weights accepts from the module
tree, since vLLM fuses linears and stacks experts but its loader still
consumes the unfused per-expert names.

Reads GGUF headers over an HTTP range request and builds the target on meta
tensors: no GPU, no weight download.

Verified against the OLMoE adapter already in-tree -- the derived rules equal
build_olmoe_mapper() exactly, which the tests pin. Also 100% coverage with no
unmatched tensors on Qwen3.6-27B, Qwen3-0.6B, DeepSeek-V2-Lite and
DeepSeek-V3.

Signed-off-by: Shreyas Atre <satre@amd.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A QKVParallelLinear or MergedColumnParallelLinear concatenates its bias the
same way it concatenates its weight, but only the weight was being expanded
back into per-part names. Any architecture with attention_bias set therefore
had attn_q/k/v.bias reported unmatched with no target to map to.

Found by running the tool on GLM-4.5-Air, which goes from 20/29 to 23/29
templates mapped. The remaining 6 are its nextn (MTP) block, correctly
unmatched: vLLM does not instantiate that module without a speculative
config, so those targets genuinely do not exist.

Signed-off-by: Shreyas Atre <satre@amd.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Tested against vllm-gguf-plugin#113 (Muse Glimmer), which exercises three
things the tool could not do.

A vision-language model ships its projector as a separate mmproj file, so
--gguf now takes more than one.

Neither transformers 5.14 nor vLLM knows muse_glimmer, so neither existing
target could be built at all. --target safetensors reads the checkpoint's own
headers over an HTTP range request instead, which needs no support for the
architecture in either library -- the usual situation when GGUF support lands
first.

Not every integer in a name is a layer index. A projector numbers its stages
mm.0/mm.1/mm.2, and collapsing those into one template hid two of the three
behind a single shape and left their targets uncovered. Members that no two of
which share a shape are an enumeration, not a repetition. The template shape
is now the most common among members rather than the first seen, so one odd
layer cannot set it.

The emitted skeleton was also silently wrong for any model with two towers.
ffn_up is mlp.up_proj under blk and mlp.fc1 under v.blk; both were written to
the same orig_to_new_substr key and the second overwrote the first, dropping
five text-stack rules with no indication. A leaf whose target depends on its
prefix is now emitted as an orig_to_new_regex rule scoped to that prefix,
which is what WeightsMapper's regex-then-substr-then-prefix order needs.

Verified by applying the derived mapper and vllm-project#113's hand-written one to all
1540 real GGUF tensors: 1539 rename identically. The one difference is
v.patch_embd.weight, which the tool leaves unmatched because its shape does
not match the target -- it needs a split, not a rename, which is what vllm-project#113
implements. The 104 attn_q/k_norm tensors vllm-project#113 drops are likewise reported
unmatched. No regression on Qwen3.6-27B, Qwen3-0.6B, DeepSeek-V2-Lite,
DeepSeek-V3, OLMoE or GLM-4.5-Air.

Signed-off-by: Shreyas Atre <satre@amd.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant