Megakernels
Captured source
source ↗Skip to content The state of sovereign AI adoption: What enterprise leaders need to know. Read now
Products
Solutions
Resources
Blog
Research
Company
Sign in
Request a demo
Platform North
Enterprise-ready AI for business
Compass
Intelligent search and discovery
Models Command
Generative language models
Transcribe New
Speech recognition model
North Mini Code
Agentic coding model
Parse New
Document parsing model
Embed
Semantic representation model
Rerank
Retrieval optimization model
Models Overview
Product Products Overview
Total Cost of AI Ownership
Pricing
Featured Command: High-performance generative AI models for real-world applications
Deploy Model Vault
Dedicated model inference platform
Private Deployments
On-prem or isolated VPCs
Security
Protect your data at every stage
See deployment options
By Industry Financial Services
Public Sector
Technology
Telecommunications
Energy and Utilities
Healthcare and Life Sciences
Manufacturing
Featured Model Vault provides fully-isolated, performant inference with Saas simplicity
Insights Customer Stories
For Developers Developers
Models Overview
Docs
Discord
LLM University
Connect Partners
Events
Webinars
Merch Store
Featured How CoreWeave used Cohere North to transform its customer support in 90 days
Blog
The latest news, launches, and insights
Read more
The state of sovereign AI adoption in 2026
Cohere and the University of Waterloo launch partnership to strengthen Canada’s AI talent pipeline
Introducing North Automations: Intelligent workflow orchestration
Research Cohere Labs
Cohere’s ML research lab
Explorations Future(s) of Work
How will AI change the way we work?
Aya Models
Multilingual AI at scale
All Papers
Initiatives Research Scholars
Finding the new generation of ML talent
Open Science Community
Championing global, open science
Catalyst Grants
Supporting impactful ML endeavors
Resources Blog
Hugging Face
Events
Featured The future of work debate has an evidence problem
About
Careers
Newsroom
Sep 08, 2026
22 minute read
Inside the megakernel serving engine for North Mini Code A technical deep dive into how Cohere’s approach to megakernels delivers 1.58x faster LLM serving on H100 devices.
Today, Cohere presents a serving engine for North Mini Code built around a decode megakernel: BF16 on a single H100, 1.25× - 1.41× faster than vLLM end-to-end. Explore the code behind the serving engine on GitHub .
Most LLM serving stacks still treat each forward pass as a sequence of kernels: launch QKV, wait; launch attention, wait; launch the MoE, wait. Each launch is fine on its own. The problem is the waiting in between. At small batch sizes, the GPU spends a surprising fraction of every decode step waiting rather than computing.
Autoregressive decoding, especially at lower batch sizes is fundamentally memory-bound. For every decode step, we move a large fraction of memory from HBM while relatively doing less compute. This means the correct question to ask is, how effectively can we use memory bandwidth and not the flops. Take North Mini Code which is a 30B model with 3.3B parameters active per token, which in BF16 means streaming 6.6 GB of weights during every decode step, plus roughly 0.5 GB of KV cache at 8K context. An H100 delivers 3.35 TB/s of bandwidth through HBM, putting the Speed-of-Light (SoL) at about 470 tok/s. vLLM serves this model at 185 tok/s, merely 39% of SoL.
Megakernels have been getting attention lately as the way to close that gap: instead of a hundred small kernels, run the entire forward pass as one persistent kernel. Starting from the pioneering work by Hazy Research's "Look Ma, No Bubbles!" , whose design we recap below, numerous follow-up works have been released, achieving various levels of speedup. Existing work has gone mainly in two directions: compilers that generate megakernels automatically, and standalone demos that measure decode speed at batch size 1.
We take one step further. This post presents what we believe is the first fully fledged serving system built around a decode megakernel. It supports everything a real server needs: continuous batching, paged attention, and ragged sequence lengths, all behind an OpenAI-compatible endpoint with tool calling. Point OpenCode at it and you can code with it.
On batch size 1, our megakernel reaches 292 tok/s, or 62% of SoL — 1.58× faster than vLLM. That margin holds across batch sizes and out to 256K of context, with no measurable loss of accuracy. Image 1: Decode throughput of various context lengths at batch size 1. Megakernel consistently outperforms vLLM. We also found that megakernels are much easier to write than their reputation suggests, so we include a recipe for porting kernels you already have into one. Ours is a single CUDA file: no compiler, no new programming paradigm, no exotic abstractions — just ordinary tiled GEMMs and ordinary paged attention, restructured to fit a single calling convention. What is a Megakernel? A GPU is roughly 100–150 independent processors, called SMs (streaming multiprocessors), that all run the same program — a kernel — on different pieces of data. A megakernel is a single persistent kernel that runs an entire forward pass: we launch exactly one threadblock per SM, and it stays resident for the entire decode step. Instead of receiving work from the driver, each block reads a task list — a list of small pieces of work it should execute, prepared on the host and sitting in global memory. Instead of kernel boundaries encoding the data dependencies, dependencies are expressed as explicit counters in global memory that tasks increment when they finish and spin on when they need an input.
The result is that the unit of scheduling shrinks from an entire operation to one tile of one operation, and the unit of synchronization shrinks from the whole GPU to the specific producers a task depends on. Image 2: One decode step, from the host to the device. Instead of one kernel per operation, the host decomposes the step into tasks — one tile of one operation each — and distributes them round-robin over the SMs, so every SM gets its own task list in global memory. The order of most tasks are determined on host by the scheduler (see the scheduler section). Full attention and the MoE are the exception: their task counts depend on the live sequence lengths and on routing, so they go into shared work queues that any SM can pull from. We...
Excerpt shown — open the source for the full document.
Notability
notability 6.0/10Substantive technical post from Cohere on efficient inference