Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/gpu-head-to-head/blob/main/bench/make_ttft_prompts.py # gpu-head-to-head aien-dev/gpu-head-to-head Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `gpu-head-to-head / bench / make_ttft_prompts.py` 51 lines ยท 2351 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Generate prompts/ttft.jsonl (PROTOCOL.md A10 TTFT rows) from pinned source texts; stdlib only. 3 4 usage: bench/make_ttft_prompts.py LONG2048 LONG8192 LONG32768 LONG256 OUT 5 6 The sources are the PrefillGate long prompts (sovereign evidence/merge-train/l369/long-{2048,8192,256}.txt 7 @ `b129e1ea`) and the DRA-85 32k prompt (long-8192 x3 + long-2048 x3 + long-256 x2). Every source is 8 checked against the sha256 below before anything is written; a mismatch exits 2 and writes nothing. 9 Token counts depend on each server's tokenizer and chat template, so none is claimed here: the run 10 records usage.prompt_tokens for every request. 11 """ 12 import hashlib 13 import json 14 import sys 15 16 SOURCES = { # id -> (argv index, sha256 of the source file) 17 "t2k": (1, "`26a44c508412e213de876eb54bb90390426b086c887a68b90fa78f7470425ee3`"), 18 "t8k": (2, "`2bcc84b25c418cba83df9546344fd4ae28962c314e03defe2aab62a8e6c8abb9`"), 19 "t32k": (3, "`791ef12bc33c74cb23f3318e1543def0a07e6008aa38e8d815381687dd5098b2`"), 20 "turn2-new": (4, "`153a5f88932393b2be56fd81f8914d44218169c614ebc5b2753069c9a09bc3a1`"), 21 } 22 # The assistant turn between the primed 32k user turn and the new 1k user turn. It is a fixed text, 23 # not the model's own reply, so the second request is byte-identical across arms. 24 TURN2_ASSISTANT = "I have read the whole document above and I am ready for your question about it." 25 TURN2_NEW_REPEAT = 4 # four copies of the 256-token PrefillGate text: about 1k new tokens 26 27 28 def main(argv): 29 if len(argv) != 6: 30 print(__doc__.strip().splitlines()[2], file=sys.stderr) 31 return 2 32 rows = [] 33 for pid, (i, want) in SOURCES.items(): 34 data = open(argv[i], "rb").read() 35 got = hashlib.sha256(data).hexdigest() 36 if got != want: 37 print("%s: %s sha256 %s is not %s" % (pid, argv[i], got, want), file=sys.stderr) 38 return 2 39 text = data.decode("utf-8") 40 if pid == "turn2-new": 41 text = "\n".join([text.rstrip("\n")] * TURN2_NEW_REPEAT) + "\n" 42 rows.append({"id": pid, "text": text, "source_sha256": want}) 43 rows.append({"id": "turn2-assistant", "text": TURN2_ASSISTANT, "source_sha256": None}) 44 with open(argv[5], "w") as f: 45 for r in rows: 46 f.write(json.dumps(r) + "\n") 47 return 0 48 49 50 if __name__ == "__main__": 51 sys.exit(main(sys.argv))