Skip to content

fix(batch): deepseek-v4 serves concurrent requests (one-row prompt batches, CacheList promotion) - #38

Merged
asher merged 3 commits into
mainfrom
dsv4-batch-decode
Aug 10, 2026
Merged

fix(batch): deepseek-v4 serves concurrent requests (one-row prompt batches, CacheList promotion)#38
asher merged 3 commits into
mainfrom
dsv4-batch-decode

Conversation

@asher

@asher asher commented Aug 10, 2026

Copy link
Copy Markdown
Owner

No description provided.

asher added 3 commits August 9, 2026 09:14
to_batch_cache has no PoolingCache arm, so any multi-row prompt batch
on a pooling-cache model raises before prefill and every request in it
fails. Concurrency above 2 was unserveable on deepseek-v4 as a result.

Cap prompt batches at one row for these models. Upstream's single-row
fast path builds the model's own scalar caches and never reaches the
conversion, and the decode side already joins those: _extend_cache
promotes a cache carrying merge with no left_padding, which is exactly
PoolingCache, and BatchPoolingCache implements extend/filter/extract.
The result is serial prefill with batched decode, which is where
batching pays; B>1 prefill is not a throughput win at depth.

Same lever the ckpt tier pulls in spec_engine, for a different reason.
Kill switch GMLX_POOLED_PREFILL_B1=0.
_extend_cache lifts a scalar cache into a batch one when it carries a
merge and no left_padding. A CacheList has neither of its own, so a
decode batch built from CacheLists (deepseek-v4: rotating window plus
two pools per layer) looked scalar on every admission and was merged a
second time. The second merge reached BatchRotatingKVCache.merge, which
calls c._temporal_order(c.keys) against rows that are already batch
caches, and every request in flight died with a TypeError.

Own the promotion test and look through CacheList members. Also give
BatchPoolingCache the left_padding attribute the other batch caches
carry (always zero; the constructor rejects anything else), so the test
reads the same way for pooled rows.

With this and the B=1 prompt-batch gate, deepseek-v4 serves concurrent
requests: c=1..4 all complete, realized decode width 3.48 of 4.
@asher
asher merged commit db2f1fc into main Aug 10, 2026
5 checks passed
@asher
asher deleted the dsv4-batch-decode branch August 10, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant