Downloads · 30 days
2.3K
17% of all-time downloads
Mungert/KernelLLM-GGUF
KernelLLM-GGUF is a machine learning model from Mungert. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as other.
This model was generated using llama.cpp at commit 5787b5da.
Downloads · 30 days
2.3K
17% of all-time downloads
All-time downloads
13.5K
Public
Repo size
158 GB
Likes
4
Public
Click a slice to open those files.
.gguf158 GB · 100%
From the Hugging Face model README
This model was generated using llama.cpp at commit 5787b5da.
Testing a new quantization method using rules to bump important layers above what the standard imatrix would use.
I have found that the standard IMatrix does not perform very well at low bit quantiztion and for MOE models. So I am using llama.cpp --tensor-type to bump up selected layers. See Layer bumping with llama.cpp
This does create larger model files but increases precision for a given model size.
Selecting the correct model format depends on your hardware capabilities and memory constraints.
📌 Use BF16 if:
✔ Your hardware has native BF16 support (e.g., newer GPUs, TPUs).
✔ You want higher precision while saving memory.
✔ You plan to requantize the model into another format.
📌 Avoid BF16 if:
❌ Your hardware does not support BF16 (it may fall back to FP32 and run slower).
❌ You need compatibility with older devices that lack BF16 optimization.
📌 Use F16 if:
✔ Your hardware supports FP16 but not BF16.
✔ You need a balance between speed, memory usage, and accuracy.
✔ You are running on a GPU or another device optimized for FP16 computations.
📌 Avoid F16 if:
❌ Your device lacks native FP16 support (it may run slower than expected).
❌ You have memory limitations.
bf16_q8_0, f16_q4_K) – Best of Both WorldsThese formats selectively quantize non-essential layers while keeping key layers in full precision (e.g., attention and output layers).
bf16_q8_0 (meaning full-precision BF16 core layers + quantized Q8_0 other layers).📌 Use Hybrid Models if:
✔ You need better accuracy than quant-only models but can’t afford full BF16/F16 everywhere.
✔ Your device supports mixed-precision inference.
✔ You want to optimize trade-offs for production-grade models on constrained hardware.
📌 Avoid Hybrid Models if:
❌ Your target device doesn’t support mixed or full-precision acceleration.
❌ You are operating under ultra-strict memory limits (in which case use fully quantized formats).
Quantization reduces model size and memory usage while maintaining as much accuracy as possible.
📌 Use Quantized Models if:
✔ You are running inference on a CPU and need an optimized model.
✔ Your device has low VRAM and cannot load full-precision models.
✔ You want to reduce memory footprint while keeping reasonable accuracy.
📌 Avoid Quantized Models if:
❌ You need maximum accuracy (full-precision models are better for this).
❌ Your hardware has enough VRAM for higher-precision formats (BF16/F16).
These models are optimized for very high memory efficiency, making them ideal for low-power devices or large-scale deployments where memory is a critical constraint.
IQ3_XS: Ultra-low-bit quantization (3-bit) with very high memory efficiency.
IQ3_S: Small block size for maximum memory efficiency.
IQ3_M: Medium block size for better accuracy than IQ3_S.
Q4_K: 4-bit quantization with block-wise optimization for better accuracy.
Q4_0: Pure 4-bit quantization, optimized for ARM devices.
| Model Format | Precision | Memory Usage | Device Requirements | Best Use Case |
|---|---|---|---|---|
| BF16 | Very High | High | BF16-supported GPU/CPU | High-speed inference with reduced memory |
| F16 | High | High | FP16-supported GPU/CPU | Inference when BF16 isn’t available |
| Q4_K | Medium-Low | Low | CPU or Low-VRAM devices | Memory-constrained inference |
| Q6_K | Medium | Moderate | CPU with more memory | Better accuracy with quantization |
| Q8_0 | High | Moderate | GPU/CPU with moderate VRAM | Highest accuracy among quantized models |
| IQ3_XS | Low | Very Low | Ultra-low-memory devices | Max memory efficiency, low accuracy |
| IQ3_S | Low | Very Low | Low-memory devices | Slightly more usable than IQ3_XS |
| IQ3_M | Low-Medium | Low | Low-memory devices | Better accuracy than IQ3_S |
| Q4_0 | Low | Low | ARM-based/embedded devices | Llama.cpp automatically optimizes for ARM inference |
| Ultra Low-Bit (IQ1/2_*) | Very Low | Extremely Low | Tiny edge/embedded devices | Fit models in extremely tight memory; low accuracy |
Hybrid (e.g., bf16_q8_0) | Medium–High | Medium | Mixed-precision capable hardware | Balanced performance and memory, near-FP accuracy in critical layers |
On KernelBench-Triton Level 1, our 8B parameter model exceeds models such as GPT-4o and DeepSeek V3 in single-shot performance. With multiple inferences, KernelLLM's performance outperforms DeepSeek R1. This is all from a model with two orders of magnitude fewer parameters than its competitors.
We introduce KernelLLM, a large language model based on Llama 3.1 Instruct, which has been trained specifically for the task of authoring GPU kernels using Triton. KernelLLM translates PyTorch modules into Triton kernels and was evaluated on KernelBench-Triton (see here). KernelLLM aims to democratize GPU programming by making kernel development more accessible and efficient.
KernelLLM's vision is to meet the growing demand for high-performance GPU kernels by automating the generation of efficient Triton implementations. As workloads grow larger and more diverse accelerator architectures emerge, the need for tailored kernel solutions has increased significantly. Although a number of works exist, most of them are limited to test-time optimization, while others tune on solutions traced of KernelBench problems itself, thereby limiting the informativeness of the results towards out-of-distribution generalization. To the best of our knowledge KernelLLM is the first LLM finetuned on external (torch, triton) pairs, and we hope that making our model available can accelerate progress towards intelligent kernel authoring systems.

