Exploring Alternatives to Cross-Entropy Loss for Language Model Training
The article discusses whether cross-entropy, the standard loss function for LLM pretraining and fine-tuning, can be replaced, and what alternatives exist. It notes that changing the loss function affects all loss-based comparisons, requiring evaluation on downstream tasks instead. The author encourages thinking through the underlying principles to potentially improve model optimization and performance.
Coverage timeline
科学空间 (苏剑林)苏剑林
一直以来,交叉熵(Cross Entropy)都是LLM预训练和微调的标准损失函数。那这个“标准”可以改吗?如果想改,那又有哪些选择呢?改完之后又会带来什么影响呢? 可能很多读者从未认真推敲过这些问题。一方面,交叉熵简洁有效,又有信息论诠释作为背书,让我们觉得它非常“理所当然”,以至于欣然接受;另一方面,换损失函数是“牵一发而动全身”的事情——换了之后意味着所有基于损失的比较都不再有效,我们只能去比下游任务效果了,工程量太大。 然而,“理所当然”不等于“别无选择”,将背后的原理思考清楚,不仅有助于我们更好地理解模型的优化过程,也可能为提升效果带来新的改进视角。 分析 更准确地说,交叉熵是分类问题的标准损失函数,而LLM的训练看上去像是逐Token的分类问题,所以沿用了交叉熵损失。这样看来,只要我们换用别的分类损失函数就行了? [...]