Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- .gitattributes +3 -0
- README.md +132 -3
- bench.py +265 -0
- config.json +22 -0
- datasets/1k_samples.jsonl +0 -0
- datasets/all_samples.jsonl +3 -0
- datasets/code_samples.jsonl +3 -0
- datasets/general_qa_samples.jsonl +3 -0
- prompts/prompt_1024.txt +3 -0
- prompts/prompt_131072.txt +0 -0
- prompts/prompt_4096.txt +3 -0
- prompts/prompt_65536.txt +0 -0
- report.py +97 -0
.DS_Store
ADDED
|
Binary file (8.2 kB). View file
|
|
|
.gitattributes
CHANGED
|
@@ -58,3 +58,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
datasets/all_samples.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
datasets/code_samples.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
datasets/general_qa_samples.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
| 1 |
-
--
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# speed-bench — Long-Context Inference Benchmarking Toolkit
|
| 2 |
+
|
| 3 |
+
A reproducible benchmark package for cold prefill and decode speed on the **llama.cpp `/v1/chat/completions`** endpoint. It includes the benchmark scripts, fixed prompt datasets, and measured results.
|
| 4 |
+
|
| 5 |
+
## Contents
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
bench.py Benchmark runner (fixed-length sweep / dataset replay)
|
| 9 |
+
report.py Combine results/*.json into a standard report (see below)
|
| 10 |
+
prompts/prompt_<L>.txt Fixed prompt datasets: 1024 / 4096 / 65536 / 131072 tokens
|
| 11 |
+
datasets/ Real-world benchmark dataset: 2 families x 3 tiers x 10 = 60 samples
|
| 12 |
+
all_samples.jsonl All 60 samples
|
| 13 |
+
code_samples.jsonl 30 code samples
|
| 14 |
+
general_qa_samples.jsonl 30 general QA samples
|
| 15 |
+
1k_samples.jsonl 20 samples in the 1K tier
|
| 16 |
+
results/bench_53_211.json Raw measured results (complete per-request timings)
|
| 17 |
+
config.json Full deployment details (quantization, n_ctx, sampling parameters, server fingerprint)
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Usage
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
python bench.py http://HOST:PORT MODEL results/out.json \
|
| 24 |
+
--lengths 1024,4096,65536,131072 --runs 2
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
The benchmark uses only the Python standard library (`transformers` is required for `--rebuild-prompts`). It processes lengths in the order given by `--lengths`, runs each tier `--runs` times, and writes the results to JSON after every run so an interruption does not lose completed data.
|
| 28 |
+
|
| 29 |
+
## Metric definitions
|
| 30 |
+
|
| 31 |
+
Use these settings when reproducing the measurements:
|
| 32 |
+
|
| 33 |
+
| Item | Setting | Reason |
|
| 34 |
+
|---|---|---|
|
| 35 |
+
| Rate source | Server-reported `timings` (`prompt_per_second` / `predicted_per_second`) | Client timing includes network and queueing overhead |
|
| 36 |
+
| `cache_prompt` | `false` | A cache hit makes prefill appear close to zero and produces misleading results |
|
| 37 |
+
| `temperature` | `0` | Reduces decode-side variation |
|
| 38 |
+
| `max_tokens` | `256` | Keeps the setting consistent across tiers for comparable decode rates |
|
| 39 |
+
| Reasoning mode | `enable_thinking: false` + `reasoning_effort: low` | Otherwise reasoning can consume the output and make decode lengths incomparable |
|
| 40 |
+
| Streaming | `stream: true` + `stream_options.include_usage` | Required to collect TTFT and usage |
|
| 41 |
+
|
| 42 |
+
TTFT is measured by the client as the time until the first SSE event containing content. All other metrics are reported by the server.
|
| 43 |
+
|
| 44 |
+
## Report format
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
python report.py results/bench_32_165_1k.json results/bench_32_165_4k.json ... --out report.md
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The report contains one row for each (Dataset × Context) pair. Values are averaged across all samples in that tier. Failed requests are excluded from the averages and counted separately (`--out` writes the Markdown report to disk).
|
| 51 |
+
|
| 52 |
+
| Dataset | Context | Input Tokens | Output Tokens | Prefill (tok/s) | TTFT (s) | Decode (tok/s) | E2E Latency (s) |
|
| 53 |
+
|---|---|---|---|---|---|---|---|
|
| 54 |
+
| code | 1k | 1039 | 246 | 431.6 | 2.65 | 16.5 | 17.35 |
|
| 55 |
+
| code | 4k | 3847 | 243 | 460.4 | 9.06 | 15.0 | 24.94 |
|
| 56 |
+
| general_qa | 1k | 1039 | 221 | 463.2 | 2.59 | 16.4 | 15.79 |
|
| 57 |
+
| general_qa | 4k | 3978 | 243 | 496.4 | 8.31 | 15.0 | 24.22 |
|
| 58 |
+
|
| 59 |
+
## Measured results (reference)
|
| 60 |
+
|
| 61 |
+
Measured deployment: `http://10.77.53.211:8080`, GGUF **Q8_0**, `n_ctx=131072`, llama.cpp fingerprint `b11103-a78cbbf70` (see `config.json`).
|
| 62 |
+
|
| 63 |
+
| Context | Prefill tok/s | Decode tok/s | TTFT | Total time per request |
|
| 64 |
+
|---|---|---|---|---|
|
| 65 |
+
| 1K | 509.5 | 17.9 | 2.3s | 16.3s |
|
| 66 |
+
| 4K | 548.9 | 16.1 | 7.8s | 23.4s |
|
| 67 |
+
| 64K | 300.5 | **5.9** | 218.6s | 261.2s |
|
| 68 |
+
| 128K | — | — | — | **Server crashed during the request** (see below) |
|
| 69 |
+
|
| 70 |
+
The difference between the two repeated runs at each tier was less than 0.3%, indicating good measurement repeatability for this endpoint.
|
| 71 |
+
|
| 72 |
+
**Known issue:** After the 128K request (130,667 prompt tokens) was sent, the server died during prefill. The client waited 240 seconds before the connection was closed, after which the port returned `Connection refused`. The deployment's practical limit is below its declared `n_ctx`; confirm that the available GPU and system memory can hold the corresponding KV cache before running the full 128K tier.
|
| 73 |
+
|
| 74 |
+
## Dataset mode: `datasets/`
|
| 75 |
+
|
| 76 |
+
The benchmark uses real-world text as input, which better represents practical workloads than synthetic repeated text. The dataset contains **2 families × 3 tiers × 10 samples = 60 samples**:
|
| 77 |
+
|
| 78 |
+
| File | Contents |
|
| 79 |
+
|---|---|
|
| 80 |
+
| `all_samples.jsonl` | All 60 samples, each with a `task_family` field |
|
| 81 |
+
| `code_samples.jsonl` | 30 code samples (HumanEval tasks with CrossCodeEval code blocks as context) |
|
| 82 |
+
| `general_qa_samples.jsonl` | 30 long-document QA and summarization samples from LongBench-Pro |
|
| 83 |
+
|
| 84 |
+
| File | Family | 1k | 4k | 64k | 128k |
|
| 85 |
+
|---|---|---|---|---|---|
|
| 86 |
+
| `all_samples.jsonl` / family-specific files | code | — | 10 | 10 | 10 |
|
| 87 |
+
| | general_qa | — | 10 | 10 | 10 |
|
| 88 |
+
| `1k_samples.jsonl` | code | 10 | — | — | — |
|
| 89 |
+
| | general_qa | 10 | — | — | — |
|
| 90 |
+
|
| 91 |
+
**The 1K tier is an additional tier** derived in advance from the paired 4K tasks. Only the context between the anchor points is trimmed; the `<CURRENT_TASK>` block and the original question remain unchanged. As a result, the `tokenizer` field is `local-o200k (openai/gpt-oss-120b)`, while the original 60 samples use `server-tokenizer`. The `construction` field in both sets documents their origin.
|
| 92 |
+
|
| 93 |
+
Fields in each record:
|
| 94 |
+
|
| 95 |
+
- `messages` — **A chat payload that can be sent directly**; the benchmark uses it as-is rather than rebuilding it.
|
| 96 |
+
- `expected_prompt_tokens` — The expected prompt token count calibrated with the tokenizer of the measured server (4k → 4096, 64k → 65536/65535, 128k → 114687/114688). `prompt_tokens_delta` in the results is the measured value minus this expectation and checks that the requested tier was sent correctly.
|
| 97 |
+
- `template_overhead` — 52 tokens for the chat template, already included above.
|
| 98 |
+
- `target_tokens` / `scale` / `task_family` / `source_dataset` / `source_id`
|
| 99 |
+
- `canonical_solution` (code) / `answer` (QA) — Reference answers for spot checks only; they do not affect benchmarking.
|
| 100 |
+
|
| 101 |
+
The target for the 128K tier is **114,688 tokens** (112 × 1024), not the commonly cited 131072. Do not mix the two values.
|
| 102 |
+
|
| 103 |
+
```bash
|
| 104 |
+
# Run the full 4K tier with four concurrent requests
|
| 105 |
+
python bench.py http://HOST:PORT default results/out.json \
|
| 106 |
+
--dataset datasets/all_samples.jsonl --scale 4k --concurrency 4
|
| 107 |
+
|
| 108 |
+
# Run only the code family, limited to five samples
|
| 109 |
+
python bench.py http://HOST:PORT default results/out.json \
|
| 110 |
+
--dataset datasets/code_samples.jsonl --limit 5
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
Each result JSON record includes `id / task_family / scale / target_tokens / expected_prompt_tokens`. After the run, the benchmark prints an aggregate table by tier with mean prefill tok/s, decode tok/s, TTFT, total time, and error count.
|
| 114 |
+
|
| 115 |
+
## Prompt datasets
|
| 116 |
+
|
| 117 |
+
Each `prompts/prompt_<L>.txt` file repeats the `FILLER` paragraphs until the target token count and then appends the same question. The files are calibrated with the **o200k-harmony vocabulary** used by the measured llama.cpp service for the gpt-oss model family:
|
| 118 |
+
|
| 119 |
+
| File | Target | Actual tokens | Characters |
|
| 120 |
+
|---|---|---|---|
|
| 121 |
+
| prompt_1024.txt | 1024 | 977 | 5,087 |
|
| 122 |
+
| prompt_4096.txt | 4096 | 4,057 | 21,159 |
|
| 123 |
+
| prompt_65536.txt | 65536 | 65,437 | 341,451 |
|
| 124 |
+
| prompt_131072.txt | 130,816 (leaving room for 256 output tokens) | 130,667 | 681,833 |
|
| 125 |
+
|
| 126 |
+
The token counts in the table are for the plain text under the o200k vocabulary. The server-reported `prompt_tokens` also includes chat-template overhead (about 60–70 tokens for the Harmony template), so values such as 1044 and 4100 in the results are expected.
|
| 127 |
+
|
| 128 |
+
**Why use fixed files:** If every user builds the prompt locally with a different tokenizer, “64K” does not represent the same input across services and the measured rates are not comparable. Sending the fixed files ensures that everyone sends identical text.
|
| 129 |
+
|
| 130 |
+
**Using a different vocabulary family:** The actual token count may shift by a few percent (for example, another vocabulary may count the same 64K prompt as 68K). If needed, run `python bench.py --rebuild-prompts <hf-tokenizer-id-or-local-path>` to regenerate the files and state the tokenizer used in the report.
|
| 131 |
+
|
| 132 |
+
**Relation to `results/`:** `results/bench_53_211.json` was measured with prompts calibrated using the **server tokenizer**. Compared with the files shipped in this package, its token counts differ by about 0.1% (for example, 65,504 vs. 65,437). To align them exactly, rerun the benchmark after the server is available and overwrite the corresponding files in `results/`.
|
bench.py
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Speed bench for a llama.cpp /v1/chat/completions server.
|
| 3 |
+
|
| 4 |
+
Two modes:
|
| 5 |
+
|
| 6 |
+
1. Length sweep - fixed prompts shipped in prompts/prompt_<L>.txt, one request per length.
|
| 7 |
+
Prompts ship as files so every replica sends byte-identical input; sizing them at run
|
| 8 |
+
time against a local tokenizer is what makes "64K" mean different things on different
|
| 9 |
+
servers. They were calibrated for the o200k-harmony vocabulary (gpt-oss family, what the
|
| 10 |
+
measured llama.cpp servers serve). Rebuild with --rebuild-prompts if your tokenizer differs.
|
| 11 |
+
|
| 12 |
+
2. Dataset - replay a jsonl of ready-made chat samples (datasets):
|
| 13 |
+
2 families x 3 tiers x 10 samples = 60, each carrying its own `messages` payload and the
|
| 14 |
+
`expected_prompt_tokens` it was calibrated to against the server tokenizer.
|
| 15 |
+
|
| 16 |
+
Rates come from the server's own `timings` block (prompt_per_second / predicted_per_second);
|
| 17 |
+
a client-side estimate is used only when the server omits it.
|
| 18 |
+
|
| 19 |
+
Usage:
|
| 20 |
+
python bench.py http://HOST:PORT MODEL results/out.json --lengths 1024,4096 --runs 2
|
| 21 |
+
python bench.py http://HOST:PORT MODEL results/out.json \
|
| 22 |
+
--dataset datasets/all_samples.jsonl --scale 4k --concurrency 4
|
| 23 |
+
python bench.py --rebuild-prompts openai/gpt-oss-120b
|
| 24 |
+
"""
|
| 25 |
+
import argparse
|
| 26 |
+
import concurrent.futures
|
| 27 |
+
import json
|
| 28 |
+
import os
|
| 29 |
+
import sys
|
| 30 |
+
import time
|
| 31 |
+
import urllib.request
|
| 32 |
+
|
| 33 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 34 |
+
PROMPT_DIR = os.path.join(HERE, 'prompts')
|
| 35 |
+
DEFAULT_LENGTHS = (1024, 4096, 65536, 131072)
|
| 36 |
+
N_CTX = 131072 # context window of the measured deployment
|
| 37 |
+
FILLER = (
|
| 38 |
+
'The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. '
|
| 39 |
+
'Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. '
|
| 40 |
+
'Risks include supplier delays, currency exposure, and hiring in the Berlin office. '
|
| 41 |
+
)
|
| 42 |
+
QUESTION = (
|
| 43 |
+
'\n\nBased on the document above, write a very detailed and comprehensive analysis report of at least 3000 words '
|
| 44 |
+
'covering every point, with sections, risks, recommendations and an action plan. Do not stop early.'
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def post(url: str, body: dict, timeout: int = 3600):
|
| 49 |
+
req = urllib.request.Request(url, data=json.dumps(body).encode(), headers={'Content-Type': 'application/json'})
|
| 50 |
+
return urllib.request.urlopen(req, timeout=timeout)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def one_run(url: str, model: str, messages: list, max_tokens: int) -> dict:
|
| 54 |
+
"""One cold request; returns the measured rates."""
|
| 55 |
+
body = {
|
| 56 |
+
'model': model,
|
| 57 |
+
'messages': messages,
|
| 58 |
+
'max_tokens': max_tokens,
|
| 59 |
+
'temperature': 0,
|
| 60 |
+
'stream': True,
|
| 61 |
+
'cache_prompt': False, # true cold prefill - cached prompts would fake the prefill rate
|
| 62 |
+
'stream_options': {'include_usage': True},
|
| 63 |
+
'timings_per_token': True,
|
| 64 |
+
'chat_template_kwargs': {'enable_thinking': False},
|
| 65 |
+
'reasoning_effort': 'low',
|
| 66 |
+
}
|
| 67 |
+
t0 = time.time()
|
| 68 |
+
ttft = None
|
| 69 |
+
n_out = 0
|
| 70 |
+
timings = None
|
| 71 |
+
usage = None
|
| 72 |
+
err = None
|
| 73 |
+
try:
|
| 74 |
+
with post(url + '/v1/chat/completions', body) as r:
|
| 75 |
+
for line in r:
|
| 76 |
+
line = line.decode().strip()
|
| 77 |
+
if not line.startswith('data:') or line == 'data: [DONE]':
|
| 78 |
+
continue
|
| 79 |
+
d = json.loads(line[5:])
|
| 80 |
+
if d.get('error'):
|
| 81 |
+
err = 'stream: ' + json.dumps(d['error'])[:300]
|
| 82 |
+
break
|
| 83 |
+
if d.get('timings'):
|
| 84 |
+
timings = d['timings']
|
| 85 |
+
if d.get('usage'):
|
| 86 |
+
usage = d['usage']
|
| 87 |
+
for c in d.get('choices', []):
|
| 88 |
+
delta = c.get('delta', {})
|
| 89 |
+
if delta.get('content') or delta.get('reasoning_content'):
|
| 90 |
+
if ttft is None:
|
| 91 |
+
ttft = time.time() - t0
|
| 92 |
+
n_out += 1
|
| 93 |
+
except Exception as e: # noqa: BLE001 - the point is to record the failure, not to crash the sweep
|
| 94 |
+
err = str(e)[:300]
|
| 95 |
+
try:
|
| 96 |
+
err += ' | ' + e.read().decode()[:300]
|
| 97 |
+
except Exception:
|
| 98 |
+
pass
|
| 99 |
+
total = time.time() - t0
|
| 100 |
+
res = {
|
| 101 |
+
'error': err,
|
| 102 |
+
'wall_s': round(total, 2),
|
| 103 |
+
'ttft_s': round(ttft, 2) if ttft else None,
|
| 104 |
+
'prompt_tokens': (usage or {}).get('prompt_tokens'),
|
| 105 |
+
'completion_tokens': (usage or {}).get('completion_tokens'),
|
| 106 |
+
}
|
| 107 |
+
if timings: # server-side numbers are authoritative
|
| 108 |
+
res.update(
|
| 109 |
+
prefill_tok_s=round(timings.get('prompt_per_second', 0), 1),
|
| 110 |
+
decode_tok_s=round(timings.get('predicted_per_second', 0), 1),
|
| 111 |
+
prefill_ms=round(timings.get('prompt_ms', 0)),
|
| 112 |
+
decode_ms=round(timings.get('predicted_ms', 0)),
|
| 113 |
+
prompt_n=timings.get('prompt_n'),
|
| 114 |
+
predicted_n=timings.get('predicted_n'),
|
| 115 |
+
)
|
| 116 |
+
elif ttft and usage:
|
| 117 |
+
res.update(
|
| 118 |
+
prefill_tok_s=round(usage['prompt_tokens'] / ttft, 1),
|
| 119 |
+
decode_tok_s=round(usage['completion_tokens'] / max(total - ttft, 1e-3), 1),
|
| 120 |
+
)
|
| 121 |
+
return res
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def build_prompt(tokenizer, target: int) -> str:
|
| 125 |
+
"""Repeat FILLER until the prompt hits `target` tokens, then append the question."""
|
| 126 |
+
per_block = len(tokenizer.encode(FILLER * 20, add_special_tokens=False)) / 20
|
| 127 |
+
n = max(1, int((target - 40) / per_block))
|
| 128 |
+
prompt = FILLER * n + QUESTION
|
| 129 |
+
while len(tokenizer.encode(prompt, add_special_tokens=False)) > target and n > 1:
|
| 130 |
+
n -= 1
|
| 131 |
+
prompt = FILLER * n + QUESTION
|
| 132 |
+
return prompt
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def rebuild_prompts(tokenizer_path: str) -> None:
|
| 136 |
+
from transformers import AutoTokenizer
|
| 137 |
+
|
| 138 |
+
tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
|
| 139 |
+
os.makedirs(PROMPT_DIR, exist_ok=True)
|
| 140 |
+
for length in DEFAULT_LENGTHS:
|
| 141 |
+
target = min(length, N_CTX - 256) # leave exactly max_tokens room for the answer
|
| 142 |
+
prompt = build_prompt(tokenizer, target)
|
| 143 |
+
path = os.path.join(PROMPT_DIR, f'prompt_{length}.txt')
|
| 144 |
+
with open(path, 'w') as fh:
|
| 145 |
+
fh.write(prompt)
|
| 146 |
+
print(f'{path}: {len(tokenizer.encode(prompt, add_special_tokens=False))} tokens, {len(prompt)} chars')
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def summarise(results: list) -> None:
|
| 150 |
+
"""Print mean rates per tier - the number a speed report actually quotes."""
|
| 151 |
+
groups: dict = {}
|
| 152 |
+
for r in results:
|
| 153 |
+
groups.setdefault(r.get('tier', '(all)'), []).append(r)
|
| 154 |
+
print(f"\n{'tier':<10}{'n':>4}{'prefill tok/s':>15}{'decode tok/s':>14}{'TTFT s':>9}{'wall s':>9}{'errors':>8}")
|
| 155 |
+
for tier, rows in sorted(groups.items()):
|
| 156 |
+
ok = [r for r in rows if not r.get('error')]
|
| 157 |
+
if not ok:
|
| 158 |
+
print(f'{tier:<10}{len(rows):>4}{"-":>15}{"-":>14}{"-":>9}{"-":>9}{len(rows):>8}')
|
| 159 |
+
continue
|
| 160 |
+
mean = lambda key: sum(r[key] for r in ok if r.get(key) is not None) / max( # noqa: E731
|
| 161 |
+
sum(1 for r in ok if r.get(key) is not None), 1)
|
| 162 |
+
print(f'{tier:<10}{len(rows):>4}{mean("prefill_tok_s"):>15.1f}{mean("decode_tok_s"):>14.1f}'
|
| 163 |
+
f'{mean("ttft_s"):>9.1f}{mean("wall_s"):>9.1f}{len(rows) - len(ok):>8}')
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def run_length_sweep(a) -> None:
|
| 167 |
+
out = {'mode': 'length_sweep', 'url': a.url, 'model': a.model, 'max_tokens': a.max_tokens,
|
| 168 |
+
'runs': a.runs, 'started': time.strftime('%F %T'), 'results': []}
|
| 169 |
+
for length in (int(x) for x in a.lengths.split(',')):
|
| 170 |
+
path = os.path.join(PROMPT_DIR, f'prompt_{length}.txt')
|
| 171 |
+
with open(path) as fh:
|
| 172 |
+
prompt = fh.read()
|
| 173 |
+
print(f"[{time.strftime('%T')}] len={length} prompt={path} chars={len(prompt)}", flush=True)
|
| 174 |
+
for i in range(a.runs):
|
| 175 |
+
res = one_run(a.url, a.model, [{'role': 'user', 'content': prompt}], a.max_tokens)
|
| 176 |
+
res.update(length=length, tier=f'{length // 1024}k', run=i + 1)
|
| 177 |
+
out['results'].append(res)
|
| 178 |
+
print(f' run{i + 1}: {json.dumps(res)}', flush=True)
|
| 179 |
+
with open(a.out, 'w') as fh:
|
| 180 |
+
json.dump(out, fh, indent=1)
|
| 181 |
+
finish(out, a)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def run_dataset(a) -> None:
|
| 185 |
+
records = []
|
| 186 |
+
with open(a.dataset) as fh:
|
| 187 |
+
for line in fh:
|
| 188 |
+
r = json.loads(line)
|
| 189 |
+
if a.scale and r.get('scale') != a.scale:
|
| 190 |
+
continue
|
| 191 |
+
if a.family and r.get('task_family') != a.family:
|
| 192 |
+
continue
|
| 193 |
+
records.append(r)
|
| 194 |
+
if a.limit:
|
| 195 |
+
records = records[:a.limit]
|
| 196 |
+
if not records:
|
| 197 |
+
raise SystemExit(f'no records in {a.dataset} matched --scale {a.scale} --family {a.family}')
|
| 198 |
+
|
| 199 |
+
out = {'mode': 'dataset', 'url': a.url, 'model': a.model, 'max_tokens': a.max_tokens,
|
| 200 |
+
'dataset': os.path.relpath(a.dataset, HERE), 'concurrency': a.concurrency,
|
| 201 |
+
'started': time.strftime('%F %T'), 'results': []}
|
| 202 |
+
print(f"[{time.strftime('%T')}] {len(records)} samples, concurrency={a.concurrency}, "
|
| 203 |
+
f"max_tokens={a.max_tokens}", flush=True)
|
| 204 |
+
|
| 205 |
+
def run_one(rec):
|
| 206 |
+
res = one_run(a.url, a.model, rec['messages'], a.max_tokens)
|
| 207 |
+
res.update(id=rec.get('id'), task_family=rec.get('task_family'), scale=rec.get('scale'),
|
| 208 |
+
tier=rec.get('scale'), target_tokens=rec.get('target_tokens'),
|
| 209 |
+
expected_prompt_tokens=rec.get('expected_prompt_tokens'))
|
| 210 |
+
if res.get('prompt_tokens') and rec.get('expected_prompt_tokens'):
|
| 211 |
+
res['prompt_tokens_delta'] = res['prompt_tokens'] - rec['expected_prompt_tokens']
|
| 212 |
+
return res
|
| 213 |
+
|
| 214 |
+
with concurrent.futures.ThreadPoolExecutor(max_workers=a.concurrency) as pool:
|
| 215 |
+
futures = {pool.submit(run_one, r): r for r in records}
|
| 216 |
+
for done in concurrent.futures.as_completed(futures):
|
| 217 |
+
res = done.result()
|
| 218 |
+
out['results'].append(res)
|
| 219 |
+
print(f" {res['id']:<22} in={res.get('prompt_tokens')} out={res.get('completion_tokens')} "
|
| 220 |
+
f"prefill={res.get('prefill_tok_s')} tok/s decode={res.get('decode_tok_s')} tok/s "
|
| 221 |
+
f"wall={res.get('wall_s')}s err={res.get('error')}", flush=True)
|
| 222 |
+
with open(a.out, 'w') as fh:
|
| 223 |
+
json.dump(out, fh, indent=1)
|
| 224 |
+
finish(out, a)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def finish(out: dict, a) -> None:
|
| 228 |
+
out['finished'] = time.strftime('%F %T')
|
| 229 |
+
out['results'].sort(key=lambda r: (r.get('tier') or '', r.get('id') or ''))
|
| 230 |
+
with open(a.out, 'w') as fh:
|
| 231 |
+
json.dump(out, fh, indent=1)
|
| 232 |
+
summarise(out['results'])
|
| 233 |
+
print(f'\nDONE -> {a.out}', flush=True)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def main() -> None:
|
| 237 |
+
ap = argparse.ArgumentParser()
|
| 238 |
+
ap.add_argument('url', nargs='?')
|
| 239 |
+
ap.add_argument('model', nargs='?')
|
| 240 |
+
ap.add_argument('out', nargs='?')
|
| 241 |
+
ap.add_argument('--lengths', default=','.join(str(x) for x in DEFAULT_LENGTHS))
|
| 242 |
+
ap.add_argument('--runs', type=int, default=2)
|
| 243 |
+
ap.add_argument('--max-tokens', type=int, default=256)
|
| 244 |
+
ap.add_argument('--dataset', help='jsonl of ready-made samples (see datasets/)')
|
| 245 |
+
ap.add_argument('--scale', help='dataset mode: only this tier, e.g. 4k')
|
| 246 |
+
ap.add_argument('--family', help='dataset mode: only this family, e.g. code')
|
| 247 |
+
ap.add_argument('--limit', type=int, help='dataset mode: cap the number of samples')
|
| 248 |
+
ap.add_argument('--concurrency', type=int, default=1, help='dataset mode: parallel in-flight requests')
|
| 249 |
+
ap.add_argument('--rebuild-prompts', metavar='TOKENIZER')
|
| 250 |
+
a = ap.parse_args()
|
| 251 |
+
|
| 252 |
+
if a.rebuild_prompts:
|
| 253 |
+
rebuild_prompts(a.rebuild_prompts)
|
| 254 |
+
return
|
| 255 |
+
if not (a.url and a.model and a.out):
|
| 256 |
+
ap.error('url, model and out are required (or use --rebuild-prompts)')
|
| 257 |
+
|
| 258 |
+
if a.dataset:
|
| 259 |
+
run_dataset(a)
|
| 260 |
+
else:
|
| 261 |
+
run_length_sweep(a)
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
if __name__ == '__main__':
|
| 265 |
+
sys.exit(main())
|
config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"measured_endpoint": "http://10.77.53.211:8080",
|
| 3 |
+
"server": "llama.cpp",
|
| 4 |
+
"server_fingerprint": "b11103-a78cbbf70",
|
| 5 |
+
"model_file": "../model/model.q8_0.gguf",
|
| 6 |
+
"quantization": "Q8_0",
|
| 7 |
+
"gguf_size_bytes": 615329280,
|
| 8 |
+
"reported_params": 579133440,
|
| 9 |
+
"n_ctx": 131072,
|
| 10 |
+
"n_ctx_train": 131072,
|
| 11 |
+
"n_vocab": 201088,
|
| 12 |
+
"n_embd": 2880,
|
| 13 |
+
"request": {
|
| 14 |
+
"temperature": 0,
|
| 15 |
+
"max_tokens": 256,
|
| 16 |
+
"stream": true,
|
| 17 |
+
"cache_prompt": false,
|
| 18 |
+
"chat_template_kwargs": {"enable_thinking": false},
|
| 19 |
+
"reasoning_effort": "low"
|
| 20 |
+
},
|
| 21 |
+
"measured_at": "2026-09-30 local time"
|
| 22 |
+
}
|
datasets/1k_samples.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
datasets/all_samples.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf6672be381c55f19bc8cb3dfbcd8d9acdca0ae294d64cef28d3279bb2970ba5
|
| 3 |
+
size 29474501
|
datasets/code_samples.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba2d6defcb3feb70bc678e821c60c8d267755020970b0d3bdccd2b2a1fe2c923
|
| 3 |
+
size 13911741
|
datasets/general_qa_samples.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:507c61b5dec65881ddf1dd16651e65a6b57f388a7a10bd6733bbef55caa5edad
|
| 3 |
+
size 15562760
|
prompts/prompt_1024.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office.
|
| 2 |
+
|
| 3 |
+
Based on the document above, write a very detailed and comprehensive analysis report of at least 3000 words covering every point, with sections, risks, recommendations and an action plan. Do not stop early.
|
prompts/prompt_131072.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
prompts/prompt_4096.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office. The quarterly report shows that revenue grew across all regions, with the strongest performance in Asia-Pacific. Engineering shipped the new storage layer, cut p99 latency by 30%, and closed 214 tickets. Risks include supplier delays, currency exposure, and hiring in the Berlin office.
|
| 2 |
+
|
| 3 |
+
Based on the document above, write a very detailed and comprehensive analysis report of at least 3000 words covering every point, with sections, risks, recommendations and an action plan. Do not stop early.
|
prompts/prompt_65536.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
report.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Turn bench.py result files into the standard speed report table.
|
| 3 |
+
|
| 4 |
+
Dataset | Context | Input Tokens | Output Tokens | Prefill (tok/s) | TTFT (s) | Decode (tok/s) | E2E Latency (s)
|
| 5 |
+
|
| 6 |
+
One row per (dataset, context tier); every value is the mean over that tier's samples.
|
| 7 |
+
Failed requests (error != null) are excluded from the means and counted in a trailing note.
|
| 8 |
+
|
| 9 |
+
Usage:
|
| 10 |
+
python report.py results/bench_32_165_*.json [--out report.md]
|
| 11 |
+
python report.py # default: every results/*.json
|
| 12 |
+
"""
|
| 13 |
+
import argparse
|
| 14 |
+
import glob
|
| 15 |
+
import json
|
| 16 |
+
import os
|
| 17 |
+
import statistics as st
|
| 18 |
+
|
| 19 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 20 |
+
TIER_ORDER = {'1k': 0, '4k': 1, '64k': 2, '128k': 3}
|
| 21 |
+
COLUMNS = ('Dataset', 'Context', 'Input Tokens', 'Output Tokens', 'Prefill (tok/s)',
|
| 22 |
+
'TTFT (s)', 'Decode (tok/s)', 'E2E Latency (s)')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def load_rows(paths: list) -> list:
|
| 26 |
+
rows = []
|
| 27 |
+
for path in paths:
|
| 28 |
+
with open(path) as fh:
|
| 29 |
+
payload = json.load(fh)
|
| 30 |
+
for r in payload.get('results', []):
|
| 31 |
+
r.setdefault('tier', r.get('scale') or f"{r.get('length', 0) // 1024}k")
|
| 32 |
+
r.setdefault('task_family', payload.get('dataset') or 'all')
|
| 33 |
+
rows.append(r)
|
| 34 |
+
return rows
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def mean(values: list) -> float:
|
| 38 |
+
values = [v for v in values if v is not None]
|
| 39 |
+
return st.mean(values) if values else float('nan')
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def build_table(rows: list) -> list:
|
| 43 |
+
groups: dict = {}
|
| 44 |
+
errors: dict = {}
|
| 45 |
+
for r in rows:
|
| 46 |
+
key = (r.get('task_family') or 'all', r.get('tier') or '?')
|
| 47 |
+
(groups if not r.get('error') else errors).setdefault(key, []).append(r)
|
| 48 |
+
table = []
|
| 49 |
+
for key in sorted(groups, key=lambda k: (k[0], TIER_ORDER.get(k[1], 9), k[1])):
|
| 50 |
+
g = groups[key]
|
| 51 |
+
table.append({
|
| 52 |
+
'Dataset': key[0],
|
| 53 |
+
'Context': key[1],
|
| 54 |
+
'Input Tokens': round(mean([r.get('prompt_tokens') for r in g])),
|
| 55 |
+
'Output Tokens': round(mean([r.get('completion_tokens') for r in g])),
|
| 56 |
+
'Prefill (tok/s)': round(mean([r.get('prefill_tok_s') for r in g]), 1),
|
| 57 |
+
'TTFT (s)': round(mean([r.get('ttft_s') for r in g]), 2),
|
| 58 |
+
'Decode (tok/s)': round(mean([r.get('decode_tok_s') for r in g]), 1),
|
| 59 |
+
'E2E Latency (s)': round(mean([r.get('wall_s') for r in g]), 2),
|
| 60 |
+
'n': len(g),
|
| 61 |
+
'errors': len(errors.get(key, [])),
|
| 62 |
+
})
|
| 63 |
+
return table
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def render(table: list) -> str:
|
| 67 |
+
lines = ['| ' + ' | '.join(COLUMNS) + ' |', '|' + '|'.join(['---'] * len(COLUMNS)) + '|']
|
| 68 |
+
for row in table:
|
| 69 |
+
lines.append('| ' + ' | '.join(str(row[c]) for c in COLUMNS) + ' |')
|
| 70 |
+
return '\n'.join(lines)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def main() -> None:
|
| 74 |
+
ap = argparse.ArgumentParser()
|
| 75 |
+
ap.add_argument('results', nargs='*')
|
| 76 |
+
ap.add_argument('--out')
|
| 77 |
+
a = ap.parse_args()
|
| 78 |
+
|
| 79 |
+
paths = a.results or sorted(glob.glob(os.path.join(HERE, 'results', '*.json')))
|
| 80 |
+
paths = [p for p in paths if os.path.basename(p) not in ('config.json',)]
|
| 81 |
+
if not paths:
|
| 82 |
+
raise SystemExit('no result files found')
|
| 83 |
+
|
| 84 |
+
table = build_table(load_rows(paths))
|
| 85 |
+
text = render(table)
|
| 86 |
+
print(text)
|
| 87 |
+
bad = sum(row['errors'] for row in table)
|
| 88 |
+
if bad:
|
| 89 |
+
print(f'\n注:{bad} 条请求失败,未计入均值。')
|
| 90 |
+
if a.out:
|
| 91 |
+
with open(a.out, 'w') as fh:
|
| 92 |
+
fh.write(text + '\n')
|
| 93 |
+
print(f'\n-> {a.out}')
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
if __name__ == '__main__':
|
| 97 |
+
main()
|