Skip to content

add attention scaling to varlen for qwen3 - #2178

Merged
liangel-02 merged 1 commit into
mainfrom
scale
Dec 29, 2025
Merged

liangel-02 merged 1 commit into
mainfrom
scale

Conversation

@liangel-02

Copy link
Copy Markdown
Contributor

as title, fixes #2170

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 26, 2025
@wwwjn

wwwjn commented Dec 26, 2025

Copy link
Copy Markdown
Contributor

Do we support varlen attention for deepseek_v3 / llama4 model? If not , do we want to explicitly fail when they apply varlen attention?

I was asking because deepseek_v3 model also need a scale here: https://github.com/pytorch/torchtitan/blob/main/torchtitan/models/deepseek_v3/model/model.py#L308, but I see it haven't supported Varlen Attention yet

@tianyu-l

Copy link
Copy Markdown
Contributor

@liangel-02

liangel-02 commented Dec 26, 2025 •

Copy link
Copy Markdown
Contributor Author

Do we support varlen attention for deepseek_v3 / llama4 model? If not , do we want to explicitly fail when they apply varlen attention?

I was asking because deepseek_v3 model also need a scale here: https://github.com/pytorch/torchtitan/blob/main/torchtitan/models/deepseek_v3/model/model.py#L308, but I see it haven't supported Varlen Attention yet

@wwwjn we don't support varlen attn for those models, i can add a check in a separate pr

update: @wwwjn see #2179

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

integration test (feature) failed, is it because it's not in pytorch yet?

@liangel-02

Copy link
Copy Markdown
Contributor Author

integration test (feature) failed, is it because it's not in pytorch yet?

yes, i have pytorch/pytorch#171199 to add to pytorch, we can land that first

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's land the pytorch change first

@liangel-02
liangel-02 merged commit 5dd9f4c into main Dec 29, 2025
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attention scaling is never used

3 participants