r/MachineLearning • u/4rtemi5 Researcher • Aug 16 '26
Research SSOG-Attention: Sum Of Separable Gaussians as a sub-quadratic and scalable alternative to SDPA. [R]
Scaled dot-product attention (SDPA) computes its Attention by computing the similarity-scores of all image-tokens with all query tokens which results in O(N²·d) complexity. SSOG (Sum Of Separable Gaussians) instead learns a few Gaussian atoms for each head and only geometrically steers them based on the query token. Since the atoms can be factorized into a separable sum of Gaussians this leads to a reduced complexity of O(N·√N·d). Experiments show that SSOG clearly beats SDPA on small data (cifar100), and delivers equivalent performance and much faster convergence on bigger datasets like IN1k. All that while being much faster and memory efficient with increasing scale.
Have a look at the full blog-post and repo to see more results and ablations and let me know what you think.
Blog-post: https://pisoni.ai/posts/ssog
Repo: https://github.com/4rtemi5/ssog
*AI was used for some of the code and some of the blog-post but I put a lot of effort into this project and stand behind every word.
26
u/log_2 PhD Aug 16 '26
Nice work. Have you looked into using a box kernel to approximate the Gaussian kernel? You only need 3 or 4 passes to very closely approximate a Gaussian, but in your case you may even get away with 1 or 2. Also separable so lets just consider 1D. You can compute the cumulative sum across the image, then the compute the box kernel simply by subtracting the edges of the kernel window. You get multiple atoms pretty much for free.
6
u/pm_me_your_pay_slips ML Engineer Aug 16 '26
Have you looked at the Gaussian processes literature? E.g exploiting kernels with kronecker structure so you never have to explicitly build the N2 kernel matrix
2
u/Useful_Hat_5259 Aug 27 '26
Great work! I'm also working on image editing research, and the MoG approach gave me some interesting ideas that could be useful for my work.
Have you looked at multi-instance cases as well? I was wondering if it might be challenging to distinguish between similar objects when they're overlapping or very close together.
7
u/qenis Aug 16 '26
"Is This New? Honest answer — I've been on the wrong side of this question: the ingredients are all published."
Why is the blog post AI-generated? Is the research also AI-generated?
3
u/arcandor Aug 16 '26
I like the graphics and the write up, thank you for sharing.
How would you approach applying this to language? Image/video attention is inherently spatial (hence why geometric worked?) versus text where long range dependencies that could invert the semantic meaning entirely. It's a sufficiently different problem, with a higher number of dimensions, that would likely require a fundamental change in the approach.
4
u/RobbinDeBank Aug 16 '26
This looks really cool. I love seeing some works in making learning more efficient, contrary to the current trend of just scaling up.
1
u/farewellrif Aug 17 '26
Does this require tensor cores? SDPA does not, which is great for old hardware.
2
u/joyj925 Aug 21 '26
solid approach to reducing attention complexity.
3
u/No-Cheetah-6338 Aug 16 '26
Lol at all the people whining about ai written blog post. Let them fall behind.
Great work and thanks for sharing.
-2
u/seg_lol Aug 16 '26
Am I having a stroke? What are we looking at here?