| 1 |
"""Sprint 40 registry refresh — first 2026 text-family entries.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import pytest |
| 6 |
|
| 7 |
from dlm.base_models import BASE_MODELS |
| 8 |
|
| 9 |
_QWEN3_KEYS = ("qwen3-1.7b", "qwen3-4b", "qwen3-8b") |
| 10 |
|
| 11 |
|
| 12 |
class TestQwen3RegistryEntries: |
| 13 |
@pytest.mark.parametrize("key", _QWEN3_KEYS) |
| 14 |
def test_entry_present(self, key: str) -> None: |
| 15 |
assert key in BASE_MODELS |
| 16 |
|
| 17 |
@pytest.mark.parametrize("key", _QWEN3_KEYS) |
| 18 |
def test_qwen3_family_uses_expected_architecture(self, key: str) -> None: |
| 19 |
spec = BASE_MODELS[key] |
| 20 |
assert spec.architecture == "Qwen3ForCausalLM" |
| 21 |
assert spec.template == "chatml" |
| 22 |
assert spec.gguf_arch == "qwen3" |
| 23 |
assert spec.tokenizer_pre == "qwen2" |
| 24 |
|
| 25 |
@pytest.mark.parametrize("key", _QWEN3_KEYS) |
| 26 |
def test_qwen3_family_is_open_and_reasoning_tuned(self, key: str) -> None: |
| 27 |
spec = BASE_MODELS[key] |
| 28 |
assert spec.license_spdx == "Apache-2.0" |
| 29 |
assert spec.requires_acceptance is False |
| 30 |
assert spec.redistributable is True |
| 31 |
assert spec.reasoning_tuned is True |
| 32 |
assert spec.suggested_prompt_temperature == pytest.approx(0.6) |
| 33 |
|
| 34 |
def test_qwen3_8b_uses_upper_bound_size_hint(self) -> None: |
| 35 |
spec = BASE_MODELS["qwen3-8b"] |
| 36 |
assert spec.params == 8_000_000_000 |
| 37 |
assert spec.size_gb_fp16 == pytest.approx(16.0) |
| 38 |
|
| 39 |
|
| 40 |
class TestQwen3ThinkingRegistryEntry: |
| 41 |
def test_entry_present(self) -> None: |
| 42 |
assert "qwen3-1.7b-thinking" in BASE_MODELS |
| 43 |
|
| 44 |
def test_reuses_live_qwen3_weights_with_reasoning_profile(self) -> None: |
| 45 |
spec = BASE_MODELS["qwen3-1.7b-thinking"] |
| 46 |
assert spec.hf_id == "Qwen/Qwen3-1.7B" |
| 47 |
assert spec.architecture == "Qwen3ForCausalLM" |
| 48 |
assert spec.template == "qwen3thinking" |
| 49 |
assert spec.gguf_arch == "qwen3" |
| 50 |
assert spec.tokenizer_pre == "qwen2" |
| 51 |
|
| 52 |
def test_reasoning_profile_keeps_open_license_and_cooler_default(self) -> None: |
| 53 |
spec = BASE_MODELS["qwen3-1.7b-thinking"] |
| 54 |
assert spec.license_spdx == "Apache-2.0" |
| 55 |
assert spec.requires_acceptance is False |
| 56 |
assert spec.redistributable is True |
| 57 |
assert spec.reasoning_tuned is True |
| 58 |
assert spec.suggested_prompt_temperature == pytest.approx(0.6) |
| 59 |
|
| 60 |
|
| 61 |
class TestLlama33RegistryEntry: |
| 62 |
def test_entry_present(self) -> None: |
| 63 |
assert "llama-3.3-8b-instruct" in BASE_MODELS |
| 64 |
|
| 65 |
def test_keeps_existing_llama_policy_surface(self) -> None: |
| 66 |
spec = BASE_MODELS["llama-3.3-8b-instruct"] |
| 67 |
assert spec.hf_id == "allura-forge/Llama-3.3-8B-Instruct" |
| 68 |
assert spec.architecture == "LlamaForCausalLM" |
| 69 |
assert spec.template == "llama3" |
| 70 |
assert spec.gguf_arch == "llama" |
| 71 |
assert spec.requires_acceptance is True |
| 72 |
assert spec.redistributable is False |
| 73 |
assert spec.license_spdx == "Other" |
| 74 |
|
| 75 |
def test_refreshes_against_mirror_plus_official_provenance_page(self) -> None: |
| 76 |
spec = BASE_MODELS["llama-3.3-8b-instruct"] |
| 77 |
assert spec.refresh_check_hf_gating is False |
| 78 |
assert spec.provenance_url == ( |
| 79 |
"https://about.fb.com/br/news/2025/04/tudo-o-que-anunciamos-no-nosso-primeiro-llamacon/" |
| 80 |
) |
| 81 |
assert spec.provenance_match_text == "novo modelo Llama 3.3 8B" |
| 82 |
|
| 83 |
def test_effective_context_hint_is_lower_than_nominal(self) -> None: |
| 84 |
spec = BASE_MODELS["llama-3.3-8b-instruct"] |
| 85 |
assert spec.context_length == 131_072 |
| 86 |
assert spec.context_length_effective == 8_192 |
| 87 |
assert spec.effective_context_length == 8_192 |
| 88 |
|
| 89 |
def test_license_url_uses_current_meta_landing_page(self) -> None: |
| 90 |
spec = BASE_MODELS["llama-3.3-8b-instruct"] |
| 91 |
assert spec.license_url == "https://llama.meta.com/llama3/license" |
| 92 |
|
| 93 |
|
| 94 |
class TestSmolLM3RegistryEntry: |
| 95 |
def test_entry_present(self) -> None: |
| 96 |
assert "smollm3-3b" in BASE_MODELS |
| 97 |
|
| 98 |
def test_live_hf_id_and_architecture_match_current_release(self) -> None: |
| 99 |
spec = BASE_MODELS["smollm3-3b"] |
| 100 |
assert spec.hf_id == "HuggingFaceTB/SmolLM3-3B" |
| 101 |
assert spec.architecture == "SmolLM3ForCausalLM" |
| 102 |
assert spec.template == "smollm3" |
| 103 |
assert spec.gguf_arch == "llama" |
| 104 |
assert spec.tokenizer_pre == "smollm" |
| 105 |
|
| 106 |
def test_entry_tracks_reasoning_first_defaults(self) -> None: |
| 107 |
spec = BASE_MODELS["smollm3-3b"] |
| 108 |
assert spec.reasoning_tuned is True |
| 109 |
assert spec.suggested_prompt_temperature == pytest.approx(0.6) |
| 110 |
|
| 111 |
def test_entry_is_open_and_long_context(self) -> None: |
| 112 |
spec = BASE_MODELS["smollm3-3b"] |
| 113 |
assert spec.license_spdx == "Apache-2.0" |
| 114 |
assert spec.requires_acceptance is False |
| 115 |
assert spec.redistributable is True |
| 116 |
assert spec.context_length == 65_536 |
| 117 |
assert spec.recommended_seq_len == 4096 |
| 118 |
|
| 119 |
|
| 120 |
class TestOlmo2RegistryEntry: |
| 121 |
def test_entry_present(self) -> None: |
| 122 |
assert "olmo-2-7b-instruct" in BASE_MODELS |
| 123 |
|
| 124 |
def test_live_hf_id_and_architecture_match_current_release(self) -> None: |
| 125 |
spec = BASE_MODELS["olmo-2-7b-instruct"] |
| 126 |
assert spec.hf_id == "allenai/OLMo-2-1124-7B-Instruct" |
| 127 |
assert spec.architecture == "Olmo2ForCausalLM" |
| 128 |
assert spec.template == "olmo2" |
| 129 |
assert spec.gguf_arch == "olmo2" |
| 130 |
assert spec.tokenizer_pre == "superbpe" |
| 131 |
|
| 132 |
def test_entry_is_open_without_reasoning_override(self) -> None: |
| 133 |
spec = BASE_MODELS["olmo-2-7b-instruct"] |
| 134 |
assert spec.license_spdx == "Apache-2.0" |
| 135 |
assert spec.requires_acceptance is False |
| 136 |
assert spec.redistributable is True |
| 137 |
assert spec.reasoning_tuned is False |
| 138 |
|
| 139 |
def test_entry_uses_model_card_context_and_size_hints(self) -> None: |
| 140 |
spec = BASE_MODELS["olmo-2-7b-instruct"] |
| 141 |
assert spec.params == 7_000_000_000 |
| 142 |
assert spec.size_gb_fp16 == pytest.approx(14.6) |
| 143 |
assert spec.context_length == 4096 |
| 144 |
assert spec.recommended_seq_len == 2048 |
| 145 |
|
| 146 |
|
| 147 |
class TestGemma2RegistryEntry: |
| 148 |
@pytest.mark.parametrize("key", ["gemma-2-2b-it", "gemma-2-9b-it"]) |
| 149 |
def test_entry_present(self, key: str) -> None: |
| 150 |
assert key in BASE_MODELS |
| 151 |
|
| 152 |
@pytest.mark.parametrize( |
| 153 |
("key", "hf_id", "params", "size_gb_fp16"), |
| 154 |
[ |
| 155 |
("gemma-2-2b-it", "google/gemma-2-2b-it", 2_600_000_000, 5.2), |
| 156 |
("gemma-2-9b-it", "google/gemma-2-9b-it", 9_000_000_000, 18.0), |
| 157 |
], |
| 158 |
) |
| 159 |
def test_live_hf_id_and_architecture_match_current_release( |
| 160 |
self, |
| 161 |
key: str, |
| 162 |
hf_id: str, |
| 163 |
params: int, |
| 164 |
size_gb_fp16: float, |
| 165 |
) -> None: |
| 166 |
spec = BASE_MODELS[key] |
| 167 |
assert spec.hf_id == hf_id |
| 168 |
assert spec.architecture == "Gemma2ForCausalLM" |
| 169 |
assert spec.template == "gemma2" |
| 170 |
assert spec.gguf_arch == "gemma2" |
| 171 |
assert spec.tokenizer_pre == "gemma" |
| 172 |
assert spec.params == params |
| 173 |
assert spec.size_gb_fp16 == pytest.approx(size_gb_fp16) |
| 174 |
|
| 175 |
@pytest.mark.parametrize("key", ["gemma-2-2b-it", "gemma-2-9b-it"]) |
| 176 |
def test_entry_follows_gemma_gating_pattern(self, key: str) -> None: |
| 177 |
spec = BASE_MODELS[key] |
| 178 |
assert spec.license_spdx == "Gemma" |
| 179 |
assert spec.license_url == "https://ai.google.dev/gemma/terms" |
| 180 |
assert spec.requires_acceptance is True |
| 181 |
assert spec.redistributable is False |
| 182 |
|
| 183 |
@pytest.mark.parametrize("key", ["gemma-2-2b-it", "gemma-2-9b-it"]) |
| 184 |
def test_entry_uses_model_card_context_hints(self, key: str) -> None: |
| 185 |
spec = BASE_MODELS[key] |
| 186 |
assert spec.context_length == 8192 |
| 187 |
assert spec.recommended_seq_len == 2048 |
| 188 |
|
| 189 |
|
| 190 |
class TestPhi4MiniReasoningRegistryEntry: |
| 191 |
def test_entry_present(self) -> None: |
| 192 |
assert "phi-4-mini-reasoning" in BASE_MODELS |
| 193 |
|
| 194 |
def test_live_hf_id_and_architecture_match_current_release(self) -> None: |
| 195 |
spec = BASE_MODELS["phi-4-mini-reasoning"] |
| 196 |
assert spec.hf_id == "microsoft/Phi-4-mini-reasoning" |
| 197 |
assert spec.architecture == "Phi3ForCausalLM" |
| 198 |
assert spec.template == "phi4mini" |
| 199 |
assert spec.gguf_arch == "phi3" |
| 200 |
assert spec.tokenizer_pre == "phi-2" |
| 201 |
|
| 202 |
def test_entry_is_reasoning_tuned_and_open(self) -> None: |
| 203 |
spec = BASE_MODELS["phi-4-mini-reasoning"] |
| 204 |
assert spec.license_spdx == "MIT" |
| 205 |
assert spec.requires_acceptance is False |
| 206 |
assert spec.redistributable is True |
| 207 |
assert spec.reasoning_tuned is True |
| 208 |
assert spec.suggested_prompt_temperature == pytest.approx(0.6) |
| 209 |
|
| 210 |
def test_entry_uses_model_card_context_and_size_hints(self) -> None: |
| 211 |
spec = BASE_MODELS["phi-4-mini-reasoning"] |
| 212 |
assert spec.params == 3_800_000_000 |
| 213 |
assert spec.size_gb_fp16 == pytest.approx(7.6) |
| 214 |
assert spec.context_length == 131_072 |
| 215 |
assert spec.recommended_seq_len == 2048 |
| 216 |
|
| 217 |
|
| 218 |
class TestMixtralRegistryEntry: |
| 219 |
def test_entry_present(self) -> None: |
| 220 |
assert "mixtral-8x7b-instruct" in BASE_MODELS |
| 221 |
|
| 222 |
def test_entry_is_open_sparse_moe(self) -> None: |
| 223 |
spec = BASE_MODELS["mixtral-8x7b-instruct"] |
| 224 |
assert spec.license_spdx == "Apache-2.0" |
| 225 |
assert spec.requires_acceptance is False |
| 226 |
assert spec.redistributable is True |
| 227 |
assert spec.modality == "text-moe" |
| 228 |
|
| 229 |
def test_entry_matches_live_family_shape(self) -> None: |
| 230 |
spec = BASE_MODELS["mixtral-8x7b-instruct"] |
| 231 |
assert spec.hf_id == "mistralai/Mixtral-8x7B-Instruct-v0.1" |
| 232 |
assert spec.architecture == "MixtralForCausalLM" |
| 233 |
assert spec.template == "mistral" |
| 234 |
assert spec.gguf_arch == "llama" |
| 235 |
assert spec.tokenizer_pre == "llama-bpe" |
| 236 |
|
| 237 |
def test_entry_uses_total_parameter_and_context_hints(self) -> None: |
| 238 |
spec = BASE_MODELS["mixtral-8x7b-instruct"] |
| 239 |
assert spec.params == 46_700_000_000 |
| 240 |
assert spec.size_gb_fp16 == pytest.approx(93.4) |
| 241 |
assert spec.context_length == 32_768 |
| 242 |
assert spec.recommended_seq_len == 2048 |
| 243 |
|
| 244 |
|
| 245 |
class TestInternVL3RegistryEntry: |
| 246 |
def test_entry_present(self) -> None: |
| 247 |
assert "internvl3-2b" in BASE_MODELS |
| 248 |
|
| 249 |
def test_entry_keeps_remote_code_contract_explicit(self) -> None: |
| 250 |
spec = BASE_MODELS["internvl3-2b"] |
| 251 |
assert spec.hf_id == "OpenGVLab/InternVL3-2B" |
| 252 |
assert spec.architecture == "InternVLChatModel" |
| 253 |
assert spec.template == "internvl2" |
| 254 |
assert spec.trust_remote_code is True |
| 255 |
|
| 256 |
def test_entry_is_registry_visible_but_not_pretending_runtime_is_generic(self) -> None: |
| 257 |
spec = BASE_MODELS["internvl3-2b"] |
| 258 |
assert spec.license_spdx == "Apache-2.0" |
| 259 |
assert spec.requires_acceptance is False |
| 260 |
assert spec.redistributable is True |
| 261 |
assert spec.modality == "vision-language" |
| 262 |
assert spec.vl_preprocessor_plan is not None |
| 263 |
assert spec.vl_preprocessor_plan.resize_policy == "dynamic" |
| 264 |
assert spec.vl_preprocessor_plan.image_token == "<image>" |