deepspeedai / deepspeedai/DeepSpeed
[REQUEST]Support for modules_to_save with LoRA under DeepSpeed ZeRO-3
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
When using PEFT LoRA with modules_to_save (e.g. ['wte','ff_out']) under DeepSpeed ZeRO-3, the training process either fails with shape mismatches or leads to large GPU memory usage.
It seems that modules_to_save parameters are not sharded like the rest of the model under ZeRO-3, which may cause them to remain in full precision on every GPU.
Reproduction
1. Load a model with LoRA using PEFT
2. Enable modules_to_save=['wte','ff_out']
3. Launch training with DeepSpeed ZeRO-3 (zero3_init_flag=False)
4. Observe that:
• wte.original_module.weight may have shape [0, hidden_size] or mismatch at load time
• Memory usage increases drastically (batch size must drop to 1)
Expected behavior
The modules_to_save parameters should be properly partitioned under ZeRO-3, so that LoRA training can proceed normally without excessive memory usage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the listed PEFT LoRA reproduction using modules_to_save=['wte','ff_out'] and DeepSpeed ZeRO-3 with zero3_init_flag=False. Investigate the ZeRO-3 handling of modules_to_save parameters and verify that the shape mismatch is resolved and those parameters are partitioned without the reported GPU memory increase.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- distributed-systems, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100