元组包装:图神经网络中小图的高效批处理
Tuple Packing: Efficient Batching of Small Graphs in Graph Neural Networks
摘要:
当在机器学习模型(如图神经网络(GNN))中处理一批图时,通常会将几个小图组合成一个整体图,以加速处理并消除或减少填充开销。例如,PyG库中支持这一点。然而,小图的大小可以相对于节点和边的数量而显著变化,因此组合图的大小仍然可以显著变化,特别是对于小批量。因此,在处理静态形状时仍然会产生过多填充和浪费计算的成本,这是最大加速的首选。本文提出了一种新的硬件不可知的方法-元组包装-产生的批处理,导致最小的开销。该算法扩展了最近引入的序列包装方法,工作在二维元组(|nodes|,|edges|)。单调启发式应用于元组值的2D直方图,以定义包装直方图箱的优先级以及达到节点数量和边缘数量限制的目标。在多个数据集上的实验验证了该算法的有效性。
英文摘要:
When processing a batch of graphs in machine learning models such as Graph Neural Networks (GNN), it is common to combine several small graphs into one overall graph to accelerate processing and remove or reduce the overhead of padding. This is for example supported in the PyG library. However, the sizes of small graphs can vary substantially with respect to the number of nodes and edges, and hence the size of the combined graph can still vary considerably, especially for small batch sizes. Therefore, the costs of excessive padding and wasted compute are still incurred when working with static shapes, which are preferred for maximum acceleration. This paper proposes a new hardware agnostic approach -- tuple packing -- for generating batches that cause minimal overhead. The algorithm extends recently introduced sequence packing approaches to work on the 2D tuples of (|nodes|, |edges|). A monotone heuristic is applied to the 2D histogram of tuple values to define a priority for packing histogram bins together with the objective to reach a limit on the number of nodes as well as the number of edges. Experiments verify the effectiveness of the algorithm on multiple datasets.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。