arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.03067cs.SE
收藏

基于DSL源码转换的自动化深度学习优化

Automated Deep Learning Optimization via DSL-Based Source Code Transformation

Ruixin Wang, Minghai Lu, Cody Hao Yu, Yi-Hsiang Lai, Tianyi Zhang

AI总结:

提出Adopter,利用DSL表示模型架构并定义转换规则,通过过程间分析、作用域匹配和综合转换,自动集成DL内核,提升精确率3%、召回率56%,训练提速22.7%,内存减少10.5%。

摘要:

随着深度学习模型变得越来越大和复杂,提高模型训练和推理效率变得至关重要。尽管已经开发了各种高度优化的库和包(称为DL内核),但确定使用哪个内核、在何处使用以及如何正确使用它们既繁琐又耗时。为了解决这一挑战,我们提出了一种名为Adopter的自动化深度学习优化方法。我们设计了一种领域特定语言(DSL)来表示深度学习模型架构,并利用该DSL来指定将DL内核集成到模型所需的模型转换规则。给定深度学习模型的源代码和一组内核的转换规则,Adopter首先执行过程间分析以识别并用我们的DSL表达模型架构。然后,Adopter执行作用域分析和子序列匹配,以识别模型架构中可应用转换规则的位置。最后,Adopter提出了一种基于综合的代码转换方法来应用转换规则。我们从Hugging Face中整理了一个包含199个模型和多种DL内核的基准。我们发现,与最先进的自动化代码转换技术相比,Adopter在精确率和召回率上分别提高了3%和56%。对9个模型的深入分析显示,平均而言,Adopter将训练速度提高了22.7%,同时将GPU内存使用量减少了10.5%。

英文摘要:

As deep learning models become increasingly bigger and more complex, it is critical to improve model training and inference efficiency. Though a variety of highly optimized libraries and packages (known as DL kernels) have been developed, it is tedious and time-consuming to figure out which kernel to use, where to use, and how to use them correctly. To address this challenge, we propose an Automated Deep learning OPTimization approach called Adopter. We design a Domain-Specific Language (DSL) to represent DL model architectures and leverage this DSL to specify model transformation rules required to integrate a DL kernel into a model. Given the source code of a DL model and the transformation rules for a set of kernels, Adopter first performs inter-procedural analysis to identify and express the model architecture in our DSL. Then, Adopter performs scope analysis and sub-sequence matching to identify locations in the model architecture where the transformation rules can be applied. Finally, Adopter proposes a synthesis-based code transformation method to apply the transformation rule. We curated a benchmark with 199 models from Hugging Face and a diverse set of DL kernels. We found that, compared to a state-of-the-art automated code transformation technique, Adopter helps improve the precision and recall by 3% and 56%, respectively. An in-depth analysis of 9 models revealed that on average, Adopter improved the training speed by 22.7% while decreasing the GPU memory usage by 10.5%.

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

↑