Repository navigation
Add dense GGUF architecture cohort - #572
Merged
Merged
Conversation
Performance Comparison
|
justinchuby
force-pushed
the
justinchuby-gguf-registry-foundation
branch
from
August 25, 2026 14:48
184176f to
3b52342
Compare
Add exact config and tensor mappings for OLMo, OLMo2, Cohere2, Arcee, SmolLM3, and Exaone against the pinned llama.cpp architecture census. Preserve architecture-specific normalization, RoPE, attention schedules, quantized module wiring, and InternLM2 Q/K permutation semantics. Validate strict tensor closure, synthetic float and quantized graph execution, and pinned real OLMo-family GGUF artifacts while deferring runtime claims that lack real-weight evidence. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-gguf-dense-transformer-cohort
branch
from
August 25, 2026 14:54
fbdc807 to
29d33a9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the first “C01 dense-transformer” GGUF cohort to the GGUF registry pipeline, including architecture-scoped config/tensor-map requirements, model-graph adaptations for quantization-aware modules, and pinned real-GGUF integration evidence where runtime is claimed.
Changes:
- Extend the GGUF architecture registry/spec to cover
olmo,olmo2,cohere2,arcee,smollm3, andexaone(including required-metadata gates and pinned upstream tensor-family closure). - Centralize quantization-aware embedding/linear construction and update several model classes to preserve tying behavior when swapping specialized text backbones.
- Add synthetic and real-artifact tests plus documentation updates to make the new support boundary explicit and verifiable.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/gguf_dense_cohort_integration_test.py | Adds pinned real-GGUF integration tests (download → hash/size/qtypes → build → save → ORT CPU run → deterministic logits/greedy token). |
| src/mobius/models/smollm.py | Uses quantization-aware embedding/linear factories and swaps in the specialized SmolLM3 text backbone via _replace_text_model(). |
| src/mobius/models/olmo.py | Makes OLMo/OLMo2 text backbones quantization-aware and swaps them in via _replace_text_model(). |
| src/mobius/models/cohere.py | Adds dense-cohort Cohere2 semantics (sliding/full attention and per-layer RoPE gating) and uses quantization-aware linear factories. |
| src/mobius/models/base.py | Introduces linear_class_for_config() / embedding_for_config() helpers and _replace_text_model() to preserve tying across specialized backbone swaps. |
| src/mobius/models/arcee.py | Passes quantization-aware linear factory into the Arcee MLP component. |
| src/mobius/integrations/gguf/_upstream.py | Extends pinned-upstream architecture representation to include exact tensor-family closures. |
| src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json | Adds tensor_families entries for the new dense architectures in the upstream pin data. |
| src/mobius/integrations/gguf/_tensor_processors_test.py | Adds InternLM2 Q/K permutation regression + dense-cohort permutation contract assertions. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds explicit tensor-name mapping tables/overrides for OLMo and Arcee plus OLMo2 extras. |
| src/mobius/integrations/gguf/_spec.py | Adds required_metadata to GGUFArchitectureSpec and validates its consistency with support claims. |
| src/mobius/integrations/gguf/_config_mapping.py | Adds required-metadata enforcement, Cohere2 head-dim/partial-RoPE handling, dense sliding/NoPE semantics, and OLMo clamp rejection. |
| src/mobius/integrations/gguf/_config_mapping_test.py | Adds dense-cohort config mapping tests, including missing-required-metadata rejection coverage. |
| src/mobius/integrations/gguf/_builder_test.py | Extends GGUF builder test fixtures to emit architecture-specific tensor sets and validates ORT CPU execution for the dense cohort. |
| src/mobius/integrations/gguf/_arch_registry.py | Registers the new dense architectures with explicit support/deferred verdicts and required metadata. |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates supported-count pin, adds pinned tensor-family closure tests, and tightens “supported” labeling to all-verdicts-supported. |
| docs/api/build_from_gguf.md | Updates the support matrix and documents dense-cohort validation boundaries and pinned real-GGUF evidence. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+433
to
+444
| def _replace_text_model(self, model: nn.Module) -> None: | ||
| """Replace the text model while preserving tied embedding/head parameters.""" | ||
| self.model = model | ||
| if isinstance(self.lm_head, TiedQuantizedLMHead): | ||
| self.lm_head = TiedQuantizedLMHead( | ||
| self.model.embed_tokens, | ||
| self.config.hidden_size, | ||
| self.config.vocab_size, | ||
| ) | ||
| elif self.config.tie_word_embeddings: | ||
| self.lm_head.weight = self.model.embed_tokens.weight | ||
|
|
Comment on lines
+143
to
+148
| for layer_index, (layer, past_kv) in enumerate(zip(self.layers, past_kvs)): | ||
| layer_type = ( | ||
| self.layer_types[layer_index] if self.layer_types else "full_attention" | ||
| ) | ||
| use_rope = self.no_rope_layers is None or self.no_rope_layers[layer_index] == 1 | ||
| hidden_states, present_kv = layer( |
justinchuby
added a commit
that referenced
this pull request
Aug 25, 2026
## Summary - add pinned llama.cpp (`8d9af256337d1a501250f9bbf4c0859a654bddd6`) GGUF specs for `olmoe`, `phimoe`, `qwen2moe`, `qwen3moe`, and `granitemoe` - implement exact metadata/config extraction, canonical Qwen aliases, tensor-family closure, routing/norm/scaling semantics, and Granite dense-vs-MoE dispatch - preserve 3-D expert ordering through affine and native quantized imports, split fused Phi QKV tensors, and preserve tied quantized Qwen3/Granite embedding heads - reverse llama.cpp's GraniteMoE Q/K row permutation in both float and packed quantized imports - map pinned expert `.scale`/`.input_scale` suffixes and reject affected files before graph construction because Mobius cannot safely represent NVFP4 scale2/activation-scale sidecars - extend the same suffix-aware preflight to reachable MTP `nextn.eh_proj` scale sidecars before either backbone or MTP graph construction - add generated support docs, negative closure/shape tests, and float/Q4 synthetic save-load-ORT coverage Stacks on #572 (`justinchuby-gguf-dense-transformer-cohort`). ## Real artifact import evidence (runtime deferred) ### GraniteMoE Validated with: - repository: `bartowski/granite-3.0-1b-a400m-instruct-GGUF` - repository revision: `0e1c3cecaa6e49ac0721be91ef441ec72eae62d4` - file: `granite-3.0-1b-a400m-instruct-Q4_K_M.gguf` - size: `821,845,024` bytes - LFS SHA-256: `074f09e13484e54e73c93830d34e9fa9917a6319fb8bae762a22594b9b4da0dc` - source config/tokenizer: `ibm-granite/granite-3.0-1b-a400m-instruct@ffec3c35bdfd97a06f0b4cd5fcc92cd9b1584445` - stored qtypes: 73 F32, 144 Q4_K, 25 Q6_K The pinned integration test verifies exact tensor closure, 24 routers, 2,304 routed expert projections, mixed-qtype routing, 2,401 `MatMulNBits` nodes including the tied quantized head, zero `QMoE` nodes, ONNX save/load, full 49,155-token logits, and repeatable three-token cached decoding. This is deterministic Mobius execution evidence, not independent llama.cpp/HuggingFace parity, so GraniteMoE runtime remains deferred. ## Runtime-DEFERRED All five entries—`olmoe`, `phimoe`, `qwen2moe`, `qwen3moe`, and `granitemoe`—have exact registry/config/tensor support and synthetic float/Q4 ORT execution, but no qualifying independent real-weight cross-runtime evidence. The only compatible Phi representative found was `tripathyShaswata/Phi-tiny-MoE-instruct-GGUF@873ccb08cd3380ee2c08573d45267fac9a6cc81b`, file `Phi-tiny-MoE-instruct-Q8_0.gguf`, size `3,999,171,104` bytes, SHA-256 `297fa09e906e18aaf03850e77d6de8d9ee8e246e00916ac09787ae2cf4bb6019`, sourced from `microsoft/Phi-tiny-MoE-instruct@2fe50e88d0e2a5a132563815686ea0dcc8e252b5`. It was not downloaded because it is not a reasonably sized representative. ## Validation - `504 passed` full focused GGUF/model tests after the Granite/expert-scale fixes - `160 passed` focused MTP/builder/tensor-mapping tests after the MTP scale preflight fix - `1 passed` revised pinned Granite real-artifact integration test - `5585 passed, 52 skipped` broad non-integration suite with `glm_moe_dsa` excluded - full `lintrunner f --output oneline --all-files` The two excluded `glm_moe_dsa` shape-inference/checker failures reproduce unchanged on the stack base and are unrelated to this cohort. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
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.
Summary
Adds the first reviewable C01 dense-transformer GGUF cohort on top of #571, using llama.cpp commit
8d9af256337d1a501250f9bbf4c0859a654bddd6as the tensor-family source of truth.olmoOLMoCausalLMModelolmo2OLMo2CausalLMModelcohere2CohereCausalLMModelarceeArceeCausalLMModelsmollm3SmolLM3CausalLMModelexaoneCausalLMModelArchitecture correctness
olmo2files carrying OLMo3 sliding-window patterns until the graph supports per-layer sliding attention.Real GGUF evidence
Pinned revisions, exact filenames, sizes, SHA-256 values, and per-tensor qtype tables are encoded in
tests/gguf_dense_cohort_integration_test.pyfor:QuantFactory/AMD-OLMo-1B-GGUF@5f34243a42dbae2141b8f5286320bf63d51eeefballenai/OLMo-2-0425-1B-Instruct-GGUF@62f8c199538474c3e33ed5d7e0580abd66686a27ggml-org/SmolLM3-3B-GGUF@4965cb60b150737b68a0408c36aeefb65078f894All three packages build, save, open in ORT CPU, and produce deterministic finite logits and pinned greedy outputs.
The mixed Q4_K_M files do not use native preservation. Q4_K and Q6_K projections are dequantized and affine-requantized to explicit-zero-point 4-bit/block-32
MatMulNBits; compatible embeddings useGatherBlockQuantized; float norm tensors remain float.Explicit exclusions
The PR does not infer compatibility from common names. Deferred candidates include GPT-NeoX and Phi-2 (fused/interleaved or dual-form QKV), Baichuan and MPT (ALiBi), StarCoder (learned positions), and unproven Qwen/Command-R aliases. Large Command-R/Seed artifacts were not downloaded.
Validation
The existing
glm_moe_dsasymbolic shape-inference/checker failures reproduce independently and are excluded from the final broad run.