gpu-head-to-head
aien-dev/gpu-head-to-head
Brought by drakestapleton
gpu-head-to-head / q35-9b / PROTOCOL.md
| 1 | # Qwen3.5-9B on one GB10: our Omega engine, stock llama.cpp on CUDA, and stock llama.cpp on Omega |
| 2 | |
| 3 | Version 3, 2026-10-27, frozen before any timed number exists. Changes: |
| 4 | - v1 (sha256 d57ff4dc…) put OURS FP8 against llama.cpp Q8_0. That breaks the first ask in ggml-org/llama.cpp discussion #31092, so v1 is withdrawn. |
| 5 | - v2 made the headline pair BF16 against BF16. |
| 6 | - v3 adds Drake's third configuration (stock llama.cpp on our GPU stack with no NVIDIA CUDA user-space libraries) and an independent correctness oracle (HF transformers). |
| 7 | |
| 8 | No timed cell has run under any version. The GPU runs so far were untimed: the BF16 llama.cpp reference capture, the OURS FP8 and BF16 correctness checks, and the HF oracle. |
| 9 | |
| 10 | Drake in chat, 2026-10-27: |
| 11 | - "run a test between Llama CPP and our system, Omega CUDA++ ... use the Qwen 3.5 9B model" |
| 12 | - "make sure we are doing it collaboratively in the repo with Llama CPP ... Make sure we're doing what she asked" |
| 13 | - "Omega versus Llama CPP (pure Omega); Pure Llama with CUDA; Omega and Llama together with no CUDA" |
| 14 | |
| 15 | ## The three configurations |
| 16 | | # | Configuration | Arms | Same-file pairing | |
| 17 | |---|---|---|---| |
| 18 | | 1 | Pure Omega: our own engine, no llama.cpp, no NVIDIA user-space libs | OURS16 | OURS16 vs LLAMA16: same BF16 values. Layout differs, see results/WEIGHTS.md | |
| 19 | | 2 | Pure llama.cpp on NVIDIA CUDA (stock release b11913) | LLAMA16, LLAMA8 | the baseline for 1 and 3 | |
| 20 | | 3 | Stock llama.cpp with our GPU backend (aien-dev/ggml-omega `OmegaGB10`), no libggml-cuda, no NVIDIA user-space libs | LLOMEGA8, LLOMEGA16 if BF16 lands | LLOMEGA8 vs LLAMA8 and LLOMEGA16 vs LLAMA16: the identical GGUF file, identical llama.cpp front end. Only the GPU backend differs | |
| 21 | |
| 22 | In configuration 3, any op ggml-omega does not take runs on ggml's CPU backend. The op placement table (GPU or CPU, share of decode time) is published with the numbers. A slow result there is reported as it is. |
| 23 | |
| 24 | ## What the llama.cpp side asked for (SIDDARTHAREDDY8, discussion #31092, 2026-10-24) and how this run meets it |
| 25 | | Ask | Here | |
| 26 | |---|---| |
| 27 | | Same model file, same quantization, same prompt, same context size | Config 3 against config 2 uses the identical GGUF file (Q8_0, and BF16 if supported), so this ask is met exactly. Config 1 cannot read GGUF, so it uses the HF safetensors the GGUF was converted from. Every tensor was checked to hold the same values (130 byte-identical, the rest reordered or exactly transformed by the converter: results/WEIGHTS.md). Same prompts, same chat template, context 32768 for every arm. | |
| 28 | | Prompt processing and generation reported separately | pp tok/s and tg tok/s are separate columns. They are never blended. | |
| 29 | | State the offload | LLAMA*: `-ngl 999`, all layers on the GPU, verified from the load log. LLOMEGA*: `-ngl 999` onto the OmegaGB10 device, plus a per-op table of what ran on the GPU and what fell back to the CPU. OURS*: every layer on the GB10 GPU, with embedding lookup and sampling locations stated from the code. | |
| 30 | | Repetitions and spread | 3 rounds × 3 reps per cell (after warm-ups). Reported as mean ± sd and median with min..max. llama-bench `-r 5` is included as a cross-check. | |
| 31 | | Correctness before speed | The `agree` cell runs first: greedy tokens from both arms on the same 16 prompts, with the first divergence index reported. Garbage output voids that arm. | |
| 32 | | Freeze machine state, publish the recipe | Recorded per session: driver version, GPU clocks and power state (`nvidia-smi -q -d CLOCK,POWER,PERFORMANCE`), load and other processes. Exact commands, llama.cpp b11913 version string, both commits, and every file hash are published in the repo. | |
| 33 | | Disclose that the stacks differ | LLAMA* uses NVIDIA's user-space libraries (libcudart, libcublas, libcuda). OURS* and LLOMEGA* load none of them, which is checked from /proc/PID/maps. Every arm uses NVIDIA's open kernel module and GSP firmware. | |
| 34 | |
| 35 | ## Arms |
| 36 | | Arm | Engine | Weights | Role | |
| 37 | |---|---|---|---| |
| 38 | | OURS16 | aien-serve-http `--engine omega` (sc #790 + omega-mv #905 build) | BF16 safetensors, HF Qwen/Qwen3.5-9B rev c2022362 | headline, config 1 | |
| 39 | | LLAMA16 | llama-server b11913, CUDA 13.4 runtime, `-ngl 999 -fa on` | BF16 GGUF, sha256 5d6fe481… | headline, config 2 | |
| 40 | | LLAMA8 | same binary | Q8_0 GGUF, sha256 e1dc8c27… | headline, config 2 (pair for LLOMEGA8) | |
| 41 | | LLOMEGA8 | stock llama-server, backend dir = CPU + libggml-omega.so only | the same Q8_0 GGUF file | headline, config 3 | |
| 42 | | LLOMEGA16 | same as LLOMEGA8 | the same BF16 GGUF file | headline, config 3, only if ggml-omega gains BF16 MUL_MAT; otherwise NOT_RUN | |
| 43 | | OURS8 | aien-serve-http, FP8 block-128 checkpoint | FP8 | reference only, never a headline (no llama.cpp FP8 type exists) | |
| 44 | |
| 45 | ## Correctness oracle |
| 46 | HF transformers 5.16.1 (nvcr.io/nvidia/vllm:26.09-py3) runs greedy BF16 on the same 16 prompts with the same chat template and thinking off: results/ref/HF-ORACLE.jsonl. It is the model's reference implementation and shares no code with any arm. Every arm's `agree` output is compared with the oracle and with LLAMA16: first divergence in characters and in tokens, using the model's tokenizer. |
| 47 | |
| 48 | ## Proof of "no NVIDIA user-space libraries" |
| 49 | For OURS* and LLOMEGA*, the shared objects the running server mapped are captured from /proc/PID/maps (maps-so.txt). It must list none of libcuda, libcudart, libcublas, libcublasLt, libnvrtc, libnvidia-ptxjitcompiler. LLAMA* is the negative control and must list them. NVIDIA's open kernel module and GSP firmware are used by every arm and are disclosed. |
| 50 | |
| 51 | ## Cells (one HTTP client for all arms: HeadToHead repo bench/bench.py, temperature 0, thinking off) |
| 52 | 1. `agree`: c=1, 128 tokens, 16 decode prompts, 1 rep each. Correctness gate, runs first. |
| 53 | 2. `decode-c1`: c=1, max 256 tokens, decode.jsonl, 2 warm-ups + 3 reps. Gives tg tok/s. |
| 54 | 3. `prefill-p512`, `prefill-p2k`, `prefill-p8k`: c=1, max 1 token, `--nonce`, 2 warm-ups + 3 reps. Gives pp tok/s and TTFT. |
| 55 | 4. `decode-c8`: LLAMA arms with `-np 8` only, as an aggregate reference. NOT_RUN for OURS, whose dense door has no batching. |
| 56 | - Server cpus 5-9,15-19, client cpus 0-1. Quiet gate before every cell: bench/quiet.py `--window 60 --max-load 6`. A cell that runs without a quiet window is marked LOADED. |
| 57 | |
| 58 | ## Design |
| 59 | - 3 rounds. In each round every arm runs once with a fresh server start, and load time is recorded. Arm order per round comes from `random.Random(9)`, and the order is logged. |
| 60 | - No re-runs by choice. A round is repeated only for a recorded machine fault, and both attempts are reported. |
| 61 | |
| 62 | ## Metrics |
| 63 | - tg tok/s per request = (completion_tokens − 1) / (t_last − t_first). |
| 64 | - pp tok/s per request = prompt_tokens / (t_first − t_send). This includes HTTP and the first sampled token, and that is stated. |
| 65 | - Per arm and cell: mean ± sd, median, min..max over all non-warm-up requests, computed in Wolfram with the queries saved. |
| 66 | - Headline: OURS16 / LLAMA16 ratio of median tg (decode-c1) and of median pp per prompt size. |
| 67 | |
| 68 | ## Not claimed |
| 69 | - One machine, one model, single-stream generation. Not batch serving. Any cell not run is NOT_RUN. |
| 70 | |
| 71 | ## Resumption amendment, 2026-10-29 (before any new timed run) |
| 72 | |
| 73 | The resumed campaign uses `bench/bench-node.mjs` on Node v24.21.0 as a |
| 74 | verification-only measurement instrument. Python is not executed. It preserves |
| 75 | the request fields, prompt rotation, warm-up selection, nonce prefix, streaming |
| 76 | content/reasoning handling and busy-response retry policy of `bench.py`. |
| 77 | Synthetic HTTP controls live in `bench/test-bench-node.mjs`; they exercise |
| 78 | fragmented UTF-8/SSE, request shape, retries, failed/truncated responses, missing |
| 79 | usage, concurrent requests, warm-ups and refusal to overwrite an existing output. |
| 80 | |
| 81 | The instrument records monotonic nanoseconds as decimal strings (`t_send_ns`, |
| 82 | `t_first_ns`, `t_last_ns`). It calculates no rates or statistics. Wolfram converts |
| 83 | those raw timestamps and applies the metric definitions above; queries and |
| 84 | results accompany the report. The default request timeout is the same as the |
| 85 | original client: Wolfram query |
| 86 | `UnitConvert[Quantity[1800, "Seconds"], "Milliseconds"]` returned |
| 87 | `Quantity[1800000, "Milliseconds"]`. |
| 88 | |
| 89 | Unlike the old client, malformed events, missing token usage and streams ending |
| 90 | without `[DONE]` fail the request and make the client exit unsuccessfully. |
| 91 | Failed rows are retained. Files from different client implementations are not |
| 92 | pooled into one timing summary. The recovered R1 remains historical evidence; |
| 93 | the resumed client needs its own complete repeated campaign before a headline |
| 94 | comparison. No new timed run has been accepted under this amendment. |
| 95 | |
| 96 | Backend operator checks are a separate qualification level from model output. |
| 97 | The existing `ggml-omega/tests/e2e-gb10.sh` requires an exclusive model window |
| 98 | with the resident model stopped. That test remains NOT_RUN while the shared |
| 99 | service is retained. Operator-only tests performed beside that service cannot |
| 100 | replace this gate. This amendment grants no permission to stop the service. |
| 101 | |
| 102 | The archived Q35 launcher named a CUDA-runtime directory that does not exist. |
| 103 | The resumed launcher uses the actual extracted companion release directory, |
| 104 | `h2h/dl/llama-bin/cudart-llama-b11913-bin-ubuntu-cuda-13.4-arm64`. |
| 105 | Its release archive SHA-256 is |
| 106 | `f6a5a0236082be3a10e9418a47ba389d23097c1fe8926581835f22e3cdeb599a`. |
| 107 | Library maps are retained for every arm. Historical maps show system-library |
| 108 | paths, so historical and resumed CUDA rows are not treated as identical runtime |
| 109 | configurations or pooled together. |
| 110 | |
| 111 | ## Authorized model-window follow-up, 2026-10-29 |
| 112 | |
| 113 | Drake explicitly authorized stopping the shared model unless it is doing a test. |
| 114 | The saved operating rule now requires checking live activity and the shared |
| 115 | board before stopping it, then restoring the original setup after testing. |
| 116 | Exclusive windows performed under that instruction have now exercised the |
| 117 | mixed backend's fixed-prompt model check. Qwen3.5-9B BF16 and Q8 each matched |
| 118 | the CPU reference over all 16 generated tokens. Nonzero MUL_MAT, RMS_NORM and |
| 119 | SWIGLU calls prove actual placement; post-inference process maps contained none |
| 120 | of the forbidden NVIDIA user-space libraries. The checkpoint files are the same |
| 121 | ones verified above. Full chat-corpus agreement and timing remain separate gates. |
| 122 | |
| 123 | The backend test driver and comparator were hardened after controls reproduced |
| 124 | false success for empty output and a changed greedy token. The driver now |
| 125 | preserves comparator failure, requires all three executed operations and checks |
| 126 | an after-inference library snapshot. Twenty-one comparator controls and eight |
| 127 | host-only driver controls passed. Backend test-source commit: |
| 128 | `f4d4014` in `aien-dev/ggml-omega`, local experimental branch at this checkpoint. |
| 129 | Its committed `evidence/gb10-model-20261029.json` binds the model results to the |
| 130 | backend, CUDApp, llama.cpp and test-source hashes and records the numerical |
| 131 | differences. Greedy agreement is not full numerical equality. |
| 132 | |
| 133 | The original shared model was restored after both completed windows, with the |
| 134 | same binary, model, configuration and healthy endpoint. A subsequent full-corpus |
| 135 | attempt refused to stop it while another worker had requests in progress. No |
| 136 | comparison cell is accepted from that refusal, and no active request was stopped. |
| 137 | The independent reference observations, repeated timing, quiet-window evidence, |
| 138 | larger-model arms and final comparison report remain incomplete. |
| 139 | |
| 140 | ## Full-server observations, 2026-10-29 |
| 141 | |
| 142 | The resumed full-server attempt exposed two defects that the bounded model |
| 143 | driver did not cover. Private CUDApp SHA helpers could resolve to incompatible |
| 144 | `libmtmd` symbols; an export map now keeps all backend definitions private except |
| 145 | `ggml_backend_init`. Empty graph nodes could also reach a chip routine requiring |
| 146 | nonempty input; the GPU executor now skips them, matching the CPU executor. |
| 147 | The original failures, debugger trace and failing empty-graph reproduction are |
| 148 | preserved. Export isolation and empty-graph regression controls pass on the |
| 149 | fixed backend, source `9b1d3d5` (local branch). |
| 150 | |
| 151 | With those fixes, LLOMEGA16 completed every original chat-corpus request without |
| 152 | request errors. All three intended GPU operations executed, and the |
| 153 | after-inference library snapshot passed. Responses differ from the resumed |
| 154 | stock BF16 baseline on d04, d14 and d15. Against the frozen independent HF |
| 155 | reference, three sequences are identical and thirteen first-divergence tuples |
| 156 | have exact previously recorded observations. These observations do not establish |
| 157 | full numerical equivalence or excuse later differences. No final accuracy or |
| 158 | timing verdict follows from this run. |
| 159 | |
| 160 | The first full LLOMEGA8 run completed its requests but failed the unchanged |
| 161 | placement gate: MUL_MAT was absent from its GPU profile. It remains a failed |
| 162 | placement experiment. Source inspection found llama.cpp's CPU-only repacked |
| 163 | weight buffers incompatible with this backend's host-buffer interface. The |
| 164 | historical Omega launcher used `-nr`; the resumed command had omitted it. The |
| 165 | corrected Q8 run uses stock `--no-repack`, the identical GGUF and the same staged |
| 166 | backend. Its placement and output remain unverified until the run completes. |
| 167 | This is a recorded configuration correction; results are not pooled across the |
| 168 | two configurations. |
| 169 | |
| 170 | Local evidence: `handoffs/stack-comparison-20261029/llomega16-full-corpus-receipt.json`, |
| 171 | `llomega16-token-audit.json`, `llomega8-token-audit.json`, |
| 172 | `startup-collision-fix.json`, `q8-placement-diagnosis.json` and |
| 173 | `llomega-correctness-3/`. The independent-reference observations still missing |
| 174 | for other arms, repeated timing, quiet-window controls and larger-model arms |
| 175 | remain outstanding. |
| 176 | |
| 177 | ## Corrected Q8 result, 2026-10-29 |
| 178 | |
| 179 | The `--no-repack` Q8 rerun completed all sixteen requests and passed the |
| 180 | unchanged three-operation placement gate. MUL_MAT, RMS_NORM and SWIGLU all have |
| 181 | nonzero GPU execution counts. The after-inference library snapshot passed, the |
| 182 | window exited successfully, and the original shared model was restored healthy. |
| 183 | Thus the two full-server defects and the Q8 placement configuration error have |
| 184 | executed follow-up evidence; they are not merely proposed repairs. |
| 185 | |
| 186 | Against the frozen independent reference, corrected Q8 has one identical |
| 187 | sequence, nine exact previously observed first-divergence tuples and six tuples |
| 188 | without accepted observations. The BF16 result remains three identical and |
| 189 | thirteen previously observed tuples. Prior observations alone do not establish |
| 190 | whole-sequence equivalence or semantic correctness. |
| 191 | |
| 192 | The combined pending list in `results/PENDING-REFERENCE-20261029.json` contains |
| 193 | thirteen distinct contexts across all resumed arms, with identical contexts |
| 194 | deduplicated while preserving the affected arms. Every saved prefix and oracle |
| 195 | token was checked against the hashed HF reference. No fresh independent score |
| 196 | is inferred. The existing checker requires Python, which the current operating |
| 197 | instructions forbid. This gate, the repeated timing campaign, larger-model |
| 198 | comparisons and final performance report remain incomplete. |
| 199 | |
| 200 | Completed Q8 evidence is in `results/LLOMEGA8-CORPUS-20261029.json`; the local raw |
| 201 | rows, post-inference maps, operation profile and token audit remain under |
| 202 | `handoffs/stack-comparison-20261029/`. This correctness run is not a timed cell, |
| 203 | and no speed winner is claimed. |
| 204 | |
| 205 | ## Independent reference completion and timing start, 2026-10-29 |
| 206 | |
| 207 | Drake clarified that external testing/reference/measurement tools may use Python |
| 208 | while Aien architecture and structural implementation remain Python-free. |
| 209 | Calculations may also use Python, with Wolfram preferred. This removes the |
| 210 | earlier reference-tool prohibition; it does not add Python to the tested native |
| 211 | engine or Omega backend. |
| 212 | |
| 213 | The original `tie_check.py`, byte-checked against this repository's pinned copy, |
| 214 | ran in the pinned NVIDIA image |
| 215 | `nvcr.io/nvidia/vllm@sha256:557747337846eecf34486866f3d992383c6f8af869fdb0e365b5093fcaee02c2`. |
| 216 | All thirteen deduplicated pending contexts produced finite observations matching |
| 217 | the exact prompt, position and token pair. The shared model was restored and |
| 218 | healthy after exit. The updated five-arm token audit has no first-divergence |
| 219 | tuple lacking a matching independent observation. |
| 220 | |
| 221 | In the thirteen new contexts, seven tested tokens rank equal to the reference's |
| 222 | top score and six rank second. These are recorded observations, not an invented |
| 223 | acceptance tolerance. LLAMA8 d08 scores its tested token above the token saved |
| 224 | in the frozen generation reference; that negative gap is preserved. A |
| 225 | first-divergence score does not verify later divergent continuation or establish |
| 226 | whole-model numerical equivalence. Exact agreement remains reported separately. |
| 227 | |
| 228 | The resumed timing campaign retains all five arms across three rounds, with |
| 229 | `random.Random(9)` determining the recorded arm order. Each fresh session reruns |
| 230 | the agree cell, then uses the original warm-up/repetition counts, prompt sizes |
| 231 | and nonce setting. Stock CUDA arms additionally run concurrency-eight and the |
| 232 | llama-bench cross-check. Corrected Omega Q8 retains `--no-repack`; its earlier |
| 233 | failed placement run remains separate. Each cell has a fresh output file. |
| 234 | |
| 235 | Client and prompt copies are frozen for the campaign. `bench-node.mjs` records |
| 236 | raw monotonic nanoseconds as declared above; the existing external Python quiet |
| 237 | checker enforces the declared window before cells. Request/library/placement |
| 238 | failure stops the campaign. A quiet gate that cannot pass after its bounded |
| 239 | attempts stops the session without accepting a timed cell. The original shared |
| 240 | model is restored between configurations. Results are not pooled with historical |
| 241 | clients or runtimes, and no speed conclusion is justified before the required |
| 242 | cells finish and their observations are analyzed. |
| 243 | |
| 244 | New committed reference evidence: `results/REFERENCE-OBSERVATIONS-20261029.jsonl`, |
| 245 | `results/REFERENCE-RECEIPT-20261029.json`, and |
| 246 | `results/ALL-ARMS-TOKEN-AUDIT-20261029.json`. |
| 247 | The live campaign manifest, frozen instruments, order and raw outputs are under |
| 248 | `handoffs/stack-comparison-20261029/timing-campaign-1/`. |