86 points bcaulfield 3 days ago 97 comments
readthenotes1 3 days ago | parent
hsavit1 3 days ago | parent
calf 3 days ago | parent
greenavocado 3 days ago | parent
jvanderbot 3 days ago | parent
Of course, attention is almost certainly a heuristic readers use, but to even bring it up as key to intelligence begs so many questions about LLMs and the mind...
kelseyfrog 3 days ago | parent
jvanderbot 3 days ago | parent
And suddenly we're looking at people who read ticker tape or by following with their finger for insights into neuroscience?
kelseyfrog 3 days ago | parent
We survived comparisons to hydraulics, clockwork, steam, circuits, information processing, and networks. I'm positive we'll survive comparisons to attention and models too.
If it's an argument from pedantism, let us remind ourselves to be language descriptivist than language prescriptivists. Prescriptivists never win.
KingMob 3 days ago | parent
So instead of being a useful, if imperfect, analogy from an outside domain, trying to use ML attention to understand biological attention just results in confusion (like this article).
Neuroscientists aren't going to tell ML researchers they can't use "attention", but nor are they going to pay attention to them (pun intended). Neural networks are almost always too divergent from biology to shed light on real neurons.
kelseyfrog 2 days ago | parent
1. https://www.thoughtco.com/polysemy-words-and-meanings-169164...
customguy 3 days ago | parent
parodysbird 3 days ago | parent
j16sdiz 3 days ago | parent
--
A computer can't read a file, it is just sending electric signal, sensing the voltage, probing the magnetic field, etc.
"read" a file is anthropomorphized terms for what the machine do when processing a file.
--
Maybe we should just stop worrying and embrace the new meaning of those words?
KingMob 3 days ago | parent
As a former perceptual neuroscientist, I can assure you that ML "attention" has very little to do with biological attention.
reverius42 3 days ago | parent
KingMob 1 day ago | parent
E.g., a high-level auditory neuron might primarily fire in response to high-pitched voices, but if you hear someone say your name in a high-pitched voice at a party, you can bias that neuron to try more selectively fire in response to just their voice, "tuning out" similarly-pitched voices.
vinceguidry 2 days ago | parent
When you think about it that way, you can bridge the two types of cognition more usefully. The how of intelligence, what attention consists of, can remain completely different, while the why can feel so universal that humans can easily forget they're talking to a machine.
KingMob 1 day ago | parent
How attention affects biological neurons has little in common with the ML mechanism of attention.
Salience explains the "why", but I'm talking about the "how".
adventured 3 days ago | parent
People are doing what people do: they're desperately moving the goal post to keep pretending humanity is particularly special and that intelligence is particularly special. Unique snowflakes and all that, we're the center of the universe. It's nothing more than elaborate human weakness & fragility on display.
We're in the first inning of this, intelligence is not going to end up being special, it's going to be trivial and low cost. See: Chinese models ten years from now.
Astra, Opus, Fable, Argon - they're all radically beyond the top 1% of humanity intellectually already, and it's going to get a lot worse quickly. The sole aspect the top 1% beat them on, and increasingly rarely, is at hyper specialization, where a person is elite at what they do. For $20-$100-$200 per month I can get access to an omnimath genius intellect far beyond any human that has ever existed, and that AI will work for me like a dog. Humanity should be scared, and the reason HN hates AI so much, is because it will wipe out very large numbers of their lucrative jobs that they imagined would form long-term careers (six figures, stock options, path to wealth, elitism re competition).
AngryData 2 days ago | parent
0xWTF 3 days ago | parent
https://www.quantamagazine.org/is-attention-the-essence-of-i...
"Sentences with pronouns such as “it” in them illustrate the challenge that attention overcomes. Consider: “The animal didn’t cross the street because it was too tired.” And: “The animal didn’t cross the street because it was too wide.” To translate these sentences correctly into French, an AI model must determine that, in the first one, “it” refers to the animal, which is a masculine word in French, so the translation should use that form of the pronoun, il. But in the second sentence, “it” refers to the street, a feminine word that requires a different pronoun, elle. How can the machine figure this out?"
"Bahdanau remembered doing translation exercises when he was learning English in school. To write each next word of his translated sentence, he’d have to glance all around the source text to figure out what should come next. “Literally you have your source sentence on the left and your writing on the right, and you’ll be, like, turning your head, left-right, left-right,” he said. “That process is what I expressed as a neural mechanism.”
That simplicity seems to me the real tell that this is the real insight. The author does a good job of walking the ready past a long list of distractors and conjuring a sense of a path to an insight, and then, there's the insight - a simple encoding of a simple task: "What is the next word? How do I figure that out? Left-right. Left-right"
pu_pe 3 days ago | parent
wyager 3 days ago | parent
tomrod 3 days ago | parent
hn_submit 3 days ago | parent
mhl47 3 days ago | parent
fyredge 3 days ago | parent
hn_submit 3 days ago | parent
hn_submit 3 days ago | parent
segmondy 3 days ago | parent
antics 3 days ago | parent
Most of the semantics of a sentence are indicated by the precise order the tokens appear. This is easiest to see in a language like English, since it is visible in two very prominent ways.
First, the morphology is fairly derivational, meaning you can keep adding suffixes to things and English speakers will generally get what you mean. For example, add some more suffixes to that word: derivational-ish-ly. You've probably never heard this specific variant, but you still probably have some idea of what it means anyway. The transformer can only capture these semantics if it has some representation of the fact that the suffixes inflect the meaning of the word's root (presumably something like `deriv`). English encodes this entirely by the position of the suffixes relative to the root. Without the positional information, there is no way to recover it, and sentences would lose much of their meaning, since English depends heavily on this construction.
Second, English has relatively few cases, and thus relies very heavily on the order of words to indicate what is the subject and what is the object. English specifically is Subject-Verb-Object, and the instinct of native English speakers to use SVO ordering is so strong, you will find them inserting nouns and pronouns into sentences that do not actually have subjects at all. "It's raining outside" is the most famous example. This sentence has no subject at all, and yet native English speakers feel a strong need to place "it's" at the beginning.
If the transformer did not have positional encodings it would be completely hopeless to recover what is the subject and what is the object from English sentences. There simply is no other way to reliably tell, other than inspecting the word positions.
It's worth noting we also do have the counterfactual. Generative language models that explicitly exclude positional information, like Latent Dirichlet Allocation, are only able to (essentially) cluster word co-occurrences. That is not as useless as it sounds—if I say "fire house burning ambulence" you kind of get the point even without a subject or an object—but it certainly does not generate the lucid, provoking sentences that modern LLMs do.
cyanydeez 3 days ago | parent
numpad0 3 days ago | parent
in-silico 3 days ago | parent
antics 3 days ago | parent
But these days, there are many more options. They all maintain this positional information in one way or another. The one you cite (as I understand it) drops the positional encodings after pretraining, and keeps (e.g.) the causal mask.
krackers 3 days ago | parent
I thought with NoPE schemes you don't even need it during pretraining
https://arxiv.org/abs/2305.19466
https://sebastianraschka.com/llm-architecture-gallery/nope/
Given the causal mask and the way attention works LLMs can implicitly propagate a signal for ordering
antics 3 days ago | parent
inkysigma 3 days ago | parent
antics 3 days ago | parent
okeuro49 3 days ago | parent
German: es regnet French: Il pluet
I don't see why English is special here.
psychoslave 3 days ago | parent
I guess the author means in contrast to some cases like "Pluvas" in Esperanto, see https://www.youtube.com/watch?v=fOBkKcbJUAE for a nice employ of it.
Italian, Spanish and Latin (for example) can generally avoid to express explicitly the subject in a dedicated pronoun, as the verb already encode the it through specific flection. In contrast in French and German only in imperative tense one can formally make such an ellipsis (colloquially of course one can encounter more nuances).
So nothing exceptionnal
adventured 3 days ago | parent
The rain is not magical, the environment is producing it. The environment is raining. It's raining outside means the environment is producing rain outside.
Who could possibly confuse that as lacking a subject.
https://www.cambridge.org/core/journals/journal-of-linguisti...
antics 3 days ago | parent
antics 3 days ago | parent
French is descended from Latin, which is "pro-drop" in the sense that you'd drop the "dummy subject" and simply write "pluit." Later, Old French, like English, lost most of its cases. Because of that, many word endings started sounding very similar (a problem known as "agreement syncretization"). The pro-drop "null" subject disappears in the record roughly as that happens, presumably to help disambiguate.
This is an entirely different path than English took, and it's also not a path any other Romance language took. Spanish isn't even subject-prominent. It fully allows the "null" construction, e.g., "llueve", which literally is just "rains."
aka-rider 2 days ago | parent
In Ukrainian it’s «дощить» (from “дощ” — rain) — the form of the word tells you its function in the sentence. Same happens in other Slavic languages: Polish, Belarusian, Slovakian.
Latin languages rely on the order of words to explain their function. So much so, English speakers don’t say “blue big ball” in German, time before place is mandated.
psychoslave 3 days ago | parent
I would rather say it’s derived from contextual element. And in linguistic context which encodes more interpretation cues, order of morphemes drop symmetrically in semantical importance, though it can still affect interpretation on pragmatic level. Latin for example already offers more flexibility regarding word order, though it’s used mostly in poetry/stylised-rhetoric. And as German show having the case encoded in the nouns don’t even prevent mandatory rigidity in sentence structure.
antics 3 days ago | parent
There isn't really a way to get around this. Natural language IS structured as a recursive tree. Our job is to extract this tree from a flat stream of tokens (or similar), and straightforwardly the only way to do that is to make the ordering of the tokens meaningful. There is no other option! This is how 100% of parsing works in any context whatsoever, both theoretically and practically.
psychoslave 3 days ago | parent
And just because utterances can be more or less matched with recursive tree doesn’t mean there is an ontological absolute truth about language there. Even "language" refers to some vague abstraction. Just like the "it" in "it rains" mentioned in this discussion: no entity out there actually respond to "language".
At introspection level, I absolutely don’t interpret utterances like recursive tree. They are more like cues going through living graphs more or less already connected and being able to change topology on the go. Impermanence of interpretation results is the only constant.
Now it’s not to dismiss that some other people might feel like "Natural language IS structured as a recursive tree" is the only way. People have different perspective, different brains, different life experiences. One who dwell in aphantasia¹ don’t perceive the world the same way as people that have hyperphantasia². Different of course here doesn’t mean better/worst or superior/inferior.
¹ A word I discovered in some HN comment
² A word that I had never red before but just popped up in my mind as I was thinking about this sentence, but which is actually already is in use in literature apparently: https://en.wikipedia.org/wiki/Hyperphantasia
antics 3 days ago | parent
I’m also not sure why you are talking about why natural languages are not different from other ones. That is what I’m saying, it’s the reason behind the comment that all parsing works the same way.
gorgolo 3 days ago | parent
spwa4 3 days ago | parent
And if you look at how transformers work you will immediately realize there's nothing a transformer can do that an RNN cannot do, and frankly that an RNN cannot do 1000x more efficiently at inference time. It's just that training even the best known RNNs is going to take a lot longer because it can't be parallelized. It cannot train on 100 GPUs, in fact it cannot really use a GPUs advantage.
Plus equivalence proofs will get you a lot further than RNNs too. Kernel methods will obviously work as well, for example.
lostmsu 3 days ago | parent
antics 2 days ago | parent
lostmsu 2 days ago | parent
antics 2 days ago | parent
> because the Vaswani et al transformer (as it is described here) simply does not work until you add the most important ingredient of all: the positional encoding.
This is factually correct. The Viswani et al transformer DOES NOT WORK without positional encodings. A transformer architecture that involves (e.g.) causal masking is a different architecture. If you want to separately discuss one of those architectures I am happy to do that too.
KingMob 3 days ago | parent
"Spreading activation" would be a better analogy.
----
It's mostly harmless, though it occasionally results in head-scratchers from the biological POV. I once saw a ML paper talking about "retinal attention", which is funny, because the retina is one of the few places in the central nervous system where afawk, attention is impossible.
There's simply no efferent (brain->retina) non-motor nerves capable of biasing photoreceptor output; the retina is largely ballistic. (Eyeball motion is not attention.)
BLKNSLVR 3 days ago | parent
scarmig 3 days ago | parent
antics 3 days ago | parent
Imagine you have a series of (x,y) coordinates. You receive a new x coordinate, and you'd like to predict the corresponding y. So, the absolute dumbest thing you can do is find the nearest x, and then report its corresponding y as your prediction. The second dumbest thing you can do is find the n closest x coordinates, and then average their y values together, and output that as your predicted value. And the third-dumbest thing you can do is that n-closest-average thing, but give the "closest" x coordinates the most "weight" when you average them. (Technically, not always "closest": you have some "kernel" function which does the weighting, but "closeness" is a good kernel so I will use it here.)
That third-dumbest thing is Nadaraya-Watson kernel smoothing. And that's what attention does. You have a big list of vectors. You compute a weighted average of those vectors. You now have a new vector. You can do what you want with it, but LLMs will generally turn that into a distribution over token types, from which you'll generally want to select either the top one, or weighted-randomly one from the top k (known as "increasing the temperature").
With all that said, I'm not sure "Kernel smoothing is all you need" is actually materially better than "attention is all you need" for 99.999% of humans. :)
patcon 3 days ago | parent
https://scikit-learn.org/stable/modules/generated/sklearn.im...
https://scikit-learn.org/stable/modules/generated/sklearn.me...
antics 3 days ago | parent
nathias 3 days ago | parent
antics 3 days ago | parent
red75prime 3 days ago | parent
Like an accountant not realizing that addition and multiplication are special cases of a monoid operation.
antics 3 days ago | parent
Aside from that, kernel smoothing has roughly 70 years of literature devoted to every practical aspect you could imagine: approximation, accuracy, pedagogy, behavior under sparsity, relationship to other well-known theories like Bayeisan learning, and so on. Variants like Performer and elliptical attention, all directly arose from the knowledge that attention is intro-grad-stats kernel smoothing. A large portion of our understanding of ICL is directly or indirectly resultant from the fact of this correspondence.
krackers 3 days ago | parent
I don't have any specific experience in ML but I always liked the formalism presented in https://www.youtube.com/watch?v=J1YCdVogd14 as a way to unify everything
antics 3 days ago | parent
MrBuddyCasino 3 days ago | parent
Now if you could please explain the rest of math in similarly simple terms?
scarmig 3 days ago | parent
zenogantner 3 days ago | parent
btw, "kernel smoothing" etc. are still fairly complex terms that sound a bit like math magic: 1-nearest-neighbor (1-nn), k-nearest-neighbor (knn), and weighted knn would be even simpler and possibly more descriptive.
antics 3 days ago | parent
First of all, the trick relies on imputed 1NN/imputed kNN/imputed weighted kNN. And second of all, you still have to explain how imputed weighted kNN relates to the problem of taking a bunch of x/y pairs and predicting a novel y for some novel x. When you start to unpack all of that it does not look simpler to me than what I wrote.
For the weights, I'm not sure that's as mysterious as you make it seem. The most important thing they learn is, basically syntax. So you have 40k token types to choose from at each prediction, and the vast majority of them are statistically implausible because they are syntactically invalid. At some positions this restriction reduces entropy from ~15-16 bits (or 40k choices) to 2^8 (~200 choices) and in some places it reduces it "only" to 12 or 13 (~8k choices, common when the next token is "approximately a noun").
Once you winnow it down, it's much closer to a moderately big multiple choice problem. And much of that entropy lies just in the model's representation of word co-occurrences.
lostmsu 3 days ago | parent
antics 2 days ago | parent
First and most importantly, attention is, formally, kernel smoothing with a particular exponential kernel function, and if you don't believe me, you can read the paper I linked, which proves it.
Second, and less importantly: kernel smoothing absolutely, definitely does NOT require a kernel function representing Euclidean distance, and in fact the entire point of kernel smoothing is that you can pick basically any function that fits your needs. Many use cases find it helpful to have a real-valued kernel function that is positive and semidefinite, or nonnegative and integrating to 1, or whatever. Different kernel functions in these spaces have different properties and trade-offs. The exponential kernel attention uses (if memory serves) is (1) finite and nonnegative, and (2) has a positive total weight so you can normalize.
Third, and least importantly, you definitely can have a kernel function that is "uniform" (i.e., "just" an average) although it's generally not very helpful (e.g., not positive semidefinite).
lostmsu 2 days ago | parent
Well, here's the thing. Kernel smoothing uses Euclidean distances. "with a particular exponential kernel function" is the novel bit. I even gave an example of what absurdity you will get if you allow arbitrary addition like this to the term.
> every assertion here is mistaken. ... Second, ..
Never made that assertion.
> Many use cases find it helpful to have a real-valued kernel function that is positive and semidefinite, or nonnegative and integrating to 1, or whatever
Yeah, that's the kernel. https://en.wikipedia.org/wiki/Kernel_(statistics). What you feed to the kernel is Euclidean distance. That's where the difference is.
> you definitely can have a kernel function that is "uniform"
You did not get that point. See response to your "First". I was explaining why the reasoning that led you to "attention == kernel smoothing" is faulty - if you apply it to averaging, you will get "averaging == kernel smoothing". Because kernel smoothing is "just" averaging with distance based weights. So attention is "just" kernel smoothing with Q-K based distance function. The issue is in both cases the part after "with " does all the heavy lifting.
antics 2 days ago | parent
For those following along, when this user says that attention is kernel smoothing with a "Q-K based distance function", I think (THINK!) what they're trying to say is the second part does more work than it gets credit for when we say attention is "just" a weighted average.
Both of these things are actually true. Attention is indeed "just" a weighted average (there is a proof in the paper in my original reply), AND ALSO, the Q/K are learned, and the similarity between two learned vectors suggests there is more going on than might initially be obvious. (I actually argue in the top comment that the positional information is the #1 reason why attention works, so I agree with this.)
Let's see why.
What are Q and K? The idea in the original paper was: we have some learned embeddings for our tokens, and some "context" we'd like to use to enrich those embeddings. Stuff like the positional information, context accumulated through layers, other learned stuff. So we do this enrichment, and that produces the so-called "query" (Q) and a "key" (K) vectors. Attention is STILL a weighted average, where the weights are determined by how "similar" those vectors are (this is what we're talking about when we discuss the "distance" provided by the so-called "kernel function").
Anyway the reason it's hard for me to parse this reply is because I think a lot is getting lost in the transition from a second language to English. For example, "distance" in this context means something specific, and to be precise the exponential kernel provides a similarity measurement (dot product can encode distance but generally requires fixed-length norms). Similarly, I am confused by their use of "Euclidean" distance (kernel functions do not require this, see p. 203 of the seminal Elements of Statistical Learning which provides a general construction of anisotropic distance-based kernels which is well-accepted), I'm not sure how to interpret "what you feed to the kernel is Euclidean distance" (a pairwise kernel should compute the similarity, not be fed the similarity) and so on. None of this is the end of the world, I am just having a very hard time figuring out what they meant.
[1]: https://mybiostats.files.wordpress.com/2015/03/chapter5-kern...
Llamamoe 2 days ago | parent
Are you, in essence, implying that the Key-Query attention mechanism is basically a neural function approximation of the Nadaraya-Watson kernel or something very like it?
alex_duf 3 days ago | parent
I thought both were useful in their own way, it's not like one replaced the other right?
lostmsu 3 days ago | parent
ptidhomme 3 days ago | parent
How can we still have it so backwards. Language is just a medium to convey information on an underlying reality. LLM do not model the medium, they model the underlying reality (so far as the medium allows it).
mbgerring 3 days ago | parent
ptidhomme 3 days ago | parent
But then dumbly concludes : oh is language intelligence ? ("Perhaps our form of intelligence is tantamount to language modeling, too?"). C'mon.
charcircuit 3 days ago | parent
Razengan 3 days ago | parent
andy_ppp 3 days ago | parent
And it turns out you probably need massive compute, about 1/3 RLHF, all the worlds data and millions of people connecting their private data to the AI to learn from amongst other things :-/
bob1029 3 days ago | parent
Madmallard 3 days ago | parent
I dunno, but this HN post and the chatter that follows is sure to help raise my stocks!
metalman 2 days ago | parent
FLAIL HARDER! DAMIT!
what does it take to get some authorative flailing around here anyway!
it's not like we are asking for a tame god to do our bidding or anything, but well ok, we are asking for a tame god, but it will be great, and the world will be perfect, so hurry up, back to work, or the Boss™, who isn't tame might have to have a word with all you little pumpkins, so back to flailing, but harder, more decisive flailing, or hey! drugs