█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

Cohere Megakernel

एक H100 पर चलने वाला सर्विंग इंजन, जो North Mini Code का पूरा decode step एक persistent CUDA kernel में चलाता है

GPU Kernels & Compilersओपन सोर्स
ताज़ा
Research release
अपडेट किया गया
8 सित॰ 2026
भाषा
C++
लाइसेंस
Apache-2.0
कवरेज
1 story

नया क्या है

Research release8 सित॰ 2026

Cohere open-sourced the decode megakernel and its serving engine for North Mini Code: 292 tokens/second at batch size 1 on one H100 (1.58x vLLM v0.24 decode) and 1.25x-1.41x faster end to end across five benchmarks.

ताज़ा खबरें

संक्षेप में

Cohere Megakernel क्या है?

Cohere Megakernel एक H100 पर चलने वाला सर्विंग इंजन, जो North Mini Code का पूरा decode step एक persistent CUDA kernel में चलाता है. यह Models & Inference टूल्स की GPU Kernels & Compilers श्रेणी में आता है; ओपन सोर्स है, C++ में लिखा गया है और Apache-2.0 लाइसेंस के तहत है।

अपडेट किया गया Markdown वर्शन ↗

सारांश

Cohere Megakernel, Cohere के North Mini Code मॉडल को OpenAI-compatible API के पीछे सर्व करने वाले single-H100 inference engine का एक रिसर्च रिलीज़ है। इसका मूल विचार decode megakernel है: हर ऑपरेशन (RMSNorm, QKV, attention, MoE, output projection) के लिए अलग CUDA kernel लॉन्च करने और हर सीमा पर पूरे ग्रिड के synchronization का खर्च उठाने के बजाय, इंजन हर streaming multiprocessor पर एक thread block लॉन्च करता है और उसे पूरे decode step के दौरान resident रखता है।

हर resident block एक ऐसी task list पर चलता है जो host पर बनती है। उस list में हर task एक ही GEMM tile या attention का एक ही split होता है, और dependencies global memory में स्पष्ट counters के रूप में दर्ज रहती हैं। इसलिए काम तब शुरू हो जाता है जब उसके अपने inputs तैयार हों, न कि किसी kernel boundary पर। Cohere उस बारीक schedule से तीन ठोस फ़ायदे बताता है: तैयार mixture-of-experts tiles attention के आख़िरी हिस्से की वजह से खाली रह गए SMs को भर देते हैं, consumers पूरे-ग्रिड वाली झूठी dependencies का इंतज़ार करना बंद कर देते हैं, और immutable weights को HBM से पहले से prefetch किया जाता है, जब दूसरा काम चल रहा होता है।

यह प्रोजेक्ट साफ़ तौर पर एक शुरुआती रिसर्च रिलीज़ है, कोई general-purpose inference engine नहीं। Cohere ने इसे एक NVIDIA H100 (sm_90a) पर, CUDA 13 या उससे नए, CPython 3.12 या उससे नए, Linux पर, और batch sizes आठ तक टेस्ट किया है। दूसरे configurations न बनाए जाते हैं, न ट्यून किए जाते हैं। इस दायरे में यह एक पूरा server है, जिसमें OpenAI-compatible completions और chat-completions endpoints, streaming, tool calling, continuous batching, ragged sequence lengths, paged KV cache, sliding-window attention, prefix caching और preemption शामिल हैं।

यह क्या करता है

  • एक persistent CUDA kernel पूरा decode forward pass चलाता है, जिससे per-op launch overhead और full-grid barriers हट जाते हैं
  • H100 पर batch size 1 में 292 tokens/second, जो theoretical speed-of-light का 62% है, और vLLM v0.24 decode से 1.58x तेज़
  • AIME 2025, SciCode, MMLU-Pro (CS), LiveCodeBench v6 और GPQA पर end to end vLLM से 1.25x-1.41x तेज़
  • streaming और tool calling के साथ OpenAI-compatible /v1/completions, /v1/chat/completions और /v1/models endpoints
  • Continuous batching, ragged sequence lengths, paged KV cache, sliding-window attention, prefix caching और preemption
  • batch size 1 पर 256K context तक speedup बना रहता है, और vLLM की तुलना में accuracy में कोई मापने योग्य गिरावट नहीं है

