Repository navigation
Add exact BitNet, embedding, and Talkie GGUF tasks - #641
Conversation
Implement BitNet's attention and FFN subnorm topology, exact ternary dequantization with scalar projection scale folding, and strict tensor closure validation. Keep packed quantization and runtime packaging fail-closed until their independent value and generation evidence exists. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Implement dedicated bidirectional feature-extraction graphs for Gemma and Llama embedding GGUFs, including pooling, local attention, optional dense heads, strict tensor closure, and stateless package ABI.\n\nImplement Talkie's weight-free normalization, inverse NeoX RoPE, post-RoPE Q/K normalization, learned gains and skips, logit scaling, and causal KV-cache behavior. Reject unsupported public and quantized profiles explicitly and add value-based parity and package tests.\n\nCo-authored-by: Copilot App <[email protected]>\nCopilot-Session: 6f7146cd-ceda-48ee-a494-06d3b12bc12d Signed-off-by: Justin Chu <[email protected]>
Associate the reviewed two-commit specialized GGUF delta with its Copilot session. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6f7146cd-ceda-48ee-a494-06d3b12bc12d Signed-off-by: Justin Chu <[email protected]>
| @@ -0,0 +1,268 @@ | |||
| # Copyright (c) Microsoft Corporation. | |||
Performance Comparison
|
🏗️ Architecture Diff
No architecture changes detected. ✅ 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 adding dedicated “exact-float” model graphs and tasks for BitNet, two stateless embedding architectures (gemma-embedding and llama-embed), and the Talkie causal LM. It also tightens GGUF validation to fail closed earlier, updates the architecture registry/support matrix, and adds synthetic parity tests and pinned YAML evidence cases.
Changes:
- Add new exact model implementations: BitNet (with attention/FFN sub-norms), Talkie (inverse NeoX RoPE + post-RoPE Q/K norm + embedding skip/logit scale), and stateless GGUF embedding models (GemmaEmbedding + LlamaEmbed).
- Introduce a dedicated 2-input embedding feature-extraction task and route GGUF embedding architectures to it.
- Extend GGUF validation, tensor mapping/processing, registry entries, tests, and documentation to reflect the newly “supported for float import” architectures.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cli_test.py | Updates a CLI guard test to use a still-deferred GGUF architecture (“pockettts”) now that Talkie is supported. |
| tests/build_graph_test.py | Adjusts encoder graph assertions to account for the new 2-input stateless embedding ABI (no token_type_ids). |
| tests/_test_configs.py | Adds tiny configs for BitNet, Talkie, and the two GGUF embedding module types. |
| testdata/cases/encoder/llama-embed-nemotron-8b-gguf.yaml | Adds a pinned evidence case documenting fail-closed RoPE-scaling boundaries for llama-embed GGUF. |
| testdata/cases/encoder/embeddinggemma-300m-gguf.yaml | Adds a pinned evidence case for gemma-embedding GGUF with environment/repro constraints. |
| testdata/cases/causal-lm/talkie-1930-13b-it-gguf.yaml | Adds a pinned evidence case describing why the public Talkie artifact is out-of-scope for the promoted scalar profile. |
| testdata/cases/causal-lm/bitnet-b1_58-2b-4t.yaml | Adds a pinned HF BitNet evidence case documenting current promotion boundaries. |
| testdata/cases/causal-lm/bitnet-b1_58-2b-4t-gguf.yaml | Adds a pinned GGUF BitNet evidence case describing why legacy/public artifacts don’t close parity gates. |
| src/mobius/tasks/_feature_extraction.py | Adds GGUFEmbeddingFeatureExtractionTask implementing the two-input stateless embedding ABI. |
| src/mobius/tasks/init.py | Exports/Registers the new embedding feature-extraction task string → task mapping. |
| src/mobius/models/talkie.py | Adds the dedicated Talkie causal LM graph implementation. |
| src/mobius/models/talkie_test.py | Adds synthetic closure, mapping, and ORT prefill/decode parity tests for Talkie. |
| src/mobius/models/gguf_embeddings.py | Adds dedicated stateless embedding graphs for gemma-embedding and llama-embed GGUF. |
| src/mobius/models/gguf_embeddings_test.py | Adds synthetic closure, mapping, and numerical parity tests for the two embedding architectures. |
| src/mobius/models/bitnet.py | Adds the dedicated BitNet causal LM graph (post-attention/post-FFN sub-norm topology). |
| src/mobius/models/bitnet_test.py | Adds BitNet closure checks, qtype dequantization-by-value tests, scale folding tests, and synthetic HF/ORT cache parity. |
| src/mobius/models/init.py | Exports the new model classes from the models package. |
| src/mobius/integrations/gguf/_upstream_gap_test.py | Updates deferred-architecture parameterization now that BitNet is supported for float import. |
| src/mobius/integrations/gguf/_tensor_processors.py | Adds a BitNet tensor processor to fold optional scalar *.scale tensors into dequantized weights. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds GGUF→HF mapping tables for embedding models, BitNet, and Talkie. |
| src/mobius/integrations/gguf/_config_mapping.py | Adds postprocessors for Talkie and GGUF embedding profiles; enforces exact promoted subsets. |
| src/mobius/integrations/gguf/_builder.py | Adds fail-closed validation hooks for BitNet/Talkie/embedding closures and routes embedding GGUF archs to the new task. |
| src/mobius/integrations/gguf/_builder_test.py | Updates GGUF builder tests to reflect Talkie’s new status (removed from unrelated parameter sets). |
| src/mobius/integrations/gguf/_arch_registry.py | Promotes BitNet, gemma-embedding, llama-embed, and Talkie to supported float import with explicit reasons/constraints. |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates expected supported-count and per-architecture quantized verdict assertions. |
| src/mobius/components/_attention.py | Adds an overridable _project_output() hook used by BitNet to insert post-attention sub-norm before o_proj. |
| src/mobius/_registry.py | Registers the new model types and default model IDs for build() discovery. |
| src/mobius/_configs/_base.py | Extends ArchitectureConfig with embedding dense head dimension fields needed by GGUF embedding graphs. |
| docs/api/build_from_gguf.md | Updates the GGUF support matrix and per-architecture entries for new supported float-import routes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ( | ||
| "bitnet", | ||
| { | ||
| "hidden_act": "relu2", | ||
| "tie_word_embeddings": True, | ||
| "rms_norm_eps": 1e-5, | ||
| }, | ||
| True, | ||
| ), |
| def __init__(self, size: int, eps: float): | ||
| super().__init__() | ||
| self._scale = [1.0] * size | ||
| self._eps = eps | ||
|
|
||
| def forward(self, op: OpBuilder, hidden_states: ir.Value) -> ir.Value: | ||
| scale = op.CastLike(op.Constant(value_floats=self._scale), hidden_states) | ||
| return op.RMSNormalization( | ||
| hidden_states, | ||
| scale, | ||
| axis=-1, | ||
| epsilon=self._eps, | ||
| stash_type=1, | ||
| ) |
## Summary Promotes two exact graph-supported GGUF routes to runtime-supported under the released `onnxruntime-genai==0.15.2` contract: - Qwen2.5-0.5B-Instruct Q8_0: `Qwen/Qwen2.5-0.5B-Instruct-GGUF@9217f5db79a29953eb74d5343926648285ec7e67`, `qwen2.5-0.5b-instruct-q8_0.gguf`, 675,710,816 bytes, SHA-256 `ca59ca7f13d0e15a8cfa77bd17e65d24f6844b554a7b6c12e07a5f89ff76844e`, 291 tensors (`F32=121`, `Q8_0=170`). - LFM2-350M F16: `LiquidAI/LFM2-350M-GGUF@8fdc9d526b7ed346b19257551b05816c7912ecc2`, `LFM2-350M-F16.gguf`, 711,482,304 bytes, SHA-256 `379ffdcbf08147c0313f6f1ce7ff558a2bc935eda633f4b46c52347032419c42`, 148 tensors (`F16=93`, `F32=55`). Evidence binds exact artifact, import route, tokenizer assets/revisions, graph identity, runtime-package identity, complete logits, 20-step decode, deterministic generation, replay/rollback/non-vacuous batch reorder, ModelPackage save/load, CLI publication, and OGA 0.15.2 execution. The inherited SmolLM runtime record was also refreshed after #641 changed its route identity, with exact real parity and OGA probes rather than accepting a structural fingerprint alone. ## Identities - Qwen route `f7391f2aac9a7617c1c10e397e91b6f31b80bb3c5f338966b46e7d3935246500`; graph `b0d1814ea69dddd405e30541e9009ba6fb73930f98538921d5c2eaa4a14f5d2c`; package `cb43c76e1bc3db07a6a3631c7a99e7c47b6891807fecffdb3b70fddd9c108173`. - LFM2 route `c961bba579ea33a2472a7c5d3f469c76f1f8c7aae8440a7eaa86bc6e878a42f4`; graph `2a15694cd5ff9f5c9f798feeca91cc41174842065ada80a18b288478725b3342`; package `87b8cdd1edc8c5be948716df3efe551f5fc8f96762d7ea3f99b27688ca9f24af`. - Qwen tokenizer `Qwen/Qwen2.5-0.5B-Instruct@a338b55dd21219a5f4da42bc11a9313d1a27d4cc`; LFM2 tokenizer `LiquidAI/LFM2-350M@73e3c253078a3b97c2e14b4c4665679f4d9b6d56`. ## Validation - Exact Qwen and LFM2 final-main probes: passed. - Refreshed SmolLM F16 parity/package and OGA 0.15.2 probes: passed. - Refreshed SmolLM2 F16 and Q4/dequantized route probes: passed. - Focused evidence/package/tokenizer/YAML gates: 626 passed, 9 deselected. - Broad serial non-integration: 8,305 passed, 57 skipped, 12 deselected. - Initialized all-files formatter and lint: passed. - Direct GPT-5.6 Sol medium evidence/security review: fixed overlapping HF/ORT/OGA lifetimes, added 2x free-space enforcement, tightened Hub-cache symlink containment including parent escapes, aligned the 16 GiB ceiling, and added explicit stale-route fail-closed coverage. ## Census and scope The documentation records the complete 90-route graph-supported census and attempted/blocked candidates. Larger and unsupported routes—including encoder/seq2seq registry gaps, GPT-2 combined-cache ABI, recurrent-state limitations, and candidates lacking an exact immutable <=16 GiB GGUF—remain deferred. No runtime claim is inferred from graph construction alone. Base: `fcd5b3bb42dbc2ca7ca4bc62e9ee502e8446085a` (#641). All named artifact, package, graph, and isolated Hub caches were deleted after evidence generation. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 43bb31ac-c136-44bc-8cdf-70cbcedd4a42 Copilot-Session: af2b8208-9638-4f6e-9651-7d3da21c0af8
Summary
gemma-embeddingandllama-embedfeature-extraction graphs with pooling/output ABI, exact attention schedules/scales, optional Gemma dense heads, and package metadataPromotion boundaries
Evidence
Validation
62 passed, 1607 deselected8297 passed, 57 skipped, 12 deselected, 1 subtest passedBase:
6617fe2b69aa9b2cd1a08dbe18a7563ac4ad7f32