verl icon indicating copy to clipboard operation
verl copied to clipboard

[Question] Loss calculation on EOS tokens for SFT

Open zhxieml opened this issue 1 year ago • 2 comments

We currently do not calculate loss on EOS tokens. Since this may lead to non-stop generation, should we mask out EOS tokens?https://github.com/volcengine/verl/blob/f0e7f9fcbe0126f29efad689690ef570bf8e9a7a/verl/utils/dataset/sft_dataset.py#L166-L167

zhxieml avatar Mar 11 '25 06:03 zhxieml

The last token prediction is actually meaningless. token id [0, 1, 2, ... n-1] -> [1, 2, 3, .. n-1, ?]. The last token is not [EOS]

vermouth1992 avatar Mar 11 '25 14:03 vermouth1992

Oh I see. Thanks!

zhxieml avatar Mar 11 '25 15:03 zhxieml