TL;DR
HLS-Seek is a novel 7B-parameter large language model (LLM) framework that automatically generates high-performance hardware code (HLS C/C++) from natural language descriptions. By replacing slow, full-synthesis hardware compilers in the reinforcement learning loop with a fast, comparative proxy reward model, HLS-Seek speeds up training by 8.5× while outperforming frontier models like GPT-5.1 in functional correctness and hardware efficiency.
What Problem Does This Paper Address?
High-Level Synthesis (HLS) allows engineers to compile algorithmic C/C++ code into digital hardware architectures (RTL) for FPGAs and ASICs. However, writing good HLS code requires carefully placing optimization directives (pragmas) and structuring code to maximize hardware efficiency—measured as Quality of Results (QoR), which includes execution latency and hardware resource utilization.
While LLMs have gotten quite good at generating functionally correct software code, they struggle with HLS because they are typically trained using Supervised Fine-Tuning (SFT), which treats all compilable code equally, making them "QoR-agnostic."
To make an LLM hardware-aware, researchers usually turn to Reinforcement Learning (RL). But there's a massive bottleneck: evaluating a single piece of code's true QoR requires running commercial HLS synthesis tools, which takes anywhere from minutes to hours per candidate. Doing this tens of thousands of times during RL training is computationally intractable.
Methods
The authors introduce HLS-Seek, a framework built on a crucial insight: RL training doesn't need absolute QoR values from a slow compiler; it only needs to know which code candidate is better than the others.
HLS-Seek implements a three-stage training pipeline:
- Diversity-Oriented SFT: The base model (Qwen2.5-Coder-7B) is trained on a broad corpus of HLS code to learn basic syntax and pragma mappings.
- Cold-Start SFT with Reasoning Traces: The model is fine-tuned on high-quality Pareto-optimal designs paired with step-by-step optimization rationales (generated by commercial reasoning models like GPT-o1).
- Proxy Reward GRPO: The model undergoes Group Relative Policy Optimization (GRPO) using a lightweight, four-component proxy reward system (Format, Compilation, Functional Correctness, and QoR).
The Siamese Comparative Reward Model
Instead of regressing absolute hardware metrics, HLS-Seek uses a Siamese neural network architecture (based on UniXcoder) to perform pairwise comparisons between candidates. It features Pragma-Aware Tokenization, which explicitly flags #pragma HLS directives so the model's attention mechanism can focus on the most hardware-critical parts of the code.
Uncertainty-Aware Switching
To prevent "reward hacking"—where the RL policy exploits flaws or blind spots in the proxy reward model—the framework uses Monte Carlo (MC) dropout. If the proxy model is highly uncertain about a candidate's quality, the system selectively triggers a real commercial compiler (Vitis HLS) to get an exact ground-truth reward. This real data is then fed back into the proxy model via online training, creating a self-improving loop.
Datasets
The authors aggregated data from three open-source HLS datasets:
- ForgeHLS
- SAGE-HLS
- HLStrans
In total, this comprised 12,661 applications and over 450,000 samples. For evaluation, they used the independent HLS-Eval benchmark (43 kernels) and a randomly selected subset of the ForgeHLS test set (108 applications).
Key Insights and Ideas
- Relative > Absolute: Shifting the reward modeling problem from absolute regression to relative pairwise ranking makes the machine learning task significantly easier and perfectly aligns with the advantage estimation used in modern RL algorithms like GRPO.
- Self-Correcting Guardrails: The MC dropout trigger rate starts high (over 55% of candidates trigger real synthesis early in training) but drops below 5% as the proxy model learns from its mistakes. This keeps the training loop incredibly fast while maintaining high reward fidelity.
- Algorithmic Restructuring: Remarkably, the RL training pushes the LLM beyond simple pragma insertion. The model actually learns complex hardware design patterns like loop fission and scalar expansion to break data dependencies and unlock parallel execution paths that general-purpose LLMs miss entirely.
Key Results
- Training Speedup: HLS-Seek achieves an 8.5× faster training time compared to traditional synthesis-in-the-loop RL, making hardware-aware RL training practical on standard academic infrastructure.
- Functional Superiority: On the HLS-Eval benchmark, HLS-Seek (7B) achieved an 81.4% functional correctness pass@5, outperforming the much larger GPT-5.1 (79.1%) and blowing past HLS-specific baselines like SAGE-HLS (41.9%).
- Hardware Efficiency (QoR): In post-synthesis evaluations across 30 diverse compute kernels, HLS-Seek achieved the lowest execution latency on 19 of them. It successfully Pareto-dominated existing HLS-specific code generation baselines on up to 9 kernels, demonstrating a superior balance between speed and resource usage.
Limitations and Future Work
While HLS-Seek marks a major step forward, a few limitations remain:
- Dependency on Initial DSE: The comparative reward model relies on an initial dataset generated via Bayesian Design Space Exploration (DSE). If the initial exploration misses key regions of the design space, the proxy model's starting accuracy could suffer.
- Platform Specificity: The evaluations were tied specifically to an AMD Alveo U280 FPGA platform. Hardware characteristics vary wildly between different FPGA architectures and ASIC technologies, meaning the reward model might need retraining or adaptation for different target hardware targets.
Summary updated