@@ -714,6 +714,183 @@ def test_hugging_face_deepseek_v4_registration_remains_valid(self) -> None:
714714 assert try_get_arch_spec ("deepseek4" ).model_type is None
715715
716716
717+ class TestPinnedRemainingConventionalMoECohort :
718+ """Pin the bounded C02 closure without aliasing incompatible MoE graphs."""
719+
720+ _ARCHITECTURES = (
721+ "arctic" ,
722+ "dbrx" ,
723+ "gpt-oss" ,
724+ "grok" ,
725+ "grovemoe" ,
726+ "smallthinker" ,
727+ )
728+ _EXPECTED_TENSOR_COUNTS : ClassVar [dict [str , int ]] = {
729+ "arctic" : 22 ,
730+ "dbrx" : 11 ,
731+ "gpt-oss" : 24 ,
732+ "grok" : 24 ,
733+ "grovemoe" : 23 ,
734+ "smallthinker" : 18 ,
735+ }
736+
737+ @pytest .mark .parametrize ("architecture" , _ARCHITECTURES )
738+ def test_loader_inventory_and_expert_sidecars_are_suffix_exact (
739+ self , architecture : str
740+ ) -> None :
741+ upstream = upstream_architectures ()[architecture ]
742+ names = set (upstream .tensor_names )
743+ assert len (names ) == self ._EXPECTED_TENSOR_COUNTS [architecture ]
744+ assert upstream .expert_tensor_suffixes == ()
745+ suffixes = dict (upstream .tensor_suffixes )
746+ expected_families = {
747+ "output" ,
748+ "blk.{bid}.attn_qkv" ,
749+ "blk.{bid}.attn_output" ,
750+ "blk.{bid}.ffn_gate_exps" ,
751+ "blk.{bid}.ffn_down_exps" ,
752+ "blk.{bid}.ffn_up_exps" ,
753+ }
754+ if architecture != "dbrx" :
755+ expected_families .update (
756+ {
757+ "blk.{bid}.attn_q" ,
758+ "blk.{bid}.attn_k" ,
759+ "blk.{bid}.attn_v" ,
760+ }
761+ )
762+ if architecture in {"arctic" , "grok" }:
763+ expected_families .update (
764+ {
765+ "blk.{bid}.ffn_gate" ,
766+ "blk.{bid}.ffn_down" ,
767+ "blk.{bid}.ffn_up" ,
768+ }
769+ )
770+ if architecture == "grovemoe" :
771+ expected_families .update (
772+ {
773+ "blk.{bid}.ffn_gate_chexps" ,
774+ "blk.{bid}.ffn_down_chexps" ,
775+ "blk.{bid}.ffn_up_chexps" ,
776+ }
777+ )
778+ assert set (suffixes ) == expected_families
779+ projection_suffixes = ("weight" , "scale" , "input_scale" )
780+ biased_projection_suffixes = ("weight" , "bias" , "scale" , "input_scale" )
781+ assert suffixes ["blk.{bid}.attn_qkv" ] == (
782+ projection_suffixes if architecture == "dbrx" else biased_projection_suffixes
783+ )
784+ for family in ("blk.{bid}.attn_q" , "blk.{bid}.attn_k" , "blk.{bid}.attn_v" ):
785+ if architecture != "dbrx" :
786+ assert suffixes [family ] == biased_projection_suffixes
787+ assert suffixes ["blk.{bid}.attn_output" ] == (
788+ biased_projection_suffixes if architecture == "gpt-oss" else projection_suffixes
789+ )
790+ for family in (
791+ "blk.{bid}.ffn_gate_exps" ,
792+ "blk.{bid}.ffn_down_exps" ,
793+ "blk.{bid}.ffn_up_exps" ,
794+ ):
795+ expected = (
796+ biased_projection_suffixes
797+ if architecture == "gpt-oss"
798+ else projection_suffixes
799+ )
800+ assert suffixes [family ] == expected
801+ assert suffixes ["output" ] == projection_suffixes
802+ assert all (name .endswith ((".weight" , ".bias" )) for name in names )
803+ assert {
804+ "blk.{bid}.ffn_gate_exps.weight" ,
805+ "blk.{bid}.ffn_down_exps.weight" ,
806+ "blk.{bid}.ffn_up_exps.weight" ,
807+ } <= names
808+
809+ def test_conditional_and_auxiliary_representations_are_not_conflated (self ) -> None :
810+ arctic = set (upstream_architectures ()["arctic" ].tensor_names )
811+ dbrx = set (upstream_architectures ()["dbrx" ].tensor_names )
812+ gpt_oss = set (upstream_architectures ()["gpt-oss" ].tensor_names )
813+ grok = set (upstream_architectures ()["grok" ].tensor_names )
814+ grove = set (upstream_architectures ()["grovemoe" ].tensor_names )
815+ small = set (upstream_architectures ()["smallthinker" ].tensor_names )
816+
817+ assert "blk.{bid}.ffn_norm_exps.weight" in arctic
818+ assert "blk.{bid}.attn_qkv.weight" in dbrx
819+ assert not {"blk.{bid}.attn_q.weight" , "blk.{bid}.attn_k.weight" } & dbrx
820+ for names in (arctic , gpt_oss , grok , grove , small ):
821+ assert {
822+ "blk.{bid}.attn_qkv.weight" ,
823+ "blk.{bid}.attn_qkv.bias" ,
824+ "blk.{bid}.attn_q.weight" ,
825+ "blk.{bid}.attn_q.bias" ,
826+ "blk.{bid}.attn_k.weight" ,
827+ "blk.{bid}.attn_k.bias" ,
828+ "blk.{bid}.attn_v.weight" ,
829+ "blk.{bid}.attn_v.bias" ,
830+ } <= names
831+ assert "blk.{bid}.attn_sinks.weight" in gpt_oss
832+ assert "blk.{bid}.ffn_gate_exps.bias" in gpt_oss
833+ assert {
834+ "blk.{bid}.layer_output_norm.weight" ,
835+ "blk.{bid}.post_ffw_norm.weight" ,
836+ } <= grok
837+ assert {
838+ "blk.{bid}.ffn_gate_chexps.weight" ,
839+ "blk.{bid}.ffn_down_chexps.weight" ,
840+ "blk.{bid}.ffn_up_chexps.weight" ,
841+ } <= grove
842+ grove_suffixes = dict (upstream_architectures ()["grovemoe" ].tensor_suffixes )
843+ assert grove_suffixes ["blk.{bid}.ffn_gate_chexps" ] == ("weight" ,)
844+ assert grove_suffixes ["blk.{bid}.ffn_down_chexps" ] == ("weight" ,)
845+ assert grove_suffixes ["blk.{bid}.ffn_up_chexps" ] == ("weight" ,)
846+ assert not any ("_chexps." in name for name in small )
847+
848+ @pytest .mark .parametrize ("architecture" , _ARCHITECTURES )
849+ def test_no_false_alias_config_or_tensor_claim_is_reachable (
850+ self , architecture : str
851+ ) -> None :
852+ spec = try_get_arch_spec (architecture )
853+ assert spec is not None
854+ assert not spec .aliases
855+ assert spec .model_type is None
856+ assert spec .config_key_map is None
857+ assert spec .tensor_map_recipe == ()
858+ assert all (verdict is Support .DEFERRED for verdict in spec .verdicts .values ())
859+ assert architecture not in GGUF_ARCH_TO_MODEL_TYPE
860+
861+ @pytest .mark .parametrize (
862+ ("architecture" , "reason_terms" ),
863+ [
864+ ("arctic" , ("dense parallel" , "separately normalized" , "residual topology" )),
865+ ("dbrx" , ("LayerNorm" , "fused QKV" , "clamp" )),
866+ ("gpt-oss" , ("MXFP4" , "expert biases" , "attention sinks" )),
867+ ("grok" , ("softcaps" , "sqrt(2)/2" , "dense-plus-routed" )),
868+ ("grovemoe" , ("separate selections" , "adjugate" , "Q/K RMSNorm" )),
869+ ("smallthinker" , ("unnormalized" , "sigmoid or softmax" , "ReLU" )),
870+ ],
871+ )
872+ def test_graph_and_routing_mismatch_is_explicit (
873+ self , architecture : str , reason_terms : tuple [str , ...]
874+ ) -> None :
875+ reason = try_get_arch_spec (architecture ).reason
876+ assert reason is not None
877+ for term in reason_terms :
878+ assert term in reason
879+
880+ @pytest .mark .parametrize ("architecture" , _ARCHITECTURES )
881+ def test_every_architecture_fails_before_graph_construction (
882+ self , architecture : str
883+ ) -> None :
884+ with pytest .raises (UnsupportedGGUFArchitectureError , match = architecture ):
885+ get_arch_spec (architecture )
886+
887+ def test_valid_hugging_face_registrations_are_not_reused_as_gguf_aliases (self ) -> None :
888+ assert {"arctic" , "dbrx" , "gpt_oss" } <= set (_REGISTRATIONS )
889+ assert try_get_arch_spec ("arctic" ).model_type is None
890+ assert try_get_arch_spec ("dbrx" ).model_type is None
891+ assert try_get_arch_spec ("gpt-oss" ).model_type is None
892+
893+
717894class TestRejectionsAreActionable :
718895 """An unsupported input must say what it is and what to do instead."""
719896
0 commit comments