Makraduli says two algebraic changes can make RMSNorm cheaper and faster. Though the layer accounts for little of the computation, it can run around 33 times in a decode step, so its launch and memory costs add up.
Weight Folding, CUDA Streams, and the Bug That Made My Model Speak Backwards
Speaker
Filip Makraduli, a co-author of the FlashNorm paper, explains how RMSNorm optimizations and CUDA stream coordination can speed transformer inference; his company and the event venue are not stated.
The paper describes folding the normalization gain into a matrix offline and deferring a scalar division so it can run alongside matrix multiplication. For architectures with two scale-invariant normalization steps, one can be removed. The repo includes a `flashify` command for weight folding; the deferred operation needs kernel work.
While implementing the parallel operations, Makraduli saw repeated text and a one-step lag during long generations. His stream join was implicit, so post-scaling could read a buffer before matrix multiplication had finished. Making the join explicit and waiting for both streams fixed the race; unit tests and perplexity checks had not exposed it.
The paper reports experiments mostly on Llama models, and Makraduli says the technique can also work with other architectures, `torch.compile`, and quantized models. He points to the Transformer Tricks and Hugging Face model repos for code and checkpoints. He also describes using Superlinked's inference engine and cluster to deploy and test open models, including smaller models sharing a GPU.
Takeaways
- Count kernel launches and memory movement when profiling layers with little arithmetic; repeated RMSNorm calls can still add wall time.
- Precompute weight folding offline to reduce repeated work during inference.
- When overlapping CUDA streams, add explicit dependencies before a consumer reads a shared buffer.
- Test long generations as well as unit tests and perplexity; stale-buffer races may emerge only over time.
- Keep inference flexible enough to deploy custom checkpoints and kernels when testing research ideas.
Mentioned in this talk
Search inside this talk
What was claimed 9
- builtNils Graef built FlashNorm
“Niels Graf, who created the approach.”
YouTube Verified2 sources· Talk, Web· archived
- metricRMSNorm: Can be started around 33 times in one decode step during inference, depending on the model
“RMSNorm can be started around 33 times.”
YouTube Unverified1 source· Talk
- featureWeight folding: Folds the gain and weight into one matrix, computed offline
“The gain and the weight are folded into one matrix, W”
YouTube Unverified1 source· Talk
- featureDeferred normalization: Defers the scalar division so it can run in parallel with matrix multiplication
“deferring the scalar divide of the matmul so that they can be done in parallel”
YouTube Unverified1 source· Talk
- builtFilip Makraduli built FlashNorm
“The idea was to do this in parallel ... to actually test out this concept.”
YouTube Unverified1 source· Talk
- featureFlashNorm: Runs matrix multiplication and RMS computation in parallel using matrix and vector units
“the matrix unit computes the matmul and the vector unit computes the RMS”
YouTube Unverified1 source· Talk
- feature
Transformer Tricks: Includes a flashify command that applies pre-position weight folding to a model“run `flashify`, and it does that”
YouTube Unverified1 source· Talk
- featureSuperlinked Inference Engine: Supports deploying Hugging Face models on a cluster
“a good way to deploy any Hugging Face model”
YouTube Unverified1 source· Talk












