Skip to content

vLLM input normalization silently changes prompts for interior or ignored attention masks #3884

Closed

Description

@Qubitium

Reproduction (current main, daa5dae)

from gptqmodel.utils.vllm import _normalize_vllm_inputs

print(_normalize_vllm_inputs(None, [10, 20, 30], [1, 0, 1]))
# (None, [[10, 30]])

print(_normalize_vllm_inputs("hello", None, [1, 0]))
# ("hello", None) -- supplied mask silently ignored

An interior zero in a Hugging Face attention mask means token 20 is masked in place. The vLLM token-prompt adapter cannot represent that attention pattern; deleting the token changes the prompt IDs, length, and positions instead of preserving or rejecting the request. _apply_attention_mask also accepts nonbinary values via bool(keep), and the text-prompt branches ignore a supplied mask. The SGLang adapter already validates binary masks and rejects interior holes.

Expected

Accept only boolean/0-1 masks that remove contiguous left or right padding from token prompts; reject interior holes and masks supplied with text prompts with a clear error. Test that valid padding removal preserves the intended token sequence and that invalid masks do not silently alter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions