- Rating
- 4
- Clarity
- 3
- Confidence
- 4
- Originality
- 3
- Quality
- 3
- Significance
- 3
Read review
Summary
The paper introduces an automated, LLM-based approach for source-to-source translation of Python implementations of LLMs/VLMs from Hugging Face into MegaKernel implementations. Compared to its most direct competitor, the MPK compiler, the authors' approach achieves a significant speedup of around 1.92x.
To make such a complex code optimization task achievable, the authors' approach allows the LLM to reason about kernel fusion using abstract operations and optimized implementation skeletons. By hiding fine-grained model semantics and hardware constraints, this abstraction helps bypass low-level complexities, thereby improving the LLM's ability to generate correct and efficient MegaKernel code.
Strengths and weaknesses
Strengths:
- The paper uniquely presents an end-to-end, purely LLM-driven approach to optimize LLM inference, a task that is traditionally handled by specialized AI compilers like TorchInductor and TVM.
- The authors provide an extensive performance evaluation, benchmarking their method against established AI compilers, specialized LLM inference engines, and even manual implementations where available.
Weaknesses:
- Compiling a MegaKernel using this approach is expensive (around $100 USD) and time-consuming (taking 5–7 hours). While one could argue that this one-time offline compilation cost is eventually offset by online inference savings, it is still significantly slower compared to specialized AI compilers that take seconds or minutes to complete their work.
Questions
-
Lack of Formal Correctness Guarantees: A primary concern is whether the proposed approach can strictly guarantee correctness. For example, in the very first step, the method relies on an LLM to analyze the forward pass and decompose the model operations into the three fusion types via text-based pattern matching. The LLM later checks correctness by generating executable Python scripts to verify that all dependencies are preserved. However, relying on empirical test cases is not equivalent to a formal guarantee of safe code generation. By comparison, traditional compilers utilize dependence graph representations and sophisticated symbolic analysis to mathematically prove which operations can be safely merged. Because compilers must ensure absolute correctness, they are inherently conservative, which can sometimes cause them to miss optimization opportunities. Correctness verification by empirical testing is not a common practice in the compilers field. I ask the authors to address my concern about absolute safe code generation.
-
Overstated First Contribution: The first contribution feels somewhat overstated. The core novelty of the paper stems from the automated framework that uses an LLM for automatic MegaKernel generation. While the abstract fusion primitives presented in Section 2.1 are important building blocks for this framework, the fusion operations themselves are already known in the literature.
-
Limited Cost Analysis: I suggest extending the cost analysis presented in Appendix G to include other base models beyond just GPT-5.2-Codex, as this cost analysis is in my opinion important for showing the method's real-world viability.
Limitations
Same concern as before: the lack of formal correctness guarantees, which I suggest the authors discuss in the Limitations section in the paper.
Paper formatting concerns
None
Thank you for your careful review and thoughtful feedback. We especially appreciate your detailed comments on the generation cost, correctness guarantees, scope of the first contribution, and the need for broader cost analysis across base LLMs. These points have helped us better clarify the practical limitations, refine our claims, and strengthen the empirical discussion of AUTOMEGAKERNEL.
Response:
We agree that the current 5–7-hour generation cycle is expensive and is a practical limitation of AUTOMEGAKERNEL. However, this cost covers the complete process of MegaKernel generation, verification, and tuning for a target model and GPU, rather than a conventional compilation run.
(1) The 5–7 hours and ~USD 105 reported correspond to the full automated workflow: The high-level stage including fusion instantiation, scheduling, mapping, and Python-based verification (∼1–2 hours, ∼USD 15) plus low-level CUDA generation and tuning (∼4–5 hours, ∼USD 90). This is a different scope from the seconds-to-minutes compilation of specialized AI compilers such as TVM, Ansor, and TorchInductor, which optimize individual operators or small subgraphs. As for MPK, it can generate MegaKernels but is constrained by predefined rules and ~100K lines of implementation code. Our broader synthesis and optimization scope is reflected in the resulting performance: up to 1.92× over MPK in our evaluated settings. It also helps explain why the current generation process is substantially more expensive than the seconds-to-minutes compilation process of specialized AI compilers.
(2) This offline cost automates target-specific MegaKernel adaptation. For supported abstractions and GPUs, AUTOMEGAKERNEL eliminates the need for experts to handcraft a complete MegaKernel per target, automating strategy generation, CUDA implementation, verification, and tuning. The cost is incurred once offline; the resulting kernel can be reused for online inference, substantially reducing the manual engineering required for per-model and per-hardware adaptation, which is most appropriate for stable, high-volume deployments.
(3) The reported 5–7 hours is the measured end-to-end generation cost of our current prototype, rather than an inherent lower bound of the approach. A substantial portion of the current cost comes from repeated sequential rounds of LLM API calls and generation, compilation, hierarchical verification, and performance tuning. Since AUTOMEGAKERNEL performs generation and verification at the instruction level, this cost could be reduced by reusing previously generated and verified implementations for compatible instruction instances and by parallelizing the generation and verification of independent instructions.
Response:
We agree that AUTOMEGAKERNEL does not provide formal correctness guarantees. Instead, it follows the standard empirical validation methodology used in AI compilers / AI kernel genaration works, and strengthens it through hierarchical verification compared with end-to-end validation.
(1) AUTOMEGAKERNEL validates correctness through three hierarchical stages rather than LLM self-assessment. First, it compares the generated Python references against the Hugging Face implementation layer by layer to catch decomposition or scheduling errors. Second, it numerically verifies each CUDA function against its Python reference. Finally, it assembles the verified CUDA instructions into the full MegaKernel and performs end-to-end verification against the original model. Each stage's output serves as the reference for the next, forming a validation chain from model semantics to the final kernel. Correctness therefore does not rely on a single empirical test or LLM self-checking.
(2) We agree that dependence analysis and symbolic reasoning provide stronger guarantees for transformation legality than our current empirical validation. However, in practical AI compiler systems, differential testing comparing against a trusted referenceis nevertheless widely used for detecting miscompilations For example, PyTorch provides an accuracy minifier to localize accuracy mismatches between eager and optimized execution. AUTOMEGAKERNEL follows this practical methodology and further strengthens correctness assurance through hierarchical verification.
(3) Our current compilation- and execution-based verification can detect many runtime failures, but it does not formally rule out out-of-bounds accesses, data races, deadlocks, or invalid synchronization under all possible executions. In future work, we plan to incorporate your suggestions to further strengthen numerical correctness guarantee, memory and synchronization safety.
Response:
We agree that the fusion operations themselves are established. Our intended claim is not that these fusion operations are new, but that their organization into an instruction-centric abstraction enables automated MegaKernel synthesis. We will revise the first contribution to provide a more precise description.
(1) Our novelty lies in abstracting existing computation and fusion patterns into instructions for automated MegaKernel generation. We do not propose new fusion operations. Our contribution is the Instruction-Centric Fusion Abstraction, which captures key computational patterns, decomposes a complex MegaKernel into manageable fused segments, and instantiates them as instructions for scheduling, optimization, and implementation. The Instruction-Centric Fusion Abstraction is therefore one of the key foundations for the reliability, performance, and extensibility of AUTOMEGAKERNEL, and is not provided by existing approaches.
(2) Our abstraction mechanism is extensible to future fusion operations. New fusion methods can be incorporated by classifying them into one of the three existing instruction abstractions or introducing a new abstraction under the same principle.
Response:
Thank you for the suggestion. We agree that evaluating additional base models is important for demonstrating the practical viability of AUTOMEGAKERNEL. We therefore further evaluate DeepSeek-V4-Flash and DeepSeek-V4-Pro, each with medium and xhigh reasoning effort, and they achieve comparably high performance, confirming the framework’s generalizability.
Table 1: Performance of the generated MegaKernels at different sequence lengths on Llama-3.2-1B and A100 (tokens/s)
We report the Iterations, Total Tokens, Time Cost, and API Cost for the complete high-level and low-level stages.
Table 2: Cost under different LLM configurations
AUTOMEGAKERNEL can operate with different base models. All four DeepSeek-V4 configurations complete both the high-level stage and the low-level stage. The high-level stage includes fusion instantiation, scheduling, mapping, and Python-based verification, while the low-level stage includes CUDA code generation and tuning. These results show that the generation workflow is not restricted to a single base model.