Sign in

Raphael Pisoni

@4rtemi5.bsky.social
3.2K followers 467 following 209 posts

Unsupervised multimodal representation of a learning researcher. www.pisoni.ai

PostsRepliesMedia
Raphael Pisoni @4rtemi5.bsky.social · 03/09/2026
Lots of people are smarter than me but my unfair advantage is that I'm dumb enough to try!
020
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
And finally please share the blog, the repo and this thread so people find out about SSOG!🚀 The more people start using it, the more GPU-hours free up for the rest of us!🤞
001
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
If you need even more numbers and plots to be convinced head over to the SSOG blog-post! Feedback welcome! pisoni.ai/posts/ssog/ And if you want to dive right into the code check out the minimal repo and mess with it! Stars welcome!🤩 github.com/4rtemi5/ssog
pisoni.ai
A Few Gaussians Is All You Need: SSOG-Attention That Steers Instead of
What if attention didn't need content scores? A handful of Gaussians per head, steered but never scored by content, matches and beats dot-product attention on ImageNet, wins by 17 points on small data
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
100
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
Might not sound super-impressive yet but SSOG does all that while being significantly smaller for the same architecture, running much faster and just generally scaling much better! Free lunch served?
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
Seems like it does! On small data (i.e. CIFAR100) SOOG completely destroys an equivalent ViT with SDPA and beats it by 17% top-1 Accuracy. On Imagenet-1k things get a bit closer. SSOG wins by much less but converges much faster and stays ahead throughout the training.
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
But how can that be more efficient? The cool thing about Gaussians is that they are linearly separable so you can compute the whole field with two 1D filter passes. SDPA complexity is O(N²d). SSOG only needs O(N√Nd). Scaling that sounds great but does it actually *work*?
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
This is the exact concept behind SSOG. Each Attention-head has a few learned Gaussian atoms that it moves along with the query. It only slightly adjusts the parameters of those atoms based on the query-token.
111
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
When You look at a birds wing you don't compare it to every other patch in your field of view. You know where to look from prior experience and the content only slightly adjusts those learned priors. A bit left, a bit up (is that the head?), further out (where does the wing end?)
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
Current Vision-Transformers use SDPA which means that for each query-token they look at and score every other token across the entire image. This gives the model a lot of options to learn patterns, but it's also super expensive and scales with N² over the number of tokens. 🥺
101
Raphael Pisoni @4rtemi5.bsky.social · 19/08/2026
What if I told you that Scaled Dot-Product Attention (SDPA) doesn't make a whole lot of sense for ViTs and you can get faster convergence, better performance and near-linear scaling with a few well-steered Gaussians? Let me introduce you to SSOG (Separable Sum Of Gaussians)!
131
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
I wrote up the full explanation and math and even implemented super-fast Triton kernels: www.pisoni.ai/posts/scaled... Small-scale runs look surprisingly stable, but obviously, we need to scale up experiments to see how these dynamics hold up. Let me know if you ca help with that!
pisoni.ai
Scaled RBF Attention: Trading Dot Products for Euclidean Distance
If you crack open the architecture of almost any modern Transformer, you will find Scaled Dot-Product Attention (SDPA) sitting at its core. We rarely second-guess it. It is heavily optimized by hardwa
000
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
Because RBF Attention actively avoids the explosion of pre-norm magnitudes, you don't need QK-norm. The network maintains healthy gradient flow natively, and you drop the weird tangent-drift artifacts entirely.
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
That term acts as a built-in, dynamic L2 regularizer. The architecture itself actively penalizes large keys. It naturally keeps vector magnitudes in check without ever forcing a projection onto a hypersphere.
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
Scaled RBF Attention offers a pretty clean workaround. If you measure similarity using negative squared Euclidean distance (-||Q - K||²) instead of a dot product, due to the softmax we end up with (Q⋅K)−||K||².
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
Because of this, with every single optimization step, the pre-norm vector length increases. As these vectors inflate, the gradients shrink toward zero. This geometric drift is one reason for why we actually need weight decay. To constantly drag parameter norms back down.
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
But why would those unnormalized vectors get so big in the first place? Think about the geometry. When your optimizer takes a linear step on a circular surface (the normalized hypersphere), the update vector inherently points outward along the tangent.
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
The problem hides in the backward pass. While the forward pass becomes scale-invariant, the gradients flowing backward through the norm layer actually scale inversely with the unnormalized inputs. Big pre-norm vectors --> tiny gradients.
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
QK-norm is definitely the industry standard right now. It stops "magnitude bullying" by projecting queries and keys onto a hypersphere before taking the dot product and makes training more stable. Sounds great right?
100
Raphael Pisoni @4rtemi5.bsky.social · 17/04/2026
I never really considered how dangerous QK-norm actually is before working on RBF Attention. While solving some obvious issues, it can be the cause of some much less obvious ones.🧵
131
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
I've packed up everything so you can try it on your own data and use cases. Let me know what you find!! Blog-post: pisoni.ai/posts/halo/ Code: github.com/4rtemi5/halo BTW I'm also currently looking for ML research roles so let me know if you know something or someone! ;)
pisoni.ai
Soap Bubbles and Attention Sinks: The Theory and History of the HALO-L
The standard Cross-Entropy loss has a well-known flaw: it forces neural networks to push their features toward infinity just to reach full confidence. The result is a messy latent space and models tha
020
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
These kinds of results are huge for safety critical classification, fighting SSL-collapse or for multimodal models like CLIP that need robust rejection thresholds. If you're working on representation learning and have the resource to scale these results up let me know.
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
Usually, better Out-of-Distribution (OOD) detection means you pay a "safety tax" and lose base accuracy. With HALO, that penalty vanishes. On CIFAR-10 (ResNet-18): • Base accuracy is maintained • ECE drops from ~8% down to 1.5% • OOD False Positives (FPR@95) cut by >50%
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
With a little high school math we can make this loss super efficient and even avoid the curse of dimensionality that plagues these kinds of losses.
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
Then wire a virtual K+1 class permanently to the origin. This creates a mathematically sound, zero-parameter "Abstain Class". Outlier data naturally falls into this origin sink.
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
This leads to radial explosion and a jagged latent space and allows the model to overconfidently hallucinate on pure noise. The fix? First switch to L2 distances instead of dot-products. Maximum confidence now maps to a finite location (distance = 0) rather than an asymptote.
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
The root of the problem are the inputs to the Categorical Cross-Entropy: Unconstrained Dot-Products. Because of how the Softmax function works, to reach 100% confidence, the network is forced to push its features infinitely far away. There is no finite "perfect" score.
100
Raphael Pisoni @4rtemi5.bsky.social · 08/04/2026
Neural networks have a fundamental problem. Feed them garbage data and instead of admitting that they are confused, they will confidently hallucinate. I just open-sourced the HALO-Loss to try and fix this. It give the model a mathematically sound *I don't know!* button.🧵
120
Raphael Pisoni @4rtemi5.bsky.social · 01/04/2026
Blog-Post: pisoni.ai/posts/scaled... Code: github.com/4rtemi5/rbf_...
pisoni.ai
Scaled RBF Attention: Trading Dot Products for Euclidean Distance
If you crack open the architecture of almost any modern Transformer, you will find Scaled Dot-Product Attention (SDPA) sitting at its core. We rarely second-guess it. It is heavily optimized by hardwa
110
Raphael Pisoni @4rtemi5.bsky.social · 01/04/2026
I dove deeper into the rabbit hole of RBF-Attention. I refined the Triton kernel, added register-tokens and developed SuSiE positional embedding as a replacement for RoPE in Euclidean space. Go have a look at the repo or the blogpost in the comments if you're interested! :)
120
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
Yes it's all in the there! Probably much more than you need to get started! :)
010
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
FYI: bsky.app/profile/4rte...
010
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
I'm open sourcing all my code for scaled RBF-Attention. If you want to roast my triton knowledge or want to check how far you have to scale things to make them break, feel free to have a look!😅 github.com/4rtemi5/rbf_...
github.com
GitHub - 4rtemi5/rbf_attention
Contribute to 4rtemi5/rbf_attention development by creating an account on GitHub.
110
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
Obvious caveats before I sound crazy: Scale: I've only tested this on tiny models and data. It all might collapse on larger models. Performance: The triton kernel works but it's a first pass. It won't outperform proper Flash-Attention anytime soon.
100
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
I trained a few models on the tiny-stories dataset and they not only converge well, but consistently seem to outperform standard SDPA.🤯
110
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
To get a semi-fair comparison of the speed and memory reqs I implemented the whole thing as a custom Triton kernel (heavily inspired by Flash-Attention by Tri Dao) and my first shot fares quite well against the hyper optimized torch implementation.
100
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
Because of that matmul the heavy lifting is still fast on GPU and the L2 norms are just lightweight additions you can broadcast on top.
100
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
Computing the full NxN distance matrix sounds like a great way to OOM and tank your speed but using a simple math trick you can expand the squared distance and use a matmul: ||q-k||² = ||q||² + ||k||² - 2(q@k.T)
120
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
The geometric intuition is pretty simple: standard attention uses dot-product similarity, which means it cares about angle and magnitude between key and query. RBF uses the euclidean distance instead, so it measures how close the vecors actually are in space.
100
Raphael Pisoni @4rtemi5.bsky.social · 28/03/2026
For some reason I decided to swap out standard dot-product attention for a scaled-rbf kernel. Pretty much expected it to fail to converge or be impossibly slow but the scaled-rbf-attention is getting unexpectedly good results?? 👇
Plot of two loss curves were rbf-attention consistently outperforms scaled dot-product attention.
120
Raphael Pisoni @4rtemi5.bsky.social · 26/03/2026
Sorry for vagueposting but I was too excited to not post at all.😅 Will share more soon!🤞
110
Raphael Pisoni @4rtemi5.bsky.social · 26/03/2026
Playing with a new kind of attention. Plots are for the same setup with standard vs. modified attention on one epoch of tiny-stories. Speed is roughly the same as flash-attention. Looking good!🤞
131
Raphael Pisoni @4rtemi5.bsky.social · 31/01/2026
Diligent people can now run that rigorous process 100x faster. They don't use AI to skip the thinking. They use it to scale their standards. The gap between people who care to look stuff up and people who don't isn't shrinking. It's about to become unbridgeable! #AI #FutureOfWork
000
Raphael Pisoni @4rtemi5.bsky.social · 31/01/2026
But for diligent people AI is a game changer! Think about the person who already cared about checking edge cases, looking up standard protocols and validating assumptions. Previously, that rigor was expensive. It took hours. It was the bottleneck. Now that friction is gone!
100
Raphael Pisoni @4rtemi5.bsky.social · 31/01/2026
So while many people assume AI is a tool for the lazy, if you were lazy before AI (operating on "vibes," skipping research, trusting your gut over data), AI is a trap. You will just generate "synthetic vibes" faster. You won't spot the hallucinations. You will produce high-volume mediocrity.
100
Raphael Pisoni @4rtemi5.bsky.social · 31/01/2026
The hard truth is: Most "knowledge work" (even at high levels) isn't actually novel reasoning. It is retrieval + synthesis of known strategies to a very high standard.
100
Raphael Pisoni @4rtemi5.bsky.social · 31/01/2026
AI isn't coming for your creativity. It's coming for your lack of diligence. People talk a lot about #AGI and "super-intelligence," but the immediate disruption is much simpler: AI is killing "vibe-based" decision-making.
100
Raphael Pisoni @4rtemi5.bsky.social · 23/01/2026
Thanks a lot! Means a lot from you!
010
Raphael Pisoni @4rtemi5.bsky.social · 23/01/2026
Over the past year Michał Lewandowski and I published a series of papers on Space Folding , and while Michał went to #AAAI to present the latest one, I worked on a blog-post explaining some the central ideas behind the papers. Let me know what you think! www.pisoni.ai/posts/space-...
pisoni.ai
The Shape of Thought: Space Folding in Neural Networks
The mathematical description of deep learning has long been dominated by the language of algebra: matrices, gradients, and optimization landscapes. A parallel and perhaps more intuitive language howev
050
Raphael Pisoni @4rtemi5.bsky.social · 23/01/2026
After a long hiatus I decided to update my blog and write about some of the things I did over the last few years. Come have a look! pisoni.ai
130