# Custom Triton Kernel Lab: Cross-Entropy + Ignore-Index — Unsloth-Style Speedup

> Source: https://sukruyusufkaya.com/learn/fine-tuning-cookbook/ftc-custom-triton-kernel-cross-entropy
> Updated: 2026-08-13T07:51:08.605Z
> Category: Fine-Tuning Cookbook (Model-by-Model)
> Module: Part XIII — Custom Kernels & Performance Surgery
**TLDR:** PyTorch native \`F.cross_entropy(ignore_index=-100)\` LLM training'in en çağrılan kernel'larından biri. Naïve implementation Triton ile %30 daha hızlı yapılabilir. Cookbook'un Lab'ı: fused logits + softmax + CE + grad → tek kernel. Unsloth'un kullandığı pattern. RTX 4090'da 8B model FT throughput +%15.

