QiMeng-MegaKernel: LLMs Optimizing LLM Inference via Automated MegaKernel Generation
Weiqiang Xiong, Shaohui Peng, Wenyi Li, Hao Lu, Qirui Zhou, Congying Ma, Ziming Ye, Zhenyu Yi, Yunji Chen, Qi Guo, Ling Li
NeurIPS 2026
Abstract. High-performance inference for large models is critical in latency-sensitive applications. Existing inference engines suffer from sequential execution of hundreds of fine-grained kernels, causing kernel launch overheads and redundant memory accesses. A promising solution is fusing multiple kernels into a single large kernel, namely MegaKernel. However, existing MegaKernel implementations are tightly coupled to specific models and GPU architectures and require extensive manual engineering. We propose an LLM-driven framework QiMeng-MegaKernel, which leverages an Instruction-Centric Fusion Abstraction to decompose MegaKernels into tractable fusion instructions, thereby enabling automated generation. Our framework jointly performs fusion strategy reasoning and CUDA code generation while hierarchically verifying correctness. Extensive experiments demonstrate that QiMeng-MegaKernel consistently outperforms state-of-the-art inference engines (up to 5.04$\times$ vLLM and 2.42$\times$ SGLang) and compilers (up to 1.92$\times$ MPK), while supporting a broader range of models (dense, MoE, and VLA) and NVIDIA GPU platforms (Hopper, Ampere, and Ada).
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:45 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
This paper tackles an important problem, and the proposed method is interesting and makes a strong contribution. However, the reviewers raised several questions that should be addressed in the rebuttal. In particular, they would like clarification on the amount of manual effort required to extend the framework to new operators, architectures, or model families; the size of the search space for a given model and GPU; the lack of a per-model breakdown of the generated MegaKernel structure; the limited performance and cost analysis; and the absence of formal correctness guarantees.
Final justification
Thanks for the rebuttal. Most concerns are well addressed.
- Final justification
- Thanks for the rebuttal. Most concerns are well addressed.
Read meta-review
Meta-review
This paper tackles an important problem, and the proposed method is interesting and makes a strong contribution. However, the reviewers raised several questions that should be addressed in the rebuttal. In particular, they would like clarification on the amount of manual effort required to extend the framework to new operators, architectures, or model families; the size of the search space for a given model and GPU; the lack of a per-model breakdown of the generated MegaKernel structure; the limited performance and cost analysis; and the absence of formal correctness guarantees.
1 comment
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
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.
Formatting concerns
None
2 comments
Rebuttal
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.
W1: Offline MegaKernel Generation Cost and Comparison with AI Compilers
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 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.
Q1: Lack of Formal Correctness Guarantees
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.
Q2: Overstated First Contribution
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.
Q3: Limited Cost Analysis
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)
| Model / Reasoning Effort | 128 | 256 | 512 | 1024 |
|---|---|---|---|---|
| DeepSeek-V4-Flash-medium | 455.3 | 454.9 | 452.5 | 452.1 |
| DeepSeek-V4-Flash-xhigh | 455.2 | 455.3 | 453.3 | 452.7 |
| DeepSeek-V4-Pro-medium | 458.3 | 458.6 | 455.6 | 454.9 |
| DeepSeek-V4-Pro-xhigh | 460.4 | 460.0 | 458.8 | 456.1 |
| AutoMegaKernel SOTA | 464.2 | 461.9 | 459.5 | 456.7 |
| MPK | 366.4 | 382.3 | 382.9 | 372.4 |
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
| Base Model | Reasoning Effort | Iterations | Total Tokens | Time Cost | API Cost |
|---|---|---|---|---|---|
| DeepSeek-V4-Flash | medium | 38 | 27.30M | 4h 56min | $4.02 |
| DeepSeek-V4-Flash | xhigh | 35 | 31.20M | 5h 22min | $4.59 |
| DeepSeek-V4-Pro | medium | 34 | 33.13M | 6h 41min | $15.13 |
| DeepSeek-V4-Pro | xhigh | 30 | 42.44M | 7h 06min | $19.38 |
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.
Dear Reviewer DxyW,
With the discussion period coming to an end, we would like to thank you again for your careful review. We have clarified the scope of our first contribution, compared the full MegaKernel generation workflow with specialized AI compilers, extended the cost analysis across base LLM configurations, and explicitly discussed the absence of formal correctness guarantees.
Please let us know if our responses have addressed your main concerns or if any point remains unclear.
Best regards, The Authors
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper presents AUTOMEGAKERNEL, an LLM-driven framework for automatically generating MegaKernels to accelerate large-model inference. The main idea is to reduce the overhead of executing many fine-grained GPU kernels by fusing model computation into a single persistent kernel. To make this generation tractable for LLMs, the paper introduces an instruction-centric fusion abstraction that decomposes a model into manageable fused instructions, such as GEMM, GEMV, and attention instructions, each guided by an optimization skeleton. The framework then uses LLMs to perform model decomposition, instruction scheduling, Python reference generation, CUDA code generation, and hierarchical verification. The paper evaluates the approach across dense LLMs, MoE models, and VLA models on multiple NVIDIA GPU generations, showing that the generated MegaKernels can improve inference efficiency over existing inference engines, compiler-based approaches, and some manually optimized implementations.
Strengths and weaknesses
Strengths:
- Addresses an important problem of automating MegaKernel-based inference acceleration for low-latency LLM decoding, proposing a structured framework (AUTOMEGAKERNEL) that decomposes models into instruction-centric fusion units and integrates scheduling, code generation, and verification.
- Introduces hierarchical verification to ensure correctness at both decomposition and instruction levels.
- Strong empirical evaluation across multiple model types (dense LLMs, MoE, VLA) and GPUs (H100, A100, L20), demonstrating substantial speedups over existing inference engines, vendor libraries, and compiler-based approaches.
Weakness:
- The paper does not clearly show the generated MegaKernel structure for each model. Although it defines GEMM/GEMV/attention instructions, it lacks a per-model breakdown of which operators are fused and how the system chooses fusion groups, making it hard to assess what is discovered automatically versus predefined by the abstraction.
- The performance analysis is helpful but incomplete. The latency decomposition explains gains over discrete-kernel engines and MPK, but there is little detailed analysis of why AUTOMEGAKERNEL surpasses handcrafted implementations in some cases. More instruction-level timing, SM utilization, occupancy/register pressure, memory-traffic, and bubble analysis would strengthen the claims.
Questions
- Can the authors provide a per-model breakdown of the generated MegaKernel structure, listing the instruction instances and the operators fused into each instruction for representative dense, MoE, and VLA models? This would clarify what fusion opportunities are discovered by AUTOMEGAKERNEL versus what is predefined by the GEMM/GEMV/attention abstraction.
- The paper reports that AUTOMEGAKERNEL can outperform handcrafted implementations such as Spector et al. and Running VLA. Can the authors provide a more detailed performance breakdown for these cases? For example, instruction-level timing, SM utilization, occupancy/register pressure, memory traffic, or bubble analysis would help explain whether the gains come from better scheduling, better fusion boundaries, lower synchronization overhead, or other factors.
Limitations
Yes
Final justification
The rebuttal largely addresses my two concerns: it clarifies that the system uses predefined GEMM/GEMV/attention abstractions while the LLM generates model- and hardware-specific instruction instances, configurations, schedules, and layouts, and it provides representative fusion groups for dense, MoE, and VLA models. It also gives concrete explanations for the handcrafted-baseline gains, including higher SM utilization for attention compared with Spector et al. and reduced memory traffic compared with Running VLA.
My remaining suggestion is that these details should be incorporated into the paper itself, preferably as a table of generated instruction instances and a concise per-baseline performance breakdown, so readers can directly inspect the fusion boundaries and understand the source of the speedups.
Formatting concerns
No
2 comments
Rebuttal
Thank you for your careful review and detailed questions. We especially appreciate your suggestions on clarifying the generated MegaKernel structure across different model types and strengthening the analysis of the performance gains over handcrafted implementations. These comments have helped us identify where the paper needs more concrete structural and instruction-level evidence.
W1 & Q1: Per-Model MegaKernel Structure and Fusion Discovery
Response:
AUTOMEGAKERNEL predefines reusable instruction abstractions and Optimization Skeletons, while the concrete operator combinations, instruction instances, configurations, instruction sequence, and instruction layout are automatically generated by the LLM for the target model and GPU.
(1) We provide the general abstractions, while the LLM generates the model- and hardware-specific structure. In Sections 2.1–2.2, we manually define three instruction abstractions,GEMM-based Fusion Instruction, GEMV-based Fusion Instruction, and Attention Instruction.These abstractions define the admissible fusion space. Within this space, the LLM partitions the model’s forward computation into concrete instruction instances based on operator compatibility and data dependencies. The partition is therefore model-specific, rather than hard-coded or obtained through unconstrained search, and is subsequently checked by hierarchical verification. For each instruction instance, the LLM further generates the algorithm-related and GPU-related configurations, including tensor shapes, memory bindings, instruction computation granularity, and parameters such as thread-block tiling and warp-level specialization. Instruction Scheduling and layout mapping then generate the instruction sequence and map the instruction instances onto the target GPU.
(2) Different models produce different concrete fusion groups, each corresponding to a concrete instruction instance. Representative instruction instances generated for single-batch decoding on H100 are shown below. For the VLA model , we present representative component SigLIP vision module.
| Model and module | Instruction type | Operators fused into the generated instruction instance |
|---|---|---|
| Llama3.2-1B, attention projection | GEMV-based | RMSNorm + QKV GEMV + RoPE |
| Llama3.2-1B, attention output | GEMV-based | output GEMV + residual addition |
| Llama3.2-1B, FFN input | GEMV-based | RMSNorm + up/gate GEMV + SiLU |
| Llama3.2-1B, FFN output | GEMV-based | down GEMV + residual addition |
| Qwen1.5-MoE-A2.7B, routing | GEMV-based | RMSNorm + router GEMV + softmax + top- selection |
| Qwen1.5-MoE-A2.7B, shared experts | GEMV-based | shared-expert up/gate GEMV + SiLU |
| Qwen1.5-MoE-A2.7B, selected experts | GEMV-based | selected-expert up/gate GEMV + SiLU |
| Qwen1.5-MoE-A2.7B, expert output | GEMV-based | down GEMV + expert combination + residual addition |
| , SigLIP attention projection | GEMM-based | QKV GEMM + bias |
| , SigLIP attention output | GEMM-based | output GEMM + bias + residual addition |
| , SigLIP MLP input | GEMM-based | up GEMM + bias + GELU |
| , SigLIP MLP output | GEMM-based | down GEMM + bias + residual addition |
W2 & Q2: Performance Breakdown versus Handcrafted Implementations
Response:
AUTOMEGAKERNEL surpasses handcrafted implementations by automatically identifying model- and hardware-specific parallelization and fusion opportunities that are not exploited in their fixed designs. We compare against these handcrafted implementations under identical settings—same GPU, model, input configuration, precision, and batch/sequence length—and present two representative cases below.
(1) Compared with Spector et al.’s handcrafted Llama3.2-1B implementation on H100, AUTOMEGAKERNEL exposes greater parallelism in attention and improves SM utilization. H100 contains 132 SMs, whereas Spector partitions the attention workload only across the eight KV heads and therefore uses at most 8 SMs concurrently. During the Instruction Scheduling and layout mapping stage in Section 3.2, AUTOMEGAKERNEL further partitions the attention computation across both KV heads and sequence tiles, increasing active-SM coverage from 6.1% to 100% and reducing attention latency from 47.44 μs to 22.76 μs, which is 2.08× faster (52.0% lower latency than the baseline).
(2) Compared with the handcrafted Running VLA implementation of on H100, AUTOMEGAKERNEL selects a larger profitable fusion boundary for this subgraph. Taking the Gemma module as an example, during Model Decomposition in Section 3.1, AUTOMEGAKERNEL fuses RMSNorm with GEMM, whereas Running VLA executes them as two separate kernels. This separate execution introduces approximately 9.7 MB of additional memory traffic each time the subgraph is invoked. This fusion eliminates the intermediate read and write without introducing register pressure or occupancy loss that would offset the gain, reducing subgraph latency from 385.9 μs to 348.5 μs, achieving a 1.11× speedup (9.7% latency reduction).
Dear Reviewer Q465,
With the discussion period coming to an end, we would like to thank you again for your helpful suggestions. We have provided a per-model breakdown of the generated MegaKernel structures and additional quantitative analyses explaining the gains over handcrafted implementations.
Please let us know if these additions have addressed your main concerns or if any further clarification is needed.
Best regards, The Authors
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
Existing inference engines usually execute many fine-grained kernels sequentially, causing kernel launch overhead and redundant memory access. In this work, the authors propose AUTOMEGAKERNEL, an LLM-driven framework that uses an instruction-centric fusion abstraction to decompose MegaKernel generation into manageable fusion segments, reason about fusion strategies, generate CUDA code, and verify correctness. The evaluation results show that AUTOMEGAKERNEL consistently improves inference efficiency, achieving speedups of up to 5.04x over vLLM, 2.42x over SGLang, and 1.92x over MPK across diverse models and GPUs. The work demonstrates that LLMs can help automate high-performance kernel generation and points toward more self-improving AI systems.
Strengths and weaknesses
Strengths:
- The proposed method is clear and makes a strong contribution. By decomposing a monolithic MegaKernel into manageable instruction-level fusion segments, the method makes the generation problem more tractable for LLMs. This abstraction also helps separate high-level fusion reasoning from low-level CUDA implementation details.
- The evaluation covers a wide range of models, including dense, MoE, and VLA models, as well as GPU hardware across Hopper, Ampere, and Ada architectures. The baselines are also strong and sufficient, including vLLM, SGLang, and MPK, which makes the claims and contributions more solid and convincing.
Weaknesses:
- The analysis shows that unaided LLMs struggle to generate correct MegaKernels, so the success of the method relies on carefully designed instruction abstractions, optimization skeletons, and verification loops. This raises the question of how much manual design effort is needed to extend the framework to new operators, architectures, or model families.
- The optimization space is not clearly described. It is unclear how the search space changes across different models, hardware, and abstraction.
Questions
- How do LLM capability and reasoning effort affect the results, including the success rate and final performance?
- The paper argues that AUTOMEGAKERNEL is most beneficial for lightweight, latency-sensitive decoding. How does the method perform in more compute-heavy regimes, such as large-batch, long-context, or prefill-dominated workloads?
- Is there any intuition we can learn from the kernels generated by the LLMs? Would it be possible to convert the process and findings into reusable skills to reduce the reasoning cost in future tasks?
- What human effort is involved in practice, including prompt tuning, to improve the success rate and reduce the generation cost of AUTOMEGAKERNEL?
- How large is the optimization space for a given model and target GPU? More specifically, how many possible combinations of decomposition choices, instruction schedules, SM mappings, and GPU-specific configurations does AUTOMEGAKERNEL need to consider?
Limitations
yes
Final justification
The rebuttal addresses most of my questions and provides useful additional evidence on the impact of LLM capability and reasoning effort, higher-intensity decoding workloads, reusable optimization knowledge, and the practical human effort involved. Overall, it substantially improves my understanding of the method, and I would maintain my positive score.
Formatting concerns
No
3 comments
Rebuttal
Thank you for your careful review and constructive feedback. We especially appreciate your detailed questions on the framework's extensibility, the optimization space, the performance boundaries across different workloads, and the practical human effort involved. These points have helped us better articulate the design principles of AUTOMEGAKERNEL, clarify the scope and limitations of our method, and organize the reusable knowledge distilled from our generation process.
W1: Manual Design Effort and Framework Extensibility
Response:
Although AUTOMEGAKERNEL does not automatically define instruction abstractions for entirely unseen computational patterns, it reduces extension effort through abstractions shared across operators, model families, and GPUs.
(1) New models or operator variants covered by existing GEMM-, GEMV-, and Attention-based patterns can directly reuse the Instruction-Centric Fusion Abstraction. Only fundamentally new computational patterns require adding a new instruction abstraction. The hierarchical verification mechanism is reusable across scenarios. For new NVIDIA GPU architectures, only hardware-specific configuration contexts and limited Optimization Skeleton slots need adaptation when new primitives are introduced.
(2) Section 4.2 evaluates four dense models, one MoE model, and one VLA model without model-specific framework redesign, while Section 4.3 covers H100, A100, and L20 GPUs. These results demonstrate reuse across representative model families and NVIDIA GPU architectures.
(3) We will clarify the extension boundary and associated manual effort in the revision.
W2 & Q5: Optimization Space, Its Variation, and Scale
Response:
The optimization space of AUTOMEGAKERNEL consists of coupled decisions, where the model, hardware, and instruction abstraction affect different dimensions.
(1) The optimization space for a given model and GPU is large, but AUTOMEGAKERNEL does not exhaustively enumerate it. We characterize the feasible space as:
where denotes valid model decompositions, dependency-preserving instruction schedules, resource-feasible SM layouts, and legal GPU and skeleton configurations, such as thread-block tiling and warp specialization. These dimensions are coupled: dependencies constrain scheduling, while register/shared-memory limits, synchronization, and workload balance constrain mappings and configurations.
(2) The model, target GPU, and instruction abstraction affect different parts of the space. Model changes modify instruction instances, tensor shapes, and granularity, affecting decomposition and instruction sequences. GPU changes affect SM resources, mappings, and configurations. Different abstractions correspond to different Optimization Skeletons—GEMM, GEMV, and Attention—with distinct data movement and optimization strategies.
(3) AUTOMEGAKERNEL assigns clear objectives to each decision. Model Decomposition reduces redundant memory accesses. Instruction Scheduling minimizes execution bubbles under dependencies. Mapping distributes instructions across SMs to reduce tail latency and improve utilization. GPU-related configurations specify thread-block tiling and warp specialization, while Optimization Skeletons define data movement and computation flow, enabling software pipelining and hardware-aware layouts.
Q1: Impact of LLM Capability and Reasoning Effort
Response:
To further evaluate the impact of LLM capability and reasoning effort, we added experiments with DeepSeek series models. The results show that AUTOMEGAKERNEL generates correct and high-performance MegaKernels across LLMs with different capabilities and reasoning efforts under the same iteration budget. Stronger models and higher reasoning effort mainly reduce optimization iterations while slightly improving final performance.
Table 1: Optimization iterations under different LLM configurations
| Stage | DeepSeek-V4-Flash-medium | DeepSeek-V4-Flash-xhigh | DeepSeek-V4-Pro-medium | DeepSeek-V4-Pro-xhigh |
|---|---|---|---|---|
| High-level | 13 | 12 | 11 | 10 |
| Low-level | 25 | 23 | 23 | 20 |
| Total | 38 | 35 | 34 | 30 |
Table 2: Performance of generated MegaKernels at different sequence lengths on Llama-3.2-1B and A100 (tokens/s)
| Model / Reasoning Effort | Seq. 128 | Seq. 256 | Seq. 512 | Seq. 1024 |
|---|---|---|---|---|
| DeepSeek-V4-Flash-medium | 455.3 | 454.9 | 452.5 | 452.1 |
| DeepSeek-V4-Flash-xhigh | 455.2 | 455.3 | 453.3 | 452.7 |
| DeepSeek-V4-Pro-medium | 458.3 | 458.6 | 455.6 | 454.9 |
| DeepSeek-V4-Pro-xhigh | 460.4 | 460.0 | 458.8 | 456.1 |
| AutoMegaKernel SOTA | 464.2 | 461.9 | 459.5 | 456.7 |
| MPK | 366.4 | 382.3 | 382.9 | 372.4 |
(1) All configurations successfully generate valid and high-performance MegaKernels. Under the same iteration budget, all four DeepSeek configurations complete both fusion planning and CUDA optimization, achieving competitive throughput and significantly outperforms MPK, demonstrating that AUTOMEGAKERNEL can effectively utilize LLMs with different capabilities and costs.
(2) Stronger LLMs and higher reasoning effort improve optimization efficiency. From DeepSeek-V4-Flash-medium to DeepSeek-V4-Pro-xhigh, the total iterations decrease from 38 to 30 (21.1% reduction).
Q2: Performance under Large-Batch, Long-Context, and Prefill Workloads
Response:
AUTOMEGAKERNEL remains competitive under higher-intensity decoding workloads, while its relative advantage decreases as arithmetic intensity increases.
(1) AUTOMEGAKERNEL is not limited to B=1. Table 11 evaluates Llama3.2-1B on H100 with B=2/4/8 and sequence lengths from 128 to 1024. Across these 12 settings, AUTOMEGAKERNEL achieves the highest throughput in 11 settings and outperforms vLLM in all settings. SGLang only surpasses AUTOMEGAKERNEL at B=8 and L=1024.
(2) The reduced advantage with larger workloads is consistent with our theoretical analysis in the paper. For low-arithmetic-intensity decoding, eliminating kernel launches, redundant memory accesses, and execution bubbles provides substantial benefits. As arithmetic intensity increases, optimized GEMM kernels already utilize the GPU efficiently, reducing the relative benefit of cross-operator fusion. Meanwhile, MegaKernel overheads, including register pressure, shared-memory usage, and possible occupancy reduction, become more significant.
(3) Therefore, AUTOMEGAKERNEL primarily targets latency-sensitive decoding. We do not claim superiority on prefill-dominated workloads and leave them for future work.
Q3: Reusability of Knowledge from Generated MegaKernels
Response:
Yes. We distill the findings from LLM-based MegaKernel generation into reusable knowledge at two complementary levels.
(1) Process-level reusable skills. Appendix C shows that the main challenge is not local CUDA generation, but preserving correctness and execution invariants across long fused computation paths. Therefore, implementation constraints must be provided hierarchically rather than through a single end-to-end prompt. Based on this observation, AUTOMEGAKERNEL separates the Strategy Level—model decomposition, instruction scheduling, and SM-level mapping—from the Implementation Level—skeleton-guided CUDA generation for individual instructions.
(2) Kernel-level reusable principles. Effective fusion boundaries generally follow the dominant GEMM-based, GEMV-based, or Attention computation, while incorporating suitable pre- and post-operations into the same instruction. Software pipelining and warp specialization are useful when memory movement can be overlapped with sufficient independent computation; in contrast, further fusion should be avoided when additional register pressure, shared-memory usage, and occupancy loss outweigh the savings from fewer launches and reduced boundary traffic. We believe these observations also provide helpful intuitions for future research on MegaKernel.
Q4: Human Effort and Prompt Tuning
Response:
AUTOMEGAKERNEL improves the success rate and reduces generation cost through a one-time reusable framework design, rather than per-model debugging or extensive prompt tuning.
(1) The one-time manual effort lies in designing reusable Instruction-Centric Fusion Abstractions, Optimization Skeletons, and a hierarchical verification mechanism. These components decompose the full MegaKernel task into manageable instructions and separate the Strategy Level from the Implementation Level. Table 2 shows that with AUTOMEGAKERNEL, all four base LLMs generate high-performance MegaKernels; without it, three fail to generate valid code, while the only correct result remains non-fused at approximately 90 tokens/s.
(2) The hierarchical verification mechanism reduces debugging and failed-iteration costs by localizing errors during generation. Before low-level CUDA generation, AUTOMEGAKERNEL verifies generated Python references against the Hugging Face implementation to catch decomposition and scheduling errors. It then verifies CUDA code per instruction, localizing compiler errors and tensor mismatches to the failing stage and instruction.
(3) Shared stage-specific prompt templates make extensive per-model prompt tuning unnecessary. Following the workflow, the prompts hierarchically convey the task, abstraction rules, target GPU specification, and verification feedback. The LLM then instantiates instructions, generates the instruction schedule and SM mapping, and produces the corresponding CUDA implementations without repeatedly tuning prompts for each target scenario.
Dear Reviewer KBm2,
With the discussion period coming to an end, we would like to thank you again for your constructive feedback. We have clarified the manual effort and optimization space, and added experiments and discussions on LLM capability, reasoning effort, performance across different workloads, reusable insights, and prompt tuning.
Please let us know if our responses have addressed your main concerns or if any point still requires clarification.
Best regards, The Authors
Thank you for the detailed response. I have no further questions and will keep my current score.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Dear Area Chair,
With the Author–Reviewer–AC discussion period coming to an end, we would like to sincerely thank you for the time and effort you have devoted to coordinating the review process and facilitating the discussion.
We have provided detailed responses to the reviewers and addressed the key concerns highlighted in the meta-review, including the manual effort required for framework extensibility, the size of the search space, the per-model breakdown of generated MegaKernel structures, performance and cost analysis, and formal correctness guarantees. We would therefore be very grateful if you could help facilitate the discussion and encourage the reviewers to review our rebuttals and let us know whether any concerns remain.
Thank you again for your time and consideration.
Best regards,
The Authors