Report Colibri benchmark metrics
Homelab Main / validate (push) Successful in 1m16s Details
Homelab Main / running-update (push) Successful in 3s Details
Homelab Main / debian-ops (push) Successful in 2m35s Details

This commit is contained in:
juvenal.diaz 2026-11-10 12:48:34 -06:00
parent 0d135b98df
commit 570ec03407
3 changed files with 45 additions and 1 deletions

View File

@ -80,3 +80,11 @@ are single-request experiments; neither backend is registered with OmniRoute.
Both Qwen runs request greedy sampling and disable thinking, so the limited
output budget is available for the answer. Check the logs to confirm that each
engine honored those settings and produced a complete answer.
The Colibri report extracts weight load time, RSS after loading weights, and
lookup decoder tokens, forwards and draft acceptance when those log lines are
present. The lookup token count describes tokens fed to the decoder, not
necessarily the visible output count. Its derived tokens/second includes the
whole command startup and is not directly comparable to llama.cpp's
generation-only rate. RSS after model loading is not peak process memory.
Fields are null when the log does not contain the corresponding measurement.

View File

@ -251,6 +251,24 @@ def parse_llama_timings(log):
return {"prompt_tokens_per_second": None, "generation_tokens_per_second": None}
def parse_colibri_metrics(log, elapsed_seconds):
"""Parse logged values without equating lookup counters with API output tokens."""
cleaned = re.sub(r"\x1b\[[0-9;]*[A-Za-z]", "", log)
load = re.search(r"resident weights loaded in\s+([0-9.]+)s\s*\|\s*RSS after load:\s*([0-9.]+)\s*GB", cleaned)
lookup = re.search(r"\[qwen36 lookup\]\s+[^\n]*?\(([0-9]+) forwards per ([0-9]+) tokens\)\s*\|\s*acceptance\s+([0-9.]+)%", cleaned)
forwards = int(lookup.group(1)) if lookup else None
tokens = int(lookup.group(2)) if lookup else None
return {
"weight_load_seconds": float(load.group(1)) if load else None,
"rss_after_weight_load_gb": float(load.group(2)) if load else None,
"lookup_decode_tokens": tokens,
"lookup_forwards": forwards,
"lookup_acceptance_percent": float(lookup.group(3)) if lookup else None,
"lookup_decode_tokens_per_second_including_startup": round(tokens / elapsed_seconds, 2) if tokens is not None and elapsed_seconds > 0 else None,
"generation_tokens_per_second": None,
}
def colibri_args():
return ["env", "COLI_VULKAN=0", "COLI_CUDA=0", sys.executable, str(COLIBRI_CLI), "run", "--model", str(QWEN_DIR), "--gpu", "none", "--ctx", "4096", "--ngen", "128", "--temp", "0", "--no-think", PROMPT]
@ -290,7 +308,8 @@ def benchmark(backend):
started = time.monotonic()
completed = command(colibri_args(), capture=True, timeout=600)
log = completed.stdout + "\n" + completed.stderr
common.update({"device": "cpu", "elapsed_seconds": round(time.monotonic() - started, 3), "colibri_version": COLIBRI_TAG, "note": common["note"] + " Review the log for generation timings and output quality."})
elapsed = time.monotonic() - started
common.update({"device": "cpu", "elapsed_seconds": round(elapsed, 3), "colibri_version": COLIBRI_TAG, **parse_colibri_metrics(log, elapsed), "note": common["note"] + " Lookup tokens are decoder inputs, not necessarily visible output tokens. The lookup rate includes startup and is not a decode-only rate; RSS after load is not peak memory."})
make_report(backend, common, log)
return
if not CLI.is_file():

View File

@ -80,6 +80,23 @@ class AiLabTest(unittest.TestCase):
self.assertEqual(llama[llama.index("--reasoning") + 1], "off")
self.assertEqual(llama[llama.index("--temp") + 1], "0")
def test_colibri_log_reports_load_memory_and_lookup_counts(self):
log = "resident weights loaded in 0.3s | RSS after load: 0.88 GB\n[qwen36 lookup] turn 1: 1.09 tokens/forward (70 forwards per 76 tokens) | acceptance 60.0% (6/10 drafts in 7 verifies) | gate on\n"
metrics = lab.parse_colibri_metrics(log, 3.27)
self.assertEqual(metrics["weight_load_seconds"], 0.3)
self.assertEqual(metrics["rss_after_weight_load_gb"], 0.88)
self.assertEqual(metrics["lookup_decode_tokens"], 76)
self.assertEqual(metrics["lookup_forwards"], 70)
self.assertEqual(metrics["lookup_acceptance_percent"], 60.0)
self.assertEqual(metrics["lookup_decode_tokens_per_second_including_startup"], 23.24)
self.assertIsNone(metrics["generation_tokens_per_second"])
def test_colibri_missing_metrics_are_not_invented(self):
metrics = lab.parse_colibri_metrics("no lookup statistics", 0)
self.assertIsNone(metrics["lookup_decode_tokens"])
self.assertIsNone(metrics["lookup_decode_tokens_per_second_including_startup"])
self.assertIsNone(metrics["rss_after_weight_load_gb"])
if __name__ == "__main__":
unittest.main()