Systems & AI Infrastructure
LightServe
High-Throughput LLM Inference Engine
Problem
Vanilla PyTorch LLM generation suffers from KV-cache memory fragmentation and wastes GPU compute when batching requests of variable sequence lengths.
Solution
Built a custom inference engine implementing PagedAttention for virtual KV-cache paging, iteration-level continuous batching, and a speculative decoding loop using a 100M draft model.
Architecture
gRPC server with token-streaming; scheduler with dynamic batching; block-paged KV-cache memory manager; custom Triton attention kernels; speculative verification logic with rollback.
Real-World Impact
Benchmarked at 3.4x higher throughput over HuggingFace generate() under concurrent load, with 58% reduction in GPU memory fragmentation and sub-80ms TTFT at batch sizes of 32.
Challenges Faced
Implementing online softmax normalization within tiled SRAM processing across non-contiguous KV-cache pages.
Key Learnings
Deep understanding of GPU memory hierarchy (HBM vs SRAM), memory-bandwidth vs. compute-bound regimes, and roofline model analysis.