Skip to content

fix: merge LoRA into refit weights under activation checkpointing - #3953

Open
anubhutivyas wants to merge 1 commit into
mainfrom
anubhutiv/fix-lora
Open

fix: merge LoRA into refit weights under activation checkpointing#3953
anubhutivyas wants to merge 1 commit into
mainfrom
anubhutiv/fix-lora

Conversation

@anubhutivyas

Copy link
Copy Markdown

What does this PR do ?

Explained in very simple terms:

Context:
There are two copies of the model during training:

  • the student — the copy that's learning
  • the writer — the copy that actually writes the math answers (vLLM)

After every training step, the student's improvements get copied over to the writer, so the next batch of answers comes from a slightly better model. That copy step is called a refit.

LoRA means we don't change the original model at all. We freeze it and attach small adjustments on top. The real model = original + small adjustments.

So the refit has to do a bit of assembly: for each layer, find that layer's adjustments, add them onto the original weights, and send the sum to the writer. It finds those adjustments by the layer's name.

Bug:

Activation checkpointing is a memory-saving trick, it throws away intermediate results and recomputes them later. To do that it wraps each layer in a box. And that box changes the layer's name: layers.0.up_proj becomes layers.0._checkpoint_wrapped_module.up_proj

But only in one of the two places the code looks. The list of weights still used the short name; the list of layers now used the long name. So the code searched for layers.0.up_proj, found nothing and just shipped the original weights, with no adjustments.

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

  • ...

Signed-off-by: anubhutiv <anubhutiv@nvidia.com>
@anubhutivyas
anubhutivyas requested review from a team as code owners September 1, 2026 18:21
@copy-pr-bot

copy-pr-bot Bot commented Sep 1, 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant