[论文解读] Contextual Temperature for Language Modeling
本文提出上下文温度(contextual temperature),一种基于上下文历史为每个词汇标记学习唯一温度的动态方法,实现语言建模中不确定性控制的动态调节。通过在每个标记和上下文上优化温度,该方法在Penn Treebank上达到55.31的困惑度,在WikiText-2上达到62.89,显著优于固定温度或基于调度的温度缩放方法。
Temperature scaling has been widely used as an effective approach to control the smoothness of a distribution, which helps the model performance in various tasks. Current practices to apply temperature scaling assume either a fixed, or a manually-crafted dynamically changing schedule. However, our studies indicate that the individual optimal trajectory for each class can change with the context. To this end, we propose contextual temperature, a generalized approach that learns an optimal temperature trajectory for each vocabulary over the context. Experimental results confirm that the proposed method significantly improves state-of-the-art language models, achieving a perplexity of 55.31 and 62.89 on the test set of Penn Treebank and WikiText-2, respectively. In-depth analyses show that the behaviour of the learned temperature schedules varies dramatically by vocabulary, and that the optimal schedules help in controlling the uncertainties. These evidences further justify the need for the proposed method and its advantages over fixed temperature schedules.
研究动机与目标
- 为解决在语言建模过程中固定温度或手工设计温度调度在控制模型不确定性方面的局限性。
- 探究最优温度轨迹是否随词汇标记和上下文而变化。
- 开发一种可自适应于每个标记和上下文的通用温度缩放机制,以提升模型校准性和性能。
- 证明动态温度控制可通过减少序列早期位置的不确定性并抑制后期不确定性,从而提升序列建模效果。
提出的方法
- 该方法为每个标记引入一个可学习的温度向量,其中温度基于Transformer编码器的隐藏状态进行条件化。
- 通过一个小型前馈网络参数化的温度网络,基于上下文嵌入预测每个标记的温度。
- 温度在Softmax函数之前应用于logits,以修改输出分布:$ p_i = \frac{\exp(z_i / \tau_i)}{\sum_j \exp(z_j / \tau_j)} $。
- 温度网络与语言模型端到端联合训练,使用交叉熵损失,使梯度能够反向传播以调整每个标记的温度。
- 通过在可学习温度向量上应用类似Softmax的操作对温度值进行归一化,以确保稳定性和可微性。
- 该方法应用于混合专家(MoS)设置,称为CT-MoS,以进一步提升长上下文序列的性能。
实验结果
研究问题
- RQ1给定标记的最优温度调度是否在不同上下文中存在显著差异?
- RQ2能否通过学习每个标记的上下文相关温度来提升语言模型的困惑度和校准性?
- RQ3动态温度控制如何影响序列中不同位置的不确定性分布?
- RQ4每个标记的温度自适应是否优于固定或全局温度调度在序列建模中的表现?
主要发现
- 所提出的上下文温度方法在Penn Treebank数据集上实现了55.31的测试困惑度,显著优于基线模型。
- 在WikiText-2数据集上,该方法达到62.89的困惑度,表明在多个基准测试中均表现出一致的性能提升。
- 分析显示,句子开头的平均温度较高,随后逐渐降低,表明初始阶段随机性较强,后期不确定性降低。
- 每个标记的温度调度差异显著:部分标记表现出‘升温’行为,而另一些则呈现稳定‘降温’,反映出上下文特定的不确定性控制。
- 消融实验证实,与固定或全局温度缩放相比,动态且上下文感知的温度调度能带来更好的性能。
- 案例研究显示,上下文温度通过学习到的温度调整概率缩放,改善了标记选择——例如,更准确地预测‘results’或‘loss’而非‘treasury’或‘$’。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。