You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vLLM generate output loses completions for shorter padded prompts when sliced at the input width #3921
The vLLM adapter removes per-row padding before inference, then returns a tensor reconstructed from each result's unpaddedprompt_token_ids. A standard Hugging Face caller slices generated tokens using the width of the original input_ids:
The first row's completion is entirely lost to the caller; with other lengths it can include prompt IDs or only part of the completion. I reproduced this with a fake vLLM engine on 8ecc295. The same behavior applies to left/right padded batches of unequal effective lengths.
Cause
_normalize_vllm_inputs strips padding for vLLM. vllm_generate concatenates result.prompt_token_ids + output.token_ids and right-pads the resulting rows; it never restores the original input width before the completion. The returned tensor therefore breaks the generate output alignment used by callers that slice at input_ids.shape[1], including the repository's server generation path (gptqmodel/utils/openai_server.py).
Expected
For tensor input_ids, preserve each row's original prefix width in the returned tensor, so output[:, input_ids.shape[1]:] begins with that row's generated token IDs. Keep the unpadded prompt sent to vLLM. Add a batched left/right-padding regression test for the returned output, not only input normalization.
This is separate from #3884, which covers attention-mask validation before generation.
Activity
fix(vllm): keep each row's original prefix width in generate output (M…