15-year-old builds sliding window attention from scratch: 4.16x speedup, 21% less VRAM

vankownlaw · reddit · 2026-10-31

A 15-year-old developer implemented custom Sliding Window Attention from scratch to tackle the VRAM bottleneck of long-context inference on consumer GPUs. The approach physically truncates old tokens via chunking before computing the QxK matrix, avoiding massive NxN matrices and OOM errors.

Benchmark on a Tesla T4 (15,000 tokens, FP16):

The author acknowledges FlashAttention exists but built this to understand the mechanics; code isn't public yet. They're asking whether the approach is viable for video processing and what bottlenecks would appear at 100k+ tokens.

Original post →

More from Infra

Infra channel →