Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
Qwen routing: break router-logit ties by expert index so greedy decoding is reproducible
YanissAmzec2a9c558de5
diff --git a/exllamav3/modules/block_sparse_mlp_routing.py b/exllamav3/modules/block_sparse_mlp_routing.pyindex 2f3023e..8dc0749 100644--- a/exllamav3/modules/block_sparse_mlp_routing.py+++ b/exllamav3/modules/block_sparse_mlp_routing.py@@ -217,9 +217,12 @@ def _routing_std_torch(cfg, y, params, include_bias = False):).expand(y.shape[0], -1)routing_weights = torch.softmax(router_logits_f, dim = -1)else:- top_v, selected_experts = torch.topk(- router_logits_f, cfg.num_experts_per_tok, dim = -1- )+ # torch.topk breaks ties between equal logits in an arbitrary, run-dependent order (and may pick a different+ # expert at the k-th place); fp16 router logits tie often. A stable descending sort keeps the lowest expert+ # index first among equals, so identical inputs give identical routing. Same values and softmax otherwise.+ top_v, selected_experts = torch.sort(router_logits_f, dim = -1, descending = True, stable = True)+ top_v = top_v[:, :cfg.num_experts_per_tok]+ selected_experts = selected_experts[:, :cfg.num_experts_per_tok].contiguous()routing_weights = torch.softmax(top_v, dim = -1)if cfg.per_expert_scale is not None:routing_weights = routing_weights * cfg.per_expert_scale.float()[selected_experts]