Skip to content

Promote exact scaled-RoPE and MLA GGUF subsets - #640

Merged
justinchuby merged 9 commits into
mainfrom
justinchuby-exact-gguf-architectures
Aug 26, 2026
Merged

justinchuby merged 9 commits into
mainfrom
justinchuby-exact-gguf-architectures

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

Promotes the maximal exact, fail-closed GGUF subset for this architecture cohort:

  • Apertus: serialized per-dimension RoPE factors, pre-RoPE Q/K RMSNorm, optional norm/projection biases, xIELU metadata ownership, and packed projection preservation.
  • MiniCPM: dense split-QKV graph with exact embedding/residual/logit scales, Q/K transforms, LongRoPE, tied/untied output closure, and ordinary expanded KV cache.
  • MiniCPM3: Q/KV-LoRA MLA with shared RoPE key, asymmetric expanded K/V cache geometry, exact scales, strict dense tensor closure, and packed fused KV-B repacking.
  • PLM: direct Q, normalized KV-A, fused per-head KV-B, shared interleaved RoPE key, asymmetric expanded cache, tied single-owner output, and ReLU-squared FFN.
  • Pangu-Embedded: ordinary full-head RoPE, split Q/K/V, mandatory attention-output bias, complete-or-none QKV bias, dense SwiGLU, tied-output ownership, and packed split projections.
  • Shared safety: rejects quantization-preserving imports when required tensor processors lack exact packed-domain transforms; GPT-2 transpose remains float-only. Serialized RoPE sidecars are accepted only where represented exactly and with floating-point storage.

Runtime/OGA promotion remains deferred because representative real-weight GGUF full-logit and deterministic generation parity was not available.

Residual blockers

  • Maincoder: Q/K RMSNorm occurs after RoPE, unlike the current generic attention ordering.
  • Mistral4: DeepSeek-style MLA, conditional dense/MoE loading, and latent-vs-expanded cache ABI.
  • PLaMo: parallel RMSNorm topology plus converter Q/output projection shuffles.
  • PLaMo3: fused QKV/SwiGLU, architecture-specific norm offsets, and periodic seven-sliding/one-full iSWA cache scheduling.
  • MiniCPM routed MoE, MiniCPM3 latent/static/paged state, legacy MiniCPM files missing unambiguous scale metadata, fused Pangu QKV, and tensor-backed/scaled Pangu RoPE remain fail-closed.

Validation

  • Initialized all-files lintrunner: clean.
  • Targeted architecture/config/GGUF suite: 1,503 passed, 1 skipped.
  • Direct-review regression suite: 32 passed.
  • Final broad non-integration suite: 8,244 passed, 57 skipped, 12 deselected, 1 subtest passed.
  • Generated GGUF documentation check: current.
  • Direct GPT-5.6 Sol medium review found and fixed Pangu rope_freqs.weight admission and quantized MiniCPM LongRoPE sidecar acceptance.

Waivers

No runtime/OGA, representative real-weight GGUF prefill/decode full-logit parity, or generation claim is made. Synthetic graph, tensor closure, packed-value transformation, and cached execution coverage is included for promoted routes.

justinchuby and others added 9 commits August 25, 2026 19:53
Declare which architecture tensor processors have exact packed-domain equivalents and reject GPT-2 quantization preservation because its required projection transpose cannot yet preserve packed values, scales, and zero-points coherently.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Consume serialized per-dimension RoPE and xIELU values, map the complete Apertus tensor closure including optional biases, and preserve packed quantized projections. Keep runtime support deferred pending representative real-weight parity evidence.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Implement PLM's direct split query path, normalized latent KV expansion, shared interleaved RoPE key, expanded asymmetric caches, tied output ownership, and non-gated ReLU-squared FFN. Add strict GGUF metadata and tensor closure validation plus packed fused-KV preservation and cache parity tests.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Promote the ordinary-RoPE, split-QKV Pangu-Embedded path with exact bias, cache, tensor-closure, and tied-output contracts. Keep fused QKV and tensor-backed LongRoPE fail-closed so packed quantization values are never silently transformed.\n\nRecord precise residual blockers for Maincoder, Mistral4, PLaMo, and PLaMo3, including PLaMo3's periodic iSWA cache schedule.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Implement dense MiniCPM and MiniCPM3 GGUF imports with pinned scale semantics, Q/K transforms, LongRoPE factors, MLA projections, asymmetric expanded caches, and strict tensor closure boundaries. Keep runtime promotion deferred and reject unrepresentable expert, latent-state, and serialized RoPE-frequency variants.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Give the GGUF-only MiniCPM module registrations representative tiny scale and MLA geometry so the shared graph suite exercises both promoted architectures instead of failing on intentionally strict production invariants.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Keep the registry test imports formatted and remove MiniCPM3 from the legacy deferred-graph assertion now that its strict promoted contract validates geometry before graph construction.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Assert exact promoted GGUF families reject missing required metadata before config extraction, matching their architecture-specific validators after replaying onto the legacy dense promotion.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 1a957193-e630-44b2-bc50-8e506899acc2
Signed-off-by: Justin Chu <[email protected]>
Keep Pangu-Embedded restricted to ordinary RoPE and require MiniCPM LongRoPE factors to use floating-point storage so quantized sidecars cannot be silently consumed outside the packed-weight contract.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 1a957193-e630-44b2-bc50-8e506899acc2
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 26, 2026 03:02
@justinchuby
justinchuby merged commit 6617fe2 into main Aug 26, 2026
16 of 25 checks passed
@justinchuby
justinchuby deleted the justinchuby-exact-gguf-architectures branch August 26, 2026 03:03
@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 710b032 → 9871514

