You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/sft.md
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,22 +167,27 @@ Upon completion of the training process, you can refer to our [evaluation guide]
167
167
168
168
NeMo RL supports LoRA (Low-Rank Adaptation) for parameter-efficient fine-tuning. LoRA reduces trainable parameters by using low-rank matrices for weight updates while keeping the base model frozen.
169
169
170
+
Notes:
171
+
- LoRA is supported with DTensor v2 and Megatron backends. DTensor v1 does not support LoRA (ensure `policy.dtensor_cfg._v2=true` when using DTensor).
172
+
- Triton kernels are only used in the DTensor v2 path. For TP > 1, Automodel currently does not support Triton kernels (see note below).
173
+
170
174
### Configuration Parameters
171
175
172
-
The LoRA configuration is specified under the `policy.lora_cfg` section:
176
+
The LoRA configuration is specified under the `policy.dtensor_cfg.lora_cfg` section:
173
177
174
178
policy:
175
-
lora_cfg:
176
-
enabled: False # Set to True to enable LoRA fine-tuning
177
-
target_modules: [] # List of module names to apply LoRA
178
-
exclude_modules: [] # List of module names to exclude from LoRA
179
-
match_all_linear: true # Apply LoRA to all linear layers
alpha: 32# LoRA scaling factor (effective lr = alpha/dim)
187
+
dropout: 0.0# Dropout probability for LoRA layers
188
+
dropout_position: "post"# Dropout position: "pre" or "post"
189
+
lora_A_init: "xavier"# Initialization method: "xavier" or "uniform"
190
+
use_triton: true # Use Triton-optimized kernels (DTensor v2 path)
186
191
187
192
### Parameter Details
188
193
- **`enabled`** (bool): Whether to enable LoRA training
@@ -194,12 +199,12 @@ policy:
194
199
- **`dropout`** (float): Dropout probability for regularization
195
200
- **`dropout_position`** (str): Apply dropout before ("pre") or after ("post") LoRA
196
201
- **`lora_A_init`** (str): Initialization method for LoRA A matrix
197
-
- **`use_triton`** (bool): Use Triton-optimized kernels for better performance. Used for dtensor v2 only. **Note**: [Automodel not support triton for TP > 1](https://github.com/NVIDIA-NeMo/Automodel/blob/b2db55eee98dfe81a8bfe5e23ac4e57afd8ab261/nemo_automodel/recipes/llm/train_ft.py#L199). Set to `false` when `tensor_parallel_size > 1` to avoid compatibility issues
202
+
- **`use_triton`** (bool): Use Triton-optimized kernels for better performance. Used for DTensor v2 only. **Note**: [Automodel does not support Triton for TP > 1](https://github.com/NVIDIA-NeMo/Automodel/blob/b2db55eee98dfe81a8bfe5e23ac4e57afd8ab261/nemo_automodel/recipes/llm/train_ft.py#L199). Set to `false` when `tensor_parallel_size > 1` to avoid compatibility issues
198
203
199
204
### Example Usage
200
205
201
206
```bash
202
-
uv run examples/run_sft.py policy.lora_cfg.enabled=True
207
+
uv run examples/run_sft.py policy.dtensor_cfg.lora_cfg.enabled=true
203
208
```
204
209
205
210
For more details on LoRA, see [LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685).
0 commit comments