GPU architecture diagram showing tiled attention computation with memory hierarchy

Build a FlashAttention-2 Kernel from Scratch in Triton

Build a production-grade FlashAttention-2 kernel from scratch in Triton, complete with tiled causal masking, FP16 accumulation, and PyTorch benchmarks to demonstrate deep GPU programming expertise.

September 20, 2026 · 14 min · 2927 words · martinuke0
Short description of the cover image subject.

Build a FlashAttention‑2 Engine from Scratch in Triton

A hands‑on guide to implementing FlashAttention‑2 in Triton, complete with tiled kernels, causal masking, and PyTorch autograd wiring — perfect for a standout CV project.

September 9, 2026 · 10 min · 1941 words · martinuke0
Diagram of tiled attention matrix blocks flowing through online softmax accumulation.

Building a FlashAttention-2 Forward Kernel in Pure NumPy

TL;DR — FlashAttention-2 is an IO-aware attention algorithm that fuses the softmax and matrix multiply into tiled CUDA kernels. We rebuild the forward pass from scratch in pure NumPy: blocking the QKV matrices into tiles, running a streaming softmax per block, and rescaling outputs online. The result is a runnable, testable side project that demonstrates memory-hierarchy thinking, numerical stability, and GPU-style programming patterns — exactly what hiring managers look for on a CV. ...

September 5, 2026 · 13 min · 2609 words · martinuke0

High Performance Inference Architectures: Scaling Large Language Model Deployment with Quantization and Flash Attention

Introduction Large Language Models (LLMs) such as GPT‑4, LLaMA‑2, and Falcon have demonstrated unprecedented capabilities across natural‑language understanding, generation, and reasoning. However, the inference phase—where a trained model serves real‑world requests— remains a costly bottleneck. Two complementary techniques have emerged as the de‑facto standard for squeezing every ounce of performance out of modern hardware: Quantization – reducing the numerical precision of weights and activations from 16‑/32‑bit floating point to 8‑bit, 4‑bit, or even binary representations. FlashAttention – an algorithmic reformulation of the soft‑max attention kernel that eliminates the quadratic memory blow‑up traditionally associated with the attention matrix. When combined, these methods enable high‑throughput, low‑latency serving of models that once required multi‑GPU clusters. This article walks through the theory, practical implementation, and real‑world deployment considerations for building a scalable inference stack that leverages both quantization and FlashAttention. ...

March 24, 2026 · 12 min · 2408 words · martinuke0
Feedback