Skip to content

Propagate rope_scaling_factor from args to GPT model construction - #6306

Draft
Alvorecer721 wants to merge 1 commit into
NVIDIA:mainfrom
Alvorecer721:fix-rope-scaling-factor-propagation
Draft

Propagate rope_scaling_factor from args to GPT model construction#6306
Alvorecer721 wants to merge 1 commit into
NVIDIA:mainfrom
Alvorecer721:fix-rope-scaling-factor-propagation

Conversation

@Alvorecer721

Copy link
Copy Markdown
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Forwards rope_scaling_factor from the parsed arguments to GPTModel, so --rope-scaling-factor actually takes effect.

Issue tracking

Linked issue: Fixes #6305

Problem

All three GPT construction sites pass rope_scaling=args.use_rope_scaling but not the factor, so GPTModel always falls back to its default of 8.0:

  • gpt_config_from_args in megatron/training/argument_utils.py (pretrain_gpt.py, train_rl.py, inference utils)
  • gpt_builder in gpt_builders.py (train_rl.py, checkpoint converter tools)
  • the ModelOpt builder in megatron/post_training/model_builder.py

Runs using the Llama 3.1 factor of 8.0 are unaffected because the defaults happen to match, which is why this went unnoticed. Anything else, e.g. 32.0 for Llama 3.2 style scaling, silently trains with 8.0.

#2902 fixed this on the old layout but was closed unmerged; the training migration (#4741) kept the gap in the new path.

Changes

  • Forward args.rope_scaling_factor at the three construction sites (one line each).
  • Regression test for the config path: gpt_config_from_args with a non-default factor must produce a config carrying that factor (tests/unit_tests/training/models/test_gpt_builder.py).
  • Regression test for the builder path: gpt_builder must include rope_scaling_factor in its GPTModel call (tests/unit_tests/models/test_gpt_model.py).

Testing

pytest -q tests/unit_tests/training/models/test_gpt_builder.py
pytest -q "tests/unit_tests/models/test_gpt_model.py::test_gpt_builder_forwards_rope_scaling_factor"

Both new tests fail before the fix (the config keeps 8.0; the kwarg is missing from the call) and pass after. All 58 tests in test_gpt_builder.py pass.

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

--rope-scaling-factor was parsed but never forwarded to the model:
gpt_config_from_args, gpt_builder, and the ModelOpt model builder all
passed rope_scaling without the factor, so GPTModel always fell back to
its default of 8.0. Training with any non-default factor (e.g. 32.0 for
Llama 3.2 style checkpoints) silently used 8.0 instead.

Forward args.rope_scaling_factor at the three construction sites and add
regression tests covering the config path and the builder path.

Signed-off-by: Alvorecer721 <yixuan.xu@ai.ethz.ch>
@copy-pr-bot

copy-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] --rope-scaling-factor is silently ignored: GPT models always use the default factor of 8.0

2 participants