From 5f05f46c7cfd541d15c46f8236113472b35dd4e7 Mon Sep 17 00:00:00 2001 From: Abiba Date: Tue, 19 May 2026 18:27:24 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20heavy=20tier=20=E2=80=94=20Dense=20first?= =?UTF-8?q?=20for=20reasoning,=20MoE=20workhorse,=20VLM=20overflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/router.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/router/router.py b/router/router.py index f82d968..e0a1b1d 100644 --- a/router/router.py +++ b/router/router.py @@ -119,7 +119,11 @@ def is_gpu_busy(model): return active >= max_c def select_best_gpu(candidates, reason): - """Pick the best GPU from candidates, preferring least-loaded.""" + """Pick the best GPU from candidates IN ORDER — first non-busy one wins.""" + for m in candidates: + if not is_gpu_busy(m): + return {"model": m, "reason": reason} + # All busy — pick least loaded best = None best_load = 999 for m in candidates: @@ -128,10 +132,7 @@ def select_best_gpu(candidates, reason): best_load = load best = m if best: - actual_reason = reason - if is_gpu_busy(best): - actual_reason = "load_balanced_" + reason - return {"model": best, "reason": actual_reason} + return {"model": best, "reason": "load_balanced_" + reason} return None def route(rd, tier): @@ -182,7 +183,7 @@ def route(rd, tier): # TIER 3: Heavy reasoning — large context or very long conversations if t > 4000 or turns > 8: - candidates = [m for m in ["qwen3.6-35B-A3B","qwen3.5-9b-vlm","qwen3.6-27B-code"] if m in avail] + candidates = [m for m in ["qwen3.6-27B-code","qwen3.6-35B-A3B","qwen3.5-9b-vlm"] if m in avail] result = select_best_gpu(candidates, "heavy_reasoning") if result: return result