Log the recurrent-state slot allocation at load; document max_batch_size for recurrent models - #467
Open
matthematics1137 wants to merge 2 commits into
Open
matthematics1137 wants to merge 2 commits into
matthematics1137 wants to merge 2 commits into
Conversation
For recurrent models with a draft model, every batch slot holds draft_num_tokens + 1 copies of the recurrent state, allocated on the GPU at load (728 MiB per slot for a 27B hybrid at draft length 4, 2.9 GiB at the default max_batch_size of 4). Log the size once the cache is built and say in the max_batch_size docs that single-user recurrent setups should set 1. The default is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Correct the transformer batch-size default in the docs. Report layer storage without assuming full checkpoint copies or GPU residency for every architecture. Add shape-based CPU tests and retain the merged checkpoint controls. Assisted-by: Codex
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Is your pull request related to a problem? Please describe.
Recurrent state slots can be a substantial part of a model's memory budget, but
the load log does not show their cost. This came out of our investigation of
drafted inference on a 12 GB card: reducing
max_batch_sizewas an importantfitting control, and its effect was not obvious.
Why should this feature be added?
Add one INFO line after creating the main cache, using the recurrent layers'
storage_size()values. It reports planned total storage, storage per batchslot, and
max_history, with a single-user hint when there is more than oneslot. It is silent without recurrent layers or history. Allocation behavior
and defaults are unchanged.
The config/schema/sample docs explain the per-slot cost and correct the
transformer batch-size default from 32 to the 128 used by the backend.
Examples
For 48 GDN layers with 48 value heads of dimension 128, four slots and four
history tokens, the shape-only test produces:
This is calculated state storage, not a measurement of total process VRAM.
It excludes weights, paged KV cache and other buffers. History layouts differ
by architecture, and some state tensors are CPU-side. The revised wording
deliberately does not describe all recurrent models as keeping full copies
of each checkpoint in VRAM.
Additional context
Updated against main at
816c321, retaining the checkpoint controls from #468and resolving the overlapping documentation hunk.
Validation:
and PLE state objects on the meta device, covering multi/single slots,
no-history/no-layer cases, and architecture-specific storage accounting.
python -m pytest -q tests/test_*.py: 197 passed, using exllamav3 Pythonsources at
12414d0with CUDA devices hidden.max_batch_sizesample comments match the schema; its defaultremains
None. No live server/GPU load test was run.AI assistance: the original patch was prepared with Claude Code; this update,
tests, and revised description were prepared with Codex on my behalf.