Personal AI, On Personal Devices
Python
fix(models): classify small Qwen3.5 checkpoints as dense (#1041)
Elliot Slusky0a418f235015
diff --git a/src/openjarvis/core/config.py b/src/openjarvis/core/config.pyindex 212153c3..b3a073a9 100644--- a/src/openjarvis/core/config.py+++ b/src/openjarvis/core/config.py@@ -297,8 +297,7 @@ def _available_memory_gb(hw: HardwareInfo) -> float:# Explicit tier table: (max_ram_gb, model_id).# Walked in order — first tier where available_gb <= max_ram is chosen.-# Uses Qwen3.5 MoE models — better quality per GB than dense models since-# only a fraction of parameters are active per token.+# Uses dense Qwen3.5 models at increasing parameter sizes._MODEL_TIERS = [(8, "qwen3.5:2b"),(16, "qwen3.5:4b"),diff --git a/src/openjarvis/intelligence/model_catalog.py b/src/openjarvis/intelligence/model_catalog.pyindex 8630cf09..62507cc2 100644--- a/src/openjarvis/intelligence/model_catalog.py+++ b/src/openjarvis/intelligence/model_catalog.py@@ -98,18 +98,17 @@ BUILTIN_MODELS: List[ModelSpec] = [},),# ------------------------------------------------------------------------ # Local models — Qwen3.5 (MoE)+ # Local models — Qwen3.5 (dense and MoE)# -----------------------------------------------------------------------ModelSpec(model_id="qwen3.5:0.8b",name="Qwen3.5 0.8B",parameter_count_b=0.8,- active_parameter_count_b=0.15,context_length=131072,supported_engines=("ollama", "vllm", "llamacpp", "sglang", "mlx"),provider="alibaba",metadata={- "architecture": "moe",+ "architecture": "dense","hf_repo": "Qwen/Qwen3.5-0.8B","mlx_repo": "mlx-community/Qwen3.5-0.8B-OptiQ-4bit",},@@ -118,12 +117,11 @@ BUILTIN_MODELS: List[ModelSpec] = [model_id="qwen3.5:2b",name="Qwen3.5 2B",parameter_count_b=2.0,- active_parameter_count_b=0.4,context_length=131072,supported_engines=("ollama", "vllm", "llamacpp", "sglang", "mlx"),provider="alibaba",metadata={- "architecture": "moe",+ "architecture": "dense","hf_repo": "Qwen/Qwen3.5-2B","mlx_repo": "mlx-community/Qwen3.5-2B-OptiQ-4bit",},@@ -132,12 +130,11 @@ BUILTIN_MODELS: List[ModelSpec] = [model_id="qwen3.5:9b",name="Qwen3.5 9B",parameter_count_b=9.0,- active_parameter_count_b=1.5,context_length=131072,supported_engines=("ollama", "vllm", "llamacpp", "sglang", "mlx"),provider="alibaba",metadata={- "architecture": "moe",+ "architecture": "dense","hf_repo": "Qwen/Qwen3.5-9B","gguf_file": "qwen3.5-9b-q4_k_m.gguf","mlx_repo": "mlx-community/Qwen3.5-9B-MLX-4bit",@@ -147,13 +144,12 @@ BUILTIN_MODELS: List[ModelSpec] = [model_id="qwen3.5:27b",name="Qwen3.5 27B",parameter_count_b=27.0,- active_parameter_count_b=3.0,context_length=131072,min_vram_gb=16.0,supported_engines=("ollama", "vllm", "llamacpp", "sglang", "mlx"),provider="alibaba",metadata={- "architecture": "moe",+ "architecture": "dense","hf_repo": "Qwen/Qwen3.5-27B","gguf_file": "qwen3.5-27b-q4_k_m.gguf","mlx_repo": "mlx-community/Qwen3.5-27B-4bit-DWQ",@@ -295,19 +291,18 @@ BUILTIN_MODELS: List[ModelSpec] = [},),# ------------------------------------------------------------------------ # Local models — Qwen3.5 (MoE, Gated DeltaNet + sparse MoE)+ # Local models — Qwen3.5 (4B dense, plus MoE variants)# -----------------------------------------------------------------------ModelSpec(model_id="qwen3.5:4b",name="Qwen3.5 4B",parameter_count_b=4.0,- active_parameter_count_b=0.5,context_length=262144,min_vram_gb=3.0,supported_engines=("ollama", "vllm", "sglang", "llamacpp", "mlx"),provider="alibaba",metadata={- "architecture": "moe",+ "architecture": "dense","hf_repo": "Qwen/Qwen3.5-4B","gguf_file": "qwen3.5-4b-q4_k_m.gguf","mlx_repo": "mlx-community/Qwen3.5-4B-OptiQ-4bit",diff --git a/tests/core/test_recommend_model.py b/tests/core/test_recommend_model.pyindex b8c95f8d..8d3908ca 100644--- a/tests/core/test_recommend_model.py+++ b/tests/core/test_recommend_model.py@@ -6,7 +6,7 @@ from openjarvis.core.config import GpuInfo, HardwareInfo, recommend_modelclass TestRecommendModelTiers:- """Tier-based model recommendation (Qwen3.5 MoE)."""+ """Tier-based model recommendation (dense Qwen3.5)."""def test_8gb_ram_picks_qwen35_2b(self) -> None:hw = HardwareInfo(platform="linux", ram_gb=8.0, gpu=None)diff --git a/tests/intelligence/test_model_catalog_extended.py b/tests/intelligence/test_model_catalog_extended.pyindex f869810b..68094f6b 100644--- a/tests/intelligence/test_model_catalog_extended.py+++ b/tests/intelligence/test_model_catalog_extended.py@@ -184,29 +184,37 @@ class TestCloudModelSpecs:class TestQwen35ModelSpecs:- """Verify Qwen3.5 MoE model entries."""+ """Verify dense and MoE Qwen3.5 model entries."""++ @pytest.mark.parametrize(+ ("model_id", "parameter_count_b"),+ [+ ("qwen3.5:0.8b", 0.8),+ ("qwen3.5:2b", 2.0),+ ("qwen3.5:4b", 4.0),+ ("qwen3.5:9b", 9.0),+ ("qwen3.5:27b", 27.0),+ ],+ )+ def test_small_dense_models_have_no_active_parameter_count(+ self, model_id: str, parameter_count_b: float+ ) -> None:+ spec = _get_spec(model_id)+ assert spec.parameter_count_b == parameter_count_b+ assert spec.active_parameter_count_b is None+ assert spec.metadata["architecture"] == "dense"def test_qwen35_2b(self) -> None:spec = _get_spec("qwen3.5:2b")- assert spec.parameter_count_b == 2.0- assert spec.active_parameter_count_b == 0.4assert spec.context_length == 131072assert spec.provider == "alibaba"- assert spec.metadata["architecture"] == "moe"for e in ("ollama", "vllm", "llamacpp", "sglang"):assert e in spec.supported_enginesdef test_qwen35_9b(self) -> None:spec = _get_spec("qwen3.5:9b")- assert spec.parameter_count_b == 9.0- assert spec.active_parameter_count_b == 1.5assert spec.context_length == 131072- def test_qwen35_27b(self) -> None:- spec = _get_spec("qwen3.5:27b")- assert spec.parameter_count_b == 27.0- assert spec.active_parameter_count_b == 3.0-def test_qwen35_35b(self) -> None:spec = _get_spec("qwen3.5:35b")assert spec.parameter_count_b == 35.0@@ -300,9 +308,6 @@ class TestModelDiscovery:"gpt-oss:120b","glm-4.7-flash","trinity-mini",- "qwen3.5:2b",- "qwen3.5:9b",- "qwen3.5:27b","qwen3.5:35b","qwen3.5:122b","qwen3.5:397b",