modelscope / modelscope/ms-swift
[Bug] Qwen3.5-35B-A3B LoRA SFT: loss=0, token_acc=0
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 1.7k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 136
Description
Checklist / 检查清单
- I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
Environment
- ms-swift: v4.0.0.dev0 (main branch, pulled 2026-02-28)
- transformers: 5.2.0
- deepspeed: ZeRO-3
- GPU: 4 nodes × 4 L40s (16 GPUs)
- Model: Qwen3.5-35B-A3B
Problem
When running LoRA SFT on Qwen3.5-35B-A3B with swift sft, loss is always 0.0, token_acc is always 0.0, and grad_norm is stuck at 1.0 (likely only from router_aux_loss).
The same training data works perfectly fine with Qwen3-VL-4B and Qwen3-VL-8B.
Training log (logging.jsonl):
{"current_steps": 1, "loss": 0.0, "grad_norm": 1.0, "learning_rate": 0.0, "epoch": 0.0, "token_acc": 0.0}
{"current_steps": 10, "loss": 0.0, "grad_norm": 1.0, "learning_rate": 5.1e-05, "epoch": 0.03, "token_acc": 0.0}
{"current_steps": 20, "loss": 0.0, "grad_norm": 1.0, "learning_rate": 0.0001, "epoch": 0.06, "token_acc": 0.0}
{"current_steps": 30, "loss": 0.0, "grad_norm": 1.0, "learning_rate": 9.9e-05, "epoch": 0.09, "token_acc": 0.0}
Training Command
swift sft
--model /path/to/Qwen3.5-35B-A3B
--dataset train_data.jsonl
--train_type lora
--lora_rank 16 --lora_alpha 32
--deepspeed ds_zero3.json
--max_length 12288
--padding_free false --packing false
--attn_impl flash_attn
(loss_scale and add_non_thinking_prefix not specified (using defaults))
args.json confirms correct model detection:
model_type: qwen3_5_moe
template: qwen3_5
loss_scale: default
How to Reproduce
- Prepare any SFT dataset in standard messages format (with or without images)
- Run training with default settings:
swift sft \
--model Qwen/Qwen3.5-35B-A3B \
--dataset your_data.jsonl \
--train_type lora \
--max_length 12288
3. Observe loss: 0.0, token_acc: 0.0, grad_norm: 1.0 in logging.jsonl
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 by reproducing the report with swift sft using Qwen/Qwen3.5-35B-A3B, LoRA, and the default settings, then inspect logging.jsonl and args.json for the zero loss and token accuracy. Compare the run with the working Qwen3-VL cases mentioned in the report; done means SFT produces nonzero loss and token accuracy with gradients reflecting the training loss.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100