Repository navigation
feat(vllm): capture generation artifacts (5/6) - #14975
Open
biswapanda wants to merge 1 commit into
Open
biswapanda wants to merge 1 commit into
biswapanda wants to merge 1 commit into
Conversation
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
This was referenced Sep 17, 2026
| raise ArtifactCaptureError( | ||
| "completion tokens exceed the admitted token bounds" | ||
| ) | ||
| if "moe_routes" in self.contents and routed_experts is not None: |
There was a problem hiding this comment.
The retained route-tensor limit is based on the source tensor's assumed int64 representation, while admission budgets routes using their compact wire dtype. For models with many routers and small expert IDs, a valid int64 vLLM tensor can therefore retain up to roughly 8x the configured decoded-byte limit until finalization, despite the request being admitted under that limit. Canonicalize the tensor before retaining it and enforce the admitted bound on that canonical representation.
🤖 AI Fix
Convert routed_experts to its validated canonical integer dtype before storing it and compare the canonical byte count against the admission budget.
This was referenced Oct 12, 2026
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.
Purpose
Add a bounded vLLM producer session that captures requested generation data, validates capacity before inference, encodes
generation_artifact_v1, and delivers the resulting opaque object through either storage target from the lower layers.What changes
VllmGenerationArtifactSessionwith explicit admission, per-delta capture, finalization, and release.moe_routesandselected_logprobs; unknown content names fail fast.generation_artifact_v1, codeczstd, and one generated choice.--enable-rland vLLM--enable-return-routed-expertswhenmoe_routesis requested.routed_experts_prompt_startand validates the returned route tensor against the effective sequence range.Admission and resource bounds
Admission happens before generation and estimates the worst-case canonical payload from prompt length,
max_tokens, model router count, experts per token, manifest overhead, and target byte limit. It rejects the request before inference if the decoded or conservatively bounded encoded object cannot fit.DYN_GENERATION_ARTIFACT_MAX_DECODED_BYTES.DYN_GENERATION_ARTIFACT_PIPELINE_CONCURRENCY.release()clears captured tokens, routes, counters, and admission state.Cancellation semantics
Encoding runs off the event loop and delivery runs behind a bounded semaphore. If the caller is cancelled before an operation starts, the queued task is cancelled. If cancellation arrives after encoding/upload starts, the operation continues in the background and retains its semaphore slot until completion, avoiding an in-process ambiguous half-write and unbounded replacement work. A worker-process crash still requires external object-store reconciliation and is not solved in this PR.
Architecture boundary
This is the vLLM schema/capture layer. The common storage writer still receives only bytes plus a target and remains unaware of routed experts or training experiences. Handler/frontend wiring is intentionally deferred to #14978.
Reviewer guide
components/src/dynamo/vllm/generation_artifact.py: admission, capture, model-layout validation, finalization, and cancellation-safe delivery.components/src/dynamo/vllm/tests/test_generation_artifact_capture.py: bounds, alignment, cancellation, concurrency, and receipt behavior.components/src/dynamo/common/generation_artifact_storage.py: side-effect-free target validation used during admission.Validation
PR stack
Review and merge bottom-up. Each PR is based on the preceding stack branch, so its diff contains only that layer. The original umbrella #14385 remains open and unchanged as a reference.