English

CuBridge: An LLM-Based Framework for Understanding and Reconstructing High-Performance Attention Kernels

Machine Learning 2026-05-07 v1

Abstract

Efficient CUDA implementations of attention mechanisms are critical to modern deep learning systems, yet supporting diverse and evolving attention variants remains challenging. Existing frameworks and compilers trade performance for flexibility, while expert-written kernels achieve high efficiency but are difficult to adapt. Recent work explores large language models (LLMs) for GPU kernel generation, but prior studies report unstable correctness and significant performance gaps for complex operators such as attention. We present CuBridge, an LLM-based framework that adapts expert-written attention kernels through a structured lift-transfer-lower workflow. CuBridge starts from expert-written CUDA attention kernels and lifts them into an executable intermediate representation that makes execution orchestration explicit while abstracting low-level CUDA syntax. Given a user-provided PyTorch specification, CuBridge generates and verifies a target IR program, then reconstructs optimized CUDA code via reference-guided lowering. Across diverse attention variants and GPU platforms, CuBridge consistently produces correct kernels and substantially outperforms general frameworks, compiler-based approaches, and prior LLM-based methods.

Keywords

Cite

@article{arxiv.2605.05023,
  title  = {CuBridge: An LLM-Based Framework for Understanding and Reconstructing High-Performance Attention Kernels},
  author = {Xing Ma and Yangjie Zhou and Wu Sun and Zihan Liu and Jingwen Leng and Yun Lin and Shixuan Sun and Minyi Guo and Jin Song Dong},
  journal= {arXiv preprint arXiv:2605.05023},
  year   = {2026}
}

Comments

Accepted to ACL 2026

R2 v1 2026-07-01T12:52:58.968Z