From dcc6f756cc28fb6b0a9eb140d4117a513fbb8321 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 8 Oct 2026 22:36:27 -0400 Subject: [PATCH] fix(api): apply request logit biases in CUDA and HIP sampling --- CMakeLists.txt | 3 + docs/DETAILS.md | 2 + docs/LOGIT_BIAS.md | 51 ++ .../logit-bias-1627-20261008/README.md | 87 +++ .../cuda/build-state.json | 8 + .../logit-bias-1627-20261008/cuda/parser.txt | 1 + .../logit-bias-1627-20261008/cuda/python.txt | 354 +++++++++ .../logit-bias-1627-20261008/cuda/sampler.txt | 12 + .../hip-live/baseline.txt | 45 ++ .../hip-live/complete.json | 8 + .../logit-bias-1627-20261008/hip-live/mtp.txt | 83 +++ .../logit-bias-1627-20261008/hip-live/off.txt | 77 ++ .../hip-live/rows.json | 700 ++++++++++++++++++ .../hip/build-state.json | 8 + .../hip/live-state.json | 5 + .../logit-bias-1627-20261008/hip/parser.txt | 1 + .../logit-bias-1627-20261008/hip/python.txt | 360 +++++++++ .../logit-bias-1627-20261008/hip/sampler.txt | 11 + .../live/baseline.txt | 38 + .../live/complete.json | 9 + .../logit-bias-1627-20261008/live/mtp.txt | 52 ++ .../logit-bias-1627-20261008/live/off.txt | 46 ++ .../logit-bias-1627-20261008/live/rows.json | 700 ++++++++++++++++++ include/strata/core/logit_bias.hpp | 39 + include/strata/core/verify.hpp | 5 + include/strata/kernels/sampler.hpp | 1 + serve/logit_bias.py | 52 ++ serve/server.py | 6 +- serve/test_logit_bias.py | 61 ++ src/core/logit_bias_test.cpp | 21 + src/core/verify.cpp | 24 +- src/kernels/cuda/sampler.cu | 10 +- src/kernels/sampler_parity.cpp | 48 ++ src/program/generate.cpp | 19 +- tools/logit_bias_http_probe.py | 91 +++ 35 files changed, 3028 insertions(+), 10 deletions(-) create mode 100644 docs/LOGIT_BIAS.md create mode 100644 docs/measurements/logit-bias-1627-20261008/README.md create mode 100644 docs/measurements/logit-bias-1627-20261008/cuda/build-state.json create mode 100644 docs/measurements/logit-bias-1627-20261008/cuda/parser.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/cuda/python.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip-live/complete.json create mode 100644 docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip-live/off.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip-live/rows.json create mode 100644 docs/measurements/logit-bias-1627-20261008/hip/build-state.json create mode 100644 docs/measurements/logit-bias-1627-20261008/hip/live-state.json create mode 100644 docs/measurements/logit-bias-1627-20261008/hip/parser.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip/python.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/hip/sampler.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/live/baseline.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/live/complete.json create mode 100644 docs/measurements/logit-bias-1627-20261008/live/mtp.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/live/off.txt create mode 100644 docs/measurements/logit-bias-1627-20261008/live/rows.json create mode 100644 include/strata/core/logit_bias.hpp create mode 100644 serve/logit_bias.py create mode 100644 serve/test_logit_bias.py create mode 100644 src/core/logit_bias_test.cpp create mode 100644 tools/logit_bias_http_probe.py diff --git a/CMakeLists.txt b/CMakeLists.txt index f54244b0..abd70a62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,6 +239,9 @@ target_link_libraries(strata-dequant PRIVATE strata_artifact) # this file is now nothing but the CLI entry point, and its inherited guard spells that as a "selftest" target_compile_definitions(strata-dequant PRIVATE STRATA_DEQUANT_SELFTEST) if(STRATA_BUILD_TESTS) + add_executable(logit_bias_test src/core/logit_bias_test.cpp) + target_include_directories(logit_bias_test PRIVATE include) + add_test(NAME logit_bias_test COMMAND logit_bias_test) # the reader refuses a duplicate tensor name at open, naming it (a synthetic GGUF: no model, no GPU) add_executable(gguf_reader_test src/artifact/gguf_reader_test.cpp) target_link_libraries(gguf_reader_test PRIVATE strata_artifact) diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 9547e112..1215eaff 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1183,6 +1183,8 @@ the speculative decoding checks at once, exactly as if it decoded one token at a each batch got them). That makes requests with penalties 1-11% slower than in 0.1.18: the draft layer guesses without penalties, so more of its guesses are now rejected. Requests without penalties are unchanged. `top_k` keeps at most 64 candidates: `0` ("off") or anything above 64 uses all 64. +**Token biases (opt-in).** The chat API supports request-scoped `logit_bias` objects and token/bias pair lists on supporting CUDA/HIP engines without continuous batching. A value of -100 (or `false` in a pair list) excludes a token. Unsupported engines return an error. See [LOGIT_BIAS.md](LOGIT_BIAS.md) for formats, limits and validation. + **Sampled drafting (opt-in, 0.1.40.2).** With temperature above 0 the engine keeps a draft only when it equals the token the model sampled for that position, and the draft layer proposes its best guess. Two opt-in switches change how the draft layer drafts a sampled request; greedy requests (temperature 0) are never touched and stay byte-identical. `STRATA_SPEC_COUPLED=1` (or `--coupled-draft`) drafts by sampling with the request's own settings and the random number the checking row will use; the text for a seed does not change. `STRATA_SPEC_PROB=1` is speculative rejection sampling: the draft layer samples its guess from its own distribution q, the check accepts it with probability min(1, p/q) (p is the model's distribution after penalties, top_k, top_p, min_p and temperature) and otherwise samples the replacement from the leftover distribution, so every token is distributed exactly as without drafts (the text for a seed then depends on the drafts, so it is reproducible only for the same engine, flags and prompt). Guesses without a distribution (prompt lookup, suffix drafts) keep the exact-match rule, which is already exact. Neither is faster in a way that holds up: on an RTX 3060 (IQ3_XXS, 200-token story and code answers, 10 interleaved pairs) the default's median output speed was 42.4 / 43.2 / 43.3 tok/s at temperature 0.3 / 0.7 / 1.0, coupled drafting 40.6 / 42.4 / 43.3 and rejection sampling 41.0 / 42.6 / 42.6, with run-to-run differences of up to 5% between repeats; drafts kept per round fell at 0.3 and rose by about 5 points at 1.0, which the cost of the longer sampled windows ate. `STRATA_SPEC_DEPTH=1` prints the acceptance by draft depth for each request; `STRATA_SPEC_MIN_TEMP=0.9` limits sampled drafting to hotter requests. Proof that the rejection rule keeps the distribution: `spec_prob_test` (chi-square, 2 million trials per case) and `spec_verify_parity` (GPU against the host reference). --- diff --git a/docs/LOGIT_BIAS.md b/docs/LOGIT_BIAS.md new file mode 100644 index 00000000..2bb52391 --- /dev/null +++ b/docs/LOGIT_BIAS.md @@ -0,0 +1,51 @@ +# Per-request token biases + +`POST /v1/chat/completions` accepts `logit_bias` with a supporting CUDA or HIP +engine, without continuous batching. The same bias applies to every generated +token in the request, including tokens checked together during speculative +decoding. It does not force single-token verification windows. + +Supply an OpenAI-style object mapping vocabulary token IDs to numeric biases: + +```json +{ + "model": "your-model", + "messages": [{"role": "user", "content": "Write the Chinese word for hello. Only the word."}], + "max_tokens": 128, + "temperature": 0, + "logit_bias": {"109266": -100} +} +``` + +The equivalent llama.cpp-style pair list is `"logit_bias": [[109266, false]]`. +Numeric pair values are also supported, for example `[[42, 2.5]]`. +Token IDs belong to the loaded model's tokenizer; the example ID is not portable +between arbitrary models. + +Biases must be finite numbers in `[-100, 100]`. Negative values discourage a +token, positive values encourage it, and **-100 excludes it** (`false` in a +pair list has the same meaning). The bias is added before repetition/frequency/ +presence penalties, temperature, and candidate filtering. Raw model logits +are not overwritten. Banning a token does not ban a word or language: other +token sequences may produce the same text. + +Omitting the field, `null`, `{}`, or `[]` clears the previous request's bias. +Biases are request sampling state; they are not stored in a conversation cache. +They do not change the model weights or prompt KV. A fixed dense vocabulary +vector is uploaded when the bias changes and reused within the request. + +Malformed entries, duplicate IDs in pair lists, IDs outside the vocabulary, +out-of-range biases, or banning the entire vocabulary return HTTP 400. Validation +on the chat route occurs before SSE streaming headers are sent. Nonempty biases +also return HTTP 400 with older engines, the current SYCL engine, or continuous +batching (`--batch`), rather than being silently ignored. The engine advertises +`logit_bias=1` in its `INFO` response when this implementation is present. + +MTP target verification applies the bias; the draft model is not biased, so a +restrictive list may reduce draft acceptance. Ordinary MTP was tested. The +experimental coupled/rejection-sampling combinations and multi-GPU execution +were not validated in this campaign. There is no startup bias-file option in +this change: send the field with each request. + +See the [validation report](measurements/logit-bias-1627-20261008/README.md) +for exact scope, examples, and raw receipts. diff --git a/docs/measurements/logit-bias-1627-20261008/README.md b/docs/measurements/logit-bias-1627-20261008/README.md new file mode 100644 index 00000000..cc28231d --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/README.md @@ -0,0 +1,87 @@ +# Chat logit-bias validation — issue #1627 + +The API previously accepted `logit_bias` without applying it. This change carries +the field into native target sampling and rejects unsupported configurations. +No cache correction, private profile, model weights, or unrelated integration +work is included in this branch. + +## Live result + +**52 HTTP checks passed: 26 on CUDA and 26 on HIP**, each across an unchanged +main binary, the candidate without MTP, and the candidate with MTP. All requests used a loopback HTTP server and +recorded emitted token IDs at the native-engine boundary. + +For the prompt "Write the Chinese word for hello. Only the word.": + +| Request | Output | First token | Result | +|---|---|---:|---| +| No bias | 你好 | 109266 | Baseline | +| `{"109266": -100}` | 您好 | 109430 | Banned token absent | +| `[[109266, false]]` | 您好 | 109430 | Same result as object | +| Next request omits bias | 你好 | 109266 | Previous bias cleared | + +The same checks passed on both GPUs, with and without MTP. A positive bias selected the boosted token; +streaming and sampled requests excluded the banned token. A 103,215-entry ban +list produced no excluded IDs. This large list is a transport/masking fixture, +not a language-filter quality evaluation. + +Out-of-vocabulary IDs and out-of-range values returned HTTP 400 even when the +request asked for streaming. Empty biases restored default behavior. Two +matched no-bias prompts (greedy and seeded sampling) produced identical token +sequences with the pristine baseline and candidate binaries. This is a focused +default-path regression check, not proof for every prompt or sampling mode. + +## Builds and tests + +| Check | CUDA / llm-60 | HIP / llm-79 | +|---|---|---| +| Engine build | Pass | Pass | +| Native bias parser, including 103,215 bans | Pass | Pass | +| Python bias/server tests | 276 passed | 276 passed | +| GPU sampler parity, default/one-block/old paths | 3 passed | 3 passed | +| Real-model HTTP requests | 26 checks passed | 26 checks passed | + +GPU parity covers positive and negative biases, greedy and sampled choices, +penalties, all target rows, clearing the device bias, unmodified raw logits, +and a 248,320-token vocabulary with only one permitted token. + +Base: upstream main `fb58e0dbc8399662c0e47c76578c6e878b14f6cf`. +CUDA hardware: RTX PRO 6000 Blackwell 96 GB, CUDA 13.2. Model: ISTA IQ3_XXS, +INT8 KV, 32,768-token allocated context. Main and candidate used the same model +and settings. The MTP arm used `--spec 4 --mtp`; the non-MTP arms used `--spec 2`. +Requests were deliberately short (2–8 output tokens) to test semantics; do not +use their timings as throughput benchmarks. MTP acceptance counters in the raw +rows confirm that the draft path was active. + +HIP was compiled for gfx1100 and tested on llm-79, Radeon RX 7900 XTX 24 GB, +with ROCm and mmap-backed CPU expert offload. Each backend was compared against +its own pristine-main build; this is not a cross-hardware speed comparison. SYCL has its own unchanged engine/sampler sources +and does not advertise support; the Python capability gate rejects its biased +requests. Continuous batching is explicitly unsupported. Multi-GPU, startup +bias files, and experimental coupled/probabilistic MTP were not validated. + +## Reproduce and inspect + +- [Usage and request formats](../../LOGIT_BIAS.md). +- `python -m unittest serve.test_logit_bias serve.test_server` +- Build with `STRATA_BUILD_TESTS=ON`, then run `logit_bias_test` and the three + `sampler_parity` CTest cases on a supported CUDA GPU. +- [Generic HTTP probe](../../../tools/logit_bias_http_probe.py) accepts paths to + the source tree, model configuration, baseline binary, candidate binary, MTP + runtime, and output directory. See its `--help`. +- [All HTTP responses, token IDs and counters](live/rows.json), + [completion receipt](live/complete.json). +- [CUDA build/hash](cuda/build-state.json), [parser](cuda/parser.txt), + [Python tests](cuda/python.txt), [sampler parity](cuda/sampler.txt). +- [HIP build/hash](hip/build-state.json), [parser](hip/parser.txt), + [Python tests](hip/python.txt), [GPU sampler parity](hip/sampler.txt). +- HIP [HTTP responses and token IDs](hip-live/rows.json), + [completion receipt](hip-live/complete.json), [job receipt](hip/live-state.json), + engine logs: [baseline](hip-live/baseline.txt), [candidate](hip-live/off.txt), + [MTP candidate](hip-live/mtp.txt). +- Engine logs: [baseline](live/baseline.txt), [candidate](live/off.txt), + [candidate with MTP](live/mtp.txt). + +The public probe replaces host-specific paths from the CUDA harness with +command-line arguments. CUDA receipts come from the original harness; the HIP +campaign executed this public version. diff --git a/docs/measurements/logit-bias-1627-20261008/cuda/build-state.json b/docs/measurements/logit-bias-1627-20261008/cuda/build-state.json new file mode 100644 index 00000000..5a9b0fb0 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/cuda/build-state.json @@ -0,0 +1,8 @@ +{ + "host": "llm-60", + "base": "fb58e0db", + "started": 1791510697.3211799, + "phase": "complete", + "finished": 1791510859.109081, + "binary_sha256": "64774e620823c40b840746cbad2ce96bdcb5f8146ad9547b1dc3464ec81b4db6" +} \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/cuda/parser.txt b/docs/measurements/logit-bias-1627-20261008/cuda/parser.txt new file mode 100644 index 00000000..c938746c --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/cuda/parser.txt @@ -0,0 +1 @@ +logit_bias_test: passed, including 103215 bans diff --git a/docs/measurements/logit-bias-1627-20261008/cuda/python.txt b/docs/measurements/logit-bias-1627-20261008/cuda/python.txt new file mode 100644 index 00000000..f0706d81 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/cuda/python.txt @@ -0,0 +1,354 @@ +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/telemetry.py:230: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/stat' mode='r' encoding='UTF-8'> + f = [int(x) for x in open("/proc/stat").readline().split()[1:]] +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/telemetry.py:213: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/cpuinfo' mode='r' encoding='utf-8'> + return line.split(":", 1)[1].strip() +ResourceWarning: Enable tracemalloc to get the object allocation traceback +[strata] 400 invalid request: logit_bias: expected an object or a list of [token_id, bias] pairs +[strata] 400 invalid request: logit_bias: this engine does not support token biases; use a supporting CUDA/HIP build +[strata] 400 invalid request: logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban +[strata] model unloaded; the next request loads it again +[strata] refused a request for Host 'rebind.example.com' from 127.0.0.1: not a name this server answers to (add it to "allowed_hosts" in the config or STRATA_ALLOWED_HOSTS, or set an API key) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 10 tokens in 0 s (88862.4 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (163202.5 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (151967.5 tok/s) (length, cancel=False) +[strata] done: 0 tokens in 1 s (0.0 tok/s) (cancel, cancel=True) +[strata] done: 0 tokens in 1 s (0.0 tok/s) (cancel, cancel=True) +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not str +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not list +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not int +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not str +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not list +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not bool +[strata] done: 8 tokens in 0 s (172961.0 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (155344.6 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (165292.8 tok/s) (length, cancel=False) +[strata] done: 12 tokens in 0 s (174762.7 tok/s) (stop, cancel=False) +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] done: 8 tokens in 0 s (191739.6 tok/s) (length, cancel=False) +[strata] done: 12 tokens in 0 s (225702.5 tok/s) (stop, cancel=False) +[strata] 400 invalid request: messages must be a list of objects +[strata] done: 12 tokens in 0 s (202950.2 tok/s) (stop, cancel=False) +[strata] 400 invalid request: messages must be a list of objects +[strata] 400 invalid request: No user query found in messages. +[strata] done: 12 tokens in 0 s (208845.0 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (206277.2 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (159783.0 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (169466.8 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (251658.2 tok/s) (stop, cancel=False) +[strata] done: 8 tokens in 0 s (190650.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (208412.6 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (205855.4 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (160547.5 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (229824.9 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (212369.8 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (198546.9 tok/s) (length, cancel=False) +[strata] done: 13 tokens in 0 s (178773.6 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (143867.9 tok/s) (stop, cancel=False) +[strata] done: 10 tokens in 0 s (105384.5 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (142179.8 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (155922.1 tok/s) (length, cancel=False), expert cache 90.0% hit +[strata] the engine reported an error: verify: layer 31 never rang (an illegal memory access was encountered) +[strata] done: 0 tokens in 0 s (0.0 tok/s) (error, cancel=False) +[strata] the engine reported an error: verify: layer 31 never rang (an illegal memory access was encountered) +[strata] done: 0 tokens in 0 s (0.0 tok/s) (error, cancel=False) +[strata] the engine stopped unexpectedly (exit code -9). The next request starts the engine again. +[strata] done: 5 tokens in 0 s (88487.4 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code None); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 50 tokens in 0 s (116185.7 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (117093.9 tok/s) (length, cancel=False) +[strata] done: 1 tokens in 0 s (82241.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 2011 tokens in 0 s (11876.5 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (11590.5 tok/s) (stop, cancel=False) +[strata] done: 5 tokens in 0 s (158875.2 tok/s) (length, cancel=False) +[strata] done: 272 tokens in 0 s (65239.9 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (52387.9 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (66355.5 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (53373.1 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (84788.3 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (56454.3 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (88849.4 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (62897.5 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "tool", "name": "nope"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (84293.0 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "tool", "name": "nope"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (56301.2 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (87633.2 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (83581.4 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (88970.1 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (65367.0 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (52039.0 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (65206.4 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (52765.9 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 181 tokens in 0 s (86005.3 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (67164.2 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "function", "function": {"name": "nope"}} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (83663.5 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "function"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (84359.8 tok/s) (stop, cancel=False) +[strata] tool_choice "required" is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (89203.1 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "banana"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (79351.7 tok/s) (stop, cancel=False) +[strata] tool_choice "sometimes" is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (84118.1 tok/s) (stop, cancel=False) +[strata] done: 64 tokens in 0 s (154362.0 tok/s) (stop, cancel=False) +[strata] done: 64 tokens in 0 s (121519.0 tok/s) (stop, cancel=False) +[strata] done: 56 tokens in 0 s (163566.2 tok/s) (stop, cancel=False) +[strata] done: 56 tokens in 0 s (121889.5 tok/s) (stop, cancel=False) +[strata] layer split: card order 2,0 (the faster card last; "gpu_order": "as_given" keeps 0,2, #1352) +[strata] layer split: card order 2,0 (the faster card last; "gpu_order": "as_given" keeps 0,2, #1352) +[strata] layer split: card order 0,2,1 (the faster card last; "gpu_order": "as_given" keeps 0,1,2, #1352) +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/sys/class/kfd/kfd/topology/nodes/0/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/sys/class/kfd/kfd/topology/nodes/1/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpz1z588ba/0/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpz1z588ba/1/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpz1z588ba/2/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpz1z588ba/3/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +strata serve: AMD: HIP_PATH=Z:\definitely\not\here does not exist: not passed to the engine +strata serve: AMD: HIP_PATH=/tmp/tmpsyuwv2ta/TheRock/build does not exist: not passed to the engine +strata serve: AMD: HIP_DEVICE_LIB_PATH=/tmp/tmpsyuwv2ta/TheRock/build does not exist: not passed to the engine +strata serve: AMD: TEMP=/tmp/tmpp2v4ovkb/no/such/dir is not writable: using /tmp/tmpp2v4ovkb/tmp +[strata] a picture a tool returned was left out of the prompt: this server has no image encoder +[strata] a picture a tool returned was left out of the prompt: this server has no image encoder +[strata] a picture a tool returned was left out of the prompt: this image format needs Pillow +[strata] a picture a tool returned was left out of the prompt: the image URL could not be read +[strata] refused an API request from the web page 'https://evil.example' (no API key; add its host to "allowed_hosts" or its origin to "cors_origins" in the config) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] done: 8 tokens in 0 s (166937.5 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (177536.7 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (195083.9 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (189573.1 tok/s) (length, cancel=False) +[strata] the engine stopped unexpectedly (exit code -9). The next request starts the engine again. +[strata] done: 3 tokens in 0 s (22919.7 tok/s) (error, cancel=False) +[strata] done: 30 tokens in 1 s (51.5 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] the engine said nothing for 1 s during the request; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 1 tokens in 1 s (2.0 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (24105.2 tok/s) (length, cancel=False) +[strata] the engine said nothing for 1 s during the request; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 1 tokens in 1 s (2.0 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (12614.4 tok/s) (length, cancel=False) +[strata] the engine did not finish the request after it was stopped (STOP) within 0 s; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 2 tokens in 1 s (4.0 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (24105.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (162098.7 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (180789.0 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (170223.4 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (119837.3 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (168445.9 tok/s) (length, cancel=False) +[strata] done: 1500 tokens in 0 s (16586.3 tok/s) (length, cancel=False) +[strata] done: 1500 tokens in 0 s (17024.1 tok/s) (length, cancel=False) +[strata] 400 invalid request: prompt (246 tokens) + max tokens (4096) exceeds the context (4096); requests are never truncated. Send a smaller max_tokens (at most 3842 here), or add "fit_max_tokens": true to the model's strata-.json to shorten it to the room left (#545) +[strata] 400 invalid request: prompt (246 tokens) + max tokens (4096) exceeds the context (4096); requests are never truncated. Send a smaller max_tokens (at most 3842 here), or add "fit_max_tokens": true to the model's strata-.json to shorten it to the room left (#545) +[strata] done: 2011 tokens in 0 s (13009.4 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13388.9 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13776.6 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13619.7 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13454.0 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (14224.3 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13497.2 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13678.7 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13839.5 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (13749.5 tok/s) (stop, cancel=False) +[strata] done: 1 tokens in 0 s (55188.2 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 1 tokens in 0 s (7085.0 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 5 tokens in 0 s (194180.7 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 1 tokens in 0 s (85598.0 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 5 tokens in 0 s (150874.2 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 8 tokens in 0 s (177536.7 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (192841.6 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (250406.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (203360.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (196224.7 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (211034.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (207126.1 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (203360.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (204600.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (197379.0 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (260111.9 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (202135.1 tok/s) (length, cancel=False) +[strata] the config has a "vision" section but no --vision in its args: added --vision and --vram-reserve-mib 700 (run setup again with --vision to write them) +[strata] the config has a "vision" section but no --vision in its args: added --vision (run setup again with --vision to write them) +[strata] the config has a "vision" section but no --vision in its args: added --vision (run setup again with --vision to write them) +[strata] done: 40 tokens in 0 s (77314.4 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 40 tokens in 0 s (77528.7 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 18 tokens in 0 s (146597.0 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (198416.5 tok/s) (stop, cancel=False) +[strata] the reply ended inside its thinking with no answer: closing the thinking once and continuing (reasoning_close_retry) +[strata] done: 64 tokens in 0 s (140395.1 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (200463.1 tok/s) (stop, cancel=False) +/usr/lib/python3.12/unittest/case.py:589: ResourceWarning: unclosed + if method() is not None: +ResourceWarning: Enable tracemalloc to get the object allocation traceback +[strata] the engine did not start (try 1 of 3); again in 0 s +[strata] other apps now use the Chat settings: temperature=0.3 +[strata] done: 16 tokens in 0 s (141879.2 tok/s) (stop, cancel=False) +[strata] other apps use their own settings again +[strata] other apps now use the Chat settings: temperature=0.3 +[strata] other apps use their own settings again +[strata] done: 16 tokens in 0 s (229040.5 tok/s) (stop, cancel=False) +[strata] other apps now use the Chat settings: temperature=1.0 +[strata] other apps now use the Chat settings: temperature=0.3, top_p=0.9, top_k=10, seed=7, max_tokens=77, reasoning_effort=low, experimental_speed_projection=False +[strata] done: 16 tokens in 0 s (196224.7 tok/s) (stop, cancel=False) +[strata] done: 5 tokens in 0 s (143640.5 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] other apps now use the Chat settings: temperature=1.0 +[strata] model unloaded; the next request loads it again +[strata] before loading: /home/dflanag3/src/Strata/.venv/bin/python -c open('/tmp/tmpsoe0dwnu/ran', 'w').close() +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (212992.0 tok/s) (stop, cancel=False) +[strata] the model unloads after 1 s without requests +[strata] model unloaded after 1 s idle; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (184209.3 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] model unloaded; the next request loads it again +[strata] model unloaded after 1 s idle; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (188671.1 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (178773.6 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (202698.7 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] starting the vision encoder ... +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (183589.1 tok/s) (stop, cancel=False) +[strata] the engine has said nothing for 1 s but is still working; it is not ended (the limit is engine_silence_s). If it is stuck, "engine_silence_s" can be set lower. +[strata] the engine has said nothing for 1 s but is still working; it is not ended (the limit is engine_silence_s). If it is stuck, "engine_silence_s" can be set lower. +[strata] done: 15 tokens in 0 s (61320.2 tok/s) (disconnect, cancel=False) +[strata] done: 20 tokens in 0 s (170847.4 tok/s) (length, cancel=False) +[strata] done: 36 tokens in 0 s (135664.8 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (64693.6 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (160975.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (79976.1 tok/s) (stop, cancel=False) +[strata] 400 invalid request: stop takes at most 4 strings +[strata] 400 invalid request: stop must be a string or a list of strings +[strata] 400 invalid request: stop_sequences must be a list of strings +[strata] 400 invalid request: stop_sequences must be a list of strings +[strata] done: 19 tokens in 0 s (168126.1 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (89240.5 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (173620.4 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (88252.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (185954.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (132684.5 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (171002.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (69263.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (79262.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (73836.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (181702.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (180400.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (184590.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (83009.9 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (84449.1 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (79054.9 tok/s) (stop, cancel=False) +[strata] done: 29 tokens in 0 s (173764.0 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (182031.3 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (82714.3 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (162360.2 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (77552.6 tok/s) (stop, cancel=False) +[strata] 400 invalid request: reasoning_budget_tokens='lots': expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=2.5: expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=True: expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=[1]: expected a whole number of tokens (0: no budget) +[strata] done: 211 tokens in 0 s (85664.3 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (114688.0 tok/s) (stop, cancel=False) +[strata] done: 211 tokens in 0 s (86391.9 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 108 tokens in 0 s (98840.2 tok/s) (stop, cancel=False) +[strata] thinking budget reached (30 tokens): wrapping up the thinking +[strata] done: 122 tokens in 0 s (72747.4 tok/s) (stop, cancel=False) +[strata] done: 20 tokens in 0 s (136178.7 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 211 tokens in 0 s (87597.6 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (121166.4 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (115166.0 tok/s) (stop, cancel=False) +[strata] done: 211 tokens in 0 s (83223.4 tok/s) (stop, cancel=False) +[strata] done: 17 tokens in 0 s (187147.4 tok/s) (stop, cancel=False) +[strata] done: 119 tokens in 0 s (119122.2 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (88843.4 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (118107.5 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (91130.6 tok/s) (length, cancel=False) +[strata] done: 120 tokens in 0 s (117432.7 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (90313.4 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (117790.0 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (90638.7 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (107621.3 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (88181.2 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (106561.1 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (89214.7 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (112890.2 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 5 tokens in 0 s (112147.2 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 13 tokens in 0 s (145791.3 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (102685.4 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (117512.8 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (161319.4 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 5 tokens in 0 s (154202.4 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +---------------------------------------------------------------------- +Ran 276 tests in 85.506s + +OK diff --git a/docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt b/docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt new file mode 100644 index 00000000..43ab58e3 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt @@ -0,0 +1,12 @@ +Internal ctest changing into directory: /home/dflanag3/strata-logit-bias-1627-20261008/build +Test project /home/dflanag3/strata-logit-bias-1627-20261008/build + Start 28: sampler_parity +1/3 Test #28: sampler_parity ................... Passed 2.25 sec + Start 30: sampler_parity_one_block +2/3 Test #30: sampler_parity_one_block ......... Passed 2.35 sec + Start 31: sampler_parity_old +3/3 Test #31: sampler_parity_old ............... Passed 4.22 sec + +100% tests passed, 0 tests failed out of 3 + +Total Test time (real) = 8.82 sec diff --git a/docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt b/docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt new file mode 100644 index 00000000..e1df5bab --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt @@ -0,0 +1,45 @@ +[strata] 2026-10-09 02:34:19 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/baseline-build/strata --serve --pack /home/dflanag3/CodiServer/pack --native /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 2 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 --mmap-experts +strata generate: PCIe probe: 13.9 GB/s host->device (best of 13.9 13.9 13.9 13.9) -> pcie_frac 0.38 (default 0.55) +strata generate: this CPU has no AVX-512: the expert kernels run on AVX-2 (multi-token for the i-quant gate/up rows) +strata generate: native pack: /home/dflanag3/CodiServer/pack experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.3 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/CodiServer/pack in 0.4 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.7 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: AMD Radeon RX 7900 XTX (gfx1100) +strata generate: experts via mmap (--mmap-experts; the GGUF shards in place, no experts.bin) +strata generate: CPU pool tasks/phase: 24 (automatic), participating threads: 8 +strata generate: 7 pool workers on logical processors 1,2,3,4,5,6,7, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 19.47 GiB free, 1024 MiB reserved (+0 MiB for the draft head) -> 8512 slots +strata generate: expert cache 11375 slots, 18.47 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: the profile fill asks for 256 pairs ahead (STRATA_FILL_AHEAD) +strata generate: pre-filled 11375 of 11375 slots from the profile in 9.1 s (2176 MB/s); slot 0 verified +strata generate: routing-aware prefetch on (the next layer's router, file tier) +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 7 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 11375 resident experts, decided on the device +strata serve: prompt chunk auto: 8192 tokens, a 96-slot ring +strata serve: the prompt path borrows 2027 CUDA0 cache slots (3.32 GiB) +prefill: the GGUF experts are 100% in the page cache; the stager takes the RAM profile +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 2 tokens, 46.9 MiB of device buffers +strata serve: 968 MiB of VRAM free with everything loaded +strata verify: capturing the 2-token window (968 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (928 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 1595 ms (14.4 tok/s), 2 generated in 197 ms (10.2 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 53.8% (516 hits / 960 lookups) +strata serve: expert tiers: GPU 516 hits this request; since the start RAM 0 blobs, files 0 blobs 24931.5 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 1.7 MB from storage (0 major faults) for 24931.5 MB of expert reads +strata serve: prompt 18 tokens = 0 reused + 18 read in 995 ms (18.1 tok/s), 8 generated in 535 ms (15.0 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 73.1% (2807 hits / 3840 lookups) +strata serve: expert tiers: GPU 2807 hits this request; since the start RAM 0 blobs, files 0 blobs 29007.0 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.9 MB from storage (0 major faults) for 4075.5 MB of expert reads diff --git a/docs/measurements/logit-bias-1627-20261008/hip-live/complete.json b/docs/measurements/logit-bias-1627-20261008/hip-live/complete.json new file mode 100644 index 00000000..0b56f709 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip-live/complete.json @@ -0,0 +1,8 @@ +{ + "status": "passed", + "requests": 26, + "token_109266": "你好", + "baseline": "/home/dflanag3/strata-logit-bias-1627-20261008/baseline-build/strata", + "candidate": "/home/dflanag3/strata-logit-bias-1627-20261008/build/strata", + "config": "/home/dflanag3/CodiServer/config.json" +} \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt b/docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt new file mode 100644 index 00000000..2184c2d4 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt @@ -0,0 +1,83 @@ +[strata] 2026-10-09 02:34:58 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/build/strata --serve --pack /home/dflanag3/CodiServer/pack --native /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 4 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 --mmap-experts --mtp /boot/Strata-data/mtp/rt +strata generate: PCIe probe: 13.9 GB/s host->device (best of 13.9 13.9 13.9 13.9) -> pcie_frac 0.38 (default 0.55) +strata generate: this CPU has no AVX-512: the expert kernels run on AVX-2 (multi-token for the i-quant gate/up rows) +strata generate: native pack: /home/dflanag3/CodiServer/pack experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.2 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/CodiServer/pack in 0.4 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.6 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata mtp: draft layer loaded, 838 MiB of VRAM (experts 675, dense 111), files read in 0.67 s (1167 MiB/s) +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: AMD Radeon RX 7900 XTX (gfx1100) +strata generate: experts via mmap (--mmap-experts; the GGUF shards in place, no experts.bin) +strata generate: CPU pool tasks/phase: 24 (automatic), participating threads: 8 +strata generate: 7 pool workers on logical processors 1,2,3,4,5,6,7, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 18.64 GiB free, 1024 MiB reserved (+71 MiB for the draft head) -> 8100 slots +strata generate: expert cache 10833 slots, 17.57 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: the profile fill asks for 256 pairs ahead (STRATA_FILL_AHEAD) +strata generate: pre-filled 10833 of 10833 slots from the profile in 8.7 s (2177 MB/s); slot 0 verified +strata generate: routing-aware prefetch on (the next layer's router, file tier) +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 7 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 10833 resident experts, decided on the device +strata serve: prompt chunk auto: 8192 tokens, a 96-slot ring +strata serve: the prompt path borrows 2029 CUDA0 cache slots (3.32 GiB) +prefill: the GGUF experts are 100% in the page cache; the stager takes the RAM profile +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 4 tokens, 58.2 MiB of device buffers +strata mtp: draft head over 40525 tokens (68.0 MiB) +strata serve: 954 MiB of VRAM free with everything loaded +strata verify: capturing the 4-token window (954 MiB of VRAM free) +strata verify: captured the 4-token window (upload no error, sync no error) +strata verify: capturing the 2-token window (916 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (916 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 1602 ms (14.4 tok/s), 2 generated in 476 ms (4.2 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 45.5% (1093 hits / 2400 lookups) +strata serve: expert tiers: GPU 1093 hits this request; since the start RAM 0 blobs, files 0 blobs 25309.4 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 825.9 MB from storage (0 major faults) for 25309.4 MB of expert reads +strata verify: capturing the 3-token window (914 MiB of VRAM free) +strata verify: captured the 3-token window (upload no error, sync no error) +strata serve: prompt 18 tokens = 0 reused + 18 read in 1035 ms (17.4 tok/s), 8 generated in 650 ms (12.3 tok/s), drafts accepted 4 of 9, 1 checkpoints +strata serve: decode expert cache hit rate: 71.0% (4430 hits / 6240 lookups) +strata serve: expert tiers: GPU 4430 hits this request; since the start RAM 0 blobs, files 0 blobs 30663.9 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 1.2 MB from storage (0 major faults) for 5354.5 MB of expert reads +strata serve: prompt 23 tokens = 0 reused + 23 read in 1183 ms (19.4 tok/s), 2 generated in 434 ms (4.6 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 56.5% (1355 hits / 2400 lookups) +strata serve: expert tiers: GPU 1355 hits this request; since the start RAM 0 blobs, files 0 blobs 36267.5 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.2 MB from storage (0 major faults) for 5603.7 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 268 ms (26.2 tok/s), 2 generated in 335 ms (6.0 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 62.5% (1501 hits / 2400 lookups) +strata serve: expert tiers: GPU 1501 hits this request; since the start RAM 0 blobs, files 0 blobs 38445.4 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 2177.8 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 265 ms (26.5 tok/s), 3 generated in 596 ms (5.0 tok/s), drafts accepted 0 of 6, 1 checkpoints +strata serve: decode expert cache hit rate: 67.8% (2929 hits / 4320 lookups) +strata serve: expert tiers: GPU 2929 hits this request; since the start RAM 0 blobs, files 0 blobs 41448.1 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.3 MB from storage (0 major faults) for 3002.7 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 205 ms (34.2 tok/s), 2 generated in 312 ms (6.4 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 66.2% (1588 hits / 2400 lookups) +strata serve: expert tiers: GPU 1588 hits this request; since the start RAM 0 blobs, files 0 blobs 43277.1 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 1829.0 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 204 ms (34.4 tok/s), 2 generated in 323 ms (6.2 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 69.3% (1664 hits / 2400 lookups) +strata serve: expert tiers: GPU 1664 hits this request; since the start RAM 0 blobs, files 0 blobs 45074.3 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 1797.3 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 168 ms (41.7 tok/s), 2 generated in 273 ms (7.3 tok/s), drafts accepted 1 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 72.9% (1750 hits / 2400 lookups) +strata serve: expert tiers: GPU 1750 hits this request; since the start RAM 0 blobs, files 0 blobs 46577.0 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 1502.7 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 166 ms (42.1 tok/s), 2 generated in 284 ms (7.0 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 76.2% (1829 hits / 2400 lookups) +strata serve: expert tiers: GPU 1829 hits this request; since the start RAM 0 blobs, files 0 blobs 48059.3 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 1482.3 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 137 ms (51.1 tok/s), 2 generated in 252 ms (7.9 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: decode expert cache hit rate: 76.8% (1842 hits / 2400 lookups) +strata serve: expert tiers: GPU 1842 hits this request; since the start RAM 0 blobs, files 0 blobs 49357.6 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 1298.3 MB of expert reads diff --git a/docs/measurements/logit-bias-1627-20261008/hip-live/off.txt b/docs/measurements/logit-bias-1627-20261008/hip-live/off.txt new file mode 100644 index 00000000..6cc6109c --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip-live/off.txt @@ -0,0 +1,77 @@ +[strata] 2026-10-09 02:34:37 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/build/strata --serve --pack /home/dflanag3/CodiServer/pack --native /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 2 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 --mmap-experts +strata generate: PCIe probe: 13.9 GB/s host->device (best of 13.9 13.9 13.9 13.9) -> pcie_frac 0.38 (default 0.55) +strata generate: this CPU has no AVX-512: the expert kernels run on AVX-2 (multi-token for the i-quant gate/up rows) +strata generate: native pack: /home/dflanag3/CodiServer/pack experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.2 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/CodiServer/pack in 0.4 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.6 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/fleet-responses-cache-20261008/source/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /boot/Strata-data/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: AMD Radeon RX 7900 XTX (gfx1100) +strata generate: experts via mmap (--mmap-experts; the GGUF shards in place, no experts.bin) +strata generate: CPU pool tasks/phase: 24 (automatic), participating threads: 8 +strata generate: 7 pool workers on logical processors 1,2,3,4,5,6,7, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 19.47 GiB free, 1024 MiB reserved (+0 MiB for the draft head) -> 8512 slots +strata generate: expert cache 11375 slots, 18.47 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: the profile fill asks for 256 pairs ahead (STRATA_FILL_AHEAD) +strata generate: pre-filled 11375 of 11375 slots from the profile in 9.3 s (2134 MB/s); slot 0 verified +strata generate: routing-aware prefetch on (the next layer's router, file tier) +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 7 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 11375 resident experts, decided on the device +strata serve: prompt chunk auto: 8192 tokens, a 96-slot ring +strata serve: the prompt path borrows 2027 CUDA0 cache slots (3.32 GiB) +prefill: the GGUF experts are 100% in the page cache; the stager takes the RAM profile +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 2 tokens, 46.9 MiB of device buffers +strata serve: 968 MiB of VRAM free with everything loaded +strata verify: capturing the 2-token window (968 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (928 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 1607 ms (14.3 tok/s), 2 generated in 199 ms (10.1 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 53.8% (516 hits / 960 lookups) +strata serve: expert tiers: GPU 516 hits this request; since the start RAM 0 blobs, files 0 blobs 24931.5 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 1.7 MB from storage (0 major faults) for 24931.5 MB of expert reads +strata serve: prompt 18 tokens = 0 reused + 18 read in 1034 ms (17.4 tok/s), 8 generated in 547 ms (14.6 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 73.1% (2807 hits / 3840 lookups) +strata serve: expert tiers: GPU 2807 hits this request; since the start RAM 0 blobs, files 0 blobs 29007.0 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.9 MB from storage (0 major faults) for 4075.5 MB of expert reads +strata serve: prompt 23 tokens = 0 reused + 23 read in 999 ms (23.0 tok/s), 2 generated in 174 ms (11.5 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 68.6% (659 hits / 960 lookups) +strata serve: expert tiers: GPU 659 hits this request; since the start RAM 0 blobs, files 0 blobs 32330.4 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.1 MB from storage (0 major faults) for 3323.4 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 212 ms (33.0 tok/s), 2 generated in 106 ms (18.8 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 74.9% (719 hits / 960 lookups) +strata serve: expert tiers: GPU 719 hits this request; since the start RAM 0 blobs, files 0 blobs 33275.1 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 944.7 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 200 ms (35.0 tok/s), 3 generated in 204 ms (14.7 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 74.1% (1067 hits / 1440 lookups) +strata serve: expert tiers: GPU 1067 hits this request; since the start RAM 0 blobs, files 0 blobs 34353.9 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.1 MB from storage (0 major faults) for 1078.8 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 160 ms (43.8 tok/s), 2 generated in 100 ms (20.1 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 80.3% (771 hits / 960 lookups) +strata serve: expert tiers: GPU 771 hits this request; since the start RAM 0 blobs, files 0 blobs 35096.7 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 742.8 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 156 ms (44.8 tok/s), 2 generated in 121 ms (16.5 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 82.5% (792 hits / 960 lookups) +strata serve: expert tiers: GPU 792 hits this request; since the start RAM 0 blobs, files 0 blobs 35827.6 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 731.0 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 132 ms (53.2 tok/s), 2 generated in 85 ms (23.4 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 85.4% (820 hits / 960 lookups) +strata serve: expert tiers: GPU 820 hits this request; since the start RAM 0 blobs, files 0 blobs 36378.9 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 551.2 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 130 ms (53.8 tok/s), 2 generated in 103 ms (19.4 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 86.6% (831 hits / 960 lookups) +strata serve: expert tiers: GPU 831 hits this request; since the start RAM 0 blobs, files 0 blobs 36932.2 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 553.3 MB of expert reads +strata serve: prompt 23 tokens = 16 reused + 7 read in 102 ms (68.4 tok/s), 2 generated in 47 ms (42.7 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: decode expert cache hit rate: 87.9% (844 hits / 960 lookups) +strata serve: expert tiers: GPU 844 hits this request; since the start RAM 0 blobs, files 0 blobs 37134.9 MB read (the GGUF in place) +strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 202.8 MB of expert reads diff --git a/docs/measurements/logit-bias-1627-20261008/hip-live/rows.json b/docs/measurements/logit-bias-1627-20261008/hip-live/rows.json new file mode 100644 index 00000000..f7aae189 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip-live/rows.json @@ -0,0 +1,700 @@ +[ + { + "mode": "baseline", + "label": "unchanged-greedy", + "status": 200, + "seconds": 1.8030352230125573, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-7d41cd97f5ab4083a998b581\", \"object\": \"chat.completion\", \"created\": 1791513271, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 23, \"prompt_ms\": 1595.5, \"prompt_per_token_ms\": 69.37, \"prompt_per_second\": 14.4, \"predicted_n\": 2, \"predicted_ms\": 196.9, \"predicted_per_token_ms\": 98.45, \"predicted_per_second\": 10.2, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 1595.5, + "decode_ms": 196.9, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 516, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 577.8, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "baseline", + "label": "unchanged-sampled", + "status": 200, + "seconds": 1.5323127520096023, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-c7365ad75a294339bf7cedd3\", \"object\": \"chat.completion\", \"created\": 1791513273, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 994.5, \"prompt_per_token_ms\": 55.25, \"prompt_per_second\": 18.1, \"predicted_n\": 8, \"predicted_ms\": 535.0, \"predicted_per_token_ms\": 66.875, \"predicted_per_second\": 15.0, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 994.5, + "decode_ms": 535.0, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 2807, + "lookups": 3840, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1096.0, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "unchanged-greedy", + "status": 200, + "seconds": 1.8097313879989088, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-b3dd496b242e4769ba27b2b9\", \"object\": \"chat.completion\", \"created\": 1791513289, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 23, \"prompt_ms\": 1607.2, \"prompt_per_token_ms\": 69.878, \"prompt_per_second\": 14.3, \"predicted_n\": 2, \"predicted_ms\": 198.5, \"predicted_per_token_ms\": 99.25, \"predicted_per_second\": 10.1, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 1607.2, + "decode_ms": 198.5, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 516, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 577.8, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "unchanged-sampled", + "status": 200, + "seconds": 1.5842197499878239, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-c4ba692945a24348b5182ff3\", \"object\": \"chat.completion\", \"created\": 1791513291, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 1034.4, \"prompt_per_token_ms\": 57.467, \"prompt_per_second\": 17.4, \"predicted_n\": 8, \"predicted_ms\": 547.3, \"predicted_per_token_ms\": 68.412, \"predicted_per_second\": 14.6, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 1034.4, + "decode_ms": 547.3, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 2807, + "lookups": 3840, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1096.0, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "ban-object", + "status": 200, + "seconds": 1.1760462709935382, + "request_bytes": 218, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-b82bf4fbe2b1463fb3d68aab\", \"object\": \"chat.completion\", \"created\": 1791513292, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 23, \"prompt_ms\": 999.4, \"prompt_per_token_ms\": 43.452, \"prompt_per_second\": 23.0, \"predicted_n\": 2, \"predicted_ms\": 173.9, \"predicted_per_token_ms\": 86.95, \"predicted_per_second\": 11.5, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 999.4, + "decode_ms": 173.9, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 659, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 447.5, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "ban-pairs", + "status": 200, + "seconds": 0.3213470099726692, + "request_bytes": 219, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-9ff7dc1c919141f685f2cdc5\", \"object\": \"chat.completion\", \"created\": 1791513293, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 211.9, \"prompt_per_token_ms\": 30.271, \"prompt_per_second\": 33.0, \"predicted_n\": 2, \"predicted_ms\": 106.4, \"predicted_per_token_ms\": 53.2, \"predicted_per_second\": 18.8, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 211.9, + "decode_ms": 106.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 719, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 314.6, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "positive-bias", + "status": 200, + "seconds": 0.4065814570058137, + "request_bytes": 216, + "token_ids": [ + 41674, + 41674, + 41674 + ], + "response": "{\"id\": \"chatcmpl-a3b6e58fcff148e4a9ce2803\", \"object\": \"chat.completion\", \"created\": 1791513294, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \" banana banana banana\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 3, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 200.2, \"prompt_per_token_ms\": 28.6, \"prompt_per_second\": 35.0, \"predicted_n\": 3, \"predicted_ms\": 203.8, \"predicted_per_token_ms\": 67.933, \"predicted_per_second\": 14.7, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 3, + "prompt_tokens": 23, + "prompt_ms": 200.2, + "decode_ms": 203.8, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 1067, + "lookups": 1440, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 492.2, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "invalid-id", + "status": 400, + "seconds": 0.0009806530142668635, + "request_bytes": 231, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: token ID outside the model vocabulary\"}}", + "engine": {} + }, + { + "mode": "off", + "label": "invalid-value", + "status": 400, + "seconds": 0.001046607008902356, + "request_bytes": 228, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban\"}}", + "engine": {} + }, + { + "mode": "off", + "label": "cleared-bias", + "status": 200, + "seconds": 0.2616803359996993, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-23e9c1d51f244ed68b540017\", \"object\": \"chat.completion\", \"created\": 1791513294, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 159.6, \"prompt_per_token_ms\": 22.8, \"prompt_per_second\": 43.9, \"predicted_n\": 2, \"predicted_ms\": 99.6, \"predicted_per_token_ms\": 49.8, \"predicted_per_second\": 20.1, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 159.6, + "decode_ms": 99.6, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 771, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 302.6, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "empty-bias", + "status": 200, + "seconds": 0.2798244880104903, + "request_bytes": 204, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-d3a854314d264919bc0d6c06\", \"object\": \"chat.completion\", \"created\": 1791513294, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 156.4, \"prompt_per_token_ms\": 22.343, \"prompt_per_second\": 44.8, \"predicted_n\": 2, \"predicted_ms\": 120.9, \"predicted_per_token_ms\": 60.45, \"predicted_per_second\": 16.5, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 156.4, + "decode_ms": 120.9, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 792, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 306.3, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "103215-bans", + "status": 200, + "seconds": 0.8766506589890923, + "request_bytes": 1643747, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-99f2648b03484b01a176710c\", \"object\": \"chat.completion\", \"created\": 1791513295, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 131.5, \"prompt_per_token_ms\": 18.786, \"prompt_per_second\": 53.2, \"predicted_n\": 2, \"predicted_ms\": 85.4, \"predicted_per_token_ms\": 42.7, \"predicted_per_second\": 23.4, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 131.5, + "decode_ms": 85.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 820, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 246.9, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "stream-ban", + "status": 200, + "seconds": 0.23628101899521425, + "request_bytes": 234, + "token_ids": [ + 109430, + 248046 + ], + "response": "data: {\"id\": \"chatcmpl-04b115a1ab7841e8abe5502e\", \"object\": \"chat.completion.chunk\", \"created\": 1791513296, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\", \"content\": \"\"}, \"finish_reason\": null}]}\n\n: keep-alive\n\ndata: {\"id\": \"chatcmpl-04b115a1ab7841e8abe5502e\", \"object\": \"chat.completion.chunk\", \"created\": 1791513296, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"content\": \"您好\"}, \"finish_reason\": null}]}\n\ndata: {\"id\": \"chatcmpl-04b115a1ab7841e8abe5502e\", \"object\": \"chat.completion.chunk\", \"created\": 1791513296, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 130.1, \"prompt_per_token_ms\": 18.586, \"prompt_per_second\": 53.8, \"predicted_n\": 2, \"predicted_ms\": 102.9, \"predicted_per_token_ms\": 51.45, \"predicted_per_second\": 19.4, \"draft_n\": 0, \"draft_n_accepted\": 0}}\n\ndata: [DONE]\n\n", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 130.1, + "decode_ms": 102.9, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 831, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 245.3, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "sampled-ban", + "status": 200, + "seconds": 0.1519488669873681, + "request_bytes": 233, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-cab276bbfbb1441983dc6d82\", \"object\": \"chat.completion\", \"created\": 1791513296, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 102.4, \"prompt_per_token_ms\": 14.629, \"prompt_per_second\": 68.4, \"predicted_n\": 2, \"predicted_ms\": 46.8, \"predicted_per_token_ms\": 23.4, \"predicted_per_second\": 42.7, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 102.4, + "decode_ms": 46.8, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 844, + "lookups": 960, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 24.9, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "unchanged-greedy", + "status": 200, + "seconds": 2.0826305910013616, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-adbe17b4c70e4d5da551b057\", \"object\": \"chat.completion\", \"created\": 1791513310, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 23, \"prompt_ms\": 1601.7, \"prompt_per_token_ms\": 69.639, \"prompt_per_second\": 14.4, \"predicted_n\": 2, \"predicted_ms\": 476.3, \"predicted_per_token_ms\": 238.15, \"predicted_per_second\": 4.2, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 1601.7, + "decode_ms": 476.3, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 0, + "hits": 1093, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1647.5, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "unchanged-sampled", + "status": 200, + "seconds": 1.6877531510253903, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-78724c051024409cb22e0d1a\", \"object\": \"chat.completion\", \"created\": 1791513312, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 1034.8, \"prompt_per_token_ms\": 57.489, \"prompt_per_second\": 17.4, \"predicted_n\": 8, \"predicted_ms\": 650.4, \"predicted_per_token_ms\": 81.3, \"predicted_per_second\": 12.3, \"draft_n\": 9, \"draft_n_accepted\": 4}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 1034.8, + "decode_ms": 650.4, + "finish": "length", + "drafts_accepted": 4, + "drafts_offered": 9, + "reused": 0, + "hits": 4430, + "lookups": 6240, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1997.8, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "ban-object", + "status": 200, + "seconds": 1.6195281529799104, + "request_bytes": 218, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-c6a4aab1f56a4b0e825662ed\", \"object\": \"chat.completion\", \"created\": 1791513314, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 23, \"prompt_ms\": 1183.4, \"prompt_per_token_ms\": 51.452, \"prompt_per_second\": 19.4, \"predicted_n\": 2, \"predicted_ms\": 433.7, \"predicted_per_token_ms\": 216.85, \"predicted_per_second\": 4.6, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 1183.4, + "decode_ms": 433.7, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 0, + "hits": 1355, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1563.9, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "ban-pairs", + "status": 200, + "seconds": 0.6055841910128947, + "request_bytes": 219, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-d9da035caea74f79b89fcd40\", \"object\": \"chat.completion\", \"created\": 1791513315, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 267.6, \"prompt_per_token_ms\": 38.229, \"prompt_per_second\": 26.2, \"predicted_n\": 2, \"predicted_ms\": 335.0, \"predicted_per_token_ms\": 167.5, \"predicted_per_second\": 6.0, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 267.6, + "decode_ms": 335.0, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 1501, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1270.6, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "positive-bias", + "status": 200, + "seconds": 0.8628598999930546, + "request_bytes": 216, + "token_ids": [ + 41674, + 41674, + 41674 + ], + "response": "{\"id\": \"chatcmpl-5bd52471cce34c1db2623709\", \"object\": \"chat.completion\", \"created\": 1791513316, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \" banana banana banana\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 3, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 264.5, \"prompt_per_token_ms\": 37.786, \"prompt_per_second\": 26.5, \"predicted_n\": 3, \"predicted_ms\": 595.5, \"predicted_per_token_ms\": 198.5, \"predicted_per_second\": 5.0, \"draft_n\": 6, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 3, + "prompt_tokens": 23, + "prompt_ms": 264.5, + "decode_ms": 595.5, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 6, + "reused": 16, + "hits": 2929, + "lookups": 4320, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 2095.5, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "invalid-id", + "status": 400, + "seconds": 0.0009065140038728714, + "request_bytes": 231, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: token ID outside the model vocabulary\"}}", + "engine": {} + }, + { + "mode": "mtp", + "label": "invalid-value", + "status": 400, + "seconds": 0.0010225320002064109, + "request_bytes": 228, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban\"}}", + "engine": {} + }, + { + "mode": "mtp", + "label": "cleared-bias", + "status": 200, + "seconds": 0.5190766409796197, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-ccaf535c75c649f2b7c241e6\", \"object\": \"chat.completion\", \"created\": 1791513317, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 204.5, \"prompt_per_token_ms\": 29.214, \"prompt_per_second\": 34.2, \"predicted_n\": 2, \"predicted_ms\": 312.0, \"predicted_per_token_ms\": 156.0, \"predicted_per_second\": 6.4, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 204.5, + "decode_ms": 312.0, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 1588, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1171.2, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "empty-bias", + "status": 200, + "seconds": 0.5297043150058016, + "request_bytes": 204, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-921a1a885ff44a8f8487d3f8\", \"object\": \"chat.completion\", \"created\": 1791513317, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 203.7, \"prompt_per_token_ms\": 29.1, \"prompt_per_second\": 34.4, \"predicted_n\": 2, \"predicted_ms\": 323.0, \"predicted_per_token_ms\": 161.5, \"predicted_per_second\": 6.2, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 203.7, + "decode_ms": 323.0, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 1664, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1139.5, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "103215-bans", + "status": 200, + "seconds": 1.0881067400041502, + "request_bytes": 1643747, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-ca834b1e562a46f5b925422a\", \"object\": \"chat.completion\", \"created\": 1791513318, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 167.7, \"prompt_per_token_ms\": 23.957, \"prompt_per_second\": 41.7, \"predicted_n\": 2, \"predicted_ms\": 272.6, \"predicted_per_token_ms\": 136.3, \"predicted_per_second\": 7.3, \"draft_n\": 3, \"draft_n_accepted\": 1}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 167.7, + "decode_ms": 272.6, + "finish": "stop", + "drafts_accepted": 1, + "drafts_offered": 3, + "reused": 16, + "hits": 1750, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 1000.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "stream-ban", + "status": 200, + "seconds": 0.4542736040020827, + "request_bytes": 234, + "token_ids": [ + 109430, + 248046 + ], + "response": "data: {\"id\": \"chatcmpl-7189537ae65e4c8ba0a5bc00\", \"object\": \"chat.completion.chunk\", \"created\": 1791513319, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\", \"content\": \"\"}, \"finish_reason\": null}]}\n\n: keep-alive\n\ndata: {\"id\": \"chatcmpl-7189537ae65e4c8ba0a5bc00\", \"object\": \"chat.completion.chunk\", \"created\": 1791513319, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"content\": \"您好\"}, \"finish_reason\": null}]}\n\ndata: {\"id\": \"chatcmpl-7189537ae65e4c8ba0a5bc00\", \"object\": \"chat.completion.chunk\", \"created\": 1791513319, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 166.4, \"prompt_per_token_ms\": 23.771, \"prompt_per_second\": 42.1, \"predicted_n\": 2, \"predicted_ms\": 284.5, \"predicted_per_token_ms\": 142.25, \"predicted_per_second\": 7.0, \"draft_n\": 3, \"draft_n_accepted\": 3}}\n\ndata: [DONE]\n\n", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 166.4, + "decode_ms": 284.5, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 1829, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 979.6, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "sampled-ban", + "status": 200, + "seconds": 0.3921648919931613, + "request_bytes": 233, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-09731a35a2a3440aa9c5de0a\", \"object\": \"chat.completion\", \"created\": 1791513319, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 137.0, \"prompt_per_token_ms\": 19.571, \"prompt_per_second\": 51.1, \"predicted_n\": 2, \"predicted_ms\": 252.4, \"predicted_per_token_ms\": 126.2, \"predicted_per_second\": 7.9, \"draft_n\": 3, \"draft_n_accepted\": 3}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 137.0, + "decode_ms": 252.4, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 1842, + "lookups": 2400, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 914.5, + "prompt_read": 7, + "offloaded": 0 + } + } +] \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/hip/build-state.json b/docs/measurements/logit-bias-1627-20261008/hip/build-state.json new file mode 100644 index 00000000..9594aa61 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip/build-state.json @@ -0,0 +1,8 @@ +{ + "host": "llm-79", + "base": "fb58e0db", + "started": 1791510810.4050398, + "phase": "complete", + "finished": 1791511053.7059107, + "binary_sha256": "868f0c5098866b04990738c985dd30376de33b741970656cdeae66cc24d42658" +} \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/hip/live-state.json b/docs/measurements/logit-bias-1627-20261008/hip/live-state.json new file mode 100644 index 00000000..ddfffded --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip/live-state.json @@ -0,0 +1,5 @@ +{ + "started": 1791513102.8196487, + "phase": "complete", + "finished": 1791513321.8137896 +} \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/hip/parser.txt b/docs/measurements/logit-bias-1627-20261008/hip/parser.txt new file mode 100644 index 00000000..c938746c --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip/parser.txt @@ -0,0 +1 @@ +logit_bias_test: passed, including 103215 bans diff --git a/docs/measurements/logit-bias-1627-20261008/hip/python.txt b/docs/measurements/logit-bias-1627-20261008/hip/python.txt new file mode 100644 index 00000000..89d5f545 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip/python.txt @@ -0,0 +1,360 @@ +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/telemetry.py:230: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/stat' mode='r' encoding='UTF-8'> + f = [int(x) for x in open("/proc/stat").readline().split()[1:]] +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/telemetry.py:213: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/cpuinfo' mode='r' encoding='utf-8'> + return line.split(":", 1)[1].strip() +ResourceWarning: Enable tracemalloc to get the object allocation traceback +[strata] 400 invalid request: logit_bias: expected an object or a list of [token_id, bias] pairs +[strata] 400 invalid request: logit_bias: this engine does not support token biases; use a supporting CUDA/HIP build +[strata] 400 invalid request: logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban +[strata] model unloaded; the next request loads it again +[strata] refused a request for Host 'rebind.example.com' from 127.0.0.1: not a name this server answers to (add it to "allowed_hosts" in the config or STRATA_ALLOWED_HOSTS, or set an API key) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 10 tokens in 0 s (26563.0 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (37019.5 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (106725.3 tok/s) (length, cancel=False) +[strata] done: 0 tokens in 1 s (0.0 tok/s) (cancel, cancel=True) +[strata] done: 0 tokens in 1 s (0.0 tok/s) (cancel, cancel=True) +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not str +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not list +[strata] 400 invalid request: tools[0] (f): "parameters" must be an object (the JSON schema of its parameters), not int +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not str +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not list +[strata] 400 invalid request: tools[0] (f): "input_schema" must be an object (the JSON schema of its parameters), not bool +[strata] done: 8 tokens in 0 s (96698.7 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (99273.5 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (87609.5 tok/s) (length, cancel=False) +[strata] done: 12 tokens in 0 s (93902.3 tok/s) (stop, cancel=False) +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"type": "function", "function": {"name": ..., "parameters": {...}}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools must be a list of tool objects, each {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] 400 invalid request: tools[0] has no name: each tool must be {"name": ..., "input_schema": {...}} +[strata] done: 8 tokens in 0 s (98689.5 tok/s) (length, cancel=False) +[strata] done: 12 tokens in 0 s (100262.2 tok/s) (stop, cancel=False) +[strata] 400 invalid request: messages must be a list of objects +[strata] done: 12 tokens in 0 s (100865.0 tok/s) (stop, cancel=False) +[strata] 400 invalid request: messages must be a list of objects +[strata] 400 invalid request: No user query found in messages. +[strata] done: 12 tokens in 0 s (120989.5 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (118427.4 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (117050.3 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (128070.4 tok/s) (stop, cancel=False) +[strata] done: 12 tokens in 0 s (124892.4 tok/s) (stop, cancel=False) +[strata] done: 8 tokens in 0 s (105186.3 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (98689.5 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (45839.4 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (117323.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (132626.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (49490.3 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (120266.8 tok/s) (length, cancel=False) +[strata] done: 13 tokens in 0 s (103859.0 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (34100.0 tok/s) (stop, cancel=False) +[strata] done: 10 tokens in 0 s (41775.9 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (43018.5 tok/s) (length, cancel=False) +[strata] done: 10 tokens in 0 s (64827.0 tok/s) (length, cancel=False), expert cache 90.0% hit +[strata] the engine reported an error: verify: layer 31 never rang (an illegal memory access was encountered) +[strata] done: 0 tokens in 0 s (0.0 tok/s) (error, cancel=False) +[strata] the engine reported an error: verify: layer 31 never rang (an illegal memory access was encountered) +[strata] done: 0 tokens in 0 s (0.0 tok/s) (error, cancel=False) +[strata] the engine stopped unexpectedly (exit code -9). The next request starts the engine again. +[strata] done: 5 tokens in 0 s (26955.7 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code None); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 50 tokens in 0 s (57283.6 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (31314.8 tok/s) (length, cancel=False) +[strata] done: 1 tokens in 0 s (18001.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 2011 tokens in 0 s (7611.3 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6194.3 tok/s) (stop, cancel=False) +[strata] done: 5 tokens in 0 s (33500.8 tok/s) (length, cancel=False) +[strata] done: 272 tokens in 0 s (11441.3 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (15018.7 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (15671.7 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (17100.9 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (15593.4 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (12311.0 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (17328.0 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (30442.4 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "tool", "name": "nope"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (43654.8 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "tool", "name": "nope"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (22372.3 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (42638.3 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (15151.6 tok/s) (stop, cancel=False) +[strata] done: 203 tokens in 0 s (41862.6 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (13619.0 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (9446.2 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (18091.8 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (14704.0 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 181 tokens in 0 s (14613.2 tok/s) (stop, cancel=False) +[strata] done: 272 tokens in 0 s (13455.0 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "function", "function": {"name": "nope"}} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (15199.5 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "function"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (47595.9 tok/s) (stop, cancel=False) +[strata] tool_choice "required" is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (16643.1 tok/s) (stop, cancel=False) +[strata] tool_choice {"type": "banana"} is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (16389.4 tok/s) (stop, cancel=False) +[strata] tool_choice "sometimes" is not supported here (or names no tool of the request): the model decides, as with "auto" +[strata] done: 203 tokens in 0 s (30639.6 tok/s) (stop, cancel=False) +[strata] done: 64 tokens in 0 s (32965.2 tok/s) (stop, cancel=False) +[strata] done: 64 tokens in 0 s (21161.6 tok/s) (stop, cancel=False) +[strata] done: 56 tokens in 0 s (34962.9 tok/s) (stop, cancel=False) +[strata] done: 56 tokens in 0 s (22713.6 tok/s) (stop, cancel=False) +[strata] layer split: card order 2,0 (the faster card last; "gpu_order": "as_given" keeps 0,2, #1352) +[strata] layer split: card order 2,0 (the faster card last; "gpu_order": "as_given" keeps 0,2, #1352) +[strata] layer split: card order 0,2,1 (the faster card last; "gpu_order": "as_given" keeps 0,1,2, #1352) +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/sys/class/kfd/kfd/topology/nodes/0/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/sys/class/kfd/kfd/topology/nodes/1/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpizcog_uz/0/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpizcog_uz/1/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpizcog_uz/2/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +/home/dflanag3/strata-logit-bias-1627-20261008/source/serve/server.py:2319: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpizcog_uz/3/properties' mode='r' encoding='UTF-8'> + props = dict(line.split() for line in open(os.path.join(root, str(n), "properties")) if len(line.split()) == 2) +ResourceWarning: Enable tracemalloc to get the object allocation traceback +strata serve: AMD: HIP_PATH=Z:\definitely\not\here does not exist: not passed to the engine +strata serve: AMD: HIP_PATH=/tmp/tmp1cb5s7ee/TheRock/build does not exist: not passed to the engine +strata serve: AMD: HIP_DEVICE_LIB_PATH=/tmp/tmp1cb5s7ee/TheRock/build does not exist: not passed to the engine +strata serve: AMD: TEMP=/tmp/tmplvd1wg4q/no/such/dir is not writable: using /tmp/tmplvd1wg4q/tmp +[strata] a picture a tool returned was left out of the prompt: this server has no image encoder +[strata] a picture a tool returned was left out of the prompt: this server has no image encoder +[strata] a picture a tool returned was left out of the prompt: this image format needs Pillow +[strata] a picture a tool returned was left out of the prompt: the image URL could not be read +[strata] refused an API request from the web page 'https://evil.example' (no API key; add its host to "allowed_hosts" or its origin to "cors_origins" in the config) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] 400 invalid request: a web page of another origin cannot have a file on this computer read as an image: send it as a data: URL (or add the page's origin to the config's trusted_origins) +[strata] done: 8 tokens in 0 s (47594.9 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (112222.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (51385.0 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (49636.7 tok/s) (length, cancel=False) +/usr/lib/python3.14/tempfile.py:484: ResourceWarning: Implicitly cleaning up + _warnings.warn(self.warn_message, ResourceWarning) +[strata] the engine stopped unexpectedly (exit code -9). The next request starts the engine again. +[strata] done: 3 tokens in 0 s (3071.3 tok/s) (error, cancel=False) +[strata] done: 30 tokens in 1 s (51.4 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] the engine said nothing for 1 s during the request; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 1 tokens in 1 s (2.0 tok/s) (error, cancel=False) +/usr/lib/python3.14/tempfile.py:484: ResourceWarning: Implicitly cleaning up + _warnings.warn(self.warn_message, ResourceWarning) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (10446.6 tok/s) (length, cancel=False) +[strata] the engine said nothing for 1 s during the request; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 1 tokens in 1 s (2.0 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (4978.4 tok/s) (length, cancel=False) +[strata] the engine did not finish the request after it was stopped (STOP) within 0 s; the server ended the engine. The engine and the server lost step (issue #481; a very slow PC can raise "engine_silence_s" in the config, 0 = wait forever). If it happens again, please add the end of the engine log to github.com/Niko1221/Strata/issues/481. The next request starts the engine again. +[strata] done: 2 tokens in 1 s (4.0 tok/s) (error, cancel=False) +[strata] the engine had stopped (exit code -9); starting it again (a minute or two) ... +[strata] the engine is running again +[strata] done: 2 tokens in 0 s (10356.3 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (111107.4 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (87600.3 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (90550.6 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (92835.4 tok/s) (length, cancel=False) +[strata] done: 50 tokens in 0 s (92835.4 tok/s) (length, cancel=False) +[strata] done: 1500 tokens in 0 s (9913.1 tok/s) (length, cancel=False) +[strata] done: 1500 tokens in 0 s (7923.2 tok/s) (length, cancel=False) +[strata] 400 invalid request: prompt (246 tokens) + max tokens (4096) exceeds the context (4096); requests are never truncated. Send a smaller max_tokens (at most 3842 here), or add "fit_max_tokens": true to the model's strata-.json to shorten it to the room left (#545) +[strata] 400 invalid request: prompt (246 tokens) + max tokens (4096) exceeds the context (4096); requests are never truncated. Send a smaller max_tokens (at most 3842 here), or add "fit_max_tokens": true to the model's strata-.json to shorten it to the room left (#545) +[strata] done: 2011 tokens in 0 s (7156.7 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (7399.3 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (7106.7 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (7228.2 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6859.3 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6901.9 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6337.3 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6539.2 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (6640.7 tok/s) (stop, cancel=False) +[strata] done: 2011 tokens in 0 s (5986.8 tok/s) (stop, cancel=False) +[strata] done: 1 tokens in 0 s (17476.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 1 tokens in 0 s (18001.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 5 tokens in 0 s (45789.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 1 tokens in 0 s (21399.5 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 5 tokens in 0 s (42027.1 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] 400 invalid request: prompt (4088 tokens) leaves no room to answer in the context (4096); requests are never truncated +[strata] done: 8 tokens in 0 s (54738.1 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (60787.0 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (120266.8 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (55188.2 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (126620.5 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (57952.4 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (141579.9 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (144010.4 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (140395.1 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (139230.0 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (100462.4 tok/s) (length, cancel=False) +[strata] done: 8 tokens in 0 s (81442.8 tok/s) (length, cancel=False) +[strata] the config has a "vision" section but no --vision in its args: added --vision and --vram-reserve-mib 700 (run setup again with --vision to write them) +[strata] the config has a "vision" section but no --vision in its args: added --vision (run setup again with --vision to write them) +[strata] the config has a "vision" section but no --vision in its args: added --vision (run setup again with --vision to write them) +[strata] done: 40 tokens in 0 s (12576.6 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 40 tokens in 0 s (13249.0 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 18 tokens in 0 s (38896.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (38382.0 tok/s) (stop, cancel=False) +[strata] the reply ended inside its thinking with no answer: closing the thinking once and continuing (reasoning_close_retry) +[strata] done: 64 tokens in 0 s (27175.1 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (46803.4 tok/s) (stop, cancel=False) +/usr/lib/python3.14/unittest/case.py:615: ResourceWarning: unclosed + result = method() +ResourceWarning: Enable tracemalloc to get the object allocation traceback +[strata] the engine did not start (try 1 of 3); again in 0 s +[strata] other apps now use the Chat settings: temperature=0.3 +[strata] done: 16 tokens in 0 s (114130.7 tok/s) (stop, cancel=False) +[strata] other apps use their own settings again +[strata] other apps now use the Chat settings: temperature=0.3 +[strata] other apps use their own settings again +[strata] done: 16 tokens in 0 s (46506.5 tok/s) (stop, cancel=False) +[strata] other apps now use the Chat settings: temperature=1.0 +[strata] other apps now use the Chat settings: temperature=0.3, top_p=0.9, top_k=10, seed=7, max_tokens=77, reasoning_effort=low, experimental_speed_projection=False +[strata] done: 16 tokens in 0 s (111107.4 tok/s) (stop, cancel=False) +[strata] done: 5 tokens in 0 s (46500.0 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] other apps now use the Chat settings: temperature=1.0 +[strata] model unloaded; the next request loads it again +[strata] before loading: /home/dflanag3/src/Strata/.venv/bin/python -c open('/tmp/tmp_t6c9dg4/ran', 'w').close() +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (48640.5 tok/s) (stop, cancel=False) +[strata] the model unloads after 1 s without requests +[strata] model unloaded after 1 s idle; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (54093.2 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] model unloaded; the next request loads it again +[strata] model unloaded after 1 s idle; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (91486.5 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (44294.0 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (92260.5 tok/s) (stop, cancel=False) +[strata] model unloaded; the next request loads it again +[strata] starting the vision encoder ... +[strata] loading the model again (it was unloaded) ... +[strata] the engine is running again +[strata] done: 13 tokens in 0 s (41276.3 tok/s) (stop, cancel=False) +[strata] the engine has said nothing for 1 s but is still working; it is not ended (the limit is engine_silence_s). If it is stuck, "engine_silence_s" can be set lower. +[strata] the engine has said nothing for 1 s but is still working; it is not ended (the limit is engine_silence_s). If it is stuck, "engine_silence_s" can be set lower. +[strata] done: 15 tokens in 0 s (33008.7 tok/s) (disconnect, cancel=False) +[strata] done: 20 tokens in 0 s (39235.8 tok/s) (length, cancel=False) +[strata] done: 36 tokens in 0 s (28292.1 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (16703.0 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (35246.3 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (14442.4 tok/s) (stop, cancel=False) +[strata] 400 invalid request: stop takes at most 4 strings +[strata] 400 invalid request: stop must be a string or a list of strings +[strata] 400 invalid request: stop_sequences must be a list of strings +[strata] 400 invalid request: stop_sequences must be a list of strings +[strata] done: 19 tokens in 0 s (71089.9 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (38424.2 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (77748.1 tok/s) (stop, cancel=False) +[strata] done: 19 tokens in 0 s (37117.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (75422.0 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (64008.0 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (36972.3 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (28920.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (25028.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (28366.5 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (103919.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (106785.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (95748.2 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (40964.4 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (40524.7 tok/s) (stop, cancel=False) +[strata] done: 36 tokens in 0 s (38826.2 tok/s) (stop, cancel=False) +[strata] done: 29 tokens in 0 s (99864.4 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (104314.3 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (43166.1 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (104748.5 tok/s) (stop, cancel=False) +[strata] done: 24 tokens in 0 s (30012.9 tok/s) (stop, cancel=False) +[strata] 400 invalid request: reasoning_budget_tokens='lots': expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=2.5: expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=True: expected a whole number of tokens (0: no budget) +[strata] 400 invalid request: reasoning_budget_tokens=[1]: expected a whole number of tokens (0: no budget) +[strata] done: 211 tokens in 0 s (18214.0 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (21702.0 tok/s) (stop, cancel=False) +[strata] done: 211 tokens in 0 s (18993.4 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 108 tokens in 0 s (24708.7 tok/s) (stop, cancel=False) +[strata] thinking budget reached (30 tokens): wrapping up the thinking +[strata] done: 122 tokens in 0 s (13044.1 tok/s) (stop, cancel=False) +[strata] done: 20 tokens in 0 s (25987.0 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 211 tokens in 0 s (15022.6 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (20601.8 tok/s) (stop, cancel=False) +[strata] thinking budget reached (20 tokens): wrapping up the thinking +[strata] done: 112 tokens in 0 s (22042.1 tok/s) (stop, cancel=False) +[strata] done: 211 tokens in 0 s (16897.3 tok/s) (stop, cancel=False) +[strata] done: 17 tokens in 0 s (52313.4 tok/s) (stop, cancel=False) +[strata] done: 119 tokens in 0 s (19819.8 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (17921.8 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (21204.1 tok/s) (length, cancel=False) +[strata] done: 119 tokens in 0 s (15193.1 tok/s) (length, cancel=False) +[strata] done: 120 tokens in 0 s (50549.0 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (17265.2 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (63719.0 tok/s) (stop, cancel=False) +[strata] done: 120 tokens in 0 s (46889.9 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (20979.4 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (32818.6 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (21519.8 tok/s) (stop, cancel=False) +[strata] done: 147 tokens in 0 s (16814.3 tok/s) (stop, cancel=False) +[strata] done: 13 tokens in 0 s (36423.5 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 5 tokens in 0 s (74898.3 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +[strata] done: 13 tokens in 0 s (35919.6 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (21199.8 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (20360.7 tok/s) (stop, cancel=False), expert cache 90.0% hit +[strata] done: 13 tokens in 0 s (34293.1 tok/s) (stop, cancel=False), expert cache 90.0% hit +/usr/lib/python3.14/tempfile.py:484: ResourceWarning: Implicitly cleaning up + _warnings.warn(self.warn_message, ResourceWarning) +[strata] done: 5 tokens in 0 s (64726.9 tok/s) (length, cancel=False) +[strata] the reply reached max tokens while still thinking, so it has no answer: a thinking budget (reasoning_budget_tokens, in the request or in strata-.json for every request) leaves room to answer +---------------------------------------------------------------------- +Ran 276 tests in 93.137s + +OK diff --git a/docs/measurements/logit-bias-1627-20261008/hip/sampler.txt b/docs/measurements/logit-bias-1627-20261008/hip/sampler.txt new file mode 100644 index 00000000..098cd6aa --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/hip/sampler.txt @@ -0,0 +1,11 @@ +Test project /home/dflanag3/strata-logit-bias-1627-20261008/build + Start 38: sampler_parity +1/3 Test #38: sampler_parity ................... Passed 1.26 sec + Start 40: sampler_parity_one_block +2/3 Test #40: sampler_parity_one_block ......... Passed 1.55 sec + Start 41: sampler_parity_old +3/3 Test #41: sampler_parity_old ............... Passed 5.17 sec + +100% tests passed, 0 tests failed out of 3 + +Total Test time (real) = 8.00 sec diff --git a/docs/measurements/logit-bias-1627-20261008/live/baseline.txt b/docs/measurements/logit-bias-1627-20261008/live/baseline.txt new file mode 100644 index 00000000..0a1412d8 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/live/baseline.txt @@ -0,0 +1,38 @@ +[strata] 2026-10-08 21:56:11 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/baseline-build/strata --serve --pack /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main --native /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 2 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 +strata generate: PCIe probe: 28.9 GB/s host->device (best of 28.9 28.8 28.9 28.8) -> pcie_frac 0.55 (default 0.55) +strata generate: native pack: /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.1 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main in 0.2 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.3 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: NVIDIA RTX PRO 6000 Blackwell Workstation Edition, compute capability 12.0 +strata generate: expert arena read through the file cache (buffered (not Windows)) +strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 20464 2 MiB pages, vm.nr_hugepages=0); transparent huge pages requested (MADV_HUGEPAGE) +strata generate: loaded 39.97 GiB at 9.26 GiB/s +strata generate: CPU pool tasks/phase: 48 (automatic), participating threads: 16 +strata generate: 15 pool workers on logical processors 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 89.90 GiB free, 1024 MiB reserved (+0 MiB for the draft head) -> 24576 slots +strata generate: expert cache 24576 slots, 39.97 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: pre-filled 24576 of 24576 slots from the profile in 1.8 s (23612 MB/s); slot 0 verified +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 15 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 24576 resident experts, decided on the device +prefill: the CPU share is ON by default for prompt chunks below 1024 tokens (the idle CPU takes some of the experts the GPU would stream; answers can differ slightly from 0.1.40.3, mean KL ~0.004). STRATA_PREFILL_CPU_SHARE=0 turns it off. +strata serve: prompt chunk auto: 8192 tokens, a 384-slot ring +strata serve: the prompt path borrows 2484 CUDA0 cache slots (3.99 GiB) +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 2 tokens, 46.9 MiB of device buffers (100% VRAM resident: zero-doorbell graph) +strata serve: 50796 MiB of VRAM free with everything loaded +strata verify: capturing the 2-token window (50796 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (50792 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 164 ms (139.9 tok/s), 2 generated in 20 ms (101.7 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 18 tokens = 0 reused + 18 read in 116 ms (155.8 tok/s), 8 generated in 52 ms (153.9 tok/s), drafts accepted 0 of 0, 1 checkpoints diff --git a/docs/measurements/logit-bias-1627-20261008/live/complete.json b/docs/measurements/logit-bias-1627-20261008/live/complete.json new file mode 100644 index 00000000..48ced202 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/live/complete.json @@ -0,0 +1,9 @@ +{ + "status": "passed", + "requests": 26, + "token_109266": "你好", + "base": "fb58e0db", + "model": "ISTA IQ3_XXS", + "kv": "int8", + "max_context": 32768 +} \ No newline at end of file diff --git a/docs/measurements/logit-bias-1627-20261008/live/mtp.txt b/docs/measurements/logit-bias-1627-20261008/live/mtp.txt new file mode 100644 index 00000000..6d96b9d0 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/live/mtp.txt @@ -0,0 +1,52 @@ +[strata] 2026-10-08 21:56:36 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/build/strata --serve --pack /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main --native /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 4 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 --mtp /home/dflanag3/Strata-data/mtp/rt +strata generate: PCIe probe: 28.9 GB/s host->device (best of 28.8 28.9 28.8 28.8) -> pcie_frac 0.55 (default 0.55) +strata generate: native pack: /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.1 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main in 0.2 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.3 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata mtp: draft layer loaded, 838 MiB of VRAM (experts 675, dense 111), files read in 0.21 s (3807 MiB/s) +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: NVIDIA RTX PRO 6000 Blackwell Workstation Edition, compute capability 12.0 +strata generate: expert arena read through the file cache (buffered (not Windows)) +strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 20464 2 MiB pages, vm.nr_hugepages=0); transparent huge pages requested (MADV_HUGEPAGE) +strata generate: loaded 39.97 GiB at 9.24 GiB/s +strata generate: CPU pool tasks/phase: 48 (automatic), participating threads: 16 +strata generate: 15 pool workers on logical processors 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 89.08 GiB free, 1024 MiB reserved (+71 MiB for the draft head) -> 24576 slots +strata generate: expert cache 24576 slots, 39.97 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: pre-filled 24576 of 24576 slots from the profile in 1.8 s (23616 MB/s); slot 0 verified +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 15 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 24576 resident experts, decided on the device +prefill: the CPU share is ON by default for prompt chunks below 1024 tokens (the idle CPU takes some of the experts the GPU would stream; answers can differ slightly from 0.1.40.3, mean KL ~0.004). STRATA_PREFILL_CPU_SHARE=0 turns it off. +strata serve: prompt chunk auto: 8192 tokens, a 384-slot ring +strata serve: the prompt path borrows 2484 CUDA0 cache slots (3.99 GiB) +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 4 tokens, 58.2 MiB of device buffers (100% VRAM resident: zero-doorbell graph) +strata mtp: draft head over 40525 tokens (68.0 MiB) +strata serve: 49868 MiB of VRAM free with everything loaded +strata verify: capturing the 4-token window (49868 MiB of VRAM free) +strata verify: captured the 4-token window (upload no error, sync no error) +strata verify: capturing the 2-token window (49864 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (49858 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 147 ms (156.7 tok/s), 2 generated in 23 ms (85.3 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata verify: capturing the 3-token window (49850 MiB of VRAM free) +strata verify: captured the 3-token window (upload no error, sync no error) +strata serve: prompt 18 tokens = 0 reused + 18 read in 102 ms (176.0 tok/s), 8 generated in 36 ms (221.9 tok/s), drafts accepted 4 of 9, 1 checkpoints +strata serve: prompt 23 tokens = 0 reused + 23 read in 108 ms (212.7 tok/s), 2 generated in 16 ms (123.1 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 26 ms (272.0 tok/s), 2 generated in 16 ms (123.2 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 26 ms (267.6 tok/s), 3 generated in 26 ms (114.6 tok/s), drafts accepted 0 of 6, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 26 ms (272.4 tok/s), 2 generated in 16 ms (124.8 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 26 ms (269.8 tok/s), 2 generated in 16 ms (124.9 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 25 ms (277.5 tok/s), 2 generated in 16 ms (123.3 tok/s), drafts accepted 1 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 25 ms (279.4 tok/s), 2 generated in 16 ms (123.3 tok/s), drafts accepted 3 of 3, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 25 ms (285.0 tok/s), 2 generated in 16 ms (124.2 tok/s), drafts accepted 3 of 3, 1 checkpoints diff --git a/docs/measurements/logit-bias-1627-20261008/live/off.txt b/docs/measurements/logit-bias-1627-20261008/live/off.txt new file mode 100644 index 00000000..753fd51f --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/live/off.txt @@ -0,0 +1,46 @@ +[strata] 2026-10-08 21:56:23 engine started: /home/dflanag3/strata-logit-bias-1627-20261008/build/strata --serve --pack /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main --native /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf --ple-gguf /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf --expert-profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin --expert-cache auto --prefill auto:8192 --spec 2 --suffix-draft 0 --max-context 32768 --kv int8 --stats --vram-reserve-mib 1024 +strata generate: PCIe probe: 28.9 GB/s host->device (best of 28.8 28.9 28.8 28.9) -> pcie_frac 0.55 (default 0.55) +strata generate: native pack: /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main experts (largest blob 2.33 MB), token embedding IQ3_S in mapped host memory (260 MiB, 0.2 s) +strata generate: 1466 MiB of weights loaded from /home/dflanag3/fleet-tool-eval-20261007/packs/ista-iq3-llm60-main in 0.2 s (302 canonical tensors skipped: served natively) +strata generate: 300 native projection matrices, 1781.11 MiB of weights, in 0.3 s +strata generate: the SSD is kept awake while rows are read: one page of the table after 100 ms without a read, until 60 s after the last request (STRATA_SSD_KEEPALIVE=0 turns it off) +strata generate: profile /home/dflanag3/strata-cache-bench-20261008/pr1489/data/expert-profile.bin: 24576 ranked pairs, built for 24576 slots +strata generate: PLE on, table 320001536 rows of /home/dflanag3/models/ISTA-IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf +strata generate: experimental native Q5_K head, 437043200 bytes, in 0.1 s +strata generate: GPU 0: NVIDIA RTX PRO 6000 Blackwell Workstation Edition, compute capability 12.0 +strata generate: expert arena read through the file cache (buffered (not Windows)) +strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 20464 2 MiB pages, vm.nr_hugepages=0); transparent huge pages requested (MADV_HUGEPAGE) +strata generate: loaded 39.97 GiB at 9.29 GiB/s +strata generate: CPU pool tasks/phase: 48 (automatic), participating threads: 16 +strata generate: 15 pool workers on logical processors 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, the host thread on 0 (draining too) (--host-core first) +strata generate: expert cache auto: 89.90 GiB free, 1024 MiB reserved (+0 MiB for the draft head) -> 24576 slots +strata generate: expert cache 24576 slots, 39.97 GiB of VRAM; policy is +strata generate: the GPU computes the experts in the cache; it rounds differently from the CPU, + so a reply can differ slightly from a run without the cache (same quality: + bench/results/2026-09-27-cache-parity). + PROFILE, ranked by routing frequency, no eviction. +strata generate: pre-filled 24576 of 24576 slots from the profile in 1.8 s (23609 MB/s); slot 0 verified +strata generate: R4 hit path ON - resident experts are computed on the GPU +strata generate: 15 expert-pool workers + the host thread +strata generate: session is up (engine 0.1.41) +strata generate: token graph hit path: 24576 resident experts, decided on the device +prefill: the CPU share is ON by default for prompt chunks below 1024 tokens (the idle CPU takes some of the experts the GPU would stream; answers can differ slightly from 0.1.40.3, mean KL ~0.004). STRATA_PREFILL_CPU_SHARE=0 turns it off. +strata serve: prompt chunk auto: 8192 tokens, a 384-slot ring +strata serve: the prompt path borrows 2484 CUDA0 cache slots (3.99 GiB) +strata hc: CUDA0: the hyper-connection read runs as staged (the norm per token and stream, the down projection's activations staged ahead by cp.async); checked bit for bit against the plain read on this card (STRATA_HC_SPLIT=1 or 0 for the earlier ones) +strata verify: window up to 2 tokens, 46.9 MiB of device buffers (100% VRAM resident: zero-doorbell graph) +strata serve: 50796 MiB of VRAM free with everything loaded +strata verify: capturing the 2-token window (50796 MiB of VRAM free) +strata verify: captured the 2-token window (upload no error, sync no error) +strata verify: capturing the 1-token window (50792 MiB of VRAM free) +strata verify: captured the 1-token window (upload no error, sync no error) +strata serve: prompt 23 tokens = 0 reused + 23 read in 132 ms (173.6 tok/s), 2 generated in 19 ms (103.0 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 18 tokens = 0 reused + 18 read in 116 ms (155.7 tok/s), 8 generated in 52 ms (154.5 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 0 reused + 23 read in 128 ms (179.5 tok/s), 2 generated in 13 ms (156.2 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 30 ms (233.2 tok/s), 2 generated in 12 ms (160.8 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 30 ms (234.0 tok/s), 3 generated in 19 ms (154.6 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 30 ms (234.9 tok/s), 2 generated in 12 ms (163.2 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 30 ms (235.6 tok/s), 2 generated in 12 ms (163.5 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 31 ms (228.3 tok/s), 2 generated in 12 ms (160.7 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 31 ms (229.0 tok/s), 2 generated in 12 ms (160.8 tok/s), drafts accepted 0 of 0, 1 checkpoints +strata serve: prompt 23 tokens = 16 reused + 7 read in 30 ms (232.1 tok/s), 2 generated in 12 ms (162.3 tok/s), drafts accepted 0 of 0, 1 checkpoints diff --git a/docs/measurements/logit-bias-1627-20261008/live/rows.json b/docs/measurements/logit-bias-1627-20261008/live/rows.json new file mode 100644 index 00000000..c14f6178 --- /dev/null +++ b/docs/measurements/logit-bias-1627-20261008/live/rows.json @@ -0,0 +1,700 @@ +[ + { + "mode": "baseline", + "label": "unchanged-greedy", + "status": 200, + "seconds": 0.1951256380416453, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-bb8c1d2423554efd83a93a4e\", \"object\": \"chat.completion\", \"created\": 1791510981, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 164.4, + "decode_ms": 19.7, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "baseline", + "label": "unchanged-sampled", + "status": 200, + "seconds": 0.16908849799074233, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-955e36d1775942e3807d8e5c\", \"object\": \"chat.completion\", \"created\": 1791510982, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 115.5, \"prompt_per_token_ms\": 6.417, \"prompt_per_second\": 155.8, \"predicted_n\": 8, \"predicted_ms\": 52.0, \"predicted_per_token_ms\": 6.5, \"predicted_per_second\": 153.8, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 115.5, + "decode_ms": 52.0, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "unchanged-greedy", + "status": 200, + "seconds": 0.1535931039834395, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-dbadc35216554333bb0f1d78\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 132.5, + "decode_ms": 19.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "unchanged-sampled", + "status": 200, + "seconds": 0.1688350880285725, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-9630f34bc9074799804541d7\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 115.6, \"prompt_per_token_ms\": 6.422, \"prompt_per_second\": 155.7, \"predicted_n\": 8, \"predicted_ms\": 51.8, \"predicted_per_token_ms\": 6.475, \"predicted_per_second\": 154.4, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 115.6, + "decode_ms": 51.8, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "ban-object", + "status": 200, + "seconds": 0.1425097290193662, + "request_bytes": 218, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-3e2c079dc09a4f3981d3fdd7\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 128.1, + "decode_ms": 12.8, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "ban-pairs", + "status": 200, + "seconds": 0.043887006933800876, + "request_bytes": 219, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-7fe05ffe34cc4e2c860bfb00\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 30.0, + "decode_ms": 12.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "positive-bias", + "status": 200, + "seconds": 0.05068232398480177, + "request_bytes": 216, + "token_ids": [ + 41674, + 41674, + 41674 + ], + "response": "{\"id\": \"chatcmpl-31bf334e1a6040e8878b2fd8\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \" banana banana banana\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 3, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 29.9, \"prompt_per_token_ms\": 4.271, \"prompt_per_second\": 234.1, \"predicted_n\": 3, \"predicted_ms\": 19.4, \"predicted_per_token_ms\": 6.467, \"predicted_per_second\": 154.6, \"draft_n\": 0, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 3, + "prompt_tokens": 23, + "prompt_ms": 29.9, + "decode_ms": 19.4, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "invalid-id", + "status": 400, + "seconds": 0.0005646139616146684, + "request_bytes": 231, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: token ID outside the model vocabulary\"}}", + "engine": {} + }, + { + "mode": "off", + "label": "invalid-value", + "status": 400, + "seconds": 0.0005740519845858216, + "request_bytes": 228, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban\"}}", + "engine": {} + }, + { + "mode": "off", + "label": "cleared-bias", + "status": 200, + "seconds": 0.04308531200513244, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-5626fd6eb7074aafa50d1abe\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 29.8, + "decode_ms": 12.3, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "empty-bias", + "status": 200, + "seconds": 0.04322411597240716, + "request_bytes": 204, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-c3fa8241f25e42ba9faba692\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 29.7, + "decode_ms": 12.2, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "103215-bans", + "status": 200, + "seconds": 0.36902957293204963, + "request_bytes": 1643747, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-ebb62a05f448496abc36ea7a\", \"object\": \"chat.completion\", \"created\": 1791510994, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 30.7, + "decode_ms": 12.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "stream-ban", + "status": 200, + "seconds": 0.04445838404353708, + "request_bytes": 234, + "token_ids": [ + 109430, + 248046 + ], + "response": "data: {\"id\": \"chatcmpl-deb53e5346a64c35ab96f03e\", \"object\": \"chat.completion.chunk\", \"created\": 1791510995, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\", \"content\": \"\"}, \"finish_reason\": null}]}\n\n: keep-alive\n\ndata: {\"id\": \"chatcmpl-deb53e5346a64c35ab96f03e\", \"object\": \"chat.completion.chunk\", \"created\": 1791510995, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"content\": \"您好\"}, \"finish_reason\": null}]}\n\ndata: {\"id\": \"chatcmpl-deb53e5346a64c35ab96f03e\", \"object\": \"chat.completion.chunk\", \"created\": 1791510995, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}\n\ndata: [DONE]\n\n", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 30.6, + "decode_ms": 12.4, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "off", + "label": "sampled-ban", + "status": 200, + "seconds": 0.043780705076642334, + "request_bytes": 233, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-2db508f195fc491686670f86\", \"object\": \"chat.completion\", \"created\": 1791510995, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 30.2, + "decode_ms": 12.3, + "finish": "stop", + "drafts_accepted": 0, + "drafts_offered": 0, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "unchanged-greedy", + "status": 200, + "seconds": 0.1719587140250951, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-839ee5d10b4d4930a1909380\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 146.7, + "decode_ms": 23.4, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "unchanged-sampled", + "status": 200, + "seconds": 0.13977801497094333, + "request_bytes": 197, + "token_ids": [ + 29292, + 369, + 264, + 1496, + 11258, + 11, + 31233, + 15019 + ], + "response": "{\"id\": \"chatcmpl-cfc3cfd29d614cccb9e34d8b\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"Python is a high-level, interpreted programming\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 18, \"completion_tokens\": 8, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 0}}, \"timings\": {\"cache_n\": 0, \"prompt_n\": 18, \"prompt_ms\": 102.3, \"prompt_per_token_ms\": 5.683, \"prompt_per_second\": 176.0, \"predicted_n\": 8, \"predicted_ms\": 36.1, \"predicted_per_token_ms\": 4.513, \"predicted_per_second\": 221.6, \"draft_n\": 9, \"draft_n_accepted\": 4}}", + "engine": { + "generated": 8, + "prompt_tokens": 18, + "prompt_ms": 102.3, + "decode_ms": 36.1, + "finish": "length", + "drafts_accepted": 4, + "drafts_offered": 9, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 18, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "ban-object", + "status": 200, + "seconds": 0.12640270090196282, + "request_bytes": 218, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-7f36f57b5c75443d99a4f95a\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 108.1, + "decode_ms": 16.2, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 0, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 23, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "ban-pairs", + "status": 200, + "seconds": 0.04322266404051334, + "request_bytes": 219, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-017a2d3854564643b57c7a7d\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 25.7, + "decode_ms": 16.2, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "positive-bias", + "status": 200, + "seconds": 0.05351781891658902, + "request_bytes": 216, + "token_ids": [ + 41674, + 41674, + 41674 + ], + "response": "{\"id\": \"chatcmpl-d5e1637066954e85be573881\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \" banana banana banana\"}, \"finish_reason\": \"length\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 3, \"total_tokens\": 26, \"prompt_tokens_details\": {\"cached_tokens\": 16}}, \"timings\": {\"cache_n\": 16, \"prompt_n\": 7, \"prompt_ms\": 26.2, \"prompt_per_token_ms\": 3.743, \"prompt_per_second\": 267.2, \"predicted_n\": 3, \"predicted_ms\": 26.2, \"predicted_per_token_ms\": 8.733, \"predicted_per_second\": 114.5, \"draft_n\": 6, \"draft_n_accepted\": 0}}", + "engine": { + "generated": 3, + "prompt_tokens": 23, + "prompt_ms": 26.2, + "decode_ms": 26.2, + "finish": "length", + "drafts_accepted": 0, + "drafts_offered": 6, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "invalid-id", + "status": 400, + "seconds": 0.0005792119773104787, + "request_bytes": 231, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: token ID outside the model vocabulary\"}}", + "engine": {} + }, + { + "mode": "mtp", + "label": "invalid-value", + "status": 400, + "seconds": 0.0004201789852231741, + "request_bytes": 228, + "token_ids": [], + "response": "{\"error\": {\"type\": \"invalid_request_error\", \"message\": \"logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban\"}}", + "engine": {} + }, + { + "mode": "mtp", + "label": "cleared-bias", + "status": 200, + "seconds": 0.04269790602847934, + "request_bytes": 186, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-faae84a173284e308ed223a7\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 25.7, + "decode_ms": 16.0, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "empty-bias", + "status": 200, + "seconds": 0.04329926997888833, + "request_bytes": 204, + "token_ids": [ + 109266, + 248046 + ], + "response": "{\"id\": \"chatcmpl-cf0ae6c0dce547fb83ea27e9\", \"object\": \"chat.completion\", \"created\": 1791511007, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"你好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 25.9, + "decode_ms": 16.0, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "103215-bans", + "status": 200, + "seconds": 0.3682536829728633, + "request_bytes": 1643747, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-9b6b4dbe3063474e90f0abe9\", \"object\": \"chat.completion\", \"created\": 1791511008, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 25.2, + "decode_ms": 16.2, + "finish": "stop", + "drafts_accepted": 1, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "stream-ban", + "status": 200, + "seconds": 0.043203829089179635, + "request_bytes": 234, + "token_ids": [ + 109430, + 248046 + ], + "response": "data: {\"id\": \"chatcmpl-095f818c294e4dac8ec68712\", \"object\": \"chat.completion.chunk\", \"created\": 1791511008, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\", \"content\": \"\"}, \"finish_reason\": null}]}\n\n: keep-alive\n\ndata: {\"id\": \"chatcmpl-095f818c294e4dac8ec68712\", \"object\": \"chat.completion.chunk\", \"created\": 1791511008, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {\"content\": \"您好\"}, \"finish_reason\": null}]}\n\ndata: {\"id\": \"chatcmpl-095f818c294e4dac8ec68712\", \"object\": \"chat.completion.chunk\", \"created\": 1791511008, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"delta\": {}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}\n\ndata: [DONE]\n\n", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 25.1, + "decode_ms": 16.2, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + }, + { + "mode": "mtp", + "label": "sampled-ban", + "status": 200, + "seconds": 0.042190782027319074, + "request_bytes": 233, + "token_ids": [ + 109430, + 248046 + ], + "response": "{\"id\": \"chatcmpl-33a65d3e68f64006b75c43a7\", \"object\": \"chat.completion\", \"created\": 1791511008, \"model\": \"bias-validation\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"您好\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 23, \"completion_tokens\": 2, \"total_tokens\": 25, \"prompt_tokens_details\": {\"cached_tokens\": 0}}}", + "engine": { + "generated": 2, + "prompt_tokens": 23, + "prompt_ms": 24.6, + "decode_ms": 16.1, + "finish": "stop", + "drafts_accepted": 3, + "drafts_offered": 3, + "reused": 16, + "hits": 0, + "lookups": 0, + "ram_blobs": 0, + "file_blobs": 0, + "file_mb": 0.0, + "prompt_read": 7, + "offloaded": 0 + } + } +] \ No newline at end of file diff --git a/include/strata/core/logit_bias.hpp b/include/strata/core/logit_bias.hpp new file mode 100644 index 00000000..cbf096cb --- /dev/null +++ b/include/strata/core/logit_bias.hpp @@ -0,0 +1,39 @@ +#pragma once +#include +#include +#include +#include +#include + +namespace strata::core { +// Native protocol: logit_bias=id:value,id:value. -100 is a hard exclusion, not a finite penalty. +inline bool parse_logit_bias(const std::string& text, int vocab, std::vector& out, std::string& error) { + out.clear(); + if (text.empty() || vocab <= 0) { error = "empty logit_bias or invalid vocabulary"; return false; } + std::vector bias((size_t) vocab, 0.0f); + std::vector seen((size_t) vocab, false); + const char* p = text.c_str(); + int banned = 0; + for (;;) { + if (*p < '0' || *p > '9') { error = "invalid logit_bias token ID"; return false; } + char* end = nullptr; + const unsigned long id = std::strtoul(p, &end, 10); + if (*end != ':' || id >= (unsigned long) vocab || seen[id]) { + error = "logit_bias ID outside vocabulary, duplicated, or missing ':'"; return false; + } + p = end + 1; + const float value = std::strtof(p, &end); + if (end == p || !std::isfinite(value) || value < -100 || value > 100 || (*end && *end != ',')) { + error = "invalid logit_bias value (expected -100..100)"; return false; + } + seen[id] = true; + bias[id] = value == -100 ? -std::numeric_limits::infinity() : value; + banned += value == -100; + if (!*end) break; + p = end + 1; + } + if (banned == vocab) { error = "logit_bias bans the entire vocabulary"; return false; } + out = std::move(bias); + return true; +} +} // namespace strata::core diff --git a/include/strata/core/verify.hpp b/include/strata/core/verify.hpp index 16849810..519fd43b 100644 --- a/include/strata/core/verify.hpp +++ b/include/strata/core/verify.hpp @@ -90,8 +90,11 @@ public: /// parameters would otherwise be baked forever - so this can change between requests freely. void set_sampling(const strata::kernels::SamplerParams& sp) { sampling_ = sp; // row t of a window at pos0 draws Philox(seed, pos0 + t): see run() + sampling_.logit_bias = logit_bias_host_.empty() ? nullptr : logit_bias_device_; if (next_) next_->set_sampling(sp); } + // One request's fixed vocabulary bias. Empty clears it; copied only when changed, on the final stage's device. + bool set_logit_bias(const std::vector& bias, std::string& err); /// The penalty histories for `sampling_.penalty_last_n`: ONE ROW PER WINDOW ROW, T rows of `history_len` /// int32 slots at that stride (`strata::kernels::penalty_rows` builds them), most recent token LAST, unused @@ -341,6 +344,8 @@ private: int32_t* d_spec_ = nullptr; ///< device: kVerifyMaxT draft ids, then kVerifyMaxT q rows int hist_len_ = 0; bool head_sampling_ = true; ///< set_head_sampling + std::vector logit_bias_host_; + float* logit_bias_device_ = nullptr; int device_ = -1; ///< the device `init` ran on: run/commit switch to it (layer split) unsigned long long* rr_stats_ = nullptr; ///< STRATA_ROUTE_RESIDENT's counters on device_ (#1578); null: none std::atomic released_{false}; ///< #267: release_gpu_waits ran (maybe on the watchdog thread): no more windows diff --git a/include/strata/kernels/sampler.hpp b/include/strata/kernels/sampler.hpp index f8d6bfe3..a3121ba1 100644 --- a/include/strata/kernels/sampler.hpp +++ b/include/strata/kernels/sampler.hpp @@ -25,6 +25,7 @@ struct SamplerParams { uint64_t seed = 0; // drives Philox, which is counter-based on (seed, token index) uint64_t counter = 0; // absolute draw index of row 0; advance across decode calls bool greedy = false; + const float* logit_bias = nullptr; // optional device array [n_vocab], added BEFORE penalties/filters; -inf bans bool gumbel = false; // STRATA_SPEC_GUMBEL=1: Gumbel-max pick keyed by (seed, counter, token id) - see sampler.cu }; diff --git a/serve/logit_bias.py b/serve/logit_bias.py new file mode 100644 index 00000000..59873a77 --- /dev/null +++ b/serve/logit_bias.py @@ -0,0 +1,52 @@ +"""Request-scoped token biases. Normalize before HTTP streaming starts.""" +import math +import re + + +def normalize(value, vocab_size=None): + if value is None: + return {} + if isinstance(value, dict): + entries = value.items() + pairs = False + elif isinstance(value, list): + entries = value + pairs = True + else: + raise ValueError("logit_bias: expected an object or a list of [token_id, bias] pairs") + out = {} + for entry in entries: + if not isinstance(entry, (list, tuple)) or len(entry) != 2: + raise ValueError("logit_bias: each entry must be [token_id, bias]") + token, bias = entry + if isinstance(token, bool) or not isinstance(token, (str, int)) or not re.fullmatch(r"[0-9]+", str(token)): + raise ValueError("logit_bias: token IDs must be non-negative integers") + token = int(token) + if token > 2147483647 or (vocab_size is not None and token >= vocab_size): + raise ValueError("logit_bias: token ID outside the model vocabulary") + if token in out: + raise ValueError("logit_bias: duplicate token ID") + if pairs and bias is False: + bias = -100.0 + if isinstance(bias, bool) or not isinstance(bias, (int, float)) or not -100 <= bias <= 100 or not math.isfinite(bias): + raise ValueError("logit_bias: biases must be finite numbers between -100 and 100; false is a pair-list ban") + out[token] = float(bias) + if vocab_size is not None and sum(b == -100 for b in out.values()) == vocab_size: + raise ValueError("logit_bias: cannot ban the entire vocabulary") + return out + + +def engine_key(value): + entries = normalize(value) + return " logit_bias=" + ",".join(f"{i}:{b:g}" for i, b in sorted(entries.items())) if entries else "" + + +def validate_request(req, engine, vocab_size): + """Fail closed for old engines, unsupported backends and continuous batching.""" + normalized = normalize(req.get("logit_bias"), vocab_size) + if normalized: + if getattr(engine, "info", {}).get("logit_bias") != 1: + raise ValueError("logit_bias: this engine does not support token biases; use a supporting CUDA/HIP build") + if getattr(engine, "batch", 0): + raise ValueError("logit_bias: continuous batching is not supported; run without --batch") + return normalized diff --git a/serve/server.py b/serve/server.py index c21f335a..b22d0891 100644 --- a/serve/server.py +++ b/serve/server.py @@ -59,6 +59,7 @@ from serve.frontend import (THINK_END, ChatTemplate, Event, OutputParser, anthro tool_choice_of, unmark_think_literals) from serve.mcp import McpCancelled, hub_from_config # noqa: E402 from serve import runconfig # noqa: E402 +from serve import logit_bias as bias_api # noqa: E402 from serve.winjob import contain # noqa: E402 from serve.structured import StructuredOutputError, prepare_format, validated_json # noqa: E402 from serve import responses as responses_api # noqa: E402 @@ -1000,7 +1001,7 @@ class StrataEngine: pn = prefix.get("tokens") if isinstance(pn, int) and not isinstance(pn, bool) and pn > 0: keys += f" pin={pn}" - return keys + StrataEngine.projection_key(sampling) + return keys + StrataEngine.projection_key(sampling) + bias_api.engine_key(sampling.get("logit_bias")) @staticmethod def projection_key(sampling: dict) -> str: @@ -1553,6 +1554,7 @@ class StrataEngine: has gone. A consumer that stops early (or `cancel`) makes the engine STOP, so it does not run to max_new.""" if not self.alive(): raise EngineDied("the engine is unavailable; this request was not sent") + bias_api.validate_request(sampling or {}, self, None) if getattr(self, "batch", 0): yield from self.generate_batched(ids, max_new, sampling, cancel, embeddings) return @@ -5122,6 +5124,7 @@ def make_handler(svc: Service): def _openai(self, req): req = svc.with_shared(req, "openai") + bias_api.normalize(req.get("logit_bias"), len(getattr(svc.tok, "tokens", ())) or None) messages, tools, kw = openai_to_messages(req) self._no_local_images(messages) if tool_choice_of(req.get("tool_choice"))[0] == "none": # as the Responses route: no tools are offered @@ -5132,6 +5135,7 @@ def make_handler(svc: Service): raise ValueError("structured response_format with tools/MCP is not supported") svc.load() max_req = max_new = int(req.get("max_completion_tokens") or req.get("max_tokens") or 0) # 0/-1: the rest + bias_api.validate_request(req, svc.engine, len(getattr(svc.tok, "tokens", ())) or None) use_mcp = req.get("strata_mcp") is True and svc.mcp is not None # the web app's opt-in (serve/mcp.py) own = {t.get("name") for t in tools or [] if isinstance(t, dict)} # #592: a second line of defence if use_mcp: diff --git a/serve/test_logit_bias.py b/serve/test_logit_bias.py new file mode 100644 index 00000000..ee3751b1 --- /dev/null +++ b/serve/test_logit_bias.py @@ -0,0 +1,61 @@ +import json +from pathlib import Path +from types import SimpleNamespace +import unittest +import urllib.error +import urllib.request + +from serve.logit_bias import engine_key, normalize, validate_request +from serve.server import ByteTokenizer, MockEngine, Service, StrataEngine, serve +from serve.frontend import ChatTemplate + + +class LogitBias(unittest.TestCase): + def test_forms_and_transport(self): + self.assertEqual(normalize({"7": -100, "9": 2.5}, 10), normalize([[7, False], [9, 2.5]], 10)) + self.assertEqual(engine_key([[9, 2.5], [7, False]]), " logit_bias=7:-100,9:2.5") + self.assertEqual(StrataEngine.sampling_keys({"logit_bias": {"7": -100}}), " logit_bias=7:-100") + for value in [None, {}, []]: + self.assertEqual(engine_key(value), "") + + def test_invalid(self): + bad = [True, 1, "x", [1], [[1]], [[1, 0, 2]], {"-1": 0}, {"1.0": 0}, {"10": 0}, + {"1": False}, [[1, True]], [[1.0, 0]], [[True, 0]], [[1, 0], ["1", 2]], + {"1": 101}, {"1": -101}, {"1": float('nan')}, {"1": float('inf')}, {"1": 10**1000}] + for value in bad: + with self.subTest(value=str(value)[:50]), self.assertRaises(ValueError): + normalize(value, 10) + with self.assertRaises(ValueError): + normalize({str(i): -100 for i in range(10)}, 10) + + def test_large_list(self): + entries = [[i, False] for i in range(103215)] + self.assertEqual(len(normalize(entries, 248320)), 103215) + self.assertEqual(engine_key(entries).count(':-100'), 103215) + + def test_capability_and_batch(self): + for engine in [SimpleNamespace(info={}), SimpleNamespace(info={'logit_bias': 1}, batch=2)]: + with self.assertRaises(ValueError): + validate_request({'logit_bias': {'1': -100}}, engine, 10) + self.assertEqual(validate_request({}, engine, 10), {}) + self.assertEqual(validate_request({'logit_bias': {'1': -100}}, SimpleNamespace(info={'logit_bias': 1}), 10), {1: -100}) + + def test_http_rejects_before_stream(self): + tok = ByteTokenizer() + engine = MockEngine(tok, 'ok', max_context=4096) + service = Service(engine, tok, ChatTemplate(Path(__file__).parent/'chat_template.jinja')) + httpd = serve(service, port=0) + try: + for bias in [True, {'1': -100}, [[1, True]]]: + data = json.dumps({'messages': [{'role': 'user', 'content': 'hi'}], 'max_tokens': 2, + 'stream': True, 'logit_bias': bias}).encode() + req = urllib.request.Request(f'http://127.0.0.1:{httpd.server_address[1]}/v1/chat/completions', + data=data, headers={'Content-Type': 'application/json'}) + with self.assertRaises(urllib.error.HTTPError) as caught: + urllib.request.urlopen(req, timeout=10) + with caught.exception as response: + self.assertEqual(response.code, 400) + self.assertIn('logit_bias', json.loads(response.read())['error']['message']) + finally: + httpd.shutdown() + httpd.server_close() diff --git a/src/core/logit_bias_test.cpp b/src/core/logit_bias_test.cpp new file mode 100644 index 00000000..0d60c88e --- /dev/null +++ b/src/core/logit_bias_test.cpp @@ -0,0 +1,21 @@ +#include "strata/core/logit_bias.hpp" +#include +#include + +int main() { + std::vector b; + std::string err; + auto check = [](bool ok) { if (!ok) { std::fprintf(stderr, "logit_bias parser regression\n"); std::exit(1); } }; + check(strata::core::parse_logit_bias("0:-100,2:1.25,3:-0.5", 4, b, err)); + check(b.size() == 4 && std::isinf(b[0]) && b[0] < 0 && b[1] == 0 && b[2] == 1.25f && b[3] == -0.5f); + for (const char* text : {"", "0:", "0:NaN", "0:inf", "0:-101", "0:101", "4:0", "-1:0", "x:1", + "0:1,", "0:1,0:2", "0:1x", "0:-100,1:-100,2:-100,3:-100", "999999999999999999999:0"}) { + check(!strata::core::parse_logit_bias(text, 4, b, err)); + check(b.empty()); + } + std::string large; + for (int i = 0; i < 103215; ++i) { if (i) large += ','; large += std::to_string(i) + ":-100"; } + check(strata::core::parse_logit_bias(large, 248320, b, err)); + check(std::isinf(b[103214]) && b[103215] == 0 && b.size() == 248320); + std::puts("logit_bias_test: passed, including 103215 bans"); +} diff --git a/src/core/verify.cpp b/src/core/verify.cpp index b148b68f..948dd3f7 100644 --- a/src/core/verify.cpp +++ b/src/core/verify.cpp @@ -417,6 +417,7 @@ Verifier::~Verifier() { if (h_commitb_) cudaFreeHost(h_commitb_); if (qcnt_) cudaFree(qcnt_); if (d_spec_) cudaFree(d_spec_); + if (logit_bias_device_) cudaFree(logit_bias_device_); if (cs_ && cs_ != ext_stream_) cudaStreamDestroy(cs_); // set_stream: the stage's stream, shared, not ours if (sh_cs_) cudaStreamDestroy(sh_cs_); if (copy_) { cudaStreamSynchronize(copy_); cudaStreamDestroy(copy_); } @@ -438,6 +439,25 @@ Verifier::~Verifier() { if (h) cudaFreeHost(h); } +bool Verifier::set_logit_bias(const std::vector& bias, std::string& err) { + if (next_ && !next_->set_logit_bias(bias, err)) return false; + if (le_ < g_->n_layers) return true; + const OnDevice on_device(device_); + if (!bias.empty() && bias.size() != (size_t) n_vocab_) { + err = "logit_bias vocabulary size mismatch"; return false; + } + if (bias != logit_bias_host_ && !bias.empty()) { + const size_t bytes = bias.size() * sizeof(float); + if ((!logit_bias_device_ && cudaMalloc((void**) &logit_bias_device_, bytes) != cudaSuccess) || + cudaMemcpy(logit_bias_device_, bias.data(), bytes, cudaMemcpyHostToDevice) != cudaSuccess) { + err = "cannot upload logit_bias"; return false; + } + } + logit_bias_host_ = bias; + sampling_.logit_bias = bias.empty() ? nullptr : logit_bias_device_; + return true; +} + bool Verifier::init(const WeightTable& wt, const ModelGeometry& g, SessionState& ss, const VerifyHits& hits, const NativeHead* head, int max_t, std::string& err) { g_diag_verifier.store(this); @@ -2102,7 +2122,7 @@ bool Verifier::run(int T, const int32_t* tokens, int64_t pos0, PoolMultiFn pool, return next_ == nullptr || next_->run(T, tokens, pos0, pool, next_user_, out, err); } const bool sampled = !sampling_.greedy && sampling_.temperature > 0.0f; - if (head_sampling_ && (sampled || hist_d_ != nullptr)) { + if (head_sampling_ && (sampled || hist_d_ != nullptr || sampling_.logit_bias != nullptr)) { SamplerParams sp = sampling_; sp.counter = (uint64_t) pos0; // STRATA_SPEC_PROB: the drafter's q lists for this window, judged by rejection sampling (spec_prob.hpp) @@ -3150,7 +3170,7 @@ bool Verifier::pl_finish(int32_t* out, std::string& err) { if (le_ < g.n_layers) return true; // an earlier stage: the hand-off is written const int T = fl_T_; const bool sampled = !sampling_.greedy && sampling_.temperature > 0.0f; - if (head_sampling_ && (sampled || hist_d_ != nullptr)) { // run()'s host-side sampling, Philox(seed, pos0 + t) + if (head_sampling_ && (sampled || hist_d_ != nullptr || sampling_.logit_bias != nullptr)) { // run()'s host-side sampling, Philox(seed, pos0 + t) SamplerParams sp = sampling_; sp.counter = (uint64_t) last_pos0_; sample_tokens(head_logits_, T, (int) n_vocab_, hist_d_, hist_len_, sp, m_out_, cs_); diff --git a/src/kernels/cuda/sampler.cu b/src/kernels/cuda/sampler.cu index fb40668f..b9e04318 100644 --- a/src/kernels/cuda/sampler.cu +++ b/src/kernels/cuda/sampler.cu @@ -158,7 +158,7 @@ __global__ void sampler_greedy_kernel(const float* __restrict__ logits, int n_vo float bv = __int_as_float(0xff800000); // -inf int best = n_vocab; for (int v = threadIdx.x; v < n_vocab; v += blockDim.x) { - const float s = apply_penalties(l[v], hit_count(v), p); + const float s = apply_penalties(p.logit_bias ? l[v] + p.logit_bias[v] : l[v], hit_count(v), p); if (s > bv) { bv = s; best = v; } } for (int off = 16; off > 0; off >>= 1) { @@ -355,7 +355,7 @@ __global__ void sampler_kernel(const float* __restrict__ logits, int n_vocab, in bool taken = false; for (int j = 0; j < i; ++j) if (sel_ids[j] == v) { taken = true; break; } if (taken) continue; - const float s = apply_penalties(l[v], hit_count(v), p); + const float s = apply_penalties(p.logit_bias ? l[v] + p.logit_bias[v] : l[v], hit_count(v), p); if (s > bv) { bv = s; best = v; } } for (int off = 16; off > 0; off >>= 1) { @@ -601,7 +601,7 @@ sampler_one_block_kernel(const float* __restrict__ logits, int n_vocab, const in float bv = __int_as_float(0xff800000); // -inf int best = n_vocab; for (int v = threadIdx.x; v < n_vocab; v += blockDim.x) { - const float s = apply_penalties(l[v], hit_count(v), p); + const float s = apply_penalties(p.logit_bias ? l[v] + p.logit_bias[v] : l[v], hit_count(v), p); if ((s < prev_v || (s == prev_v && v > prev_i)) && s > bv) { bv = s; best = v; } } for (int off = 16; off > 0; off >>= 1) { @@ -730,7 +730,7 @@ sampler_split_part_kernel(const float* __restrict__ logits, int n_vocab, const i #pragma unroll for (int j = 0; j < kSplitPerLane; ++j) { const int v = lo + 32 * j + lane; - s[j] = v < n_vocab ? l[v] : __int_as_float(0xff800000); + s[j] = v < n_vocab ? (p.logit_bias ? l[v] + p.logit_bias[v] : l[v]) : __int_as_float(0xff800000); } if (use_bits) { #pragma unroll @@ -1258,7 +1258,7 @@ void sample_tokens(const float* logits, int n_tokens, int n_vocab, const int* hi }(); // One block per token, 1,024 threads over the vocabulary. See `sampler_greedy_kernel`. const int gthreads = 1024; - if (!(multi && shmem == 0 && sample_greedy_cluster(logits, n_tokens, n_vocab, out, stream))) + if (!(multi && shmem == 0 && !p.logit_bias && sample_greedy_cluster(logits, n_tokens, n_vocab, out, stream))) sampler_greedy_kernel<<<(unsigned) n_tokens, gthreads, shmem, (cudaStream_t) stream>>>( logits, n_vocab, history, history_len, p, p.penalty_last_n, p.penalty_last_n, out); } else if (sampled_path() == SampledPath::Old) { diff --git a/src/kernels/sampler_parity.cpp b/src/kernels/sampler_parity.cpp index 1c1cf88b..744800c8 100644 --- a/src/kernels/sampler_parity.cpp +++ b/src/kernels/sampler_parity.cpp @@ -484,6 +484,54 @@ int main(int argc, char** argv) { int bad = 0; const int NV = 512, NT = 4; + // Request bias affects every target row, including greedy; omission leaves logits and the default pick intact. + // Compare against an independently pre-biased input through each ctest sampler implementation. + { + std::vector l(NV * NT), bias(NV, 0.0f), adjusted; + for (int t = 0; t < NT; ++t) + for (int v = 0; v < NV; ++v) l[t * NV + v] = float(v % 17) / 4; + l[0] = 50; + bias[0] = -std::numeric_limits::infinity(); + bias[7] = 20; + bias[16] = -9; + adjusted = l; + for (int t = 0; t < NT; ++t) + for (int v = 0; v < NV; ++v) adjusted[t * NV + v] += bias[v]; + float* db = nullptr; + check(cudaMalloc(&db, NV * sizeof(float)), "bias malloc"); + check(cudaMemcpy(db, bias.data(), NV * sizeof(float), cudaMemcpyHostToDevice), "bias upload"); + std::vector hist(NT * 4, 7); + DeviceRows raw(l, NT, hist, 4), expected(adjusted, NT, hist, 4); + for (bool greedy : {true, false}) for (bool penalty : {false, true}) { + strata::kernels::SamplerParams p; + p.greedy = greedy; p.temperature = greedy ? 0 : 0.8f; p.seed = 71; p.top_k = 16; + if (penalty) { p.penalty_last_n = 4; p.penalty_freq = 3; p.penalty_repeat = 1.1f; } + const auto want = expected.sample(p, nullptr); + p.logit_bias = db; + const auto got = raw.sample(p, nullptr); + if (got != want || std::find(got.begin(), got.end(), 0) != got.end()) ++bad; + p.logit_bias = nullptr; + DeviceRows plain(l, NT, hist, 4); + if (raw.sample(p, nullptr) != plain.sample(p, nullptr)) ++bad; + } + std::vector unchanged(l.size()); + check(cudaMemcpy(unchanged.data(), raw.l, l.size() * sizeof(float), cudaMemcpyDeviceToHost), "raw logits"); + if (unchanged != l) ++bad; + // The reporter's vocabulary scale, with only one permitted token: masked entries cannot win top-k tails. + const int vocab = 248320; + std::vector large(vocab, 100), bans(vocab, -std::numeric_limits::infinity()); + bans[109266] = 0; large[109266] = -50; + cudaFree(db); + check(cudaMalloc(&db, vocab * sizeof(float)), "large bias malloc"); + check(cudaMemcpy(db, bans.data(), bans.size() * sizeof(float), cudaMemcpyHostToDevice), "large bias upload"); + DeviceRows many(large, 1, {}, 0); + for (bool greedy : {true, false}) { + strata::kernels::SamplerParams p; p.greedy = greedy; p.logit_bias = db; + if (many.sample(p, nullptr) != std::vector{109266}) ++bad; + } + cudaFree(db); + } + // ---- fixture 1: plain greedy. top_k = 0 (disabled), top_p = 1 (disabled), T = 1 -> argmax. { strata::kernels::SamplerParams p; p.top_k = 0; p.top_p = 1.0f; p.temperature = 1.0f; p.greedy = true; diff --git a/src/program/generate.cpp b/src/program/generate.cpp index bb12ff6f..6c6eae42 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -1,3 +1,4 @@ +#include "strata/core/logit_bias.hpp" // src/program/generate.cpp - P2.S6: `strata generate`. // // THE DRIVER, and the first program in this project that answers a question. Everything below it is a @@ -8481,7 +8482,7 @@ int main(int argc, char** argv) { slots_all += remote_experts[(size_t) r].resident(); mib_all += (int64_t) (remote_experts[(size_t) r].gib() * 1024.0); } - std::printf("INFO context=%lld kv=%s kv_resident=%lld expert_slots=%lld expert_cache_mib=%lld " + std::printf("INFO logit_bias=1 context=%lld kv=%s kv_resident=%lld expert_slots=%lld expert_cache_mib=%lld " "expert_slots_primary=%lld expert_cache_primary_mib=%lld spec=%d " "mtp_max=%d lookup=%d vram_free_mib=%lld cvec=%s arena_mib=%lld pool_workers=%d pcie_frac=%.2f " "spec_min_p=%.2f conversation_cache_mib=%lld conversation_cache_slots=%d " @@ -9382,6 +9383,8 @@ int main(int argc, char** argv) { unsigned long long req_seed = 0; float req_min_p = 0.0f, req_penalty_repeat = 1.0f, req_penalty_freq = 0.0f, req_penalty_present = 0.0f; int req_penalty_last_n = 0; + std::string req_bias_text; + bool req_bias_present = false; int req_cvec = 1; // cvec=0|1: a loaded control vector for this request (on when absent) // ckpt=0: a one-shot call whose turn no later request extends. No checkpoint at its last turn boundary // (so no split there) nor every --prompt-cache-every tokens, and its session is neither continued nor @@ -9409,7 +9412,8 @@ int main(int argc, char** argv) { if (eq == std::string::npos) { endp = const_cast(start); break; } const std::string key = tok.substr(0, eq); const float fv = std::strtof(tok.c_str() + eq + 1, nullptr); - if (key == "cvec") req_cvec = std::atoi(tok.c_str() + eq + 1); + if (key == "logit_bias") { req_bias_text = tok.substr(eq + 1); req_bias_present = true; } + else if (key == "cvec") req_cvec = std::atoi(tok.c_str() + eq + 1); else if (key == "ckpt") req_ckpt = std::atoi(tok.c_str() + eq + 1) != 0; else if (key == "pin") req_pin = std::max(0, std::atoll(tok.c_str() + eq + 1)); else if (key == "temperature") req_temperature = fv; @@ -9427,6 +9431,13 @@ int main(int argc, char** argv) { // unknown keys are skipped: the ids start at the first token without '=' } } + std::vector req_bias; + std::string bias_error; + if (req_bias_present && (o.batch > 0 || + !strata::core::parse_logit_bias(req_bias_text, (int) n_vocab, req_bias, bias_error))) { + std::printf("ERR logit_bias: %s\n", o.batch > 0 ? "continuous batching is not supported" : bias_error.c_str()); + continue; + } std::string emb_path; if (geni && endp != nullptr) { while (*endp == ' ') ++endp; @@ -10268,6 +10279,10 @@ int main(int argc, char** argv) { req_sp.penalty_freq = req_penalty_freq; req_sp.penalty_present = req_penalty_present; req_sp.counter = 0; + if (!ver.set_logit_bias(req_bias, err) || (pipe && !ver_b.set_logit_bias(req_bias, err))) { + std::printf("ERR %s\n", err.c_str()); + return 1; + } ver.set_sampling(req_sp); if (pipe) ver_b.set_sampling(req_sp); // (reaches the later stage's odd verifier) if (use_mtp) mtp.set_draft_sampling(req_sp); // STRATA_SPEC_COUPLED=1: sampled drafts (a no-op otherwise) diff --git a/tools/logit_bias_http_probe.py b/tools/logit_bias_http_probe.py new file mode 100644 index 00000000..312cda14 --- /dev/null +++ b/tools/logit_bias_http_probe.py @@ -0,0 +1,91 @@ +"""Real HTTP chat validation, with emitted token IDs captured at the engine boundary.""" +import argparse, json, sys, time, urllib.error, urllib.request +from pathlib import Path +ap=argparse.ArgumentParser(description=__doc__) +for name in ['source','config','baseline','candidate','mtp','output']: + ap.add_argument('--'+name,type=Path,required=True) +a=ap.parse_args() +source=a.source.resolve() +sys.path[:0]=[str(source),str(source/'tools')] +from serve.server import StrataEngine, Service, engine_args, child_env, serve +from serve.frontend import ChatTemplate +import strata_tokenizer as ST + +cfg=json.loads(a.config.read_text()) +cfg={k:v for k,v in cfg.items() if k in ['args','tokenizer','gpu','lib_dirs','env']} +args=list(cfg['args']) +for flag in ['--conversation-cache-spill-dir','--conversation-cache-disk-mib','--mtp']: + if flag in args:i=args.index(flag);del args[i:i+2] +args=[a for a in args if a!='--conversation-cache-disk-only'] +tp=Path(cfg['tokenizer']);vocab=json.loads((tp/'vocab.json').read_text());tokens=[None]*len(vocab) +for t,i in vocab.items():tokens[i]=t +tok=ST.Tokenizer(tokens,(tp/'merges.txt').read_text().split('\n'),json.loads((tp/'token_type.json').read_text())) +template=ChatTemplate(tp/'chat_template.jinja') +rows=[] +out=a.output;out.mkdir(parents=True,exist_ok=True) +class AuditEngine(StrataEngine): + def generate(self,*a,**kw): + self.emitted=[] + for token in super().generate(*a,**kw): + if token is not None:self.emitted.append(token) + yield token + +for mode in ['baseline','off','mtp']: + exe=(a.baseline if mode=='baseline' else a.candidate).resolve() + current=list(args) + if mode=='mtp':current+=['--mtp',str(a.mtp.resolve())];current[current.index('--spec')+1]='4' + local=dict(cfg,args=current,exe=str(exe),cwd=str(source),log=str(out/(mode+'.log'))) + engine=AuditEngine(local['exe'],engine_args(local),cwd=local['cwd'],log=local['log'],env=child_env(local)) + service=Service(engine,tok,template,model_name='bias-validation') + server=serve(service,port=0) + def call(label,prompt='Write the Chinese word for hello. Only the word.',expect=200,**kw): + req={'model':'bias-validation','messages':[{'role':'user','content':prompt}],'max_tokens':8,'temperature':0,'reasoning_effort':'none',**kw} + data=json.dumps(req).encode();started=time.perf_counter() + http=urllib.request.Request(f'http://127.0.0.1:{server.server_address[1]}/v1/chat/completions',data=data,headers={'Content-Type':'application/json'}) + try: + with urllib.request.urlopen(http,timeout=180) as response:status=response.status;raw=response.read().decode() + except urllib.error.HTTPError as e: + with e:status=e.code;raw=e.read().decode() + row={'mode':mode,'label':label,'status':status,'seconds':time.perf_counter()-started,'request_bytes':len(data), + 'token_ids':list(engine.emitted) if status==200 else [],'response':raw,'engine':dict(engine.last) if status==200 else {}} + rows.append(row);(out/'rows.json').write_text(json.dumps(rows,indent=2,ensure_ascii=False)) + print(mode,label,status,row['token_ids'],flush=True) + assert status==expect,(label,status,raw) + return row + try: + first=call('unchanged-greedy') + sampled=call('unchanged-sampled',prompt='Write one sentence about Python.',temperature=0.7,top_k=20,seed=42) + if mode=='baseline':continue + assert engine.info.get('logit_bias')==1 + banned=first['token_ids'][0] + one=call('ban-object',logit_bias={str(banned):-100}) + two=call('ban-pairs',logit_bias=[[banned,False]]) + assert banned not in one['token_ids'] and banned not in two['token_ids'] + assert one['token_ids']==two['token_ids'] + boosted=tok.encode(' banana',parse_special=False)[0] + positive=call('positive-bias',logit_bias={str(boosted):100},max_tokens=3) + assert positive['token_ids'][0]==boosted + # Changing requests must not inherit a prior mask, including after a rejected request. + call('invalid-id',expect=400,logit_bias={str(len(tokens)):1},stream=True) + call('invalid-value',expect=400,logit_bias={'0':101},stream=True) + again=call('cleared-bias') + assert again['token_ids']==first['token_ids'] + empty=call('empty-bias',logit_bias={}) + assert empty['token_ids']==first['token_ids'] + large=set(range(103214));large.add(banned) + if len(large)<103215:large.add(103214) + bulk=call('103215-bans',logit_bias=[[i,False] for i in sorted(large)],max_tokens=8) + assert not set(bulk['token_ids']) & large + streamed=call('stream-ban',logit_bias={str(banned):-100},stream=True) + assert banned not in streamed['token_ids'] + sampled_ban=call('sampled-ban',logit_bias={str(banned):-100},temperature=0.8,seed=123) + assert banned not in sampled_ban['token_ids'] + finally: + server.shutdown();server.server_close();engine.close() + +for label in ['unchanged-greedy','unchanged-sampled']: + before=next(x for x in rows if x['mode']=='baseline' and x['label']==label) + after=next(x for x in rows if x['mode']=='off' and x['label']==label) + assert before['token_ids']==after['token_ids'],('default-output-changed',label) +(out/'complete.json').write_text(json.dumps({'status':'passed','requests':len(rows),'token_109266':tok.decode([109266]), + 'baseline':str(a.baseline),'candidate':str(a.candidate),'config':str(a.config)},indent=2,ensure_ascii=False))