package modelplan import ( "math" "testing" ) func TestCPUSpeedMatchesWhatThePoCMeasured(t *testing.T) { for _, c := range []struct { bytes int64 bw, want float64 }{ {1117320736, 24.9, 14.5}, // node01, qwen2.5-1.5b {9_000_000_000, 41.9, 3.3}, // node05, qwen2.5-coder-14b } { got := CPUTokensPerSecond(c.bytes, c.bw) if math.Abs(got-c.want)/c.want > 0.15 { t.Errorf("%d bytes at %.1f GB/s: %.1f tok/s, measured %.1f", c.bytes, c.bw, got, c.want) } } if CPUTokensPerSecond(0, 40) != 0 || CPUTokensPerSecond(1e9, 0) != 0 { t.Error("an unknown size or bandwidth should give no figure") } } func TestAModelOfExpertsReadsItsActiveShare(t *testing.T) { for name, want := range map[string]float64{ "Qwen/Qwen3-30B-A3B-Instruct-2507-GGUF": 0.16, "inclusionAI/Ling-flash-A2.5B": 1.6 * 2.5 / 30, "Qwen/Qwen3-8B": 1, "meta-llama/Llama-3.1-8B-Instruct": 1, } { if got := ActiveShare(name, 30e9); math.Abs(got-want) > 0.001 && !(want == 1 && got == 1) { t.Errorf("%s: %.3f, want %.3f", name, got, want) } } }