News for hackers. Stuff that matters.
Re:Tensor Product Attention Is All You Need by lostmsu on Friday January 24, 2025 @10:19AM (#42813906)
If you have a batch of size 1, for every token you need to load the entire model from memory into cache as you go through it. If it is 32 you can produce 32 tokens while doing the same amount of loading from VRAM.
Re:Tensor Product Attention Is All You Need by menaerus on Friday January 24, 2025 @12:43PM (#42815493)
That's not how it works because if what you're saying had been true then the self-attention memory complexity would be O(1), e.g. regardless of the batch size. This obviously isn't the case since each batch computation necessitates it's own load/store memory bandwidth. I suggest reading one of the transformers papers to really understand how it works.
Re:Tensor Product Attention Is All You Need by lostmsu on Friday January 24, 2025 @02:04PM (#42816067)
This was a simplification. Of course you need some extra VRAM I/O based on your KV cache size.

But assuming your KV cache size is << model size, that simplification is pretty accurate.

See, e.g. https://www.databricks.com/blog/llm-inference-performance-en...

You can just scroll to the first chart they have that explains the idea.