AI Engineer

Weight Folding, CUDA Streams, and the Bug That Made My Model Speak Backwards — Filip Makraduli

Sep 19, 2026 17 min
transformer architecturecudamodel optimizationinferencerms-norm
Watch on YouTube Follow AI Engineer on Rundown — free

Summary

AI summaries can be incomplete or wrong. Verify anything important against the original video.

Filip Makraduli explains the 'FlashNorm' technique, which uses algebraic optimizations to make the RMSNorm layer in transformer models faster and cheaper to compute. He also covers his experience implementing these optimizations in CUDA, including a challenging debugging journey involving race conditions in GPU streams.

In this technical deep-dive, Filip Makraduli presents 'FlashNorm,' a method to optimize the RMSNorm layer standard in modern transformer architectures. By applying simple algebraic rearrangements, he demonstrates how to fold scaling weights and defer the division operation, significantly reducing computation time. The presentation details three specific propositions for rewriting the layer, showing how they can be combined or simplified to achieve efficiency gains. A major part of the talk focuses on the practical challenges of implementing these changes in CUDA. Makraduli details how he attempted to parallelize the matrix multiplication and normalization steps using multiple CUDA streams, which led to a 'race condition' bug that caused his model's output to repeat words or display lag. He explains the root cause—the implicit join between streams—and provides the solution by adding explicit synchronization events to ensure data integrity. Finally, he discusses how these optimizations can be deployed using the 'Superlinked' inference engine to serve Hugging Face models, emphasizing the benefits of self-hosting and full stack control for production performance.

Methods & findings

Locked

Claims & arguments

Locked

Key Points

Locked

Worth watching if: You are an AI engineer or researcher working on inference optimization, CUDA development, or transformer model deployment and want to learn about practical kernel-level performance improvements.

Sign in to unlock the full extract

Every claim, key point, and timestamp for this AI Engineer video — plus a daily email of every channel you follow.

Sign in with Google

No credit card. Free tier forever.

Watch on YouTube