Skip to content

Run frontier MoE models on hardware you already own β€” pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

test: split the tok/s bound out of test_cpu_vs_cpu_determinism

ZacharyZcR50f61435040d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4c124b56..1a51accd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -501,19 +501,20 @@ jobs:
# that before reading anything else out of a run.
run: cd c && SNAP=./glm_tiny TF=1 COLI_TEMP=0 ./colibri 64 16 16
- name: Structural efficiency tests
- # test_cpu_vs_cpu_determinism is NOT in this list. Despite the name its
- # second assertion is a tok/s stability bound (two runs within 25%), and
- # the tiny replay is 15 ms end to end -- it measured 38.8% between two
- # identical runs on a quiet local box, so a shared runner would make it
- # flaky on day one. Its first assertion (hit-rate identical) IS a real
- # determinism check and does hold; splitting the two is worth doing, but
- # not silently from a CI change.
+ # test_cpu_vs_cpu_tok_s_stability is NOT in this list: it is a tok/s
+ # bound (two runs within 25%) over a ~15 ms tiny replay -- it measured
+ # 38.8% between two identical runs on a quiet local box, so a shared
+ # runner would make it flaky on day one. The determinism test (hit-rate
+ # identical across two greedy replays) carries no timing assertion any
+ # more, so it CAN run here -- and it is the one that catches stray
+ # threading / uninitialized state.
run: |
cd c
python3 -m unittest -v \
tests.test_inefficiency.TinyEfficiencyTest.test_telemetry_parses \
tests.test_inefficiency.TinyEfficiencyTest.test_profile_phases_present_and_nonneg \
- tests.test_inefficiency.TinyEfficiencyTest.test_disk_wait_not_dominant
+ tests.test_inefficiency.TinyEfficiencyTest.test_disk_wait_not_dominant \
+ tests.test_inefficiency.TinyEfficiencyTest.test_cpu_vs_cpu_determinism
# The token-exact parity gate from #7 (c/tests/test_cluster_sharding.py): the
# engine's local CPU run must already reproduce the transformers oracle
diff --git a/c/tests/test_inefficiency.py b/c/tests/test_inefficiency.py
index 70fadb72..78fa66eb 100644
--- a/c/tests/test_inefficiency.py
+++ b/c/tests/test_inefficiency.py
@@ -166,16 +166,32 @@ class TinyEfficiencyTest(unittest.TestCase):
def test_cpu_vs_cpu_determinism(self):
"""Two greedy REPLAY runs with the same seed produce identical telemetry.
- TEMP=0 = greedy (no sampling), so tok/s and hit-rate must be reproducible.
+ TEMP=0 = greedy (no sampling), so the hit-rate must be reproducible.
A drift here means non-determinism crept into the decode path (stray
threading, uninitialized state) β€” which on a real model would make A/B
- comparisons meaningless."""
+ comparisons meaningless. Deliberately NO timing assertion: determinism
+ is about what is computed, not how fast (that lives in the stability
+ test below), which is what lets this one run on shared CI runners."""
a = self._run(REPLAY="1", TEMP="0", NGEN="8", SEED="1")
b = self._run(REPLAY="1", TEMP="0", NGEN="8", SEED="1")
self.assertEqual(a["returncode"], 0)
self.assertEqual(b["returncode"], 0)
self.assertEqual(a["hit_pct"], b["hit_pct"], "greedy hit-rate drifted between runs")
- # tok/s within 25% β€” exact equality is too strict across scheduler noise.
+
+ def test_cpu_vs_cpu_tok_s_stability(self):
+ """Two identical runs land within 25% in tok/s.
+
+ A wall-clock bound, NOT a determinism check: the tiny replay is ~15 ms
+ end to end, so a single scheduler stall can blow the band (38.8%
+ measured between identical runs on a quiet box; ~10x observed under
+ WSL2). Kept for quiet local machines, where a huge gap still flags a
+ real problem (a run that reloaded weights, a poisoned cache) β€” but it
+ is expected to be noisy on shared or virtualized hosts, and CI does
+ not run it."""
+ a = self._run(REPLAY="1", TEMP="0", NGEN="8", SEED="1")
+ b = self._run(REPLAY="1", TEMP="0", NGEN="8", SEED="1")
+ self.assertEqual(a["returncode"], 0)
+ self.assertEqual(b["returncode"], 0)
self.assertLess(abs(a["tok_s"] - b["tok_s"]) / max(a["tok_s"], b["tok_s"]), 0.25)