शुरू करें

आपको चाहिए एक NVIDIA H100, CUDA 13+, Python 3.12+, Linux, और North Mini Code का एक लोकल checkpoint। Repository की BUILD_AND_RUN.md फ़ाइल में detailed install, server flags, benchmarking और profiling की जानकारी है।

Submodules के साथ clone करें

Submodules ज़रूरी हैं, सामान्य clone से build नहीं होगा।

bashbash
git clone --recurse-submodules https://github.com/cohere-ai/cohere-megakernel.git
cd cohere-megakernel

Dependencies इंस्टॉल करें

एक virtual environment बनाएँ, Python requirements और FlashAttention-3 इंस्टॉल करें, साथ में CMake के लिए ज़रूरी OpenSSL dev headers भी।

bashbash
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt
uv pip install flash-attn-3 --index-url https://download.pytorch.org/whl/cu130
sudo apt install -y libssl-dev ninja-build

Kernel build करें

उसी interpreter से build करें जिससे आप चलाने वाले हैं। उसे -DPython_EXECUTABLE के ज़रिए स्पष्ट रूप से पास करें, वरना CMake कोई system Python चुन सकता है।

bashbash
cmake -S . -B build -G Ninja \
  -DPython_EXECUTABLE="$(which python)" -DCMAKE_BUILD_TYPE=Release
cmake --build build

OpenAI-compatible server शुरू करें

--ckpt को अपने लोकल North Mini Code checkpoint की ओर और --lib को build से बनी library की ओर इंगित करें।

bashbash
python src/serving/server.py \
  --host 127.0.0.1 --port 8000 \
  --lib "$PWD/build/libmk_release.so" \
  --ckpt <checkpoint-path> \
  --device cuda:0 --bs 8 --frac-vram-utilization 0.7

Chat completion भेजें

Server OpenAI chat-completions के फ़ॉर्मैट में बात करता है, इसलिए मौजूदा clients बिना बदलाव के काम करते हैं।

bashbash
curl http://127.0.0.1:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "North-Mini-Code-1.0",
    "messages": [{"role": "user", "content": "Write a Python Fibonacci function."}],
    "max_tokens": 128,
    "temperature": 0
  }'

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • कम batch sizes पर एक H100 पर North Mini Code सर्व करना, जहाँ हर kernel का launch overhead decode time पर हावी रहता है
  • मौजूदा OpenAI-compatible client के पीछे बिना application code बदले एक तेज़ backend लगाना
  • अपना persistent megakernel लिखने से पहले एक काम किया हुआ, एक-फ़ाइल वाला उदाहरण पढ़ना और समझना
  • एक ही hardware पर decode-bound mixture-of-experts serving की vLLM से benchmarking करना

How Cohere Megakernel compares

Cohere Megakernel alongside other open-source gpu kernels & compilers tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
FlashInfer★ 7.1kLLM सर्विंग के लिए अटेंशन, GEMM और MoE कर्नेल, आपके GPU के लिए सही बैकएंड चुनकर
Liger-Kernel★ 6.7kLLM ट्रेनिंग को तेज़ करने और मेमोरी उपयोग घटाने वाले fused Triton kernels
nvdriver★ 5.4kबिना संशोधन वाले CUDA सॉफ़्टवेयर के तहत NVIDIA के प्रोप्राइटरी ड्राइवर की जगह लेने का लक्ष्य रखने वाला एक क्लीन-रूम Rust Linux कर्नल ड्राइवर
cuTile Rust★ 1.1ksafe Rust में GPU kernels लिखें, एक बार में एक tile
CUDA for AMD on Windows★ 350ZLUDA और HIP SDK के ज़रिए AMD GPU पर बिना बदलाव के CUDA ऐप्लिकेशन चलाने वाला, Windows के लिए स्क्रिप्ट-आधारित सेटअप
Cohere Megakernel★ 112एक H100 पर चलने वाला सर्विंग इंजन, जो North Mini Code का पूरा decode step एक persistent CUDA kernel में चलाता है