Skip to content

Add masked-diffusion GGUF architecture cohort - #582

Merged
justinchuby merged 4 commits into
mainfrom
justinchuby-add-diffusion-gguf-cohort
Aug 25, 2026
Merged

justinchuby merged 4 commits into
mainfrom
justinchuby-add-diffusion-gguf-cohort

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • add pinned llama.cpp GGUF support surfaces for dream, llada, llada-moe, and rnd1
  • implement bidirectional, cache-free dense and MoE masked-token graphs with exact Q/K normalization, routing, tying, fused-QKV, and shifted-logit semantics
  • enforce mask-token metadata, masked-diffusion-only dispatch, suffix-exact tensor closure, quantization roles, and malformed tensor rejection
  • keep runtime status deferred pending independent masked-step logits and deterministic multi-step generation parity

Architecture decisions

  • the neural ABI is input_ids -> logits + proposed_tokens; timestep, noise schedule, remasking, seed, and iteration policy remain external
  • dense LLaDA alone reverses the pinned interleaved-RoPE Q/K permutation; Dream, LLaDA-MoE, and RND1 do not
  • LLaDA-MoE uses raw selected softmax weights; RND1 renormalizes selected weights
  • fused QKV splits by [Q width, KV width, KV width]; supported affine/native projection and expert quantization is preserved

Validation

  • focused diffusion/config/tensor/builder tests: 822 passed
  • final cohort regression selection: 112 passed
  • broad non-integration suite excluding confirmed base failure: 5,854 passed, 52 skipped
  • full lintrunner: passed
  • pinned real LLaDA-1.5-Tiny.Q2_K.gguf SHA-256 verified; 57-tensor header census, mask token, and quantized CPU masked forward verified

The unfiltered broad suite has two glm_moe_dsa shape/checker failures that reproduce unchanged on the stacked base (072a6de); this PR does not alter that model.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 6dc9f43 → 05b92e0

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 388 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 264 264 +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 126 126 +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 428 428 +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

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 6dc9f43 → 05b92e0

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
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 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪

No architecture changes detected. ✅


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

@justinchuby
justinchuby force-pushed the justinchuby-add-t5-gguf-cohort branch from 072a6de to 05d2809 Compare August 25, 2026 15:24
Base automatically changed from justinchuby-add-t5-gguf-cohort to main August 25, 2026 15:24
@justinchuby
justinchuby requested a review from a team August 25, 2026 15:24
justinchuby and others added 4 commits August 25, 2026 08:26
Implement exact bidirectional graph, metadata, tensor closure, and quantized import paths for Dream, LLaDA, LLaDA-MoE, and RND1. Preserve architecture-specific Q/K permutation, fused QKV, MoE routing, and shifted-logit semantics while keeping runtime support deferred pending independent parity.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Fail before graph construction when Dream, LLaDA-MoE, or RND1 uses fused QKV while quantization preservation is active. The packed graph has separate Q/K/V targets, so the previous loader path could silently dequantize the fused source and leave packed parameters uninitialized.

Cover affine, native-block, and mixed float/quantized sources; retain float and explicit dequantization fused-QKV support; and document why stacked MoE expert tensors do not share this hazard.

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

Copilot-Session: 9db6165f-5116-473a-a5d7-1b68fe8ff095
Signed-off-by: Justin Chu <[email protected]>
Construct dense masked-diffusion MLP projections with the active quantized linear factory so the rebased GGUF importer can satisfy the newer packed-consumer contract. Update preflight coverage to patch the shard-aware GGUF opener introduced on main.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Include the four masked-diffusion architectures in the explicit quantized-import policy set introduced on main. Their packed projection execution paths are covered by the focused GGUF tests.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Copilot AI lite review requested due to automatic review settings August 25, 2026 15:29
@justinchuby
justinchuby force-pushed the justinchuby-add-diffusion-gguf-cohort branch from b229ff4 to 05b92e0 Compare August 25, 2026 15:29
@justinchuby
justinchuby merged commit 46aec39 into main Aug 25, 2026
17 of 23 checks passed
@justinchuby
justinchuby deleted the justinchuby-add-diffusion-gguf-cohort branch August 25, 2026 15:30

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

