Skip to content

Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.

fix(bench): separate load probes from context throughput results (#42)

Afloate1e4f47ee15a
diff --git a/bench/analyze.py b/bench/analyze.py
index eb118f3..ddb6796 100644
--- a/bench/analyze.py
+++ b/bench/analyze.py
@@ -255,6 +255,17 @@ def ctx():
if not R:
return
print("## 3. Long context: one WikiText haystack per depth (2026-11-09 harness), 128 greedy tokens, same text for every engine\n")
+ probes = [r for r in R if r.get("mode") == "load"]
+ if probes:
+ print("**Load-only fit probes** (no generation or throughput measurement):\n")
+ print("| box | round | depth | arm | status |")
+ print("|---|---|---|---|---|")
+ for r in probes:
+ print(f"| {r['_box']} | {r['round']} | {r['ctx_n'] // 1024}k | {r['arm']} | {r['status']} |")
+ print()
+ R = [r for r in R if r.get("mode", "fill") == "fill"]
+ if not R:
+ return
print("Decode = reply tok/s after the prompt; prefill = prompt tok/s. Medians over rounds; ratios paired per (box, round).\n")
print("| class | depth | arm | n | decode tok/s | prefill tok/s | acceptance | peak RssAnon MiB | min MemAvailable MiB | status | recall |")
print("|---|---|---|---|---|---|---|---|---|---|---|")
diff --git a/bench/test_context_analysis.py b/bench/test_context_analysis.py
new file mode 100644
index 0000000..5b07008
--- /dev/null
+++ b/bench/test_context_analysis.py
@@ -0,0 +1,45 @@
+import contextlib
+import io
+import unittest
+from unittest.mock import patch
+
+import analyze
+
+
+def row(mode, **values):
+ return dict({"_box": "e2", "round": 0, "ctx": "8192", "ctx_n": 8192,
+ "arm": "ours", "mode": mode, "status": "ok"}, **values)
+
+
+class ContextAnalysisTest(unittest.TestCase):
+ def analyze_rows(self, rows):
+ output = io.StringIO()
+ with patch.object(analyze, "load", return_value=rows), \
+ patch.object(analyze, "OUT", {}), patch.object(analyze, "REG", []), \
+ contextlib.redirect_stdout(output):
+ analyze.ctx()
+ summary = analyze.OUT.copy()
+ return output.getvalue(), summary
+
+ def test_load_only_probe_is_reported_without_throughput(self):
+ output, summary = self.analyze_rows([row("load")])
+ self.assertIn("Load-only fit probes", output)
+ self.assertIn("| e2 | 0 | 8k | ours | ok |", output)
+ self.assertNotIn("ctx", summary)
+
+ def test_load_rows_do_not_replace_fill_measurements(self):
+ fill = row("fill", decode_tok_s=12.0, prefill_tok_s=30.0, sha256="reply", recall=[1] * 5)
+ output, summary = self.analyze_rows([fill, row("load")])
+ self.assertIn("Load-only fit probes", output)
+ self.assertEqual(summary["ctx"][("Ice Lake", 8192, "ours")]["n"], 1)
+ self.assertEqual(summary["ctx"][("Ice Lake", 8192, "ours")]["dec"], 12.0)
+
+ def test_failed_load_is_not_counted_as_failed_generation(self):
+ fill = row("fill", decode_tok_s=12.0, prefill_tok_s=30.0, sha256="reply", recall=[1] * 5)
+ output, summary = self.analyze_rows([fill, row("load", status="died_at_load")])
+ self.assertIn("| e2 | 0 | 8k | ours | died_at_load |", output)
+ self.assertEqual(summary["ctx"][("Ice Lake", 8192, "ours")]["n"], 1)
+
+
+if __name__ == "__main__":
+ unittest.main()