AutoMegaKernel: New System Compiles Large Language Models into Single CUDA Kernels for Faster Inference
Researchers have developed AutoMegaKernel (AMK), a system that compiles HuggingFace Llama models into a single CUDA kernel that executes the entire forward pass in one launch without hand-written code. The system uses static validation to ensure deadlock-freedom and race-freedom, rejecting unsafe schedules before execution, and achieves token-for-token accuracy matching with HuggingFace implementations. The approach shows significant speedups on inference-class GPUs (up to 1.33x on NVIDIA L4) compared to optimized cuBLAS, though it trails on high-bandwidth training-class hardware like A100/H100.
AutoMegaKernel is a compilation system that transforms HuggingFace Llama-family language models into a single persistent cooperative CUDA kernel, eliminating the need for per-model hand-written CUDA code. The system's key innovation is a frozen schedule-IR validator that statically certifies deadlock-freedom and race-freedom through static graph checks, rejecting unsafe agent-proposed schedules before launch. Testing on 7,160 adversarial schedules (6,091 unsafe) demonstrated zero false-accepts and acceptance of all 360 real lowerings. The system successfully retargets across NVIDIA GPU architectures (sm_80/sm_90/sm_120) from a single codebase and auto-generates correct megakernels for 10 supported models. On a SmolLM2-135M checkpoint, it reproduces HuggingFace greedy decode token-for-token with perplexity matching at 2.5e-7. An unattended autoresearch loop self-improves the megakernel by 1.25-1.72x over baseline. A search-found int8 (W8A16) megakernel outperforms CUDA-graphed cuBLAS bf16 at batch-1 decode across inference-class GPUs, achieving up to 1.33x speedup on L4, 1.25-1.27x on L40S, and 1.19-1.23x on RTX 5090, though it trails on training-class A100/H100 hardware.
What's missing
The study's scope is limited to relatively small models (largest checkpoint tested is TinyLlama-1.1B), and the precision-asymmetric comparison (W8A16 vs bf16) at decode position 0 may not reflect full-sequence inference performance. The static validation approach, while effective in testing, is not a mechanized proof and relies on graph checks rather than formal verification. Generalization to other model architectures beyond Llama-family models and performance on longer sequences remain open questions.
What different sources said
- arXiv cs.AICenter
AgentCompile: An LLM-Guided Compiler for Direct CUDA Inference
Related
Gut Bacteria Enzyme Found to Break Down Heat-Processed Food Compounds, Producing Novel Biogenic Amines
Researchers have discovered that an enzyme in common gut bacteria can degrade N-epsilon-carboxymethyllysine (CML), a compound formed during thermal food processing, producing previously unknown biogenic amines. The enzyme, ornithine decarboxylase SpeC from enterobacteria, acts on CML and related modified lysine derivatives through a low-level 'underground' catalytic activity. This finding suggests a previously unrecognized communication axis between thermally processed dietary compounds and gut microbial physiology, with potential implications for host health.
Full-Length Gene Sequencing Reveals Two Distinct Bacterial Communities in Black-Legged Ticks Expanding Into Canada
Researchers used Oxford Nanopore full-length 16S rRNA gene sequencing to characterize the microbiome of Ixodes scapularis black-legged ticks collected in Nova Scotia, Canada, distinguishing between tick-adapted bacteria and environmentally acquired bacteria. The study comes as I. scapularis — the primary vector of Lyme disease — is rapidly expanding northward into Canada due to climate change. The findings suggest that environmentally derived bacteria in tick microbiomes are not mere contamination, which has implications for how tick microbiome data is collected and interpreted across surveillance studies.
Study Identifies Metabolic Link Between Cell Envelope Stress and Biofilm Formation in Bacteria
Researchers have discovered that the metabolite acetyl-CoA directly inhibits enzymes that degrade the bacterial signaling molecule c-di-GMP, connecting cell envelope biosynthesis stress to biofilm formation in Pseudomonas aeruginosa. The study found that sub-inhibitory concentrations of antibiotics targeting early peptidoglycan biosynthesis — but not other antibiotic classes — elevate c-di-GMP levels by reducing phosphodiesterase activity, with acetyl-CoA competing for the enzyme active site. Because the relevant enzyme domain is broadly conserved across bacterial species, this checkpoint mechanism may be widespread and could have implications for understanding antibiotic-induced biofilm responses.