Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

训练时loss一直为0 #21

Open
FWLamb opened this issue Feb 10, 2025 · 10 comments
Open

训练时loss一直为0 #21

FWLamb opened this issue Feb 10, 2025 · 10 comments

Comments

@FWLamb
Copy link

FWLamb commented Feb 10, 2025

拉去训练任务后,loss一直为0,会是什么原因导致的呢?

Image

@lllfx
Copy link

lllfx commented Feb 10, 2025

我复现也是这样的。

Image

@FWLamb
Copy link
Author

FWLamb commented Feb 10, 2025

我复现也是这样的。

Image

推理有效果吗?

@lllfx
Copy link

lllfx commented Feb 10, 2025

我复现也是这样的。
Image

推理有效果吗?

没效果,训练后变差了

@anine09
Copy link
Contributor

anine09 commented Feb 10, 2025

其实我也没有什么头绪,我自己遇到了类似的情况,前90步loss一直为0,我们还在讨论

@anine09
Copy link
Contributor

anine09 commented Feb 10, 2025

或许可以参考 huggingface/trl#2703 (comment)

@QinHsiu
Copy link

QinHsiu commented Feb 12, 2025

Image,你好,我也遇见了这个问题,然后我在测试的时候发现有很多案例都出现了重复生成的问题,像这样:

Image,抽取了100条数据,这种重复的数据占比超过了一半(我是测试了4个模型,分别是训练50、100、150和200的模型,都存在这种情况)

@anine09
Copy link
Contributor

anine09 commented Feb 12, 2025

Hi @QinHsiu ,首先请确保你没有使用“思考长度奖励函数”,这可能会造成严重的重复生成问题,另外 loss 为 0 可以确定是 GRPO 本身的特性,见上面讨论中提到 TRL 官方解释

@QinHsiu
Copy link

QinHsiu commented Feb 12, 2025

你好,我只用了两个激励函数,

Image

@anine09
Copy link
Contributor

anine09 commented Feb 12, 2025

那重复问题应该就是由于模型自身能力带来的,其他的复现报告也经常发现重复,我个人会建议你试试最长子序列匹配的惩罚,暂时没有什么好方案,可能换更大的模型有效,但是这都只是我的个人猜测

另外 @QinHsiu 你可以改一下我们仓库的最新代码,开启了 flash-attn,效率更高,就在你展示的代码附近

@QinHsiu
Copy link

QinHsiu commented Feb 12, 2025

好的,谢谢提醒,感谢你们的开源工作!

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

No branches or pull requests

4 participants