News for hackers. Stuff that matters.
Re:Show HN: LLM Attention Visualization by stared on Tuesday September 08, 2026 @02:49PM (#49614902)
I am curious what's the actual formula.

I mean, there so many headers and layers, it is tricky to make a choice that will resonate with our intuition . Is it some weighted average? Or maybe ablation test?

Re:Show HN: LLM Attention Visualization by ifz on Tuesday September 08, 2026 @03:00PM (#49615081)
It's really simple, basically just the magnitude of the value vector, weighted by QK dot product, summed across all attention heads and layers.

When I started, I expected I'd have to experiment a lot to find something comprehensible. But this simple computation can already show some patterns.

Re:Show HN: LLM Attention Visualization by stared on Tuesday September 08, 2026 @03:19PM (#49615442)
Nice! Sometimes the simplest approaches work the best.
Re:Show HN: LLM Attention Visualization by nullbio on Wednesday September 09, 2026 @08:20AM (#49625338)
Might be cool to try different colors for the different attention heads instead of summing them across all attention heads, and making the backgrounds composed of stacked color layers? So you can see how each attention head attends to tokens individually.
Re:Show HN: LLM Attention Visualization by visarga on Tuesday September 08, 2026 @03:18PM (#49615415)
If you want quick access look at google images for "transformer attention formula" there are some interesting depictions