Repository navigation
[Llama] Add scaled RoPE support for Llama 3 and 4 - #1839
Merged
Merged
Conversation
shuhuayu
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
October 8, 2025 19:17
tianyu-l
reviewed
Oct 8, 2025
tianyu-l
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Looks good in general. I left some comments.
Verified forward parity between Titan Llama 3.1 8B and HuggingFace Llama 3.1 8B. The KL divergence of outputs from the same sample inputs is small.
Would be good to show before vs. after. IIRC previously the difference is already very small.
tianyu-l
approved these changes
Oct 9, 2025
tianyu-l
left a comment
Contributor
There was a problem hiding this comment.
Looks very good. Had one more nit comment.
githubsgi
pushed a commit
to githubsgi/torchtitan
that referenced
this pull request
Oct 13, 2025
Llama 3.1 models use scaled RoPE by default, and Llama 4 17B x 16E uses scaled RoPE while 17B x 128E does not. 1. Verified forward parity between Titan Llama 3.1 8B and HuggingFace Llama 3.1 8B. The KL divergence of outputs from the same sample inputs is small.  For comparison, before adding scaled RoPE support, the forward parity check on the Llama 3.1 8B model incurred a slightly larger KL divergence on sample inputs.  2. Verified training of Llama 3.1 8B with tensor parallel degree = 4.  3. Verified training of Llama 4 debug model with scaled RoPE. 
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
Llama 3.1 models use scaled RoPE by default, and Llama 4 17B x 16E uses scaled RoPE while 17B x 128E does not. 1. Verified forward parity between Titan Llama 3.1 8B and HuggingFace Llama 3.1 8B. The KL divergence of outputs from the same sample inputs is small.  For comparison, before adding scaled RoPE support, the forward parity check on the Llama 3.1 8B model incurred a slightly larger KL divergence on sample inputs.  2. Verified training of Llama 3.1 8B with tensor parallel degree = 4.  3. Verified training of Llama 4 debug model with scaled RoPE. 
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
Llama 3.1 models use scaled RoPE by default, and Llama 4 17B x 16E uses scaled RoPE while 17B x 128E does not. 1. Verified forward parity between Titan Llama 3.1 8B and HuggingFace Llama 3.1 8B. The KL divergence of outputs from the same sample inputs is small.  For comparison, before adding scaled RoPE support, the forward parity check on the Llama 3.1 8B model incurred a slightly larger KL divergence on sample inputs.  2. Verified training of Llama 3.1 8B with tensor parallel degree = 4.  3. Verified training of Llama 4 debug model with scaled RoPE. 
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Llama 3.1 models use scaled RoPE by default, and Llama 4 17B x 16E uses scaled RoPE while 17B x 128E does not.
Verified forward parity between Titan Llama 3.1 8B and HuggingFace Llama 3.1 8B. The KL divergence of outputs from the same sample inputs is small.

For comparison, before adding scaled RoPE support, the forward parity check on the Llama 3.1 8B model incurred a slightly larger KL divergence on sample inputs.

Verified training of Llama 3.1 8B with tensor parallel degree = 4.

Verified training of Llama 4 debug model with scaled RoPE.
