Datasets:
v3.2: long windows 4K, 8K, 16K, 32K, 224K, 512K by default
Browse files123453 unmodified lines9101112131415161718192021222364 unmodified lines8889909192939460 unmodified lines155156157158159160161#!/usr/bin/env python3# llm-serving-bench v3.1: single-stream serving speed of any OpenAI-compatible server (stdlib only, greedy, streamed, timed on the wire).# Prompts come from the HF dataset Francesco/llm-serving-bench (pinned revision), downloaded once into a cache folder:# short 60 prompts: Spec-Bench (6 tasks x 10, first turn) code 20 prompts: HumanEval 0-19# long LongBench v2, one Code Repository Understanding question, repository cut from the middle to fill each window.3 unmodified linesimport argparse, json, os, re, statistics, subprocess, time, urllib.error, urllib.requestfrom pathlib import PathDATASET, REVISION = "Francesco/llm-serving-bench", "v3.1"FILES = ("short.jsonl", "code.jsonl", "agent.jsonl", "long.jsonl")WINDOWS = {"32K": 32_768, "224K": 229_376, "512K": 512_000}ap = argparse.ArgumentParser()ap.add_argument("--url", default="http://127.0.0.1:8003/v1")ap.add_argument("--out", default="llm-serving-bench-result.json")ap.add_argument("--cache", default=os.environ.get("LLM_SERVING_BENCH_CACHE", str(Path.home() / ".cache" / "llm-serving-bench")))ap.add_argument("--windows", default="32K,224K,512K")ap.add_argument("--short-only", action="store_true")ap.add_argument("--label", default="")ap.add_argument("--temperature", type=float, default=0.0, help="0 (default): greedy, repeatable; 1: as most models are served (speculative decoding accepts less)")64 unmodified linesMODEL = (info.get("data") or [{}])[0].get("id", "default") # [Agent] vLLM wants the served model name in every requestmax_len = max((m.get("max_model_len") or 0) for m in info.get("data", [{}])) or Nonelong_row = rows("long.jsonl")[0]res = {"bench": "llm-serving-bench v3.1", "dataset": f"{DATASET}@{REVISION}", "label": args.label, "url": URL, "server": info,"date": time.strftime("%Y-%m-%d %H:%M"), "short": {}, "long": {}}ask([{"role": "user", "content": "Say hi."}], 8) # warm-up 160 unmodified linesres["gpu_end"] = gpu()json.dump(res, open(args.out, "w"), indent=1)print(f"\n**llm-serving-bench v3.1** {args.label} ({res['date']}, GPU {res['gpu_end']})\n")print("| set | decode tok/s | median TTFT s |\n|---|---|---|")for c, v in res["short"].items():print(f"| {c} | {v['decode_tok_s']} | {v['ttft_median_s']} |")123453 unmodified lines9101112131415161718192021222364 unmodified lines8889909192939460 unmodified lines155156157158159160161#!/usr/bin/env python3# llm-serving-bench v3.2: single-stream serving speed of any OpenAI-compatible server (stdlib only, greedy, streamed, timed on the wire).# Prompts come from the HF dataset Francesco/llm-serving-bench (pinned revision), downloaded once into a cache folder:# short 60 prompts: Spec-Bench (6 tasks x 10, first turn) code 20 prompts: HumanEval 0-19# long LongBench v2, one Code Repository Understanding question, repository cut from the middle to fill each window.3 unmodified linesimport argparse, json, os, re, statistics, subprocess, time, urllib.error, urllib.requestfrom pathlib import PathDATASET, REVISION = "Francesco/llm-serving-bench", "v3.2"FILES = ("short.jsonl", "code.jsonl", "agent.jsonl", "long.jsonl")WINDOWS = {"4K": 4_096, "8K": 8_192, "16K": 16_384, "32K": 32_768, "224K": 229_376, "512K": 512_000}ap = argparse.ArgumentParser()ap.add_argument("--url", default="http://127.0.0.1:8003/v1")ap.add_argument("--out", default="llm-serving-bench-result.json")ap.add_argument("--cache", default=os.environ.get("LLM_SERVING_BENCH_CACHE", str(Path.home() / ".cache" / "llm-serving-bench")))ap.add_argument("--windows", default="4K,8K,16K,32K,224K,512K")ap.add_argument("--short-only", action="store_true")ap.add_argument("--label", default="")ap.add_argument("--temperature", type=float, default=0.0, help="0 (default): greedy, repeatable; 1: as most models are served (speculative decoding accepts less)")64 unmodified linesMODEL = (info.get("data") or [{}])[0].get("id", "default") # [Agent] vLLM wants the served model name in every requestmax_len = max((m.get("max_model_len") or 0) for m in info.get("data", [{}])) or Nonelong_row = rows("long.jsonl")[0]res = {"bench": "llm-serving-bench v3.2", "dataset": f"{DATASET}@{REVISION}", "label": args.label, "url": URL, "server": info,"date": time.strftime("%Y-%m-%d %H:%M"), "short": {}, "long": {}}ask([{"role": "user", "content": "Say hi."}], 8) # warm-up 160 unmodified linesres["gpu_end"] = gpu()json.dump(res, open(args.out, "w"), indent=1)print(f"\n**llm-serving-bench v3.2** {args.label} ({res['date']}, GPU {res['gpu_end']})\n")print("| set | decode tok/s | median TTFT s |\n|---|---|---|")for c, v in res["short"].items():print(f"| {c} | {v['decode_tok_s']} | {v['ttft_median_s']} |")
bench.py+6-6