Live data from Hacker News

Attention Is Off By One

evanmiller.org

231–240 of 347 posts

Re: Attention Is Off By One

#231
Here is an article that explains more about the outliers that emerge in large transformer models, which is what this modified softmax is being proposed to fix:

https://timdettmers.com/2022/08/17/llm-int8-and-emergent-fea...

The fact that these only emerge in larger models is likely one reason the author hasn't actually tried it.

Re: Attention Is Off By One

#232

Earlier quoted context omitted.

That simple comment is a strong counterpoint to the entire blog post? Except with the +1 denominator, it might be that the model trains all of the inputs to become very negative so softmax chucks out close to zeros, whereas it wouldn't bother before because making one prob bigger makes another smaller.

> it might be that the model trains all of the inputs to become very negative It still can't do this because of L2 regularization / weight decay. If two vectors are norm 1, their inner product is at least -1, so with 2000 vectors that's still 2000 * e^(-1) =~ 735. Not saying it's theoretically impossible that it could happen. But you would have to try _really_ hard to make it happen.

I guess you could add a sort of gating operation with a learnable parameter that sends the value to -inf if doesn't reach the threshold.

Of course it might have some other serious repercussions.

Re: Attention Is Off By One

#233
post #8

I don't really understand the subject matter enough, so I apologize in advance for the meta-comment... The author mentions that he would maybe have written this as a scientific paper: > I tried writing a serious-looking research paper about the bug and my proposed fix, but I lost a series of pitched battles against Pytorch and biblatex, so I figured I’d just write a blog post instead. (History is written by the winne…

It's interesting, because as a scientist who reads and writes these kinds of papers, my first impression was: This guy has a pretty big ego or is otherwise badly miscalibrated if he believes his genius idea has a "99.44%" chance of preventing outlier activations without doing any experiments.

Not ego, he's playing on the old Ivory Soap slogan "99+44⁄100% Pure"

https://en.m.wikipedia.org/wiki/Ivory_(soap)

Re: Attention Is Off By One

#234

The I know it's on-vogue on HN to complain about academia, but the blog post is not making a good argument. The post could have probably gotten the point across in less than 1/4 of the overall length (probably even less than 1/8th), instead the author wrapped the the post into lots of informalisms and a thinly veiled complained about academic publishing. The result of this is reflected in the discussion here, nobody…

Thats the fundamental reason we end up with an Attention Economy - People have limited Attention to pay to everything, But unlimited capacity/need to receive Attention (via Michael Goldhaber).

This plants the seed for the info explosion (those 200 bikeshedding comments or those 6 billion videos on how to boil an egg).

To counter it we have rankings of comments and links and news feeds from google to fb to hn. But its just another layer of bullshit cause most of the pool of what is being ranked is bullshit.

We are yet to design Information systems that take into account what Goldhaber said about Attention 3-4 decades ago.

Re: Attention Is Off By One

#235
I believe the author is correct. I've read the paper he's referring to and the code in the pytorch lib, and linked Google code from sibling posts. To me it is extremely impressive to have come up with a simple change to a known algorithm to deal with a recently identified issue. There is a strange, but very human, tendency to discount discoveries which are not novel. As if somehow genius and insight can only occur once. (It is, unfortunately, especially common among academics.) So I hope the author feels pride in being right and knowing enough to come to an excellent conclusion.

Re: Attention Is Off By One

#236
If I followed this correctly and didn’t mess up my indices, adding 1 to the softmax denominator is exactly equivalent to appending an extra zero to the softmax input (effectively casting an exp(0) vote for a new null option) and appending an extra row of zeros to V (so the null option is all zeros).

The latter seems like something training could figure out by itself (zero doesn’t seem like a hard place to land with the weights producing V, although a bunch of zero weights would be needed), but the former is a bit awkward, as QK^T is quadratic in the weights.

In any case, this seems intuitively quite reasonable. But I do wonder whether the 1 in the denominator (equivalent to an exp(0) vote) is the best choice if the goal is to quantize well. 0 is in the middle of the numerical range, and perhaps the implicit null vote should be weighted lower than the middle of the range.

Re: Attention Is Off By One

#237

Earlier quoted context omitted.

Nah, scientific papers are supposed to be precise and technical. This reads like those quite frequent suggestions here of switching all equations in papers to plain English or code: it honestly comes from a place of ignorance, and I say that as basically a layman myself. What should be encouraged is for academics to blog about their research as well. It would even help when recruiting and onboarding new members. Righ…

There was this sociologist who had written a paper for us all to read ahead of time. I started to read the damn thing, and my eyes were coming out: I couldn’t make head nor tail of it! I figured it was because I hadn’t read any of the books on the list. I had this uneasy feeling of “I’m not adequate,” until finally I said to myself “I’m gonna stop, and read one sentence slowly so I can figure out what the hell it mea…

Not an academic here, but I've read (and continue to read) through research papers regularly.

The original bitcoin paper is a great example. I was able to follow the paper almost fully at my first read itself—despite my not having a formal background in maths.

...and as you said, many of the insubstantial papers hide behind jargon and unnecessarily complex equations, just to camouflage their lack of substance. It's frustrating to spend time deciphering a paper, only to realize that you've essentially wasted that time.

Re: Attention Is Off By One

#238
I know we're not allowed to talk about neuroscience in AI threads, but the "megalodon" reference got me thinking about pyramidal cells in the brain. I mean, why are they so big? Maybe this isn't a problem, maybe it's an external bit of evidence that, no, really, some things matter a lot more. Which definitely jives with lived experience.

Re: Attention Is Off By One

#239

1. Summary The author is suggesting that we add 1 to the denominator of the softmax that is used within attention mechanisms (not the final output softmax). The softmax inside an attention unit allows it to see key/query matches as probabilities; those probabilities support a continuous-valued version of a key-value lookup (instead of 1/0 output of a lookup, we get weights where a high weight = the desired key-value…

Yea - the way we can "tell if this is good" is by

a) train two identical models on a large dataset, one with the +1 in the denominator for the softmax steps of the attention modules, one without

b) show that they have similar performance (doubt the +1 will make performance better, but we need to show it doesn't make things worse)

c) show that there are less "blowups" in the model with +1, and therefore they are more effectively quantized.

Re: Attention Is Off By One

#240

1. Summary The author is suggesting that we add 1 to the denominator of the softmax that is used within attention mechanisms (not the final output softmax). The softmax inside an attention unit allows it to see key/query matches as probabilities; those probabilities support a continuous-valued version of a key-value lookup (instead of 1/0 output of a lookup, we get weights where a high weight = the desired key-value…

The way I understood it, the author is saying that, with this change, big values disappear, and we can then use fewer bits to encode the output of transformers, which means reducing the memory requirements of the network. Memory being the limiting factor to running models large, this would be a big deal.

Yeah, good to bring it back to the original point. Reading the article felt exciting, but in hindsight I am now missing a key detail.

The equations all seem to be matrix operations with a fixed number of rows / columns (you can take me as a real layman here). Unless you change that, I don't understand _how_ you can reduce memory needs. Granted, I'm probably putting my foot in my mouth not understanding transformers.

Post reply on HN