Skip to content

repositioning fixes, tensor shape mismatch#91

Merged
nataxcan merged 2 commits into
mainfrom
spans_fast_repositioning_bugfix
Sep 24, 2025
Merged

repositioning fixes, tensor shape mismatch#91
nataxcan merged 2 commits into
mainfrom
spans_fast_repositioning_bugfix

Conversation

@nataxcan
Copy link
Copy Markdown
Member

@nataxcan nataxcan commented Sep 22, 2025

Accuracy numbers were wrong on our evals, now they're good again.

The issue was in _perform_repositioning in gpu_model_runner.py in the v1 API.

Basically if there's not too many repositioning requests, the vectors from different layers of the model are concatenated along the batch dimension before RoPE is applied twice to them.

Problem was: I forgot that the "positions" tensor telling the RoPE function what positional encodings to apply to the vectors needs to be repeated as its batch size does not match the big tensor's. Normally PyTorch would broadcast that tensor, but the RoPE function calls the .view function on the key vectors such that this is a wrong assumption.

@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Copy link
Copy Markdown
Member

@tdoublep tdoublep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nataxcan nataxcan force-pushed the spans_fast_repositioning_bugfix branch from 96aeac5 to 3d660f9 Compare September 24, 2025 10:12
Signed-off-by: Nathan Ordonez <nathanaxcan@gmail.com>
Signed-off-by: Nathan Ordonez <nathanaxcan@gmail.com>
@nataxcan nataxcan force-pushed the spans_fast_repositioning_bugfix branch from 3d660f9 to d3077c5 Compare September 24, 2025 10:15
@nataxcan nataxcan merged commit 1c3cd0e into main Sep 24, 2025
1 check passed
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.

2 participants