Model Sub-model Changes Status

No architecture changes detected. ✅


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

@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing 710b032 → 9871514

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 324 KB 324 KB +0.0% ⚪
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 450 450 +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.

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 promotes additional llama.cpp-pinned GGUF “exact / fail-closed” import subsets by adding dedicated architecture implementations (PLM, MiniCPM, MiniCPM3), expanding GGUF tensor-closure validation and config postprocessing, and updating the GGUF support registry/docs/tests accordingly.

Changes:

  • Add exact PLM decoder model + GGUF config/tensor mapping and quantized-preserving import coverage.
  • Add exact MiniCPM (dense) and MiniCPM3 (MLA) GGUF-specific model graphs plus extensive closure/parity tests.
  • Promote Apertus and Pangu-Embedded GGUF routes (including stricter quantized-keep safety checks) and update the support matrix/docs.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/_test_configs.py Adds tiny config entries for plm, minicpm_gguf, and minicpm3_gguf graph-build coverage.
src/mobius/models/plm.py Introduces an exact PLM decoder model built on DeepSeekMLA with strict config validation.
src/mobius/models/plm_test.py Adds PLM unit tests for parameter contracts, cache shapes, parity, and fail-closed variants.
src/mobius/models/minicpm.py Introduces exact MiniCPM and MiniCPM3 GGUF-specific text graphs and scaling behavior.
src/mobius/models/apertus.py Extends Apertus to own xIELU scalars via initializers and optional Q/K norm bias handling.
src/mobius/models/init.py Exports new MiniCPM/MiniCPM3 and PLM model classes.
src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json Updates pinned architecture tensor inventories/metadata requirements (Apertus + MiniCPM3).
src/mobius/integrations/gguf/_tensor_processors.py Adds PACKED_SAFE_PROCESSORS to gate keep_quantized=True safety.
src/mobius/integrations/gguf/_tensor_mapping.py Adds mapping tables for PLM, MiniCPM3, and Apertus extras.
src/mobius/integrations/gguf/_plm_test.py Adds synthetic PLM GGUF contract tests, including packed KV-B preservation.
src/mobius/integrations/gguf/_minicpm_test.py Adds focused MiniCPM/MiniCPM3 GGUF exactness/closure/permutation tests.
src/mobius/integrations/gguf/_dense_c01_test.py Adjusts dense C01 pre-config failure tests for updated promotion boundaries.
src/mobius/integrations/gguf/_conventional_decoder_test.py Promotes/validates pangu-embedded conventional decoder constraints and deferral reasons.
src/mobius/integrations/gguf/_config_mapping.py Adds postprocessors for Apertus, PLM, MiniCPM/MiniCPM3, and Pangu-Embedded strict config restoration.
src/mobius/integrations/gguf/_builder.py Adds MiniCPM/MiniCPM3 GGUF tensor-closure validation; extends dense C01 closure for Apertus.
src/mobius/integrations/gguf/_arch_registry.py Promotes PLM/MiniCPM/MiniCPM3/Apertus/Pangu-Embedded import specs; rejects GPT-2 quantized-preserving import.
src/mobius/integrations/gguf/_arch_registry_test.py Updates expected supported counts/sets and adds a safety test ensuring quantized import doesn’t skip required processors.
src/mobius/integrations/gguf/_apertus_test.py Adds Apertus end-to-end synthetic GGUF tests for rope/xIELU/bias ownership and execution.
src/mobius/_registry.py Registers PLM and GGUF-specific MiniCPM/MiniCPM3 module types in fallback registrations.
src/mobius/_configs/_base.py Adds config fields for per-layer xIELU scalar ownership and per-layer Q/K norm bias flags.
docs/api/build_from_gguf.md Updates generated GGUF support census and architecture rows (Apertus, GPT-2, MiniCPM, MiniCPM3, PLM, Pangu-Embedded).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mobius/models/plm.py
Comment on lines +41 to +45
if rope_dim % 2:
raise ValueError("PLM qk_rope_head_dim must be even")
if config.num_key_value_heads != config.num_attention_heads:
raise ValueError("PLM caches expanded K/V for every attention head")
if config.q_lora_rank is not None:
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.

2 participants