The 80B Qwen3-Coder-Next on a 16 GB Mac, about 13 tok/s, fully offline. A mixture-of-experts inference engine for Apple silicon.
Rust
0.5.3 candidate: the wrangler keeps every expert resident when a Qwen3.5/3.6 MoE file fits; fast path on by default; the door honours request temperature and top_p
Picassoai84eef0c3935b
diff --git a/Cargo.lock b/Cargo.lockindex 4e3d69c..5020edb 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -289,7 +289,7 @@ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"[[package]]name = "coachwhip"-version = "0.5.2"+version = "0.5.3"dependencies = ["anyhow","candle-core",@@ -302,7 +302,7 @@ dependencies = [[[package]]name = "coachwhip-engine"-version = "0.5.2"+version = "0.5.3"dependencies = ["candle-core","candle-metal-kernels",@@ -316,7 +316,7 @@ dependencies = [[[package]]name = "coachwhip-prepare"-version = "0.5.2"+version = "0.5.3"dependencies = ["anyhow","byteorder",@@ -326,7 +326,7 @@ dependencies = [[[package]]name = "coachwhip-server"-version = "0.5.2"+version = "0.5.3"dependencies = ["anyhow","candle-core",diff --git a/Cargo.toml b/Cargo.tomlindex 73ee1ba..00680d0 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -3,7 +3,7 @@ members = ["crates/engine", "crates/server", "crates/cli", "crates/prepare"]resolver = "2"[workspace.package]-version = "0.5.2"+version = "0.5.3"edition = "2021"license = "Apache-2.0"publish = falsediff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rsindex 4d3a1ac..8313782 100644--- a/crates/cli/src/main.rs+++ b/crates/cli/src/main.rs@@ -145,6 +145,25 @@ fn main() -> Result<()> {std::env::set_var("COACHWHIP_NOCACHE", "1");}let device = Device::new_metal(0)?;+ // Wrangler: when the whole file fits in the GPU with a gigabyte to spare for the chat, every+ // expert is kept resident and the fast path is used. Any switch set by hand wins.+ if std::env::var("COACHWHIP_RESIDENT").is_err() {+ let arch = std::fs::File::open(&args.model).ok().and_then(|mut f| candle::quantized::gguf_file::Content::read(&mut f).ok())+ .and_then(|c| c.metadata.get("general.architecture").and_then(|v| v.to_string().ok().cloned()));+ let file_len = std::fs::metadata(&args.model).map(|m| m.len()).unwrap_or(u64::MAX);+ let max = coachwhip_engine::gpu_sync::gpu_memory(&device).map(|(_, m)| m).unwrap_or(0);+ let fits = file_len.saturating_add(1_000_000_000) < max;+ if fits && matches!(arch.as_deref(), Some("qwen35moe") | Some("qwen3next")) {+ for (k, v) in [("COACHWHIP_RESIDENT", "1"), ("COACHWHIP_FUSE", "1"), ("COACHWHIP_NEWMV", "1"), ("COACHWHIP_ADDNORM", "1"),+ ("COACHWHIP_ROUTER16", "1"), ("COACHWHIP_GDN2", "1"), ("COACHWHIP_PIECE", "1"), ("COACHWHIP_GROUP", "3"),+ ("COACHWHIP_PROMPT_CHUNK", "256"), ("COACHWHIP_SHORT", "256"), ("COACHWHIP_FAST_CHAT", "1"), ("COACHWHIP_SPIN", "1")] {+ if std::env::var(k).is_err() {+ std::env::set_var(k, v);+ }+ }+ eprintln!("coachwhip: the whole model fits in the GPU ({:.1} of {:.1} GB): every expert stays resident", file_len as f64 / 1e9, max as f64 / 1e9);+ }+ }// A hot path belongs to one model: its routes live in a folder named after the model file.let model_name = args.model.file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_else(|| "model".into());let routes = args.routes.join(&model_name);