[codex] tune prefill settings for trace round1#2
Draft
DngBack wants to merge 3 commits into
Draft
Conversation
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.
What changed
docker-compose-air_0705-0940.ymlfortrace-round1long-context shape.MAX_NUM_BATCHED_TOKENSMAX_NUM_SEQSMAX_CUDAGRAPH_CAPTURE_SIZEMAX_NUM_PARTIAL_PREFILLSMAX_LONG_PARTIAL_PREFILLSLONG_PREFILL_TOKEN_THRESHOLDmax_long_partial_prefills=1/long_prefill_token_threshold=8192to2/24576.MAX_NUM_BATCHED_TOKENSfrom8192to4096to favor TBT/ITL once TTFT has enough margin.skipped_waitingrequests when calculating per-slot chunk budget.Trace analysis
config_yml_aira/phase1_info/trace-round1.jsonlcontains 120 requests in 6 waves of 20 requests. Requests inside a wave arrive every 25 ms; waves are separated by 4.525 s. Conversation history grows by 2 messages each wave.Using the cached Qwen tokenizer as an estimate:
12924 / 18724 / 27348 / 273648192long-prefill threshold27.3kprompt tokens eachWith the previous settings, every request became a long prefill but only one long partial prefill could run at a time. Worse, when all-long requests were skipped due to quota, they moved into
skipped_waiting; the patch only planned againstwaiting, so the next step could calculate an oversized one-request chunk and lose concurrency again. The patch now plans against bothskipped_waitingandwaiting, so all-long tail waves keep the intended two chunk slots.For TBT/ITL,
max_num_batched_tokens=8192still allowed roughly 4096 prefill tokens per partial slot. That is good for TTFT but can make decode wait behind large prefill kernels. Defaulting to4096makes each two-slot prefill step closer to ~2048 tokens per slot, trading some TTFT slack for steadier decode interleaving.Validation
python3 -m py_compile config_yml_aira/0705-0940/patch_vllm_concurrent_prefill_v024.pydocker build --build-arg BASE_IMAGE=vllm/vllm-openai:v0.24.0-ubuntu2404 -f config_yml_aira/0705-0940/Dockerfile.vllm-concurrent-prefill -t dngback/vllm-v0.24.0-ubuntu2404-concurrent-prefill:latest config_yml_aira/0705-0940docker run --rm --entrypoint python3 dngback/vllm-v0.24.0-ubuntu2404-concurrent-prefill:latest /opt/dng-vllm-patches/patch_vllm_concurrent_prefill_v024.py --checkwaiting_queues = (self.skipped_waiting, self.waiting)max_num_batched_tokens=4096,max_num_partial_prefills=2,max_long_partial_prefills=2,long_prefill_token_threshold=24576curl http://127.0.0.1:8000/v1/modelscurl http://127.0.0.1:8000/v1/chat/completionsreturnedOK.