Skip to content

Add conventional dense GGUF architectures - #635

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby-implement-deferred-dense-gguf
Aug 25, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby-implement-deferred-dense-gguf

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

Promotes eight conventional GGUF decoder architectures whose pinned llama.cpp ABI closes over existing Mobius components:

  • bloom → bloom
  • codeshell → kclgpt
  • command-r → command_r
  • jais2 → jais2
  • orion → orion
  • qwen → qwen
  • starcoder → gpt_bigcode
  • xverse → xverse

The 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

  • L1: config extraction, exact pinned tensor mapping/closure, graph construction, graph-initializer ownership, and weight alignment for every promoted architecture.
  • L3: synthetic parity where a constructible Transformers reference exists; dedicated value-based tests cover CodeShell fused QKV, Bloom interleaving, and Xverse Q/K inverse permutation.
  • Quantized import: supported only for split-projection command-r and jais2; rejected for fused/permuted projection routes that cannot safely transform packed blocks.
  • Runtime: deferred for all eight pending representative real-weight GGUF ORT parity and deterministic generation evidence.
  • Metadata: generic decoder config remains pinned to OGA 0.15.2; the network-free runtime probe passes.

Waivers

  • Real-weight L4/L5 goldens are waived for jais2 (smallest public checkpoint 8B), kclgpt/CodeShell (7B), orion (14B), and xverse (7B): no bounded small public artifacts exist for CPU CI. The waiver text claims only the evidence actually run.
  • No real GGUF CLI/runtime support is claimed; runtime verdicts remain deferred.
  • The full model coverage suite has two unrelated baseline failures on main: kimi_k3 and lfm2_moe lack 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:

  • Encoders 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

  • Focused GGUF/build/config/tensor/weight suite: 3,522 passed, 47 skipped, 39 xfailed.
  • Broad non-integration suite after final fixes: 7,927 passed, 57 skipped.
  • Final parity regression subset: 92 passed, 1 skipped.
  • New coverage waiver integrity: 10 passed, 4 skipped.
  • OGA 0.15.2 network-free probe: 2 passed.
  • Generated GGUF docs check: clean.
  • Initialized lintrunner format/lint: clean.
  • GPT-5.6 Sol medium architecture and regression reviews: final pass clean after addressing all findings.

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]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 25, 2026 22:22
@@ -0,0 +1,412 @@
# Copyright (c) Microsoft Corporation.
@justinchuby
justinchuby merged commit 3b2c9cd into main Aug 25, 2026
14 of 24 checks passed
@justinchuby
justinchuby deleted the justinchuby-implement-deferred-dense-gguf branch August 25, 2026 22:23
@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing 8513774 → a43cd35

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 324 KB -16.5% 🟢
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 265 265 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 127 127 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 429 429 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 8513774 → a43cd35

Model Sub-model Changes Status
gpt2 model 37 🟡
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
gpt2 / model — 37 change(s)

Op summary: 54 → 54 nodes

No op-sequence changes.

Connectivity changes:

  • node[2] Add: input_ids [37, 38] → [36, 37]
  • node[4] Unsqueeze: input_ids [40, 9] → [39, 9]
  • node[8] Concat: input_ids [42, 43, 44] → [41, 42, 43]
  • node[9] Expand: input_ids [41, 45] → [40, 44]
  • node[10] Unsqueeze: input_ids [46, 9] → [45, 9]
  • node[11] LayerNormalization: input_ids [39, 10, 11] → [38, 10, 11]
  • node[13] MatMul: input_ids [48, 49] → [47, 48]
  • node[15] MatMul: input_ids [48, 51] → [47, 50]
  • node[17] MatMul: input_ids [48, 53] → [47, 52]
  • node[18] Attention: input_ids [50, 52, 54, 47, 3, 4] → [49, 51, 53, 46, 3, 4]
  • node[20] MatMul: input_ids [55, 58] → [54, 57]
  • node[21] Add: input_ids [39, 59] → [38, 58]
  • node[22] LayerNormalization: input_ids [60, 16, 17] → [59, 16, 17]
  • node[24] MatMul: input_ids [61, 62] → [60, 61]
  • node[25] Add: input_ids [63, 19] → [62, 19]
  • node[26] Gelu: input_ids [64] → [63]
  • node[28] MatMul: input_ids [65, 66] → [64, 65]
  • node[29] Add: input_ids [67, 21] → [66, 21]
  • node[30] Add: input_ids [60, 68] → [59, 67]
  • node[31] LayerNormalization: input_ids [69, 22, 23] → [68, 22, 23]
  • node[33] MatMul: input_ids [70, 71] → [69, 70]
  • node[35] MatMul: input_ids [70, 73] → [69, 72]
  • node[37] MatMul: input_ids [70, 75] → [69, 74]
  • node[38] Attention: input_ids [72, 74, 76, 47, 5, 6] → [71, 73, 75, 46, 5, 6]
  • node[40] MatMul: input_ids [77, 80] → [76, 79]
  • node[41] Add: input_ids [69, 81] → [68, 80]
  • node[42] LayerNormalization: input_ids [82, 28, 29] → [81, 28, 29]
  • node[44] MatMul: input_ids [83, 84] → [82, 83]
  • node[45] Add: input_ids [85, 31] → [84, 31]
  • node[46] Gelu: input_ids [86] → [85]
  • node[48] MatMul: input_ids [87, 88] → [86, 87]
  • node[49] Add: input_ids [89, 33] → [88, 33]
  • node[50] Add: input_ids [82, 90] → [81, 89]
  • node[51] LayerNormalization: input_ids [91, 34, 35] → [90, 34, 35]
  • node[52] Transpose: input_ids [36] → [7]
  • node[53] MatMul: input_ids [92, 93] → [91, 92]

Initializer changes:

  • count 30 → 29; dtype distribution: FLOAT: 29 → 28

Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

justinchuby added a commit that referenced this pull request Aug 25, 2026
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]>
justinchuby added a commit that referenced this pull request Aug 25, 2026
## 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
titaiwangms added a commit that referenced this pull request Aug 26, 2026
## 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
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.

3 participants