arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.16883cs.LGcs.AIcs.MScs.PL
收藏

Scorch:一个面向稀疏深度学习的库

Scorch: A Library for Sparse Deep Learning

Stanford University(斯坦福大学);KTH Royal Institute of Technology(瑞典皇家理工学院)

Bobby Yan, Alexander J. Root, Trevor Gale, David Broman, Fredrik Kjolstad

AI总结:

针对现有深度学习框架稀疏操作支持不足的问题,提出可无缝集成到PyTorch的稀疏计算库Scorch,通过编译器栈自动优化与适配运行时,在CPU推理任务上实现1.05-5.78倍于PyTorch Sparse的速度提升,助力稀疏架构探索。

摘要:

深度学习模型规模的快速增长给传统稠密计算范式的能力带来了压力。利用稀疏计算进行大规模模型的训练与部署已日益流行,但现有深度学习框架对稀疏操作的支持十分有限。为填补这一空白,我们推出Scorch——一个将高效稀疏张量计算无缝集成到PyTorch生态中的库,初期聚焦于CPU上的推理工作负载。Scorch为稀疏张量提供了灵活直观的接口,支持多种稀疏数据结构。它引入了一套编译器栈,可自动实现关键优化,包括自动循环重排、分块与格式推断。结合可适配稠密和稀疏数据的运行时,Scorch在不牺牲易用性的前提下,相比手写的PyTorch Sparse(torch.sparse)操作实现了显著的速度提升。更重要的是,Scorch能够高效计算那些缺乏手工优化PyTorch实现的复杂稀疏操作,这种灵活性对于探索新型稀疏架构至关重要。我们在多个领域的不同深度学习模型上验证了Scorch的易用性与性能增益:仅需极少的代码改动,Scorch在端到端任务上相比PyTorch Sparse可实现1.05-5.78倍的速度提升。Scorch的无缝集成与性能优势使其成为PyTorch生态的宝贵补充,我们相信它将推动稀疏性作为深度学习扩展工具的更广泛探索,并为其他稀疏库的开发提供参考。

英文摘要:

The rapid growth in the size of deep learning models strains the capabilities of traditional dense computation paradigms. Leveraging sparse computation has become increasingly popular for training and deploying large-scale models, but existing deep learning frameworks lack extensive support for sparse operations. To bridge this gap, we introduce Scorch, a library that seamlessly integrates efficient sparse tensor computation into the PyTorch ecosystem, with an initial focus on inference workloads on CPUs. Scorch provides a flexible and intuitive interface for sparse tensors, supporting diverse sparse data structures. Scorch introduces a compiler stack that automates key optimizations, including automatic loop ordering, tiling, and format inference. Combined with a runtime that adapts its execution to both dense and sparse data, Scorch delivers substantial speedups over hand-written PyTorch Sparse (torch.sparse) operations without sacrificing usability. More importantly, Scorch enables efficient computation of complex sparse operations that lack hand-optimized PyTorch implementations. This flexibility is crucial for exploring novel sparse architectures. We demonstrate Scorch's ease of use and performance gains on diverse deep learning models across multiple domains. With only minimal code changes, Scorch achieves 1.05-5.78x speedups over PyTorch Sparse on end-to-end tasks. Scorch's seamless integration and performance gains make it a valuable addition to the PyTorch ecosystem. We believe Scorch will enable wider exploration of sparsity as a tool for scaling deep learning and inform the development of other sparse libraries.

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

↑