Skip to content

[rl] GQA attention enablement in torchtitan vllm wrapper - #2299

Merged
wwwjn merged 2 commits into
mainfrom
gh/wwwjn/10/head
Feb 2, 2026
Merged

wwwjn merged 2 commits into
mainfrom
gh/wwwjn/10/head

Conversation

@wwwjn

@wwwjn wwwjn commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Following #2259

Context: Fix RL attention implementation, add numerics check scripts comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native Qwen3 model

NOTE: I tried enabling CI for this work, but need more efforts install vllm from source code (need to build vllm from scratch). Will enable CI in later PRs

fix comments

remove tests

add enable_gqa flag

[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 29, 2026
@wwwjn wwwjn changed the title GQA attention enablement in torchtitan vllm wrapper [rl] GQA attention enablement in torchtitan vllm wrapper Jan 29, 2026
@wwwjn

wwwjn commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

retry merge #2291, the code is the same as #2291

@wwwjn
wwwjn changed the base branch from gh/wwwjn/10/base to main January 29, 2026 23:23
for layer in self.model.layers.values():
h = layer(h, rope_cache, attention_masks=None, positions=positions)

h = self.model.norm(h)

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.

so norm is not included in self.model and we need to manually apply outside?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are manually calling forward for each module within self.model. Previously the norm layer is in compute_logits, but now I moved it to forward function similiar to vllm's native qwen3 implementation. From the numerics test, I don't see these change affecting final results

Following #2259

Context: Fix RL attention implementation, add numerics check scripts comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native Qwen3 model

NOTE: I tried enabling CI for this work, but need more efforts install vllm from source code (need to build vllm from scratch). Will enable CI in later PRs

[ghstack-poisoned]
@wwwjn
wwwjn merged commit 2b0a4a3 into main Feb 2, 2026
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* pytorch#2300
* __->__ pytorch#2299

Following pytorch#2259

Context: Fix RL attention implementation, add numerics check scripts
comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native
Qwen3 model

NOTE: I tried enabling CI for this work, but need more efforts install
vllm from source code (need to build vllm from scratch). Will enable CI
in later PRs
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* pytorch#2300
* __->__ pytorch#2299

Following pytorch#2259

Context: Fix RL attention implementation, add numerics check scripts
comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native
Qwen3 model

NOTE: I tried enabling CI for this work, but need more efforts install
vllm from source code (need to build vllm from scratch). Will enable CI
in later PRs
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.

3 participants