Skip to content

Forward rotary_base and rope_scaling_factor to LLaVAModel in the VLM builders - #6586

Merged
chtruong814 merged 2 commits into
NVIDIA:mainfrom
adityaghai07:fix-vlm-rope-args
Aug 21, 2026
Merged

Forward rotary_base and rope_scaling_factor to LLaVAModel in the VLM builders#6586
chtruong814 merged 2 commits into
NVIDIA:mainfrom
adityaghai07:fix-vlm-rope-args

Conversation

@adityaghai07

@adityaghai07 adityaghai07 commented Aug 17, 2026

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

What

Two RoPE arguments are parsed but never forwarded to LLaVAModel, so they are silently ignored on the VLM path. LLaVAModel already accepts both and forwards them to the language model — only the call sites needed updating.

Argument pretrain_vlm.py examples/multimodal/model.py
language_rotary_base ❌ → fixed here ✅ already passed
language_rope_scaling_factor ❌ → fixed here ❌ → fixed here

rope_scaling_factor (commit 1) — --rope-scaling-factor never reaches the model, which keeps LLaVAModel's default of 8.0. This is the VLM half of #6305, which states that pretrain_vlm.py and examples/multimodal/model.py "have the same issue on the LLaVA path... a separate call surface and not covered by the linked PR". Complements #6306, which covers the GPT/post-training paths.

rotary_base (commit 2, #6585) — --rotary-base never reaches the model, which keeps the default of 10000. Unlike RoPE scaling this is not opt-in: it applies to every RoPE model on this path and must match the pretrained checkpoint (Llama 3.x uses 500000). The sibling call site in examples/multimodal/model.py:218 already passes it, which is what makes this an oversight rather than an intentional difference.

Both values are forwarded into the language model (llava_model.py:254-256GPTModelRotaryEmbedding); the vision encoder never sees them. There is no fallback via the config — base TransformerConfig has no rotary_base field (the only one in transformer_config.py belongs to MLATransformerConfig, and gpt_model.py:166 excludes multi-latent attention from this branch), so the keyword argument is the only path.

History

Both appear to be plumbing that was added to the model but never wired at the call site:

  • 617dc63c0 ("Make rotary base configurable in LlavaModel", 2024-06-27) added language_rotary_base to llava_model.py only — +2 lines in one file, no call site updated. 63be779b4 later updated examples/multimodal/model.py; pretrain_vlm.py never was.
  • 8c98d2def ("llama3.2 support", 2025-01-31) added language_rope_scaling_factor to llava_model.py and updated zero call sites.

Testing

These call sites are not currently unit tested — no test in the repo imports pretrain_vlm.model_provider, and exercising it requires an initialized torch.distributed process group (pretrain_vlm.py:89) plus a fully-populated args namespace, so a mock-based test would be fragile. The change is a three-line argument forwarding, verified by inspection against the sibling call site and against the equivalent GPT-path fix in #6306. Happy to add a test if maintainers would like one, and glad to follow whatever approach #6306 settles on.

🤖 Generated with Claude Code

adityaghai07 and others added 2 commits August 17, 2026 23:01
Both VLM call sites pass language_rope_scaling but never
language_rope_scaling_factor, so LLaVAModel falls back to its default of
8.0 and --rope-scaling-factor is silently ignored when training a VLM.

LLaVAModel already accepts the parameter and forwards it to the language
model, so only the call sites need updating.

Reported for the GPT path in NVIDIA#6305, which notes that the VLM call sites
are a separate surface not covered by its linked PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Aditya Ghai <adityaghailbdrp1@gmail.com>
pretrain_vlm.py never passes language_rotary_base, so LLaVAModel falls
back to its default of 10000 and --rotary-base is silently ignored. The
sibling call site in examples/multimodal/model.py already passes it.

Unlike RoPE scaling, rotary_base is not opt-in: it is used by every RoPE
model on this path, and it must match the pretrained checkpoint (Llama
3.x uses 500000).

Fixes NVIDIA#6585

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Aditya Ghai <adityaghailbdrp1@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 17, 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.

@adityaghai07
adityaghai07 marked this pull request as ready for review August 17, 2026 17:37
@adityaghai07
adityaghai07 requested a review from a team as a code owner August 17, 2026 17:37
@svcnvidia-nemo-ci
svcnvidia-nemo-ci requested a review from a team August 17, 2026 17:37
@adityaghai07
adityaghai07 marked this pull request as draft August 18, 2026 07:32
@adityaghai07
adityaghai07 marked this pull request as ready for review August 18, 2026 07:32
@maanug-nv

Copy link
Copy Markdown
Contributor

/ok to test 187a759

@Phlip79
Phlip79 enabled auto-merge August 18, 2026 22:20
@nemo-automation-bot

Copy link
Copy Markdown

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/32497337271

Merged via the queue into NVIDIA:main with commit 60e0396 Aug 21, 2026
156 of 178 checks passed
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Aug 21, 2026
devnkong pushed a commit to devnkong/Megatron-LM that referenced this pull request Aug 22, 2026
…builders (NVIDIA#6586)

Signed-off-by: Aditya Ghai <adityaghailbdrp1@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Kezhi Kong <kezhik@kezhik-mlt.client.nvidia.com>
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] pretrain_vlm.py silently ignores --rotary-base: LLaVAModel always uses the default 10000

6 participants