arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2107.06433cs.DCcs.ARcs.LGcs.PF
收藏

一种新的Sinkhorn词移动距离并行算法及其在PIUMA和Xeon CPU上的性能

A New Parallel Algorithm for Sinkhorn Word-Movers Distance and Its Performance on PIUMA and Xeon CPU

Intel(英特尔)

Jesmin Jahan Tithi, Fabrizio Petrini

摘要:

词移动器距离(WMD)通过计算将源/查询文档的所有词最佳地移动到目标文档的最相似词的成本来测量两个文本文档之间的语义差异。计算两个文档之间的WMD是昂贵的,因为它需要解决$O(V^3log(V))$优化问题,其中$V$是文档中唯一单词的数量。幸运的是,大规模杀伤性武器可以被定义为地球移动者的距离(EMD),通过向优化问题添加熵惩罚并使用Sinkhorn-Knopp算法求解,可以将算法复杂度降低到$O(V^2)$。另外,通过采用并行方法,即,一次针对多个目标文档计算单个查询文档的WMD。Sinkhorn WMD是许多ML/NLP应用程序中使用的关键内核。通常用Python实现。然而,一个简单的Python实现可能会留下显著的性能,即使它可能在内部调用优化的C++ BLAS例程。本文提出了一种新的稀疏{P}算法{A},该算法采用$O(V^2)$ EMD算法计算{S}inkhorn-Knopp {W}ord-movers {D}距离,计算一个文档到多个文档的语义距离。我们算法转换$O(V^2)$密集计算繁重的EMD版本到一个等效的稀疏一个使用新的融合SDDMM-SpMM(稀疏选择稠密矩阵,稀疏稠密矩阵乘法)内核。我们针对两种截然不同的架构实现并优化了该算法--全新的英特尔可编程集成统一内存架构(PIUMA)和英特尔至强CPU。我们表明,我们能够在两个平台上达到接近峰值的性能。

英文摘要:

The Word Movers Distance (WMD) measures the semantic dissimilarity between two text documents by computing the cost of optimally moving all words of a source/query document to the most similar words of a target document. Computing WMD between two documents is costly because it requires solving an $O(V^3log(V))$ optimization problem where $V$ is the number of unique words in the document. Fortunately, WMD can be framed as an Earth Mover's Distance (EMD) for which the algorithmic complexity can be reduced to $O(V^2)$ by adding an entropy penalty to the optimization problem and solving it using the Sinkhorn-Knopp algorithm. Additionally, the computation can be made highly parallel by adopting a batching approach, i.e., computing the WMD of a single query document against multiple target documents at once. Sinkhorn WMD is a key kernel used in many ML/NLP applications. and usually gets implemented in Python. However, a straightforward Python implementation may leave significant performance on the table even though it may internally call optimized C++ BLAS routines. We present a new sparse {P}arallel {A}lgorithm for {S}inkhorn-Knopp {W}ord-movers {D}istance to compute the semantic distance of one document to many other documents by adopting the $O(V^2)$ EMD algorithm. We algorithmically transform $O(V^2)$ dense compute-heavy EMD version into an equivalent sparse one using new fused SDDMM-SpMM (sparse selection of dense-dense matrix-, sparse-dense matrix-multiplication) kernels. We implemented and optimized this algorithm for two very different architectures -- the new Intel Programmable Integrated Unified Memory Architecture (PIUMA) and Intel Xeon CPUs. We show that we were able to reach close to peak performance on both platforms.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