Skip to content

docs(onnx-pack): the KV cache is opt-in, not a missing feature - #684

Merged
bong-water-water-bong merged 3 commits into
mainfrom
1bit/onnx-pack-kv-cache
Oct 31, 2026
Merged

bong-water-water-bong merged 3 commits into
mainfrom
1bit/onnx-pack-kv-cache

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

From the owner's pi session on ryzen (commit 93b2191). Docs only.

🤖 Generated with Claude Code

The pack page said a cached graph was "a different, much larger piece of work"
and left it there. It exists now: `--cached` exports the cache as an input and an
output, and at a 256-token prompt it is 63.7 ms/token against 291.2 for the
re-run-the-sequence graph, with the gap widening as context grows and logits
matching transformers' own cached greedy loop to mean KL 1.2e-07 at identical
top-1.

What is still absent is written down separately, because "has a KV cache" and
"is a server" are different claims: no batching, no paged cache, one sequence.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY (tprs-ready applied). The replacement text is faithful to the measurement it summarises; two notes, neither blocking.

The numbers are the ones recorded in onnx/README.md on #683's head — --cached 63.66 ms/token against uncached 291.22 at a 256-token prompt (-n 16 --threads 8, same box), 4.6x (291.22/63.66 = 4.58), and "mean KL of 1.2e-07 nats with top-1 matching at every step" — so the sentence replaces a "no KV cache" claim with the same measurement the runner's own doc carries, rather than a new number.

Merge order matters here: those numbers exist only on #683's branch. main's onnx/README.md has none of 63.66 / 291.22 / 1.2e-07 / 4.6x, so if this lands before #683 it will point readers at a measurement that is not in the tree yet. #683 first, then this one.

One clause in the new text is not in the doc it summarises: "no batching, no paged cache, one sequence at a time". It is true of the runner — onnx/ort_run.cpp:238 hard-wires the batch dimension (dims[2] = {1, ids.size()}) and the cached graph carries one stacked past/present per step — but onnx/README.md and docs/onnx.md do not say it anywhere. Worth one sentence there so the pack doc is not the only place that limit is written down, and so a future paged-cache or batching change has something to update.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Oct 31, 2026
@bong-water-water-bong
bong-water-water-bong merged commit 5979437 into main Oct 31, 2026
7 of 8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/onnx-pack-kv-cache branch October 31, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant