/ Модель

Характеристики

Контекст
32 768 токенов
Параметры
14 млрд
Размер весов
29,5 ГБ
Архитектура
qwen3 · dense
Базовая модель
Qwen3-14B-Base
Библиотека
transformers
Опубликована
5 фев 2026

drkernel-14b

Генерация текстаТекст → текст3 профессии

Дообученная модель Qwen3-14B для генерации и итеративной оптимизации GPU-ядер, в особенности на Triton, с обратной связью от выполнения.

60скачиваний за 30 дней6лайковвеса обновлены6 фев 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

DR.Kernel-14B — дообученная HKUST-NLP языковая модель для генерации и оптимизации GPU-ядер, особенно на Triton, в рамках DR.Kernel. Она основана на Qwen3-14B и использует архитектуру Qwen3ForCausalLM: плотная модель примерно на 14,8 млрд параметров с контекстом до 32 768 токенов и весами BF16. Модель принимает описание задачи с эталонной реализацией PyTorch и генерирует оптимизированную реализацию ModelNew.

Обучение включает этап SFT на траекториях генерации и уточнения ядер, а затем многошаговое обучение с подкреплением. При оптимизации предполагается получать обратную связь о компиляции, корректности и производительности из среды KernelGYM, поэтому модель рассчитана на итеративную работу агента, а не только на однократную генерацию кода. Основные сценарии — исследование генерации ядер и бенчмаркинг, а также оптимизация Triton-кода.

Модель не предназначена для универсальной помощи в программировании, если отсутствует оценка ядер с выполнением. Сгенерированный код требует проверки перед применением, особенно в критически важных системах. Лицензия в предоставленной карточке не описана.

Сценарии применения

  • генерация Triton-ядер по эталонной реализации PyTorch
  • итеративная оптимизация GPU-ядер по результатам компиляции и выполнения
  • сравнительное тестирование генерации ядер на KernelBench
  • уточнение кода ModelNew по обратной связи о корректности и производительности

Ограничения

Модель специализирована на генерации и оптимизации ядер и не рассчитана на универсальные задачи программирования без обратной связи от выполнения. Сгенерированный код следует проверять; карточка не сообщает лицензию.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

DR.Kernel-14B

Model Paper

hkust-nlp/drkernel-14b is a Qwen3-14B-based model specialized for GPU kernel generation and optimization (especially Triton) in the DR.Kernel framework.

It is trained for iterative optimization with execution feedback from KernelGYM, rather than single-shot code generation only.

Model Summary

  • Model type: Qwen3ForCausalLM
  • Parameter count: 14,768,307,200 (from model.safetensors.index.json)
  • Weight dtype: BF16
  • Base model family: Qwen3-14B
  • Main capability: generate and iteratively refine optimized ModelNew kernel implementations from PyTorch reference tasks

Model Specs

From config.json:

  • num_hidden_layers: 40
  • hidden_size: 5120
  • intermediate_size: 17408
  • num_attention_heads: 40
  • num_key_value_heads: 8
  • max_position_embeddings: 32768
  • vocab_size: 151936
  • transformers_version: 4.56.0

From model.safetensors.index.json:

  • total_parameters: 14,768,307,200
  • total_size: 29,536,614,400 bytes
  • Expected checkpoint shards: model-00001-of-00007.safetensors ... model-00007-of-00007.safetensors

Training Recipe (DR.Kernel)

The 14B model follows the same two-stage DR.Kernel pipeline:

  1. Cold-start SFT
    • Dataset: hkust-nlp/drkernel-coldstart-8k
    • Multi-turn trajectory warm-up for kernel generation/refinement
  2. Multi-turn RL
    • Train dataset: hkust-nlp/drkernel-rl-data
    • Validation dataset: hkust-nlp/drkernel-validation-data (KernelBench Level 2 validation split)
    • Core methods: TRLOO + MRS + PR + PRS
    • Execution environment: KernelGYM with compilation/correctness/performance/profiling feedback

Related training scripts in this repo:

  • drkernel/kernel/scripts/sft/14b-coldstart.sh
  • drkernel/kernel/scripts/rl/14b_trloo_mrs_pr_prs.sh

Intended Use

  • Kernel generation research and benchmarking
  • Triton kernel optimization with iterative feedback
  • Multi-turn agentic code refinement under execution-based reward

Not Intended Use

  • Safety-critical production deployment without additional verification
  • General-purpose coding assistant use where kernel-evaluation feedback is unavailable

Prompting Format

The model is trained with kernel-optimization prompts that:

  • Provide a PyTorch reference architecture (Model, get_inputs, get_init_inputs)
  • Require returning an optimized ModelNew
  • In multi-turn settings, append server feedback and request iterative improvement

For best behavior, keep the same task style as DR.Kernel datasets and use chat-format messages.

Quick Start (Transformers)

Use the same fixed 1-shot first-turn prompt template as DR.Kernel data (recommended):

import textwrap
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "hkust-nlp/drkernel-14b"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)

ref_code = textwrap.dedent(
    """
    import torch
    import torch.nn as nn

    class Model(nn.Module):
        def __init__(self):
            super().__init__()

        def forward(self, x):
            x = torch.abs(x)
            x = x - 1.0
            return x

    def get_inputs():
        return [torch.randn(64, 128)]

    def get_init_inputs():
        return []
    """
).strip()

example_ref_code = textwrap.dedent(
    """
    import torch
    import torch.nn as nn
    import torch.nn.functional as F

    class Model(nn.Module):
        def __init__(self) -> None:
            super().__init__()

        def forward(self, a, b):
            return a + b

    def get_inputs():
        # randomly generate input tensors based on the model architecture
        a = torch.randn(1, 128).cuda()
        b = torch.randn(1, 128).cuda()
        return [a, b]

    def get_init_inputs():
        # randomly generate tensors required for initialization based on the model architecture
        return []
    """
).strip()

example_kernel_code = textwrap.dedent(
    '''
    import torch
    import torch.nn as nn
    import torch.nn.functional as F
    import triton
    import triton.language as tl

    @triton.jit
    def add_kernel(
        x_ptr,  # Pointer to first input
        y_ptr,  # Pointer to second input
        out_ptr,  # Pointer to output
        n_elements,  # Total number of elements in input/output
        BLOCK_SIZE: tl.constexpr,
    ):
        # Each program handles a contiguous block of data of size BLOCK_SIZE
        block_start = tl.program_id(0) * BLOCK_SIZE
        # Create a range of offsets [0..BLOCK_SIZE-1]
        offsets = block_start + tl.arange(0, BLOCK_SIZE)
        # Mask to ensure we don't go out of bounds
        mask = offsets < n_elements
        # Load input values
        x = tl.load(x_ptr + offsets, mask=mask, other=0.0)
        y = tl.load(y_ptr + offsets, mask=mask, other=0.0)
        # Perform the elementwise addition
        out = x + y
        # Store the result
        tl.store(out_ptr + offsets, out, mask=mask)

    def triton_add(x: torch.Tensor, y: torch.Tensor):
        """
        This function wraps the Triton kernel call. It:
          1. Ensures the inputs are contiguous on GPU.
          2. Calculates the grid (blocks) needed.
          3. Launches the Triton kernel.
        """
        assert x.is_cuda and y.is_cuda, "Tensors must be on CUDA."
        x = x.contiguous()
        y = y.contiguous()

        # Prepare output tensor
        out = torch.empty_like(x)

        # Number of elements in the tensor
        n_elements = x.numel()
        BLOCK_SIZE = 128  # Tunable parameter for block size

        # Determine the number of blocks needed
        grid = lambda meta: ((n_elements + meta["BLOCK_SIZE"] - 1) // meta["BLOCK_SIZE"],)

        # Launch the Triton kernel
        add_kernel[grid](x, y, out, n_elements, BLOCK_SIZE=BLOCK_SIZE)
        return out

    class ModelNew(nn.Module):
        def __init__(self) -> None:
            super().__init__()

        def forward(self, a, b):
            # Instead of "return a + b", call our Triton-based addition
            return triton_add(a, b)
    '''
).strip()

prompt_template = textwrap.dedent(
    """\
    You write custom Triton kernels to replace the pytorch operators in the given architecture to get speedups.

    You have complete freedom to choose the set of operators you want to replace. You may make the decision to replace some operators with custom Triton kernels and leave others unchanged. You may replace multiple operators with custom implementations, consider operator fusion opportunities (combining multiple operators into a single kernel, for example, combining matmul+relu), or algorithmic changes (such as online softmax). You are only limited by your imagination.

    Here's an example to show you the syntax of inline embedding custom Triton kernels in torch: The example given architecture is:

    ```python
    {example_ref_code}
    ```

    The example new arch with custom Triton kernels looks like this:

    ```python
    {example_kernel_code}
    ```

    You are given the following architecture:
    ```python
    {ref_code}
    ```

    Optimize the architecture named Model with custom Triton operators! Name your optimized output architecture ModelNew. Output the new code in codeblocks. Please generate real code, NOT pseudocode, make sure the code compiles and is fully functional. Let's think step by step.
    """
).strip()

prompt = prompt_template.format(
    example_ref_code=example_ref_code,
    example_kernel_code=example_kernel_code,
    ref_code=ref_code,
)
messages = [{"role": "user", "content": prompt}]

inputs = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    return_tensors="pt",
).to(model.device)

with torch.no_grad():
    outputs = model.generate(
        inputs,
        max_new_tokens=2048,
        do_sample=True,
        temperature=1.0,
        top_p=1.0,
    )

# Only print newly generated tokens
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=False))

Evaluation

Use KernelGYM-based evaluation scripts in this repo:

  • drkernel/kernel/scripts/eval/drkernel-14b-maxturns3.sh
  • drkernel/kernel/scripts/eval/grading_common.sh for custom evaluation runs

Validation data:

  • hkust-nlp/drkernel-validation-data (KernelBench Level 2 validation tasks)

Data and Attribution

Please acknowledge original dataset/benchmark authors when using this model.

Related Resources

Citation

@article{liuetal2026,
  title={Dr.Kernel: Reinforcement Learning Done Right for Triton Kernel Generations},
  author={Wei Liu, Jiawei Xu, Yingru Li, Longtao Zheng, Tianjian Li, Qian Liu, Junxian He},
  journal={arXiv:2602.05885},
  year={2026}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Qwen3ForCausalLM
Ревизия весов
9982aff

0 моделей