Download tools/report_speed.py from RightNowAI/RightNow-Mini: direct link, hf CLI and curl.
- Browser
- Download file 5.19 kB
-
https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/tools/report_speed.py
- Command line
-
hf download hf://RightNowAI/RightNow-Mini/tools/report_speed.py
-
curl -L -o report_speed.py https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/tools/report_speed.py
5.19 kB
| """Write results/speed.md from the raw files on the node. Every figure is read from a file; a missing one is said. | |
| python tools/report_speed.py /data/train/mini > results/speed.md | |
| """ | |
| import json | |
| import sys | |
| R = sys.argv[1] if len(sys.argv) > 1 else "/data/train/mini" | |
| NAMES = {"stock": "vLLM, no drafting (the stock line)", "dspark": "vLLM with the draft head in the checkpoint (the public fast recipe)", | |
| "dflash": "**RightNow Mini engine**: vLLM with the prepared published drafter, its logit cap off", | |
| "dflash-keepcap": "the same with the drafter's logit cap as published"} | |
| def load(p): | |
| try: | |
| return json.load(open(p)) | |
| except Exception: | |
| return None | |
| def fmt(v, n=0): | |
| return "not measured" if v is None else f"{v:,.{n}f}" | |
| def main(): | |
| out = [] | |
| w = out.append | |
| w("# Speed: the engine lines on one GPU") | |
| w("") | |
| w("Measured on 2026-12-01 on one GPU of the node, one line after another on the same GPU, with the") | |
| w("same client (`tools/bench.py`: greedy decoding, 64 fixed coding prompts, 512 new tokens, token counts from the") | |
| w("server's usage report) and the same 200-prompt capture (`tools/parity.py`). Cores 0 to 31 were kept free for") | |
| w("the server under test and its client. Start each line with `engine/serve.sh` or `tools/serve.sh`.") | |
| w("") | |
| w("| Line | 1 stream, tok/s | First token, ms | 8 streams, per stream / sum | 32 streams | 64 streams | Prefill 4K, tok/s | Prefill 64K, tok/s |") | |
| w("|---|---|---|---|---|---|---|---|") | |
| single = {} | |
| for c in ("stock", "dspark", "dflash", "dflash-keepcap"): | |
| d = load(f"{R}/results/raw/speed-engine/{c}.json") | |
| if not d: | |
| w(f"| {NAMES[c]} | not measured | | | | | | |") | |
| continue | |
| L, P = d["levels"], d["prefill"] | |
| g = lambda k, f: (L.get(k) or {}).get(f) | |
| single[c] = g("1", "per_stream_decode_tps_median") | |
| w(f"| {NAMES[c]} | {fmt(single[c], 1)} | {fmt(g('1', 'ttft_ms_median'), 1)} | " | |
| + " | ".join(f"{fmt(g(k, 'per_stream_decode_tps_median'), 1)} / {fmt(g(k, 'sum_out_tps'))}" for k in ("8", "32", "64")) | |
| + f" | {fmt((P.get('4000') or {}).get('prefill_tps_median'))} | {fmt((P.get('64000') or {}).get('prefill_tps_median'))} |") | |
| w("") | |
| if single.get("stock") and single.get("dflash"): | |
| w(f"One stream: the engine line gives {single['dflash'] / single['stock']:.2f} times the stock line" | |
| + (f" and {single['dflash'] / single['dspark']:.2f} times the public fast recipe" if single.get("dspark") else "") + ".") | |
| w("") | |
| w("The other public engine measured, SGLang, is in `baseline.md` (224.9 tok/s plain and 422.5 tok/s with the draft head, one stream).") | |
| w("") | |
| w("## Does a line give the same tokens as the stock model?") | |
| w("") | |
| w("200 fixed coding prompts, one request at a time, temperature 0, 128 new tokens, the server's own token ids.") | |
| w("A prompt counts as equal only if every token id is equal.") | |
| w("") | |
| w("| Line, against the stock line | Prompts equal of 200 | Prompts different | First difference at token (min / median / max) |") | |
| w("|---|---|---|---|") | |
| for c, name in (("stock-again", "the stock line, captured a second time"), ("dspark", NAMES["dspark"]), ("dflash", NAMES["dflash"]), | |
| ("dflash-keepcap", NAMES["dflash-keepcap"])): | |
| d = load(f"{R}/results/raw/parity/compare-{c}.json") | |
| if not d: | |
| w(f"| {name} | not measured | | |") | |
| continue | |
| fd = d["first_difference_positions"] | |
| pos = f"{fd[0]} / {fd[len(fd) // 2]} / {fd[-1]}" if fd else "none" | |
| w(f"| {name} | **{d['prompts_equal']}** | {d['prompts_different']} | {pos} |") | |
| w("") | |
| rows = [] | |
| for c, name in (("dflash-vs-dspark", NAMES["dflash"]), ("dflash-keepcap-vs-dspark", NAMES["dflash-keepcap"])): | |
| d = load(f"{R}/results/raw/parity/compare-{c}.json") | |
| if d: | |
| fd = d["first_difference_positions"] | |
| rows.append(f"| {name} | **{d['prompts_equal']}** | {d['prompts_different']} | {fd[0]} / {fd[len(fd) // 2]} / {fd[-1]} |" if fd else f"| {name} | **{d['prompts_equal']}** | 0 | none |") | |
| if rows: | |
| w("The same capture, compared with the public fast recipe instead of the stock line:") | |
| w("") | |
| w("| Line, against the public fast recipe | Prompts equal of 200 | Prompts different | First difference at token (min / median / max) |") | |
| w("|---|---|---|---|") | |
| for r in rows: | |
| w(r) | |
| w("") | |
| w("What this says, plainly: drafting changes which tokens the engine checks together in one step, and on this model") | |
| w("the engine's arithmetic for a token depends slightly on what shares its step. The model still decides every") | |
| w("token, but where two candidate tokens are almost tied the choice can flip, and from that token on the text") | |
| w("differs. This engine build has no mode that removes that dependence for this model. So a line with drafting is") | |
| w("**not** token-identical to the stock line; the table above is the measured size of the difference.") | |
| print("\n".join(out)) | |
| if __name__ == "__main__": | |
| main() | |