"""Hesitation markers per 1k generated tokens (paragraphs starting with Wait/Alternatively/Hmm/...), per run.""" import json, re, sys HES = re.compile(r"\n\n(\*\*)?(wait|but wait|hmm|alternatively|actually|hold on|let me (double[- ]check|verify|re-?check|reconsider|check again))", re.I) for tag in sys.argv[1:]: rs = [json.loads(l) for l in open(f"results/{tag}/mini.jsonl", encoding="utf-8")] toks = sum(r["n_tokens"] for r in rs); h = sum(len(HES.findall(r["completion"])) for r in rs) print(f"{tag:12s} n={len(rs):3d} hesitations/1k tok {1000 * h / toks:5.2f} avg_tok {toks / len(rs):6.0f}")