[论文解读] Adaptive Sampled Softmax with Kernel Based Sampling
本文提出基于核函数的采样方法用于自适应采样softmax,利用二次核函数高效近似softmax分布。通过在O(D log n)时间内采用分治算法自适应模型输出,实现低偏差训练,采样数量显著减少——相比均匀采样减少1至2个数量级,其中D为核空间维度。
Softmax is the most commonly used output function for multiclass problems and is widely used in areas such as vision, natural language processing, and recommendation. A softmax model has linear costs in the number of classes which makes it too expensive for many real-world problems. A common approach to speed up training involves sampling only some of the classes at each training step. It is known that this method is biased and that the bias increases the more the sampling distribution deviates from the output distribution. Nevertheless, almost any recent work uses simple sampling distributions that require a large sample size to mitigate the bias. In this work, we propose a new class of kernel based sampling methods and develop an efficient sampling algorithm. Kernel based sampling adapts to the model as it is trained, thus resulting in low bias. Kernel based sampling can be easily applied to many models because it relies only on the model's last hidden layer. We empirically study the trade-off of bias, sampling distribution and sample size and show that kernel based sampling results in low bias with few samples.
研究动机与目标
- 解决在类别数量庞大时,使用非softmax采样分布导致采样softmax偏差过高的问题,特别是当类别数较大时。
- 克服均匀采样或基于流行度的采样效率低下问题,这些方法需要大量采样才能降低偏差。
- 开发一种能根据模型输出、模型结构和参数自适应调整的采样方法。
- 通过利用核方法与对数时间算法,实现大规模多分类问题的高效采样。
- 证明基于核函数的采样方法可在远少于标准方法的采样量下,达到全softmax的性能。
提出的方法
- 提出一种依赖于模型最后一层隐藏层输出的基于核函数的采样分布,实现基于样本、模型和参数的自适应采样。
- 使用二次核函数近似指数形式的softmax函数,从而在核空间中高效计算归一化常数。
- 设计一种分治采样算法,时间复杂度为O(D log n),其中D为核空间维度,n为类别数。
- 仅在训练过程中应用基于核函数的采样,而损失计算仍使用完整的指数softmax,以保持模型质量。
- 确保该方法具有通用性,适用于任何在隐藏表示与类别嵌入之间使用点积的模型。
- 利用核函数的性质,实现在训练步骤中无需完整计算softmax即可实现快速采样。
实验结果
研究问题
- RQ1与均匀采样或基于流行度的采样相比,基于核函数的采样是否能显著降低采样softmax训练中的偏差?
- RQ2在收敛质量与速度方面,基于核函数的采样相比均匀采样在采样效率上表现如何?
- RQ3对于类别数n >> 10^4的大规模多分类问题,基于核函数的采样方法是否能够高效计算?
- RQ4基于模型输出的自适应采样是否相比非自适应采样能实现更快收敛或更好泛化性能?
- RQ5在保持计算效率的前提下,基于核函数的采样在多大程度上可近似全softmax分布?
主要发现
- 基于核函数的采样,特别是采用二次核函数时,相比均匀采样显著降低了偏差,仅需1至2个数量级更少的采样量即可达到全softmax的性能。
- 所提出的分治采样算法时间复杂度为O(D log n),使其在类别数量庞大时仍具可扩展性。
- 与均匀或全局流行度等静态分布相比,基于模型输出自适应的采样分布(如基于核函数的分布)在采样效率上实现显著提升。
- 即使采样量极小(例如m ≈ 10–50),基于核函数的采样也能实现与全softmax相当的收敛质量,而均匀采样需大幅增加m才能达到类似性能。
- 一旦偏差足够降低,继续增加采样量超过某一临界点后,收敛速度不再提升,表明大样本量下收益递减。
- 该方法通过仅在采样时使用核函数,而损失计算仍采用全softmax,从而在保持模型精度的同时,保留了指数softmax的高质量输出。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。