Repository navigation
Add exact Hunyuan V3 GGUF graph support - #679
Merged
Merged
Conversation
Performance Comparison
|
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class Hunyuan-V3 (“hy_v3”) GGUF graph import support to mobius, including an independently cached NextN/MTP head sidecar and strict fail-closed GGUF tensor/metadata validation. This extends the GGUF importer/registry so HYV3 is no longer aliased to a neighboring architecture and can be selected/routed explicitly.
Changes:
- Introduces HYV3 model/config/task implementations (dense-prefix + routed/shared MoE trunk; one-layer NextN/MTP head with independent KV cache).
- Adds strict HYV3 GGUF tensor-closure + shape + storage-type validation and integrates it into GGUF build/arch registry and MTP wiring (including target-only split handling).
- Adds dedicated unit/synthetic and GGUF end-to-end tests plus updates route census + docs + registry hooks.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/synthetic_parity_test.py | Skips generic synthetic parity for hy_v3 and points to dedicated router parity tests. |
| tests/build_graph_test.py | Adds HyV3MtpModel to the “bespoke IO contract” coverage list. |
| tests/_test_configs.py | Adds a tiny hy_v3 config for graph-build test coverage. |
| src/mobius/tasks/_hy_v3_mtp.py | New task defining the HYV3 MTP sidecar I/O contract and independent KV cache. |
| src/mobius/tasks/init.py | Exposes HyV3MtpTask and registers the “hy-v3-mtp” task key. |
| src/mobius/models/hy_v3.py | New HYV3 trunk + MoE/router + MTP head module implementations. |
| src/mobius/models/hy_v3_test.py | New graph + executable synthetic-reference tests (router correctness, weight preprocessing, MTP cache shape). |
| src/mobius/models/init.py | Exports HyV3CausalLMModel and HyV3MtpModel. |
| src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json | Updates pinned llama.cpp census to list hy_v3 as a supported sidecar architecture. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds hy_v3-specific tensor mapping extras for import. |
| src/mobius/integrations/gguf/_route_census.py | Updates route census dependency listings (removes hy_v3 from the prior dependency set). |
| src/mobius/integrations/gguf/_route_census_test.py | Updates expected category counts after route changes. |
| src/mobius/integrations/gguf/_mtp.py | Extends MTP validation/mapping/config derivation/build to support hy_v3 sidecar semantics. |
| src/mobius/integrations/gguf/_mtp_test.py | Updates pinned loader/converter union expectations to include hy_v3 sidecars. |
| src/mobius/integrations/gguf/_hy_v3.py | New fail-closed HYV3 GGUF validator (metadata, tensor closure, shapes, explicit-float auxiliaries). |
| src/mobius/integrations/gguf/_hy_v3_test.py | New HYV3 GGUF contract + end-to-end build tests (combined + target-only split). |
| src/mobius/integrations/gguf/_config_mapping.py | Adds hy_v3 config postprocess to restore exact semantics and handles target-only split MTP metadata. |
| src/mobius/integrations/gguf/_builder.py | Integrates HYV3 validation and relaxes static_cache rejection when MTP is metadata-only (target-only split). |
| src/mobius/integrations/gguf/_arch_registry.py | Marks hy_v3 graph-importable with explicit tensor map recipe, postprocessor, and quantized-import rejection. |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates importable architecture counts and includes hy_v3 in promoted conventional decoders. |
| src/mobius/_registry.py | Registers hy_v3 backbone and HyV3MtpModel fallback registrations. |
| src/mobius/_configs/_base.py | Adds HyV3Config and HyV3MtpConfig, including from_transformers logic for dense-prefix schedule. |
| src/mobius/_configs/init.py | Exports HyV3Config and HyV3MtpConfig. |
| docs/api/build_from_gguf.md | Updates generated support/census tables and hy_v3 architecture status. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
justinchuby
force-pushed
the
justinchuby-implement-hunyuan-v3-gguf
branch
3 times, most recently
from
August 27, 2026 20:05
8c69a13 to
b9b26cc
Compare
Implement authoritative HyV3 metadata and tensor closure, full-attention trunk and independently cached NextN graphs, Q/K normalization, dense-prefix and sigmoid routed/shared MoE behavior, and fail-closed storage handling. Cover fused and split expert layouts, target-only and combined artifacts, synthetic routing parity, route census, and generated documentation. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Apply the formatter from current main and retain explicit fail-closed float-storage checks under the updated lint configuration. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Drop dead validator code identified during pull request review so the exact tensor closure remains straightforward to audit. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Normalize official Tencent checkpoint names before MoE expansion with collision detection. Add native payload-free parity, exact coverage metadata, and a discriminating llama.cpp router-floor regression. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
Document why the four GGUF-specialized MoE graph variants use dedicated L1 and contract coverage instead of native Hugging Face L2 configuration loading. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
Fail closed on auxiliary and compute-only GGUF types for all model tensors while allowing valid float, F64, and quantized weight storage. Keep normalization and routing tensors restricted to explicit floating-point storage. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
Keep the official expert-selection correction bias in float32 through FP16 and BF16 graph construction so near-boundary top-k choices match the source model. Add trunk and MTP initializer checks plus an executable selection regression that diverges after float16 rounding. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
Compare executable FP32 and FP16 correction-bias graphs with strictly different near-boundary expert scores, avoiding any dependency on TopK tie ordering. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
Retain the promoted text-cohort coverage entries from main and remove the duplicate pre-rebase variants so repository lint stays fail-closed after the HyV3 rebase. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-implement-hunyuan-v3-gguf
branch
from
August 27, 2026 21:02
eab1db0 to
4a13b39
Compare
Include the routing normalization floor in HyV3 route identities because it changes expert mixing semantics, while regression tests preserve byte-identical fingerprints for legacy and unrelated consumers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4d631b7b-5551-4cbd-bd00-4e53f18bf75e Signed-off-by: Justin Chu <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hy_v3trunk and NextN graph/task implementations from authoritative Tencent Transformers and llama.cpp semantics rather than aliasing a neighboring architectureEvidence
Authoritative semantics were checked against Tencent's official HyV3 Transformers implementation and pinned llama.cpp source. The official checkpoint is approximately 600 GiB (112 shards near 5.36 GiB each), so no representative artifact under the 16 GiB policy limit exists and no payload was pinned or downloaded.
Deferred evidence / waivers
Production routing does not pin, default, reject, or special-case Hugging Face revisions by model ID:
revision=Noneremains normal and arbitrary explicit revisions continue to forward.