As an NLP person it's very hard for me to endorse this explanation, 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.
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.
> "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.
French is interesting because it evolved this so-called "dummy subject" pattern (which is actually called "subject-prominence") for an entirely different reason than English.
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."
The sentence does have a very obvious subject. The environment is producing rain. The subject is the environment and its condition is being elaborated. It = environment.
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.
And with this reply we begin one of the permanent debates on this subject. Regardless of where anyone here comes down on this particular case, "it" is an indisputable truth that not all English sentences have subjects. Yet, many of them have pronouns where a subject should be. Maybe the famous example isn't one of them, but "it" is not at all hard to come up with a sentence where that is true. :)
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).
Yes, as I mentioned to another commenter, I'm talking about the original formulation because that's what the article talks about. We have more options now, although (as you seem to be suggesting) they do all necessarily model position. They have to—there is no other way to do things like recover the subject in an English sentence without positional information.
AFAIK, positional encoding is not that important for the performance of causal transformers (e.g. all important modern LLMs). The causal masking itself supplies necessary information implicitly.
This has been addressed several times now in the peer comments to this one. I am addressing the original formulation of the problem because the article is about the original formulation. There are other options available now, including causal masking, but in the original formulation positional encodings are THE most important single ingredient in success, because many aspects of semantics cannot be recovered from anything except position. One example is the subject in an English sentence.
To clarify, I'm talking about the original formulation of the problem, where positional encodings are crucial, because the article is talking about the original formulation of the problem.
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.
You could be right, I have not kept up with the literature very closely! I'm just trying to help people understand that this article does not capture something very important about the Vaswani et al formulation of the transformer architecture. :)
They don't really have that many different characters, it's just that the way Chinese script was adapted to computers use a rigid set of that many pre-composed characters.
>Most of the semantics of a sentence are indicated by the precise order the tokens appear.
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.
It's hard to speak for every language on Earth, but generally languages that have less flexible word orderings will have correspondingly more complicated morphology. In those cases, order does obviously still matter, but instead of in word orderings, it would be in things like prefixes and suffixes.
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.
There is nothing like a valid criterion to discriminate "natural" in languages. All human languages are praxeostratic, they result from the cumulation of practices through time. Some might be more or less blank slate founded through theoretical jump, but even burning the bridge doesn’t mean creation ex nihilo. I mean, the only thing that would not be "natural", would obviously be "supernatural", like if one pretend a language to be some divine creation and not result of human contingent existence.
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
A tree is a graph so I’m not sure I understand your idea. But, at the end of the day, the point of the tree is just to represent the relationships between the tokens. There IS a relationship. As long as your theory represents that as precisely and with as much predictive power as trad linguistics, it doesn’t really matter how.
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.
But positional encoding by itself also won't work nearly as well.
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.
"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"
This is a really neat, approachable way to explain the concept of attention in plain words. Thanks for giving us the reference, though in my understanding the formulation in the first paragraph comes from Natalie Wolchover, the columnist, rather than Bahdanau.
Rule #1 of reading CS papers - don't trust the anthropomorphized terms. Rule #2 - definitely don't extrapolate those terms to the real mind.
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...
The problem lies more in #2 than #1. It's fine to repurpose words in new domains, but there's zero guarantee that translates back into anything useful about the original domain.
As a former perceptual neuroscientist, I can assure you that ML "attention" has very little to do with biological attention.
I'm skeptical it requires embracing new meanings, it only requires being unbiased (non human centric in thinking). If an organic looking alien landed on Earth, circa 1950, with the capabilities of whatever the cutting edge version of eg Mythos is, humanity at the time would have had absolutely zero problem recognizing it as de facto intelligent, even if it only responded when prompted during interactions. People would have merely categorized it as a different type of intelligence. Instead of embracing that intelligence can come in many forms, as sci-fi has proposed about the appearance of alien creatures for many decades, when confronted with the arrival of another type of intelligence, humanity becomes cowardly as it always does when its perceived specialness is challenged.
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).
It's misleading. When it's right, it's right by coincidence, since the vast majority of algorithmic terms that seem like they should provide insight into the human mind, like "attention" could just as easily be called "finger" or "tape head".
And suddenly we're looking at people who read ticker tape or by following with their finger for insights into neuroscience?
Humans will alway try to conflate mysteries because of our drive toward parsimony.
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.
Some humans do this, some humans do that. Some people keep things as they found them at best, maybe even smear them together, others refine and differentiate. If all we did was conflate we would have no language at all.
Yes, but attention is not like the other analogies you highlighted. The word already HAS a meaning in biology.
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.
40% of English words are polysemic[1]. Humans deal with ambiguous meaning all the time. No one has ever won this battle and no one ever will. Why try to resolve an annoyance by making everyone else change? Just resolve the annoyance internally. It's much easier.
It's bad metaphysics. If you really want to do bad metaphysics, then you can, but it's also hardly an attack on you if others promote norms of not doing bad metaphysics.
The term "attention" confuses more than it reveals, trading well-known terminology for a weak analogy to how the human brain works. Kernel smoothing is all you need.
For those who are not math people, this comment is referring to the fact that "attention" is formally equivalent[1] to Nadaraya-Watson kernel smoothing, which is a kind of weighted average. Yes! Incredibly, attention is just a weighted average.
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. :)
Yeah, I mean, a lot of things can express attention, because attention is mechanically extremely simple. The "trick" of attention is that it's "relatively easy" to train. Or if not "relatively easy", we at least have a lot of collective experience doing it.
The crucial question, however, is "Where do the weights come from?" :-)
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.
Yeah but Nadaraya-Watson kernel smoothing isn't actually 1NN/kNN/weighted kNN.
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.
Attention is not based on Euclidean closeness, therefore it is not kernel smoothing. Saying otherwise would be the same as saying kernel smoothing is just an average (e.g. omitting the important part that it has to be distance-based-weighted).
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).
The authors did not know that it was Nadaraya-Watson kernel smoothing when they wrote the paper. Not recognizing that the novel thing you are doing is secretly another, very old, very common thing, turns out to be an extremely common ailment in modern ML/AI literature. :) I suspect this is true also of physics.
Wouldn't it be better to express it like this: the authors haven't realized that the attention mechanism can be represented as a special case of Nadaraya–Watson kernel smoothing, a representation that hasn't resulted in practical improvements in attention mechanisms, probably indicating that the connection isn't that important in ML?
Like an accountant not realizing that addition and multiplication are special cases of a monoid operation.
No. It definitely has resulted in practical improvements to attention. One practical improvement is that kernel smoothing is vastly easier to explain than "attention", which I think I have already demonstrated here.
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.
No, kernel smoothing is based on a function of distance between points. Attention is based on a function of distance between their learned Q and K projections.
The original paper title is catchy but it’s more like “positional encoding and attention and parallelism across attention heads are all you need…”
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 :-/
The answer is clearly "no." The fact that neural networks can decipher patterns in our language without knowing what the sentence is about or even what the individual words mean makes it obvious that the entire A.I. "boom" is based on quicksand. These A.I. companies may sprinkle in some stuff that makes it look intelligent, but the current transformer/attention system will only get us so far.
It means generated output is based on mathematical relations of vectors that represent words or part of words. I believe pre-language cavemen are intelligent with the caveat that transfer of knowledge is severely reduced. I am even tempted to say that cats and dogs are more intelligent than LLMs.
An IMO under-appreciated aspect of attention is that it's an ingredient for building a Turing-complete evaluator, since (for example) it lets you implement mutable RAM by treating the attended data as a write log: https://yager.io/neural/turing/turing.html
As a former neuroscientist of visual perception, I always feel compelled to point out that "attention" in the ML sense has very little to do with biological attention.
"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.)
Attention is not the key, if anything is the key to intelligence it is scale. As long as all of the information is there for the model, with sufficient scale you will see intelligence emerge. This premise is core to the belief that the main blocker behind LLMs being "discovered" was not architecture, but in fact compute. Once sufficient compute is available eventually someone will be able to create an LLM that is intelligent.
>> To be sure, the success of LLMs shows how much information about the world is encoded in the statistical patterns of language alone
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).
As an NLP person it's very hard for me to endorse this explanation, 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.
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.
> "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.
German: es regnet French: Il pluet
I don't see why English is special here.
French is interesting because it evolved this so-called "dummy subject" pattern (which is actually called "subject-prominence") for an entirely different reason than English.
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."
Slovenian: Dežuje.
One word (rains) is the full sentence. Because nothing else needs to be said.
Romanian: Plouā
Klingon: SIStah
The sentence does have a very obvious subject. The environment is producing rain. The subject is the environment and its condition is being elaborated. It = environment.
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...
And with this reply we begin one of the permanent debates on this subject. Regardless of where anyone here comes down on this particular case, "it" is an indisputable truth that not all English sentences have subjects. Yet, many of them have pronouns where a subject should be. Maybe the famous example isn't one of them, but "it" is not at all hard to come up with a sentence where that is true. :)
Then why don't you say "environment is raining outside" ?
Many syllable waste time. Contraction fast.
Sky wet
Il pleut*
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
Well, the masking could be causal and I think that's been investigated by several groups.
Yes, as I mentioned to another commenter, I'm talking about the original formulation because that's what the article talks about. We have more options now, although (as you seem to be suggesting) they do all necessarily model position. They have to—there is no other way to do things like recover the subject in an English sentence without positional information.
AFAIK, positional encoding is not that important for the performance of causal transformers (e.g. all important modern LLMs). The causal masking itself supplies necessary information implicitly.
This has been addressed several times now in the peer comments to this one. I am addressing the original formulation of the problem because the article is about the original formulation. There are other options available now, including causal masking, but in the original formulation positional encodings are THE most important single ingredient in success, because many aspects of semantics cannot be recovered from anything except position. One example is the subject in an English sentence.
I like the enthusiasm but no they actually work fine without positional encodings: https://arxiv.org/abs/2512.12167
To clarify, I'm talking about the original formulation of the problem, where positional encodings are crucial, because the article is talking about the original formulation of the problem.
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.
>drops the positional encodings after pretraining,
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
You could be right, I have not kept up with the literature very closely! I'm just trying to help people understand that this article does not capture something very important about the Vaswani et al formulation of the transformer architecture. :)
The Chinese will eventually test this theory with their 80000 character set.
They don't really have that many different characters, it's just that the way Chinese script was adapted to computers use a rigid set of that many pre-composed characters.
>Most of the semantics of a sentence are indicated by the precise order the tokens appear.
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.
It's hard to speak for every language on Earth, but generally languages that have less flexible word orderings will have correspondingly more complicated morphology. In those cases, order does obviously still matter, but instead of in word orderings, it would be in things like prefixes and suffixes.
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.
Think you mean it the other way? More flexible languages require more complex morphology
There is nothing like a valid criterion to discriminate "natural" in languages. All human languages are praxeostratic, they result from the cumulation of practices through time. Some might be more or less blank slate founded through theoretical jump, but even burning the bridge doesn’t mean creation ex nihilo. I mean, the only thing that would not be "natural", would obviously be "supernatural", like if one pretend a language to be some divine creation and not result of human contingent existence.
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
A tree is a graph so I’m not sure I understand your idea. But, at the end of the day, the point of the tree is just to represent the relationships between the tokens. There IS a relationship. As long as your theory represents that as precisely and with as much predictive power as trad linguistics, it doesn’t really matter how.
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.
But positional encoding by itself also won't work nearly as well.
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.
This is the core insight, some in the original grad student author's own words:
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"
This is a really neat, approachable way to explain the concept of attention in plain words. Thanks for giving us the reference, though in my understanding the formulation in the first paragraph comes from Natalie Wolchover, the columnist, rather than Bahdanau.
Rule #1 of reading CS papers - don't trust the anthropomorphized terms. Rule #2 - definitely don't extrapolate those terms to the real mind.
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...
Sure. but how far can we apply this logic?
--
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?
The problem lies more in #2 than #1. It's fine to repurpose words in new domains, but there's zero guarantee that translates back into anything useful about the original domain.
As a former perceptual neuroscientist, I can assure you that ML "attention" has very little to do with biological attention.
Wow, a guarantee from a neuroscientist! Those are rare!
I didn't even realize attention was a biological thing! I thought it was more metaphysical.
I'm skeptical it requires embracing new meanings, it only requires being unbiased (non human centric in thinking). If an organic looking alien landed on Earth, circa 1950, with the capabilities of whatever the cutting edge version of eg Mythos is, humanity at the time would have had absolutely zero problem recognizing it as de facto intelligent, even if it only responded when prompted during interactions. People would have merely categorized it as a different type of intelligence. Instead of embracing that intelligence can come in many forms, as sci-fi has proposed about the appearance of alien creatures for many decades, when confronted with the arrival of another type of intelligence, humanity becomes cowardly as it always does when its perceived specialness is challenged.
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).
Why not? Who has earned a monopoly on anti-anthropomorphism?
It's misleading. When it's right, it's right by coincidence, since the vast majority of algorithmic terms that seem like they should provide insight into the human mind, like "attention" could just as easily be called "finger" or "tape head".
And suddenly we're looking at people who read ticker tape or by following with their finger for insights into neuroscience?
Humans will alway try to conflate mysteries because of our drive toward parsimony.
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.
Some humans do this, some humans do that. Some people keep things as they found them at best, maybe even smear them together, others refine and differentiate. If all we did was conflate we would have no language at all.
Yes, but attention is not like the other analogies you highlighted. The word already HAS a meaning in biology.
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.
40% of English words are polysemic[1]. Humans deal with ambiguous meaning all the time. No one has ever won this battle and no one ever will. Why try to resolve an annoyance by making everyone else change? Just resolve the annoyance internally. It's much easier.
1. https://www.thoughtco.com/polysemy-words-and-meanings-169164...
[flagged]
It's bad metaphysics. If you really want to do bad metaphysics, then you can, but it's also hardly an attack on you if others promote norms of not doing bad metaphysics.
The term "attention" confuses more than it reveals, trading well-known terminology for a weak analogy to how the human brain works. Kernel smoothing is all you need.
For those who are not math people, this comment is referring to the fact that "attention" is formally equivalent[1] to Nadaraya-Watson kernel smoothing, which is a kind of weighted average. Yes! Incredibly, attention is just a weighted average.
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. :)
[1]: https://arxiv.org/abs/1908.11775
Ah neat, is that related to k-nearest neighbor imputation too?
https://scikit-learn.org/stable/modules/generated/sklearn.im...
https://scikit-learn.org/stable/modules/generated/sklearn.me...
kNN imputation is a special case of kernel smoothing: one where the "kernel function" (which prescribes weights to the points) is uniform.
Aren't all of these (including convolution) specific instances of Graph Neural Networks?
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
Yeah, I mean, a lot of things can express attention, because attention is mechanically extremely simple. The "trick" of attention is that it's "relatively easy" to train. Or if not "relatively easy", we at least have a lot of collective experience doing it.
The crucial question, however, is "Where do the weights come from?" :-)
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.
Yeah but Nadaraya-Watson kernel smoothing isn't actually 1NN/kNN/weighted kNN.
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.
Thanks for writing that out, so I didn't have to do the same but less eloquently :)
Attention is not based on Euclidean closeness, therefore it is not kernel smoothing. Saying otherwise would be the same as saying kernel smoothing is just an average (e.g. omitting the important part that it has to be distance-based-weighted).
I think every assertion here is mistaken. :)
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).
This was unexpectedly good.
Now if you could please explain the rest of math in similarly simple terms?
Why are they calling it 'attention' if it's just a weighted average? Human attention is something very different.
The authors did not know that it was Nadaraya-Watson kernel smoothing when they wrote the paper. Not recognizing that the novel thing you are doing is secretly another, very old, very common thing, turns out to be an extremely common ailment in modern ML/AI literature. :) I suspect this is true also of physics.
Wouldn't it be better to express it like this: the authors haven't realized that the attention mechanism can be represented as a special case of Nadaraya–Watson kernel smoothing, a representation that hasn't resulted in practical improvements in attention mechanisms, probably indicating that the connection isn't that important in ML?
Like an accountant not realizing that addition and multiplication are special cases of a monoid operation.
No. It definitely has resulted in practical improvements to attention. One practical improvement is that kernel smoothing is vastly easier to explain than "attention", which I think I have already demonstrated here.
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.
I don't understand the link between attention and kernel smoothing in your analogy, what am I missing?
I thought both were useful in their own way, it's not like one replaced the other right?
No, kernel smoothing is based on a function of distance between points. Attention is based on a function of distance between their learned Q and K projections.
The original paper title is catchy but it’s more like “positional encoding and attention and parallelism across attention heads are all you need…”
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 :-/
Among my peers, some would want to interpret "it was tired" to mean that the road had too many vehicles on it.
Too many tires (or perhaps on second thought that was you joke, sorry just woke up).
You are just too tired this morning (hit with tires)
I think the humble byte pair encoder is doing a lot more heavy lifting than it is being credited for.
The answer is clearly "no." The fact that neural networks can decipher patterns in our language without knowing what the sentence is about or even what the individual words mean makes it obvious that the entire A.I. "boom" is based on quicksand. These A.I. companies may sprinkle in some stuff that makes it look intelligent, but the current transformer/attention system will only get us so far.
Not to attack you, but even a modern model will make a more coherent argument than this.
And what does that "without knowing what the sentence is even" even mean? Care to elaborate/define it?
It means generated output is based on mathematical relations of vectors that represent words or part of words. I believe pre-language cavemen are intelligent with the caveat that transfer of knowledge is severely reduced. I am even tempted to say that cats and dogs are more intelligent than LLMs.
I'm not even tempted. It's a fact.
To me it merely signals that there are certain mathematical relationships in our language that can be deduced (by neural networks). Nothing more.
[dead]
An IMO under-appreciated aspect of attention is that it's an ingredient for building a Turing-complete evaluator, since (for example) it lets you implement mutable RAM by treating the attended data as a write log: https://yager.io/neural/turing/turing.html
This IS interesting and nifty!
As a former neuroscientist of visual perception, I always feel compelled to point out that "attention" in the ML sense has very little to do with biological attention.
"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.)
I thought it was scaling
Is this [LLM-related Topic] the [Holy Grail of Research]?
I dunno, but this HN post and the chatter that follows is sure to help raise my stocks!
3Blue1Brown - Compression is Intelligence: https://www.youtube.com/watch?v=l6DKRf-fAAM
Attention is not the key, if anything is the key to intelligence it is scale. As long as all of the information is there for the model, with sufficient scale you will see intelligence emerge. This premise is core to the belief that the main blocker behind LLMs being "discovered" was not architecture, but in fact compute. Once sufficient compute is available eventually someone will be able to create an LLM that is intelligent.
That would be pattern recognition
barely have enough attention to read through the subtitle
TLDR
[dead]
>> To be sure, the success of LLMs shows how much information about the world is encoded in the statistical patterns of language alone
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).
No, they do not, they very clearly model the medium. Why do you believe otherwise?
The whole article is about just that : the LLM has to know what an "animal" and a "street" is to perform effectively.
But then dumbly concludes : oh is language intelligence ? ("Perhaps our form of intelligence is tantamount to language modeling, too?"). C'mon.