Skip to content

perf: Fix DSV3 perf regression & boost weight loading time (dsv3 MTP) - #2794

Merged
terrykong merged 4 commits into
mainfrom
youngeunk/dsv3-fix
Jun 24, 2026
Merged

terrykong merged 4 commits into
mainfrom
youngeunk/dsv3-fix

Conversation

@youngeunkwon0405

@youngeunkwon0405 youngeunkwon0405 commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

  1. Fix the performance regression caused by fix(grpo): improve non-colocated refit handling #2672
  2. Enhance the weight loading time when the MTP spec dec is enabled. Mostly targeting for dsv3 recipe update.(perf: Update the dsv3 perf recipe #2779)

Without this fix, MTP-enabled dsv3 takes 30-40mins for the model loading to load the entire ~1300 GB models from the storage. This fix makes the code to follow the load_format == "dummy" trick that relies on the refit to fill the model weights and perform the load from storage only for the MTP layers.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@youngeunkwon0405
youngeunkwon0405 requested review from a team as code owners June 12, 2026 03:34
@copy-pr-bot

copy-pr-bot Bot commented Jun 12, 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.

@youngeunkwon0405 youngeunkwon0405 self-assigned this Jun 12, 2026
@youngeunkwon0405 youngeunkwon0405 added Performance Related to improving performance deepseek Related to deepseek 671b CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Jun 12, 2026
@youngeunkwon0405 youngeunkwon0405 changed the title perf: Fix DSV3 performance regression and enhance weight loading time for dsv3 MTP perf: Fix DSV3 perf regression & boost weight loading time (dsv3 MTP) Jun 12, 2026
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 4f4891b

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 74a8e81

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test af1a910

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 549a508

Comment thread nemo_rl/algorithms/grpo.py Resolved

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, aside from the changes to offloading in grpo.py. @yuki-97 to also take a look at those calls

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

Hi @terrykong, the CI failed with this test

2026-06-24T16:29:57.5622036Z =================================== FAILURES ===================================
2026-06-24T16:29:57.5622584Z _________________ test_nightly_compute_stays_below_2150_hours __________________
2026-06-24T16:29:57.5622955Z 
2026-06-24T16:29:57.5624107Z nightly_test_suite = ['tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1.v3.sh', 'tests/test_suites/llm/grpo-llama3.2-1b-...nstruct-1n8g-fsdp2tp1-sglang.sh', 'tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-2n8g-fsdp2tp1-sglang.sh', ...]
2026-06-24T16:29:57.5625985Z tracker = <tests.unit.conftest.tracker.<locals>.Tracker object at 0x7373a80d4440>
2026-06-24T16:29:57.5626389Z 
2026-06-24T16:29:57.5627203Z     def test_nightly_compute_stays_below_2150_hours(nightly_test_suite, tracker):
2026-06-24T16:29:57.5629024Z         command = f"DRYRUN=1 HF_HOME=... HF_DATASETS_CACHE=... CONTAINER= ACCOUNT= PARTITION= ./tools/launch {' '.join(nightly_test_suite)}"
2026-06-24T16:29:57.5629866Z     
2026-06-24T16:29:57.5630135Z         print(f"Running command: {command}")
2026-06-24T16:29:57.5630482Z     
2026-06-24T16:29:57.5630787Z         # Run the command from the project root directory
2026-06-24T16:29:57.5631194Z         result = subprocess.run(
2026-06-24T16:29:57.5631511Z             command,
2026-06-24T16:29:57.5631782Z             shell=True,
2026-06-24T16:29:57.5632061Z             cwd=project_root,
2026-06-24T16:29:57.5632367Z             capture_output=True,
2026-06-24T16:29:57.5632673Z             text=True,
2026-06-24T16:29:57.5633041Z             check=False,  # Don't raise exception on non-zero exit code
2026-06-24T16:29:57.5633475Z         )
2026-06-24T16:29:57.5633699Z     
2026-06-24T16:29:57.5634010Z         # Print stdout and stderr for debugging if the test fails
2026-06-24T16:29:57.5634443Z         print("STDOUT:")
2026-06-24T16:29:57.5634739Z         print(result.stdout)
2026-06-24T16:29:57.5635045Z         print("STDERR:")
2026-06-24T16:29:57.5635332Z         print(result.stderr)
2026-06-24T16:29:57.5635625Z     
2026-06-24T16:29:57.5635912Z         # Assert that the command exited successfully
2026-06-24T16:29:57.5636700Z         assert result.returncode == 0, f"Command failed with exit code {result.returncode}"
2026-06-24T16:29:57.5637233Z     
2026-06-24T16:29:57.5637956Z         # Assert that the last line of stdout contains the expected prefix
2026-06-24T16:29:57.5638507Z         stdout_lines = result.stdout.strip().splitlines()
2026-06-24T16:29:57.5638994Z         assert len(stdout_lines) > 0, "Command produced no output"
2026-06-24T16:29:57.5639555Z         last_line = stdout_lines[-1]
2026-06-24T16:29:57.5639990Z         assert last_line.startswith("[INFO]: Total GPU hours:"), (
2026-06-24T16:29:57.5640502Z             f"Last line of output was not as expected: '{last_line}'"
2026-06-24T16:29:57.5640922Z         )
2026-06-24T16:29:57.5641276Z         total_gpu_hours = float(last_line.split(":")[-1].strip())
2026-06-24T16:29:57.5641712Z >       assert total_gpu_hours <= 2150, (
2026-06-24T16:29:57.5642371Z             f"Total GPU hours exceeded 2150: {last_line}. We should revisit the test suites to reduce the total GPU hours."
2026-06-24T16:29:57.5643031Z         )
2026-06-24T16:29:57.5643740Z E       AssertionError: Total GPU hours exceeded 2150: [INFO]: Total GPU hours: 2249. We should revisit the test suites to reduce the total GPU hours.
2026-06-24T16:29:57.5644542Z E       assert 2249.0 <= 2150
2026-06-24T16:29:57.5644738Z 
2026-06-24T16:29:57.5644936Z unit/test_recipes_and_test_suites.py:269: AssertionError
2026-06-24T16:29:57.5645427Z =============================== warnings summary ===============================

Seems like we have too many tests? Can you please tell me what is the right thing to resovle this error?

@yfw

yfw commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Hi @terrykong, the CI failed with this test

2026-06-24T16:29:57.5622036Z =================================== FAILURES ===================================
2026-06-24T16:29:57.5622584Z _________________ test_nightly_compute_stays_below_2150_hours __________________
2026-06-24T16:29:57.5622955Z 
2026-06-24T16:29:57.5624107Z nightly_test_suite = ['tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1.v3.sh', 'tests/test_suites/llm/grpo-llama3.2-1b-...nstruct-1n8g-fsdp2tp1-sglang.sh', 'tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-2n8g-fsdp2tp1-sglang.sh', ...]
2026-06-24T16:29:57.5625985Z tracker = <tests.unit.conftest.tracker.<locals>.Tracker object at 0x7373a80d4440>
2026-06-24T16:29:57.5626389Z 
2026-06-24T16:29:57.5627203Z     def test_nightly_compute_stays_below_2150_hours(nightly_test_suite, tracker):
2026-06-24T16:29:57.5629024Z         command = f"DRYRUN=1 HF_HOME=... HF_DATASETS_CACHE=... CONTAINER= ACCOUNT= PARTITION= ./tools/launch {' '.join(nightly_test_suite)}"
2026-06-24T16:29:57.5629866Z     
2026-06-24T16:29:57.5630135Z         print(f"Running command: {command}")
2026-06-24T16:29:57.5630482Z     
2026-06-24T16:29:57.5630787Z         # Run the command from the project root directory
2026-06-24T16:29:57.5631194Z         result = subprocess.run(
2026-06-24T16:29:57.5631511Z             command,
2026-06-24T16:29:57.5631782Z             shell=True,
2026-06-24T16:29:57.5632061Z             cwd=project_root,
2026-06-24T16:29:57.5632367Z             capture_output=True,
2026-06-24T16:29:57.5632673Z             text=True,
2026-06-24T16:29:57.5633041Z             check=False,  # Don't raise exception on non-zero exit code
2026-06-24T16:29:57.5633475Z         )
2026-06-24T16:29:57.5633699Z     
2026-06-24T16:29:57.5634010Z         # Print stdout and stderr for debugging if the test fails
2026-06-24T16:29:57.5634443Z         print("STDOUT:")
2026-06-24T16:29:57.5634739Z         print(result.stdout)
2026-06-24T16:29:57.5635045Z         print("STDERR:")
2026-06-24T16:29:57.5635332Z         print(result.stderr)
2026-06-24T16:29:57.5635625Z     
2026-06-24T16:29:57.5635912Z         # Assert that the command exited successfully
2026-06-24T16:29:57.5636700Z         assert result.returncode == 0, f"Command failed with exit code {result.returncode}"
2026-06-24T16:29:57.5637233Z     
2026-06-24T16:29:57.5637956Z         # Assert that the last line of stdout contains the expected prefix
2026-06-24T16:29:57.5638507Z         stdout_lines = result.stdout.strip().splitlines()
2026-06-24T16:29:57.5638994Z         assert len(stdout_lines) > 0, "Command produced no output"
2026-06-24T16:29:57.5639555Z         last_line = stdout_lines[-1]
2026-06-24T16:29:57.5639990Z         assert last_line.startswith("[INFO]: Total GPU hours:"), (
2026-06-24T16:29:57.5640502Z             f"Last line of output was not as expected: '{last_line}'"
2026-06-24T16:29:57.5640922Z         )
2026-06-24T16:29:57.5641276Z         total_gpu_hours = float(last_line.split(":")[-1].strip())
2026-06-24T16:29:57.5641712Z >       assert total_gpu_hours <= 2150, (
2026-06-24T16:29:57.5642371Z             f"Total GPU hours exceeded 2150: {last_line}. We should revisit the test suites to reduce the total GPU hours."
2026-06-24T16:29:57.5643031Z         )
2026-06-24T16:29:57.5643740Z E       AssertionError: Total GPU hours exceeded 2150: [INFO]: Total GPU hours: 2249. We should revisit the test suites to reduce the total GPU hours.
2026-06-24T16:29:57.5644542Z E       assert 2249.0 <= 2150
2026-06-24T16:29:57.5644738Z 
2026-06-24T16:29:57.5644936Z unit/test_recipes_and_test_suites.py:269: AssertionError
2026-06-24T16:29:57.5645427Z =============================== warnings summary ===============================

Seems like we have too many tests? Can you please tell me what is the right thing to resovle this error?

@youngeunkwon0405 I believe this should be fixed on main. @yuki-97 had bumped the threshold to fix the test

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

Hi @terrykong, the CI failed with this test

2026-06-24T16:29:57.5622036Z =================================== FAILURES ===================================
2026-06-24T16:29:57.5622584Z _________________ test_nightly_compute_stays_below_2150_hours __________________
2026-06-24T16:29:57.5622955Z 
2026-06-24T16:29:57.5624107Z nightly_test_suite = ['tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1.v3.sh', 'tests/test_suites/llm/grpo-llama3.2-1b-...nstruct-1n8g-fsdp2tp1-sglang.sh', 'tests/test_suites/llm/grpo-qwen2.5-math-1.5b-instruct-2n8g-fsdp2tp1-sglang.sh', ...]
2026-06-24T16:29:57.5625985Z tracker = <tests.unit.conftest.tracker.<locals>.Tracker object at 0x7373a80d4440>
2026-06-24T16:29:57.5626389Z 
2026-06-24T16:29:57.5627203Z     def test_nightly_compute_stays_below_2150_hours(nightly_test_suite, tracker):
2026-06-24T16:29:57.5629024Z         command = f"DRYRUN=1 HF_HOME=... HF_DATASETS_CACHE=... CONTAINER= ACCOUNT= PARTITION= ./tools/launch {' '.join(nightly_test_suite)}"
2026-06-24T16:29:57.5629866Z     
2026-06-24T16:29:57.5630135Z         print(f"Running command: {command}")
2026-06-24T16:29:57.5630482Z     
2026-06-24T16:29:57.5630787Z         # Run the command from the project root directory
2026-06-24T16:29:57.5631194Z         result = subprocess.run(
2026-06-24T16:29:57.5631511Z             command,
2026-06-24T16:29:57.5631782Z             shell=True,
2026-06-24T16:29:57.5632061Z             cwd=project_root,
2026-06-24T16:29:57.5632367Z             capture_output=True,
2026-06-24T16:29:57.5632673Z             text=True,
2026-06-24T16:29:57.5633041Z             check=False,  # Don't raise exception on non-zero exit code
2026-06-24T16:29:57.5633475Z         )
2026-06-24T16:29:57.5633699Z     
2026-06-24T16:29:57.5634010Z         # Print stdout and stderr for debugging if the test fails
2026-06-24T16:29:57.5634443Z         print("STDOUT:")
2026-06-24T16:29:57.5634739Z         print(result.stdout)
2026-06-24T16:29:57.5635045Z         print("STDERR:")
2026-06-24T16:29:57.5635332Z         print(result.stderr)
2026-06-24T16:29:57.5635625Z     
2026-06-24T16:29:57.5635912Z         # Assert that the command exited successfully
2026-06-24T16:29:57.5636700Z         assert result.returncode == 0, f"Command failed with exit code {result.returncode}"
2026-06-24T16:29:57.5637233Z     
2026-06-24T16:29:57.5637956Z         # Assert that the last line of stdout contains the expected prefix
2026-06-24T16:29:57.5638507Z         stdout_lines = result.stdout.strip().splitlines()
2026-06-24T16:29:57.5638994Z         assert len(stdout_lines) > 0, "Command produced no output"
2026-06-24T16:29:57.5639555Z         last_line = stdout_lines[-1]
2026-06-24T16:29:57.5639990Z         assert last_line.startswith("[INFO]: Total GPU hours:"), (
2026-06-24T16:29:57.5640502Z             f"Last line of output was not as expected: '{last_line}'"
2026-06-24T16:29:57.5640922Z         )
2026-06-24T16:29:57.5641276Z         total_gpu_hours = float(last_line.split(":")[-1].strip())
2026-06-24T16:29:57.5641712Z >       assert total_gpu_hours <= 2150, (
2026-06-24T16:29:57.5642371Z             f"Total GPU hours exceeded 2150: {last_line}. We should revisit the test suites to reduce the total GPU hours."
2026-06-24T16:29:57.5643031Z         )
2026-06-24T16:29:57.5643740Z E       AssertionError: Total GPU hours exceeded 2150: [INFO]: Total GPU hours: 2249. We should revisit the test suites to reduce the total GPU hours.
2026-06-24T16:29:57.5644542Z E       assert 2249.0 <= 2150
2026-06-24T16:29:57.5644738Z 
2026-06-24T16:29:57.5644936Z unit/test_recipes_and_test_suites.py:269: AssertionError
2026-06-24T16:29:57.5645427Z =============================== warnings summary ===============================

Seems like we have too many tests? Can you please tell me what is the right thing to resovle this error?

@youngeunkwon0405 I believe this should be fixed on main. @yuki-97 had bumped the threshold to fix the test

Thanks @yfw , I will bump main and retry.

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test fce3fb4

@terrykong

Copy link
Copy Markdown
Collaborator

@youngeunkwon0405 i think the nightly test thing is a bug on main and it may be fixed by rebasing

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

@youngeunkwon0405 i think the nightly test thing is a bug on main and it may be fixed by rebasing

Thanks @terrykong and @yfw , the error was resolved by rebasing. Are we waiting for @yuki-97's final call?

@yfw

yfw commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@youngeunkwon0405 i think the nightly test thing is a bug on main and it may be fixed by rebasing

Thanks @terrykong and @yfw , the error was resolved by rebasing. Are we waiting for @yuki-97's final call?

I think we are good with the offloading, but I had one more comment here #2794 (review). Can you please take a look?

@youngeunkwon0405

youngeunkwon0405 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@youngeunkwon0405 i think the nightly test thing is a bug on main and it may be fixed by rebasing

Thanks @terrykong and @yfw , the error was resolved by rebasing. Are we waiting for @yuki-97's final call?

I think we are good with the offloading, but I had one more comment here #2794 (review). Can you please take a look?

I added a logic that checks if the MTP is trained by policy (which means it will get it from refit), in that case we are not calling load_mtp_weights_from_disk.
0feb4fa

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 0feb4fa

Signed-off-by: Youngeun Kwon <[email protected]>
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test d1bcda9

@terrykong

Copy link
Copy Markdown
Collaborator

lgtm, but will let @yfw's review be the approval necessary for the PR. thanks @youngeunkwon0405

@yfw

yfw commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

lgtm, thank you!

This branch was previously deployed

2 inactive deployments
public — d1bcda9f Deployed Jun 24, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #1406
test — d1bcda9f Deployed Jun 24, 2026 by copy-pr-bot[bot] via Wait in test approval queue #12668
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) deepseek Related to deepseek 671b Performance Related to improving performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants