Repository navigation
Add conventional dense GGUF architectures - #635
Conversation
Promote Bloom, CodeShell, Command-R, Jais2, Orion, Qwen v1, StarCoder, and Xverse with strict config and tensor closure, truthful quantized/runtime verdicts, and synthetic graph/value coverage. Preserve generic decoder metadata and fix tied-weight handling for LayerNorm and GPT-2-family models. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
| @@ -0,0 +1,412 @@ | |||
| # Copyright (c) Microsoft Corporation. | |||
Performance Comparison
|
🏗️ Architecture Diff
gpt2 / model — 37 change(s)Op summary: 54 → 54 nodes No op-sequence changes. Connectivity changes:
Initializer changes:
Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
There was a problem hiding this comment.
Pull request overview
This PR expands Mobius’s GGUF import surface by promoting eight conventional dense decoder architectures (Bloom, CodeShell/kclgpt, Command-R, Jais2, Orion, Qwen v1, StarCoder/gpt_bigcode, Xverse) to “graph-importable” status with strict metadata/tensor closure, architecture-specific config normalization, and weight/value transforms needed to match pinned llama.cpp ABIs.
Changes:
- Add conventional-decoder GGUF validation + tensor-name mapping recipes, plus value processors for Bloom and Xverse.
- Introduce/extend model/config glue for legacy LayerNorm decoders (CodeShell/Jais2) and fused-QKV splitting for Qwen v1, plus embedding/head-tying fixes for GPT-2-family (StarCoder).
- Add/expand synthetic closure + parity tests and update docs/support-matrix census to reflect the newly importable architectures.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/synthetic_parity_test.py | Adds a Jais2 synthetic-parity tolerance entry. |
| tests/model_coverage_test.py | Adds explicit coverage waivers/notes for newly promoted architectures with no small public checkpoints. |
| tests/_test_configs.py | Adds tiny test configs for jais2, kclgpt, and xverse. |
| src/mobius/models/starcoder2.py | Uses _replace_text_model() to preserve embedding/head tying when swapping the text backbone. |
| src/mobius/models/qwen.py | Adds Qwen v1 fused-QKV splitting in preprocess_weights() to support canonical GGUF input. |
| src/mobius/models/legacy_decoder.py | Introduces legacy LayerNorm decoder variants with non-gated FFN and optional fused-QKV input; adds CodeShell HF/GGUF name normalization. |
| src/mobius/models/legacy_decoder_test.py | Adds unit tests for CodeShell normalization + fused-QKV split closure, Xverse RoPE initializers, and Jais2 bias closure. |
| src/mobius/models/gpt2.py | Implements physical embedding/head tying semantics and routes tying/quant-preprocessing through preprocess_quantized_weights with GPT-2-family embed keys. |
| src/mobius/models/gpt2_test.py | Adds tests ensuring parameter ownership and preprocessing behavior for tied/untied GPT-2-family variants (including StarCoder, BioGPT, XGLM). |
| src/mobius/models/base.py | Uses _replace_text_model() in LayerNormCausalLMModel to preserve tying across backbone replacement. |
| src/mobius/models/init.py | Exports newly added legacy decoder model classes. |
| src/mobius/integrations/gguf/_tensor_processors.py | Adds Bloom head-interleaving restoration and Xverse Q/K permutation inversion processors; registers them. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds mapping recipes for legacy LayerNorm decoders, Bloom, StarCoder, plus extras for Qwen v1 and Command-R. |
| src/mobius/integrations/gguf/_conventional_decoder_test.py | Adds a comprehensive synthetic GGUF closure/config/verdict test suite for the eight promoted conventional decoder architectures. |
| src/mobius/integrations/gguf/_config_mapping.py | Adds a conventional-legacy config postprocessor and updates default-activation routing for new model types. |
| src/mobius/integrations/gguf/_builder.py | Adds strict tensor/metadata/shape contract validation for conventional decoders during GGUF validation. |
| src/mobius/integrations/gguf/_arch_registry.py | Promotes the eight architectures with explicit mapping recipes, processors, config postprocessing, and explicit runtime/quantized-import verdicts. |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates importable-architecture census and adjusts closure tests for promoted conventional decoders. |
| src/mobius/_registry.py | Registers CodeShell/Jais2/Xverse, updates Orion registration, and adjusts GPT-2-family registrations for scaled-embedding variants. |
| src/mobius/_configs/_base.py | Adds Jais2Config, CodeShellConfig, and XverseConfig normalization logic. |
| src/mobius/_configs/_base_test.py | Adds tests validating the new config normalizations/defaults. |
| src/mobius/_configs/init.py | Exports new config classes. |
| docs/api/build_from_gguf.md | Updates GGUF support matrix/census and architecture rows to reflect the new promoted import routes and their stated limitations. |
Suppressed comments (1)
src/mobius/integrations/gguf/_arch_registry_test.py:1535
pytest.mark.parametrize("architecture", [])results in this test collecting zero cases, so it no longer protects against regressions. If there are no remaining "configurable but unmappable" architectures, it's better to assert that dynamically rather than leaving an empty parameter list.
@pytest.mark.parametrize("architecture", [])
def test_configurable_but_unmappable_architectures_are_refused(
self, architecture: str
) -> None:
with pytest.raises(UnsupportedGGUFArchitectureError, match="Unsupported GGUF"):
get_arch_spec(architecture)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Apply the repository-pinned Ruff formatter to the Xverse permutation helper added by #635 so all-files lint is idempotent on the specialized branch. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c9f552d7-041b-482e-b1a6-7227d980ed5f Signed-off-by: Justin Chu <[email protected]>
## Summary Promotes four stateless specialized GGUF encoder architectures from the pinned llama.cpp census: - `eurobert`: pre-RMSNorm split-QKV RoPE encoder with parallel SwiGLU - `neo-bert`: fused contiguous QKV, interleaved RoPE, fused SwiGLU, and CLS pooling - `nomic-bert` (dense only): post-norm RoPE encoder with gated FFN - `jina-bert-v2`: ALiBi encoder with optional Q/K norms, optional second attention norm, and fused/separate GeGLU All four use a dedicated GGUF feature-extraction task supporting `NONE`, `MEAN`, and `CLS` pooling. Tensor closure and shape validation are fail-closed. Quantized import is rejected until complete fused/split packed-weight routes exist; runtime packaging remains deferred pending representative real-weight evidence. ## Authoritative evidence - llama.cpp pin: `8d9af256337d1a501250f9bbf4c0859a654bddd6` - HF config pins: - `EuroBERT/EuroBERT-210m@39b51e15dd1f1a06f58b5cbf6a8a188cec60bd0e` - `chandar-lab/NeoBERT@5424c8efeea6491b151d62dee55a752165407430` - `nomic-ai/nomic-embed-text-v1.5@e9b6763023c676ca8431644204f50c2b100d9aab` - `jinaai/jina-embeddings-v2-small-en@44e7d1d6caec8c883c2d4b207588504d519788d0` Tests cover tiny graph construction, pinned config transforms, exact tensor mapping/closure, contiguous NeoBERT QKV and interleaved RoPE, tanh GeGLU, FP16/BF16 Jina ALiBi graph loading, pooling ABI, left-padded CLS value selection, and float-only quantization policy. ## Residual deferred architectures - `jina-bert-v3`: released artifacts require adapter handling; MoE scheduling is not covered - `nomic-bert-moe`: encoder MoE schedule/experts remain unsupported - `talkie`: dedicated gain/skip/logit-scale graph and value transforms required - `wavtokenizer-dec`: requires a code-token-to-ISTFT-feature task and waveform processor - `rwkv6`, `rwkv6qwen2`, `rwkv7`, `arwkv7`: token-shift plus matrix-state ABI is not KV/Mamba state - `bailingmoe3`: mixed KDA convolution/matrix state plus MLA cache - `deepseek4`: compressed cache/history/rollback ABI is not represented by the fallback graph - `pockettts`, `qwen3tts`: primary GGUFs require mandatory sidecar bundles and non-text orchestration ## Validation - Shared registry/build/task/runtime/docs/coverage suite before the formatter-only follow-up: **4146 passed, 284 skipped, 16 deselected** - Directly affected conventional decoder/docs tests after formatting: **53 passed** - Broad non-integration suite before the formatter-only follow-up: **7983 passed, 57 skipped** - Generated GGUF docs: exact generator output - Full initialized `lintrunner f --output oneline --all-files`: success and zero worktree changes after commit `4e1059eb` - GPT-5.6 Sol medium review of the formatter-only follow-up: clean; semantic equivalence confirmed - Exact base: `3b2c9cd624c5f1e58a5948fb7e6af6453ea64ff2` (#635) - Head: `4e1059eb6516ba40d7e059a799ab47d1f420835e` The post-format monolithic shared rerun was attempted twice, but the host dropped to 100–115 MiB free and pytest could no longer create temporary files (`FileNotFoundError: No usable temporary directory`; OpenMP `/tmp` allocation failures). The formatting-only affected tests pass, and the identical shared suite passed immediately before the semantic no-op formatting commit. ## Waivers - Generic L2/L4/L5: the four registered module types are GGUF-only and have no native HF `model_type` route. Pinned HF-to-GGUF config semantics and synthetic ORT parity are covered by `_specialized_encoders_test.py`; misleading generic `test_model_id` claims are intentionally omitted. - Real-weight runtime generation: these are encoder-only GGUF routes and runtime support remains explicitly deferred; no runtime capability is claimed. - Quantized parity/Olive: packed fused/split projection ownership is intentionally rejected, not silently dequantized under `keep_quantized=True`. - Exact-main coverage baseline: `kimi_k3` and `lfm2_moe` already have test IDs without YAML cases on #635; the shared run excludes those two cases and their aggregate sentinel. Specialized coverage checks pass. - Existing SmolLM OGA 0.15.2 evidence probe has a baseline route-hash mismatch (`3ca3…` produced vs `b999…` pinned) that reproduces unchanged on untouched #630; this branch preserves the baseline route fingerprint and does not update evidence. --------- Signed-off-by: Justin Chu <[email protected]> Copilot-Session: c9f552d7-041b-482e-b1a6-7227d980ed5f
## Summary - align Jais2, CodeShell, Xverse, and Kimi-K3 model `config_class` declarations with registry dispatch - record Kimi-K3 and LFM2-MoE coverage limitations without fabricating golden data - support both tensor and mapping Transformers linear-attention cache ABIs in Falcon-H1 and GatedDeltaNet parity tests - mark the selective-MXFP4 Kimi-K3 checkpoint as a strict graph-only L2 xfail - preserve independent dashboard confidence levels when L2 xfails but L3 passes ## Root causes - #635 introduced the Jais2, CodeShell, and Xverse registry/model contract mismatches - #621 introduced the Kimi-K3 contract and coverage gaps - #606 introduced LFM2-MoE without an L4/L5 coverage disposition - #610 assumed the older tensor cache representation in Falcon-H1 parity coverage - #327 added a dashboard meta-assertion that incorrectly required every L2 xfail to have confidence below L2, contradicting the independent-level truth table ## Validation - dashboard plus original CI regression gates: 90 passed - affected graph and weight-alignment gates: 25 passed - Kimi-K3 L2: 1 passed, 2 strict xfailed --------- Signed-off-by: titaiwang <[email protected]> Copilot-Session: 2fe48e9f-4ebc-43a9-85f3-4e4f99f3ed5d
Summary
Promotes eight conventional GGUF decoder architectures whose pinned llama.cpp ABI closes over existing Mobius components:
bloom→bloomcodeshell→kclgptcommand-r→command_rjais2→jais2orion→orionqwen→qwenstarcoder→gpt_bigcodexverse→xverseThe change adds strict metadata/tensor/shape closure, architecture-specific config normalization and weight transforms, value-based QKV/permutation tests, truthful Hugging Face build paths, generated census updates, and generic decoder metadata compatible with pinned
onnxruntime-genai==0.15.2.Support and evidence
command-randjais2; rejected for fused/permuted projection routes that cannot safely transform packed blocks.Waivers
jais2(smallest public checkpoint 8B),kclgpt/CodeShell (7B),orion(14B), andxverse(7B): no bounded small public artifacts exist for CPU CI. The waiver text claims only the evidence actually run.main:kimi_k3andlfm2_moelack YAML cases. The four new per-model waiver and integrity checks pass.Residual conventional dense/encoder architectures
Deferred for materially different contracts rather than aliased unsafely:
eurobert,jina-bert-v2,jina-bert-v3,neo-bert,nomic-bert: pre/post-norm, RoPE/ALiBi, gated/parallel FFN, or conditional topology differences.bitnet,gemma-embedding: special quantization/sub-norm or bidirectional embedding/pooling ABI.gptneox,mpt,openelm: loader unions or per-layer arrays not represented by the current graph.maincoder,minicpm3,plm,nanbeige,pangu-embedded,plamo3,apertus: special attention order, MLA/cache, logical layer reuse, LongRoPE tensors, alternating SWA, or serialized per-dimension RoPE factors.jais,plamo: MuP/ALiBi scaling or parallel RMS/shuffle transforms need dedicated graph/value work.MoE, multimodal, and recurrent/special-state families remain owned by separate workstreams.
Validation