Skip to main content
QUICK REVIEW

[论文解读] Parallelizing Word2Vec in Multi-Core and Many-Core Architectures

Shihao Ji, Nadathur Satish|arXiv (Cornell University)|Nov 18, 2016
Topic Modeling参考文献 7被引用 8
一句话总结

该论文提出 HogBatch,一种高度优化的 word2vec 实现,通过小批量处理和负样本共享,将 Hogwild 中的向量-向量操作替换为矩阵-矩阵乘法(GEMM),从而在多核和众核系统上实现近线性扩展。其在 Intel Broadwell 上达到 580 万词/秒,在 Knights Landing 上达到 890 万词/秒,为迄今报告的最快性能。

ABSTRACT

Word2vec is a widely used algorithm for extracting low-dimensional vector representations of words. State-of-the-art algorithms including those by Mikolov et al. have been parallelized for multi-core CPU architectures, but are based on vector-vector operations with "Hogwild" updates that are memory-bandwidth intensive and do not efficiently use computational resources. In this paper, we propose "HogBatch" by improving reuse of various data structures in the algorithm through the use of minibatching and negative sample sharing, hence allowing us to express the problem using matrix multiply operations. We also explore different techniques to distribute word2vec computation across nodes in a compute cluster, and demonstrate good strong scalability up to 32 nodes. The new algorithm is particularly suitable for modern multi-core/many-core architectures, especially Intel's latest Knights Landing processors, and allows us to scale up the computation near linearly across cores and nodes, and process hundreds of millions of words per second, which is the fastest word2vec implementation to the best of our knowledge.

研究动机与目标

  • 解决 Hogwild-based word2vec 在现代多核和众核系统上因内存带宽瓶颈和计算利用率低而导致的可扩展性差的问题。
  • 通过批量处理多个上下文词和共享负样本,利用 word2vec 更新中的数据局部性,以支持 Level-3 BLAS 操作。
  • 通过数据并行化在集群中实现多节点间的强可扩展性,同时保持最小的精度损失。
  • 在 Intel 最新架构上实现接近线性的性能扩展,特别是在 Knights Landing 上,超越现有的 CPU 和 GPU 实现。

提出的方法

  • 引入输入上下文词的小批量处理,将多个 word2vec 更新合并为单个矩阵操作。
  • 实现负样本共享,即在一批输入词中复用同一组负样本,以支持基于 GEMM 的计算。
  • 将原始的向量-向量点积操作转换为矩阵-矩阵乘法(GEMM)操作,降低内存带宽压力并提高计算利用率。
  • 通过合并对同一模型条目的更新,在 CPU 核心间使用共享内存并行化,减少缓存行乒乓效应。
  • 通过节点间的数据并行化将优化扩展至分布式内存系统,定期同步模型以保持收敛性。
  • 针对 Intel 的 Knights Landing 架构进行优化,充分利用其宽矢量单元和高封装内存带宽。

实验结果

研究问题

  • RQ1基于 GEMM 的小批量处理是否能通过降低内存带宽压力,在现代多核 CPU 上显著提升 word2vec 性能?
  • RQ2负样本共享是否能在不损失模型精度的前提下,实现 word2vec 中高效的矩阵-矩阵乘法?
  • RQ3所提出的 HogBatch 算法是否能在 36 个 CPU 核心和最多 32 个节点的集群中实现近线性扩展?
  • RQ4在吞吐量和精度方面,HogBatch 与当前最先进的 CPU 和 GPU 实现相比表现如何?

主要发现

  • HogBatch 在 36 核 Intel Broadwell CPU 上实现 580 万个词/秒,相比原始 Hogwild 实现提升 3.6 倍。
  • 在 Intel 的 Knights Landing 处理器上,HogBatch 实现 890 万个词/秒,为迄今报告的 CPU 上 word2vec 的最高吞吐量。
  • 该算法在 Broadwell CPU 的全部 36 个线程上实现近乎线性扩展,而原始 Hogwild 实现超过 8 个线程后性能显著下降。
  • 在分布式模式下,HogBatch 在最多 16 个 Broadwell 节点或 8 个 Knights Landing 节点上实现近线性扩展,吞吐量超过 1 亿词/秒,精度仅下降 1%。
  • 在 4 个 Knights Landing 节点上,性能达到 2940 万个词/秒,优于使用 4 块 Titan-X GPU 的最佳 GPU 实现(2000 万个词/秒)。
  • 使用 GEMM 操作减少了缓存行竞争和线程间通信,提升了计算资源利用率,增强了可扩展性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。