CUDA-L2: Surpassing cuBLAS Performance for Matrix Multiplication via RL

CUDA-L2 uses LLMs and RL to auto-optimize HGEMM kernels, achieving up to 28% speedup over cuBLAS on GPUs.

martes, 28 de julio de 2026 • 3 min read • Q2BSTUDIO Team

Optimización automática de kernels HGEMM con aprendizaje por refuerzo

In the world of high-performance computing, optimizing CUDA kernels for fundamental operations like half-precision matrix multiplication (HGEMM) has traditionally been an art reserved for hardware-savvy engineers. However, a new approach is changing the game: CUDA-L2, a system that combines large language models (LLMs) with reinforcement learning (RL) to automate the search for optimal CUDA kernel configurations. The results are striking: it systematically outperforms closed-source libraries like Nvidia's cuBLAS and cuBLASLt, as well as torch.matmul, in both offline and server modes. This breakthrough not only demonstrates that artificial intelligence can improve already highly optimized code, but also opens the door to a new era of automatic optimization in critical infrastructures.

CUDA-L2 uses execution speed as the reward for the RL agent, exploring over 1,000 kernel configurations. In offline tests, it achieves an average speedup of 22% over torch.matmul, 19.2% over cuBLAS with optimal layout, 16.8% over cuBLASLt-heuristic, and 11.4% over cuBLASLt-AutoTuning. In server mode, simulating real-time inference, the gains widen to 28.7%, 26%, 22.4%, and 15.9% respectively. These numbers show that even the most critical and already highly optimized operations can benefit from an AI-driven approach.

The key lies in the ability of LLMs to guide the exploration of configuration spaces in a way that would be infeasible for a human. By integrating knowledge of code patterns and performance, the model learns to propose promising combinations that the RL agent evaluates and refines iteratively. This paradigm is transferable to other domains where software optimization is complex and multidimensional.

For companies like Q2BSTUDIO, specialized in custom software development, such advances represent a direct opportunity. Automatic optimization via RL and LLMs can be applied to enterprise applications, cloud systems, data analytics platforms, and cybersecurity solutions. For instance, in cloud environments like AWS or Azure, where every millisecond of latency matters, an automatically optimized kernel can reduce costs and improve user experience. Similarly, in Business Intelligence (BI) systems such as Power BI, faster matrix multiplication algorithms can accelerate queries and data transformations.

Cybersecurity can also leverage these techniques. Encryption and authentication algorithms often rely on matrix operations. Automatic optimization could speed up verification processes without compromising security. Moreover, AI agents, increasingly present in enterprise environments, require fast inferences that depend on efficient kernels. CUDA-L2 demonstrates that AI can optimize itself, closing the virtuous circle.

Q2BSTUDIO, as a software and technology development company, integrates these capabilities into its artificial intelligence and automation services. The company offers solutions ranging from cross-platform application development to scalable cloud infrastructure deployment, always focusing on efficiency and innovation. The combination of LLMs and RL for kernel optimization is an example of how cutting-edge research translates into practical value for clients.

The impact of CUDA-L2 goes beyond matrix multiplication. It opens the door to autonomous optimization systems for any CUDA kernel, and even for code in other languages and architectures. In a context where computing demand grows exponentially, tools like this will be essential to maintain performance without linearly increasing hardware costs. Companies that adopt these techniques will gain a significant competitive advantage.

In conclusion, CUDA-L2 not only outperforms cuBLAS but redefines how we understand software optimization. For Q2BSTUDIO, it represents an inspiration and another tool in its arsenal to deliver high-performance custom software, integrating AI, cloud, cybersecurity, and BI. The era of automatic optimization has arrived, and those who embrace it will lead the next technological leap.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.