KernelLLM Workflow for Triton Kernel Generation: Our approach uses KernelLLM to translate PyTorch code (green) into Triton kernel candidates. Input and output components are marked in bold. The generations are validated against unit tests, which run kernels with random inputs of known shapes. This workflow allows us to evaluate multiple generations (pass@k) by increasing the number of kernel candidate generations. The best kernel implementation is selected and returned (green output).
The model was trained on approximately 25,000 paired examples of PyTorch modules and their equivalent Triton kernel implementations, and additional synthetically generated samples. Our approach combines filtered code from TheStack [Kocetkov et al. 2022] and synthetic examples generated through torch.compile() and additional prompting techniques. The filtered and compiled dataset is [KernelBook]](https://huggingface.co/datasets/GPUMODE/KernelBook).
We finetuned Llama3.1-8B-Instruct on the created dataset using supervised instruction tuning and measured its ability to generate correct Triton kernels and corresponding calling code on KernelBench-Triton, our newly created variant of KernelBench [Ouyang et al. 2025] targeting Triton kernel generation. The torch code was used with a prompt template containing a format example as instruction during both training and evaluation. The model was trained for 10 epochs with a batch size of 32 and a standard SFT recipe with hyperparameters selected by perplexity on a held-out subset of the training data. Training took circa 12 hours wall clock time on 16 GPUs (192 GPU hours), and we report the best checkpoint's validation results.

| Model | Parameters (B) | Score | Pass@k |
|---|---|---|---|
| KernelLLM | 8 | 20.2 | 1 |
| KernelLLM | 8 | 51.8 | 10 |
| KernelLLM | 8 | 57.1 | 20 |
| DeepSeek V3 | 671 | 16 | 1 |
| GPT-4o | ~200 | 15 | 1 |
| Qwen2.5 | 32 | 15 | 1 |
| Llama 3.3 | 70 | 13 | 1 |
| Llama 3.1 | 8 | 14 | 20 |
| Llama 3.1 | 8 | 6 | 1 |
| Llama R1 Distill | 70 | 11 | reasoning |
| DeepSeek R1 | 671 | 30 | 1 |
Our 8B parameter model achieves competitive or superior performance compared to much larger models on kernel generation tasks, demonstrating the effectiveness of our specialized training approach on KernelBench Level 1 versus various baselines. KernelLLM inference was run with temperature=1.0 and top_p=0.97.
The resulting model is competitive with state of the art LLMs despite its small size. We evaluate our model on KernelBench which is an open-source benchmark to evaluate the ability of LLMs to write efficient GPU kernels. It contains 250 selected PyTorch modules organized into difficulty levels, from single torch operators such as Conv2D or Swish (level 1), to full model architectures (level 3). The benchmark measures both correctness (by comparing against reference PyTorch outputs) and performance (by measuring speedup over baseline implementations). We implemented a new KernelBench-Triton variant that evaluates an LLMs ability to generate Triton kernels, making it an ideal benchmark for evaluating KernelLLM's capabilities. All our measurements were done on Nvidia H100 GPUs.
KernelLLM shows quasi log-linear scaling behavior during pass@k analysis.
For more information, please see Project Popcorn.
To use KernelLLM, install the required dependencies:
pip install transformers accelerate torch triton
KernelLLM provides a simple interface for generating Triton kernels from PyTorch code. The included kernelllm.py script offers multiple methods for interacting with the model.
from kernelllm import KernelLLM
# Initialize the model
model = KernelLLM()
# Define your PyTorch module
pytorch_code = '''
import torch
import torch.nn as nn
class Model(nn.Module):
"""
A model that computes Hinge Loss for binary classification tasks.
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, predictions, targets):
return torch.mean(torch.clamp(1 - predictions * targets, min=0))
batch_size = 128
input_shape = (1,)
def get_inputs():
return [torch.randn(batch_size, *input_shape), torch.randint(0, 2, (batch_size, 1)).float() * 2 - 1]
def get_init_inputs():
return []
'''
# Generate optimized Triton code
optimized_code = model.generate_triton(pytorch_code, max_new_tokens=512)
print(optimized_code)
You can also use the built-in REPL interface:
python kernelllm.py
This will start an interactive session where you can input your PyTorch code and receive Triton-optimized implementations.
KernelLLM provides several methods for customizing the generation process:
from kernelllm import KernelLLM
model = KernelLLM()
# Stream output in real-time
model.stream_raw("Your prompt here", max_new_tokens=2048)
# Generate raw text without the Triton-specific prompt template
raw_output = model.generate_raw("Your prompt here", temperature=1.0, max_new_tokens=2048)
Despite showing promising results, KernelLLM has several limitations:
Model Developers: Meta.
Input: Models input text only.
Output: Models generate text only.
Model Architecture: KernelLLM is an auto-regressive language model that uses an optimized transformer architecture.
Model Dates: KernelLLM was trained in March 2025.
Status: This is a static model trained on an offline dataset.
License: See LICENSE.pdf for details.
Intended Use Cases: KernelLLM is intended for commercial and research use in English, relevant programming languages, Python, and Triton.
Out-of-Scope Uses: Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for KernelLLM and its variants.
Training Factors: We used custom training libraries.
Carbon Footprint: In aggregate, training KernelLLM required 250 hours of computation on hardware of type H100-80GB, not including the training of the base model. 100% of the estimated tCO2eq emissions were offset by Meta's sustainability program.
KernelLLM and its variants are a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, KernelLLM's potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate or objectionable responses to user prompts. Therefore, before deploying any applications of KernelLLM, developers should perform safety testing and tuning tailored to their specific applications of the model.
Please see the Responsible Use Guide available at https://ai.meta.com/llama/responsible-use-guide.
@software{kernelllm2025,
title={KernelLLM},
author={Fisches, Zacharias and Paliskara, Sahan and Guo, Simon and Zhang, Alex and Spisak, Joe and Cummins, Chris and Leather, Hugh and Isaacson, Joe and Markosyan, Aram and Saroufim, Mark},
year={2025},
month={5},
note={Corresponding authors: Aram Markosyan, Mark Saroufim},
url={https://huggingface.co/facebook/KernelLLM},
}
Help me test my AI-Powered Quantum Network Monitor Assistant with quantum-ready security checks:
The full Open Source Code for the Quantum Network Monitor Service available at my github repos ( repos with NetworkMonitor in the name) : Source Code Quantum Network Monitor. You will also find the code I use to quantize the models if you want to do it yourself GGUFModelBuilder
💬 How to test:
Choose an AI assistant type:
TurboLLM (GPT-4.1-mini)HugLLM (Hugginface Open-source models)TestLLM (Experimental CPU-only)I’m pushing the limits of small open-source models for AI network monitoring, specifically:
🟡 TestLLM – Current experimental model (llama.cpp on 2 CPU threads on huggingface docker space):
🟢 TurboLLM – Uses gpt-4.1-mini :
🔵 HugLLM – Latest Open-source models:
"Give me info on my websites SSL certificate""Check if my server is using quantum safe encyption for communication""Run a comprehensive security audit on my server"I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAI—all out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is open source. Feel free to use whatever you find helpful.
If you appreciate the work, please consider buying me a coffee ☕. Your support helps cover service costs and allows me to raise token limits for everyone.
I'm also open to job opportunities or sponsorship.
Thank you! 😊