arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.16949cs.LGcs.CL
收藏

SparseTransX:使用稀疏矩阵运算高效训练基于翻译的知识图谱嵌入

SparseTransX: Efficient Training of Translation-Based Knowledge Graph Embeddings Using Sparse Matrix Operations

Md Saidul Hoque Anik, Ariful Azad

AI总结:

本文提出SparseTransX框架,通过用SpMM稀疏矩阵乘法内核替换核心嵌入计算,统一scatter和gather操作,显著减少基于翻译的知识图谱嵌入模型的训练时间和内存使用,并在CPU和GPU上实现大幅加速。

摘要:

知识图谱(KG)学习为生成新知识和进行推理提供了一个强大的框架。训练KG嵌入可能需要非常长的时间,特别是对于较大的数据集。我们的分析表明,嵌入的梯度计算是基于翻译的KG嵌入训练循环中的主要函数之一。我们通过用SpMM(稀疏-稠密矩阵乘法)内核替换核心嵌入计算来解决这个问题。这使我们能够将多个scatter(和gather)操作统一为单个操作,从而减少训练时间和内存使用。我们创建了一个使用稀疏内核训练KG模型的通用框架,并实现了四个模型,即TransE、TransR、TransH和TorusE。我们的稀疏实现在CPU上表现出高达5.3倍的加速,在GPU上表现出高达4.2倍的加速,且GPU内存占用显著降低。对于给定的模型,这种加速在大型和小型数据集上都是一致的。我们提出的稀疏方法也可以扩展到加速其他基于翻译的(如TransC、TransM等)和非翻译的(如DistMult、ComplEx、RotatE等)模型。SpTransX框架的实现已作为Python包在https://github.com/HipGraph/SpTransX上公开提供。

英文摘要:

Knowledge graph (KG) learning offers a powerful framework for generating new knowledge and making inferences. Training KG embedding can take a significantly long time, especially for larger datasets. Our analysis shows that the gradient computation of embedding is one of the dominant functions in the translation-based KG embedding training loop. We address this issue by replacing the core embedding computation with SpMM (Sparse-Dense Matrix Multiplication) kernels. This allows us to unify multiple scatter (and gather) operations as a single operation, reducing training time and memory usage. We create a general framework for training KG models using sparse kernels and implement four models, namely TransE, TransR, TransH, and TorusE. Our sparse implementations exhibit up to 5.3x speedup on the CPU and up to 4.2x speedup on the GPU with a significantly low GPU memory footprint. The speedups are consistent across large and small datasets for a given model. Our proposed sparse approach can be extended to accelerate other translation-based (such as TransC, TransM, etc.) and non-translational (such as DistMult, ComplEx, RotatE, etc.) models as well. An implementation of the SpTransX framework is publicly available as a Python package in https://github.com/HipGraph/SpTransX.

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

↑