Repository navigation
Let a remote GGUF estimate be priced without its compute reserve - #8641
Conversation
Backend CI is red on main. #8524 gave a non-diffusion remote estimate a default ubatch and changed the output-buffer slot count from n_parallel-1 to max(1, n_parallel), so every single-slot remote estimate now carries about 0.58 GB of compute reserve. Ten tests that patch _estimate_gguf_kv_gb to zero and then assert an exact GB total were not updated with it, and have been failing ever since with 4.575732421875 != 4.0 and the same offset at 10, 12 and 14 GB. The estimator is right and the tests are stale, so the arithmetic is untouched: the reserve moves into _remote_gguf_compute_reserve_gb, a pure extraction, and the tests hold it at zero the way they already hold _estimate_gguf_kv_gb at zero. Anything pricing something other than the model itself, a drafter for instance, can now do the same. tests/test_chat_load_during_training.py: 118 passed, was 8 failed.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
CI status, since the red checks here are not this PRs. The four Backend CI jobs and Chat UI Tests fail with That one is #8608, which is open and already carries the fix. The two are red on each other: #8608 fails the eight VRAM assertions this PR fixes ( The earlier |
…them #8524 changed the remote output-buffer slot count from n_parallel - 1 to max(1, n_parallel), so every single-slot uncached estimate gained about 0.58 GB. #8641 then extracted the reserve and held it at zero in the drafter tests, which turned Backend CI green without settling whether the charge is right. It is not. The local branch, which reads the header and is fitted to measured allocations, charges act_scratch + output_buffer * (slots - 1) for a chat model: {1:36, 2:492, 4:1388, 8:3220} MiB, so one slot reserves the scratch and no output buffer. The remote branch stands in for that same computation on a model whose header is not readable yet, and the two are supposed to agree: an existing comment in the same function calls out the case where "the same model 409s while remote and loads once cached" as the thing to avoid. Charging the first slot made every uncached chat load read 0.58 GB heavier than the identical cached one, on an estimator whose only consumer refuses the load when it does not fit. So the slot count goes back to matching the local branch, and the activation scratch it was standing in for is charged explicitly, at a ceiling the way the vocab already is. Without that a one-slot remote load would carry the KQ mask alone, which is the same divergence pointing the other way. Measured against _estimate_compute_buffer_bytes for a 152k-vocab, 5120-wide chat model at the default micro-batch, remote now sits just above cached rather than half a gigabyte above it: 1 slot cached 0.0449 GiB remote 0.0726 GiB (+0.028) 2 slots cached 0.3782 GiB remote 0.6476 GiB (+0.269) Known residual: a remote EMBEDDING GGUF now reads low, by 0.31 GB at one slot for a 152k vocab, because that branch charges an output buffer at every slot and this one cannot tell an embedding repo from a chat repo before the header is readable. #8524's own comment records that there is no reliable pre-load probe for it. The under-charge is bounded by the model's real vocab and those repos are small, which is the same small-half trade the activation scratch used to be, against half a gigabyte of headroom taken from every chat load.
* tests: pin the remote GGUF compute reserve #8524 changed the output-buffer slot count from max(0, n_parallel - 1) to max(1, n_parallel) and gave a non-diffusion remote estimate a default micro-batch, which is right: llama-server allocates an output buffer for the one slot it runs, and the old count reserved nothing for it. Ten tests caught the change only as an unexplained 0.58 GB and were red on main until #8641. #8641 resolved that by extracting the term so those tests can hold it at zero, the way they already hold _estimate_gguf_kv_gb at zero. That is the right call for them, but it leaves the arithmetic with nothing asserting it: all fifteen references to _remote_gguf_compute_reserve_gb in the suite patch it, and a grep for the constants it is built from finds no test at all. It decides whether a load is refused, so it should not be free to drift. Two cases, shape rather than magnitude: the single-slot floor, and diffusion charging nothing. The single-slot total is spelled out because the reserve is linear in the slot count, so any two samples are one buffer apart under the old formula and the new one alike, and only an absolute anchor sees the floor. Constants come from the module, so retuning a safety factor moves the test with the code while dropping a term still fails it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * tests: drop llama batch env overrides in the compute reserve helper * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * tests: tighten comments in the compute reserve tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim redundant sentence in compute reserve test docstring --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Backend CI is red on
main, and has been since #8524.That PR gave a non-diffusion remote estimate a default ubatch and changed the output-buffer slot count from
n_parallel - 1tomax(1, n_parallel), so every single-slot remote estimate now carries about 0.58 GB of compute reserve. Ten tests instudio/backend/tests/test_chat_load_during_training.pypatch_estimate_gguf_kv_gbto0.0and then assert an exact GB total, and they were not updated with it:with the same 0.5757 offset at 10, 12 and 14 GB.
The estimator is right and the tests are stale, so the arithmetic is untouched here. The remote compute reserve moves into
_remote_gguf_compute_reserve_gb, a pure extraction from_estimate_gguf_required_gb, and the tests hold it at zero the way they already hold_estimate_gguf_kv_gbat zero. Anything pricing something other than the model itself, a drafter for instance, can now do the same.studio/backend/tests/test_chat_load_during_training.py: 118 passed, was 8 failed / 110 passed.