Spaces:
Running on Zero
Running on Zero
File size: 25,244 Bytes
e25024e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | """Tests for architecture-aware preset defaults.
Tests the detection logic and recommended parameter overrides for each
architecture class (dense/MoE, standard/reasoning).
"""
from __future__ import annotations
from obliteratus.architecture_profiles import (
ArchitectureClass,
ArchitectureProfile,
ReasoningClass,
detect_architecture,
get_profile_summary,
apply_profile_to_method_config,
)
# ---------------------------------------------------------------------------
# Detection: Dense models
# ---------------------------------------------------------------------------
class TestDenseDetection:
"""Test that standard dense models are correctly classified."""
def test_llama_is_dense(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.arch_class == ArchitectureClass.DENSE
assert profile.reasoning_class == ReasoningClass.STANDARD
assert not profile.is_moe
def test_qwen_dense_is_dense(self):
profile = detect_architecture("Qwen/Qwen2.5-7B-Instruct")
assert profile.arch_class == ArchitectureClass.DENSE
assert not profile.is_moe
def test_gemma_is_dense(self):
profile = detect_architecture("google/gemma-3-27b-it")
assert profile.arch_class == ArchitectureClass.DENSE
def test_phi_is_dense(self):
profile = detect_architecture("microsoft/Phi-4-mini-instruct")
assert profile.arch_class == ArchitectureClass.DENSE
def test_mistral_small_is_dense(self):
profile = detect_architecture("mistralai/Mistral-Small-24B-Instruct-2501")
assert profile.arch_class == ArchitectureClass.DENSE
def test_yi_is_dense(self):
profile = detect_architecture("01-ai/Yi-1.5-9B-Chat")
assert profile.arch_class == ArchitectureClass.DENSE
def test_dense_label(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.profile_label == "Dense Standard"
def test_dense_recommended_method(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.recommended_method == "aggressive"
# ---------------------------------------------------------------------------
# Detection: MoE models
# ---------------------------------------------------------------------------
class TestMoEDetection:
"""Test that MoE models are correctly classified."""
def test_gpt_oss_is_moe(self):
"""GPT-OSS is MoE. Without config, defaults to small (conservative)."""
profile = detect_architecture("openai/gpt-oss-20b")
assert profile.is_moe
assert profile.arch_class == ArchitectureClass.SMALL_MOE
def test_qwen3_30b_is_small_moe(self):
profile = detect_architecture("Qwen/Qwen3-30B-A3B")
assert profile.is_moe
def test_deepseek_v3_is_large_moe(self):
profile = detect_architecture("deepseek-ai/DeepSeek-V3.2")
assert profile.is_moe
def test_kimi_k2_is_large_moe(self):
profile = detect_architecture("moonshotai/Kimi-K2-Instruct")
assert profile.is_moe
def test_qwen3_235b_is_moe(self):
profile = detect_architecture("Qwen/Qwen3-235B-A22B")
assert profile.is_moe
def test_glm_47_is_moe(self):
profile = detect_architecture("zai-org/GLM-4.7")
assert profile.is_moe
def test_llama4_maverick_is_moe(self):
profile = detect_architecture("meta-llama/Llama-4-Maverick-17B-128E-Instruct")
assert profile.is_moe
def test_step_flash_is_moe(self):
profile = detect_architecture("stepfun-ai/Step-3.5-Flash")
assert profile.is_moe
def test_minimax_is_moe(self):
profile = detect_architecture("MiniMaxAI/MiniMax-M2.1")
assert profile.is_moe
def test_mistral_large_3_is_moe(self):
profile = detect_architecture("mistralai/Mistral-Large-3-675B-Instruct-2512")
assert profile.is_moe
def test_moe_recommended_method_is_surgical(self):
"""All MoE profiles recommend surgical method."""
profile = detect_architecture("openai/gpt-oss-20b")
assert profile.recommended_method == "surgical"
def test_gpt_oss_with_config_is_small_moe(self):
"""GPT-OSS with config providing expert count → small MoE."""
class MockConfig:
model_type = "gpt_neox"
num_hidden_layers = 32
hidden_size = 2560
intermediate_size = 6912
vocab_size = 50304
num_local_experts = 8
num_experts_per_tok = 2
profile = detect_architecture("openai/gpt-oss-20b", config=MockConfig())
assert profile.is_moe
assert profile.arch_class == ArchitectureClass.SMALL_MOE
# ---------------------------------------------------------------------------
# Detection: Reasoning models
# ---------------------------------------------------------------------------
class TestReasoningDetection:
"""Test that reasoning models are correctly classified."""
def test_r1_distill_qwen_is_reasoning(self):
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
assert profile.reasoning_class == ReasoningClass.REASONING
def test_r1_distill_llama_is_reasoning(self):
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Llama-8B")
assert profile.reasoning_class == ReasoningClass.REASONING
def test_r1_distill_is_dense_reasoning(self):
"""R1 distills are dense (distilled from MoE into dense)."""
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-14B")
assert profile.arch_class == ArchitectureClass.DENSE
assert profile.reasoning_class == ReasoningClass.REASONING
assert profile.profile_label == "Dense Reasoning"
def test_olmo_think_is_reasoning(self):
profile = detect_architecture("allenai/Olmo-3.1-32B-Think")
assert profile.reasoning_class == ReasoningClass.REASONING
def test_olmo_standard_is_not_reasoning(self):
"""OLMo (without Think) must NOT be classified as reasoning.
Regression test: 'olmo' contains 'o1' substring."""
profile = detect_architecture("allenai/Olmo-3-7B-Instruct")
assert profile.reasoning_class == ReasoningClass.STANDARD
def test_falcon3_is_not_reasoning(self):
"""falcon3 must NOT match 'o3' reasoning pattern."""
profile = detect_architecture("tiiuae/Falcon3-7B-Instruct")
assert profile.reasoning_class == ReasoningClass.STANDARD
def test_full_r1_is_moe_reasoning(self):
profile = detect_architecture("deepseek-ai/DeepSeek-R1")
assert profile.is_moe
assert profile.reasoning_class == ReasoningClass.REASONING
def test_reasoning_dense_more_directions(self):
"""Dense reasoning models need more directions (>=12) to span refusal."""
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
assert profile.arch_class == ArchitectureClass.DENSE
assert profile.method_overrides.get("n_directions", 0) >= 12
def test_reasoning_dense_more_passes(self):
"""Dense reasoning models need more refinement passes (>=4)."""
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
assert profile.arch_class == ArchitectureClass.DENSE
assert profile.method_overrides.get("refinement_passes", 0) >= 4
def test_non_reasoning_is_standard(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.reasoning_class == ReasoningClass.STANDARD
# ---------------------------------------------------------------------------
# Detection with config object
# ---------------------------------------------------------------------------
class TestConfigDetection:
"""Test detection when a mock config is provided."""
def test_moe_config_attrs(self):
"""Config with num_local_experts should be detected as MoE."""
class MockConfig:
model_type = "mixtral"
num_hidden_layers = 32
hidden_size = 4096
intermediate_size = 14336
vocab_size = 32000
num_local_experts = 8
num_experts_per_tok = 2
profile = detect_architecture(
"custom/mixtral-model", config=MockConfig(),
num_layers=32, hidden_size=4096,
)
assert profile.is_moe
assert profile.num_experts == 8
assert profile.num_active_experts == 2
def test_large_moe_threshold(self):
"""MoE models with >100B params should be classified as large."""
class MockConfig:
model_type = "deepseek_v3"
num_hidden_layers = 61
hidden_size = 7168
intermediate_size = 18432
vocab_size = 102400
n_routed_experts = 256
num_experts_per_tok = 8
profile = detect_architecture(
"custom/large-moe", config=MockConfig(),
)
assert profile.arch_class == ArchitectureClass.LARGE_MOE
def test_small_moe_threshold(self):
"""MoE models with <=16 experts should be classified as small."""
class MockConfig:
model_type = "mixtral"
num_hidden_layers = 32
hidden_size = 4096
intermediate_size = 14336
vocab_size = 32000
num_local_experts = 8
num_experts_per_tok = 2
profile = detect_architecture(
"custom/small-moe", config=MockConfig(),
)
assert profile.arch_class == ArchitectureClass.SMALL_MOE
def test_dense_config(self):
"""Config without MoE attributes should be dense."""
class MockConfig:
model_type = "llama"
num_hidden_layers = 32
hidden_size = 4096
intermediate_size = 11008
vocab_size = 32000
profile = detect_architecture(
"custom/dense-model", config=MockConfig(),
)
assert profile.arch_class == ArchitectureClass.DENSE
assert not profile.is_moe
def test_llama4_scout_is_large_moe(self):
"""Llama 4 Scout: 109B total params with 16 experts → LARGE_MOE.
Regression test: params > 100B must override low expert count."""
class MockConfig:
model_type = "llama4"
num_hidden_layers = 48
hidden_size = 5120
intermediate_size = 14336
vocab_size = 202048
num_local_experts = 16
num_experts_per_tok = 1
profile = detect_architecture(
"meta-llama/Llama-4-Scout-17B-16E-Instruct",
config=MockConfig(),
)
assert profile.is_moe
assert profile.arch_class == ArchitectureClass.LARGE_MOE
# ---------------------------------------------------------------------------
# Recommended defaults validation
# ---------------------------------------------------------------------------
class TestRecommendedDefaults:
"""Test that recommended defaults match research findings."""
def test_dense_standard_no_riemannian(self):
"""Dense Standard: Riemannian OFF (manifolds are flat)."""
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert not profile.breakthrough_modules.get("riemannian", True)
def test_dense_standard_anti_ouroboros_on(self):
"""Dense Standard: Anti-Ouroboros ON for self-repair mapping."""
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.breakthrough_modules.get("anti_ouroboros", False)
def test_dense_standard_spectral_cert_on(self):
"""Dense Standard: Spectral cert ON for verification."""
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert profile.breakthrough_modules.get("spectral_cert", False)
def test_moe_conditional_on(self):
"""MoE: Conditional abliteration is #1 technique (Cracken AI 2025)."""
profile = detect_architecture("openai/gpt-oss-20b")
assert profile.breakthrough_modules.get("conditional", False)
def test_moe_no_project_embeddings(self):
"""MoE: Project embeddings OFF (cascades through router)."""
profile = detect_architecture("openai/gpt-oss-20b")
assert not profile.method_overrides.get("project_embeddings", True)
def test_moe_per_expert_directions(self):
"""MoE: Per-expert directions ON (global directions fail on MoE)."""
profile = detect_architecture("openai/gpt-oss-20b")
assert profile.method_overrides.get("per_expert_directions", False)
def test_large_moe_riemannian_on(self):
"""Large MoE: Riemannian ON (curved shared layer geometry)."""
profile = detect_architecture("deepseek-ai/DeepSeek-V3.2")
assert profile.breakthrough_modules.get("riemannian", False)
def test_reasoning_dense_jailbreak_contrast(self):
"""Reasoning Dense: Jailbreak contrast ON for thinking-chain refusal."""
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
assert profile.method_overrides.get("use_jailbreak_contrast", False)
def test_reasoning_moe_gentle_transplant(self):
"""Reasoning MoE: transplant_blend very low (preserve reasoning)."""
profile = detect_architecture("deepseek-ai/DeepSeek-R1")
assert profile.method_overrides.get("transplant_blend", 1.0) <= 0.10
# ---------------------------------------------------------------------------
# Profile summary
# ---------------------------------------------------------------------------
class TestProfileSummary:
"""Test the human-readable profile summary."""
def test_summary_contains_profile_label(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
summary = get_profile_summary(profile)
assert "Dense Standard" in summary
def test_summary_contains_method(self):
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
summary = get_profile_summary(profile)
assert "aggressive" in summary
def test_summary_contains_citations(self):
profile = detect_architecture("openai/gpt-oss-20b")
summary = get_profile_summary(profile)
assert "SAFEx" in summary or "Cracken" in summary
def test_summary_contains_moe_info(self):
profile = detect_architecture("openai/gpt-oss-20b")
summary = get_profile_summary(profile)
assert "MoE" in summary
def test_summary_contains_breakthrough_modules(self):
profile = detect_architecture("openai/gpt-oss-20b")
summary = get_profile_summary(profile)
assert "conditional" in summary
# ---------------------------------------------------------------------------
# apply_profile_to_method_config
# ---------------------------------------------------------------------------
class TestApplyProfile:
"""Test that profile overrides are correctly applied to method configs."""
def test_overrides_applied(self):
from obliteratus.abliterate import METHODS
profile = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
base = dict(METHODS["aggressive"])
merged = apply_profile_to_method_config(profile, base)
assert merged["n_directions"] == profile.method_overrides["n_directions"]
def test_non_overridden_preserved(self):
from obliteratus.abliterate import METHODS
profile = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
base = dict(METHODS["aggressive"])
merged = apply_profile_to_method_config(profile, base)
# norm_preserve is not in overrides, should come from base
assert merged["norm_preserve"] == base["norm_preserve"]
def test_empty_overrides(self):
from obliteratus.abliterate import METHODS
base = dict(METHODS["advanced"])
profile = ArchitectureProfile(
arch_class=ArchitectureClass.DENSE,
reasoning_class=ReasoningClass.STANDARD,
method_overrides={},
breakthrough_modules={},
)
merged = apply_profile_to_method_config(profile, base)
assert merged == base
def test_override_key_not_in_base_is_added(self):
"""Override keys absent from base config should be added to result.
This is important for the UI auto-detect path: keys like
use_jailbreak_contrast may not exist in the base method config
but are valid pipeline parameters that app.py reads via merged.get().
"""
from obliteratus.abliterate import METHODS
base = dict(METHODS["advanced"])
profile = ArchitectureProfile(
arch_class=ArchitectureClass.DENSE,
reasoning_class=ReasoningClass.STANDARD,
method_overrides={"use_jailbreak_contrast": True},
breakthrough_modules={},
)
merged = apply_profile_to_method_config(profile, base)
assert merged["use_jailbreak_contrast"] is True
# ---------------------------------------------------------------------------
# All 6 profile combinations
# ---------------------------------------------------------------------------
class TestAllSixProfiles:
"""Verify label, method, overrides, and breakthrough modules for each profile."""
def _make_moe_config(self, num_experts=8, active=2, layers=32, hidden=4096):
class C:
model_type = "mixtral"
num_hidden_layers = layers
hidden_size = hidden
intermediate_size = hidden * 4
vocab_size = 32000
num_local_experts = num_experts
num_experts_per_tok = active
return C()
def test_dense_standard_full(self):
p = detect_architecture("meta-llama/Llama-3.1-8B-Instruct")
assert p.profile_label == "Dense Standard"
assert p.recommended_method == "aggressive"
assert not p.breakthrough_modules["riemannian"]
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["spectral_cert"]
assert not p.breakthrough_modules["conditional"]
assert len(p.profile_description) > 0
assert len(p.research_citations) > 0
def test_dense_reasoning_full(self):
p = detect_architecture("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
assert p.profile_label == "Dense Reasoning"
assert p.recommended_method == "aggressive"
assert p.method_overrides["n_directions"] >= 12
assert p.method_overrides["refinement_passes"] >= 4
assert p.method_overrides["use_jailbreak_contrast"] is True
assert p.method_overrides["use_chat_template"] is True
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["riemannian"]
assert p.breakthrough_modules["conditional"]
assert p.breakthrough_modules["spectral_cert"]
assert len(p.profile_description) > 0
def test_small_moe_standard_full(self):
config = self._make_moe_config(num_experts=8, active=2)
p = detect_architecture("custom/small-moe-model", config=config)
assert p.profile_label == "Small MoE Standard"
assert p.arch_class == ArchitectureClass.SMALL_MOE
assert p.recommended_method == "surgical"
assert p.method_overrides["per_expert_directions"] is True
assert p.method_overrides["invert_refusal"] is False
assert p.method_overrides["project_embeddings"] is False
assert p.breakthrough_modules["conditional"]
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["spectral_cert"]
assert not p.breakthrough_modules["riemannian"]
assert len(p.profile_description) > 0
def test_small_moe_reasoning_full(self):
"""The most fragile combination: MoE + reasoning."""
config = self._make_moe_config(num_experts=8, active=2)
# Add "think" to name to trigger reasoning detection
p = detect_architecture("custom/small-moe-think-model", config=config)
assert p.profile_label == "Small MoE Reasoning"
assert p.arch_class == ArchitectureClass.SMALL_MOE
assert p.reasoning_class == ReasoningClass.REASONING
assert p.recommended_method == "surgical"
assert p.method_overrides["per_expert_directions"] is True
assert p.method_overrides["use_jailbreak_contrast"] is True
assert p.method_overrides["use_chat_template"] is True
assert p.method_overrides["invert_refusal"] is False
assert p.breakthrough_modules["conditional"]
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["spectral_cert"]
assert len(p.profile_description) > 0
def test_large_moe_standard_full(self):
config = self._make_moe_config(num_experts=256, active=8, layers=61, hidden=7168)
p = detect_architecture("custom/large-moe-model", config=config)
assert p.profile_label == "Large MoE Standard"
assert p.arch_class == ArchitectureClass.LARGE_MOE
assert p.recommended_method == "surgical"
assert p.method_overrides["per_expert_directions"] is True
assert p.method_overrides["layer_adaptive_strength"] is True
assert p.method_overrides["expert_transplant"] is True
assert p.method_overrides["transplant_blend"] == 0.10
assert p.method_overrides["attention_head_surgery"] is True
assert p.method_overrides["project_embeddings"] is False
assert p.breakthrough_modules["conditional"]
assert p.breakthrough_modules["riemannian"]
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["spectral_cert"]
assert len(p.profile_description) > 0
def test_large_moe_reasoning_full(self):
config = self._make_moe_config(num_experts=256, active=8, layers=61, hidden=7168)
p = detect_architecture("custom/large-moe-r1-model", config=config)
assert p.profile_label == "Large MoE Reasoning"
assert p.arch_class == ArchitectureClass.LARGE_MOE
assert p.reasoning_class == ReasoningClass.REASONING
assert p.recommended_method == "surgical"
assert p.method_overrides["n_directions"] == 8
assert p.method_overrides["transplant_blend"] == 0.08
assert p.method_overrides["use_jailbreak_contrast"] is True
assert p.method_overrides["safety_neuron_masking"] is True
assert p.breakthrough_modules["conditional"]
assert p.breakthrough_modules["riemannian"]
assert p.breakthrough_modules["anti_ouroboros"]
assert p.breakthrough_modules["spectral_cert"]
assert len(p.profile_description) > 0
# ---------------------------------------------------------------------------
# Edge cases
# ---------------------------------------------------------------------------
class TestEdgeCases:
"""Edge cases for architecture detection."""
def test_empty_model_name(self):
"""Empty string should fall through to Dense Standard."""
profile = detect_architecture("")
assert profile.arch_class == ArchitectureClass.DENSE
assert profile.reasoning_class == ReasoningClass.STANDARD
def test_unknown_model_type_in_config(self):
"""Unknown model_type should not cause MoE classification."""
class MockConfig:
model_type = "banana"
num_hidden_layers = 12
hidden_size = 768
intermediate_size = 3072
vocab_size = 30522
profile = detect_architecture("custom/unknown-arch", config=MockConfig())
assert profile.arch_class == ArchitectureClass.DENSE
def test_config_with_zero_experts(self):
"""num_local_experts=0 should not trigger MoE."""
class MockConfig:
model_type = "llama"
num_hidden_layers = 32
hidden_size = 4096
intermediate_size = 11008
vocab_size = 32000
num_local_experts = 0
profile = detect_architecture("custom/dense-with-zero", config=MockConfig())
assert not profile.is_moe
assert profile.arch_class == ArchitectureClass.DENSE
def test_allcaps_model_name(self):
"""Case-insensitive matching should work for all-caps names."""
profile = detect_architecture("DEEPSEEK-AI/DEEPSEEK-R1-DISTILL-QWEN-7B")
assert profile.reasoning_class == ReasoningClass.REASONING
assert profile.arch_class == ArchitectureClass.DENSE # distill = dense
def test_single_expert_is_moe(self):
"""num_local_experts=1 is technically MoE (single expert)."""
class MockConfig:
model_type = "llama"
num_hidden_layers = 32
hidden_size = 4096
intermediate_size = 11008
vocab_size = 32000
num_local_experts = 1
profile = detect_architecture("custom/single-expert", config=MockConfig())
# 1 expert still triggers MoE detection (the code treats any >0 as MoE)
assert profile.is_moe
|