AutoVecCoder: Teaching LLMs to Generate Explicitly Vectorized Code

Shangzhan Li, Xinyu Yin, Xuanyu Jin, Ye He, Yuxin Zhou, Yuxuan Li, Xu Han, Wanxiang Che, Qi Shi, Ting Liu, Maosong SunarXiv 2026

TL;DR

AutoVecCoder is a specialized training framework that empowers Large Language Models (LLMs) to generate high-performance, explicitly vectorized code using SIMD intrinsics. By combining a knowledge-augmented data synthesis pipeline (VecPrompt) with execution-driven reinforcement learning (VecRL), the authors produced an 8B-parameter model that outperforms frontier models like GPT-5 and DeepSeek-R1, even surpassing standard -O3 compiler optimizations in several complex scenarios.

What Problem Does This Paper Address?

In high-performance computing, vectorization—using Single Instruction, Multiple Data (SIMD) architectures—is essential for speed. However, developers face a frustrating dichotomy. They can rely on implicit vectorization (letting the compiler do the work), which is often suboptimal because compilers are "conservative" and give up if they can't prove a loop is safe to vectorize. Alternatively, they can use explicit vectorization (writing low-level "intrinsics" manually), which offers maximum performance but is incredibly difficult, error-prone, and hard to port across hardware.

While LLMs are great at general coding, they struggle with SIMD intrinsics. There is very little high-quality vectorized code in their training data, and the strict semantic requirements of hardware instructions make "hallucinations" particularly catastrophic. AutoVecCoder aims to bridge this gap, teaching models to think like performance engineers.

Methods

The authors propose a two-stage framework to instill hardware-level expertise into an LLM:

  1. VecPrompt (Data Synthesis): To solve the data scarcity problem, the authors built a pipeline that generates a high-fidelity training corpus. They used "seed programs" (both real-world snippets and synthetic templates) and applied Retrieval-Augmented Generation (RAG). By pulling in official Intel SIMD documentation during the distillation process, they ensured the teacher model (DeepSeek-R1) had the "ground truth" for hardware constraints. The resulting code was then strictly filtered for compilability and functional equivalence.
  2. VecRL (Reinforcement Learning): Since SFT (Supervised Fine-Tuning) only teaches a model to imitate code, the authors used Group Relative Policy Optimization (GRPO) to teach the model to optimize for speed. They created a hierarchical reward function:
  3. Strict Filtering: Zero reward for code that doesn't work.
  4. Baseline Incentive: A reward for functional correctness.
  5. Performance Bonus: A reward based on the actual execution speedup measured in a dedicated hardware sandbox.
Overview of the AUTOVECCODER framework, integrating VECPROMPT and VECRL

Datasets

  • Training Data: A high-fidelity dataset of 7,685 samples for SFT and 3,988 samples for RL, covering arithmetic, logic, reduction, and type conversion across various data types (float, int8-64, etc.).
  • Evaluation: The model was tested on SimdBench, a multi-architecture benchmark for SIMD code generation. The authors specifically focused on the SSE and AVX subsets for x86 architectures.

Key Insights and Ideas

  • Specialization Beats Scale: The 8B-parameter AutoVecCoder outperformed models 50x its size (like GPT-5). This suggests that for low-level systems tasks, domain-specific knowledge and execution feedback are more important than raw parameter count.
  • Surpassing the Compiler: The model successfully vectorized loops that traditional compilers (even at -O3) refused to touch. It achieved this by discovering patterns like mask-based control flow and memory access restructuring, effectively bypassing the conservative static analysis bottlenecks that plague tools like GCC or Clang.
  • The "Cold-Start" Problem in RL: The authors found that training on raw execution speed alone (Naive SpeedUp Reward) leads to "speculative optimization"—the model finds high-risk patterns that are fast but fragile, eventually causing performance to crash. Their hierarchical reward design was crucial for stable convergence.

Key Results

AutoVecCoder-8B achieved state-of-the-art results across the board:

  • Correctness: On the AVX instruction set, it reached 76.76% correctness, significantly higher than DeepSeek-R1 (73.53%) and GPT-5 (62.50%).
  • Efficiency (Fast1): This metric tracks code that is strictly faster than its scalar counterpart. AutoVecCoder-8B achieved 47.35% on AVX and 53.53% on SSE, nearly doubling the performance of many baseline models.
  • Compiler Comparison: In specific case studies involving non-deterministic iterations and complex dependencies, the model generated code that outperformed standard compiler auto-vectorization.
Main results on SimdBench comparing AUTOVECCODER-8B with SOTA LLMs

Limitations and Future Work

While impressive, the current work is limited to x86 architectures (SSE/AVX). The authors acknowledge that generalizability to ARM NEON or RISC-V Vector remains to be extensively tested. Additionally, the framework currently focuses on C/C++ loops; extending this to more complex, unstructured code or specialized domain-specific languages (like Triton for GPUs) is the next frontier. Finally, the reward function does not yet distinguish between "partial" and "full" vectorization, which could be a path toward even more efficient code generation.

Summary updated

BibTeX
@misc{li2026autoveccoder,
  author = {Shangzhan Li and Xinyu Yin and Xuanyu Jin and Ye He and Yuxin Zhou and Yuxuan Li and Xu Han and Wanxiang Che and Qi Shi and Ting Liu and Maosong Sun},
  title = {{AutoVecCoder: Teaching LLMs to Generate Explicitly Vectorized Code}},
  year = {2026},
  eprint = {2605.17978},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.17978},
}
Figure