Adds a new GGUF “masked-diffusion LM” architecture cohort (Dream, LLaDA, LLaDA-MoE, RND1) to Mobius’ GGUF import path, wiring these models to a bidirectional, cache-free masked-diffusion task contract (input_ids -> logits + proposed_tokens) while keeping runtime support explicitly deferred pending parity validation.

Changes:

  • Introduces masked-diffusion model classes/config normalization (dense + MoE) and updates the masked-diffusion task to optionally apply llama.cpp-style shifted-logits semantics.
  • Extends GGUF architecture registry/config mapping/tensor mapping to enforce mask-token metadata, suffix-exact tensor closure, diffusion-only task dispatch, and fused-QKV handling (including explicit rejection for quantization-preserving imports).
  • Expands unit tests and GGUF builder tests/docs to cover diffusion contract validation, tensor closure, Q/K permute behavior, and execution smoke tests.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/build_graph_test.py Updates graph-IO assertions to accommodate masked-diffusion’s cache-free ABI and extra proposed_tokens output.
tests/_test_configs.py Adds tiny-config coverage entries for dream, llada_moe, and rnd1 (plus alias entries).
src/mobius/tasks/_masked_diffusion.py Adds optional logits shifting before ArgMax proposals to match llama.cpp diffusion alignment.
src/mobius/models/llada.py Adds Dream/LLaDA-MoE/RND1 config normalization and model classes; implements diffusion dense/MoE bidirectional graphs and Q/K norm semantics.
src/mobius/models/llada_test.py Adds tests for HF alias/config normalization, shifted-logits behavior, and MoE diffusion graph execution without cache.
src/mobius/models/init.py Exposes Dream/LLaDA-MoE/RND1 model classes from the public models package.
src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json Pins diffusion architectures’ tensor families/names for suffix-exact closure.
src/mobius/integrations/gguf/_tensor_processors_test.py Extends Q/K permute expectations for llada vs dream and diffusion MoE variants.
src/mobius/integrations/gguf/_tensor_mapping.py Adds diffusion tensor-family suffix allowlists and fused-QKV mapping recipe; tightens suffix allowlist enforcement.
src/mobius/integrations/gguf/_config_mapping.py Implements diffusion GGUF postprocessors enforcing mask token metadata, activation constraints, bias/fused-QKV consistency, and routing semantics.
src/mobius/integrations/gguf/_config_mapping_test.py Adds diffusion config-extraction tests (defaults, rejection cases, fused/separate bias validation).
src/mobius/integrations/gguf/_builder.py Adds diffusion-only task dispatch checks, fused-QKV split validation/splitting, and rejection for quantization-preserving fused-QKV diffusion imports.
src/mobius/integrations/gguf/_builder_test.py Adds diffusion GGUF build/run tests (float + quantized), fused-QKV split tests, and pre-graph-build rejection tests.
src/mobius/integrations/gguf/_arch_registry.py Registers diffusion architectures/specs with deferred runtime status and explicit validation-pending reasons.
src/mobius/integrations/gguf/_arch_registry_test.py Updates pinned supported-count and adds diffusion architectures to closure and malformed-suffix rejection tests.
src/mobius/_registry.py Registers Dream/LLaDA-MoE/RND1 model types (and aliases) to masked-diffusion task dispatch.
src/mobius/_configs/_base.py Adds mask_token_id and diffusion_shift_logits fields; adjusts DFlash config construction to avoid duplicate mask_token_id kwargs.
docs/api/build_from_gguf.md Documents the masked language-diffusion GGUF contract and deferred runtime rationale/artifact pinning.

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

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