22
votes
What is the intuition behind the dot product attention?
Let's start with a bit of notation and a couple of important clarifications.
$\mathbf{Q}$ refers to the query vectors matrix, $q_i$ being a single query vector associated with a single input word.
$\...
- 4,753
18
votes
Accepted
What exactly are the "parameters" in GPT-3's 175 billion parameters and how are they chosen/generated?
Parameters is a synonym for weights, which is the term most people use for a neural networks parameters (and indeed in my experience it is a term that machine learners will use in general whereas ...
- 4,400
10
votes
Accepted
What kind of word embedding is used in the original transformer?
I have found a good answer in this blog post The Transformer: Attention Is All You Need:
we learn a “word embedding” which is a smaller real-valued vector representation of the word that carries some ...
- 465
8
votes
Accepted
Is there any artificial intelligence that possesses "concentration"?
Douglas Hofstadter's CopyCat architecture for solving letter-string analogy problems was deliberately engineered to maintain a semantically-informed notion of 'salience', i.e. given a variety of ...
- 7,176
8
votes
Accepted
What is different in each head of a multi-head attention mechanism?
The reason each head is different is because they each learn a different set of weight matrices $\{ W_i^Q, W_i^K, W_i^V \}$ where $i$ is the index of the head. To clarify, the input to each attention ...
- 1,400
8
votes
Why does GPT-2 Exclude the Transformer Encoder?
GPT-2 is a close copy of the basic transformer architecture.
GPT-2 does not require the encoder part of the original transformer architecture as it is decoder-only, and there are no encoder attention ...
- 1,004
8
votes
Accepted
In Computer Vision, what is the difference between a transformer and attention?
The original transformer is a feedforward neural network (FFNN)-based architecture that makes use of an attention mechanism. So, this is the difference: an attention mechanism (in particular, a self-...
- 37k
7
votes
Accepted
What is the purpose of Decoder mask (triangular mask) in Transformer?
The Transformer model presented in this tutorial is an auto-regressive Transformer. Which means that prediction of next token only depends on it's previous tokens.
So in order to predict next token, ...
- 240
7
votes
Accepted
Why does this multiplication of $Q$ and $K$ have a variance of $d_k$, in scaled dot product attention?
In statistics, if $X$ and $Y$ are independent and randomly distributed variables:
$\mathbb{E}[X + Y] = \mathbb{E}[X] + \mathbb{E}[Y] \\
Var(X + Y) = Var(X) + Var(Y) \\
\mathbb{E}[XY] = \mathbb{E}[X]\...
- 1,400
7
votes
How to assess if OpenAI's ChatGPT chatbot has a human in the loop?
Until you can prove that OpenAI has HITL in ChatGPT, it is just an idea with no basis. It's not up to us to disprove it, it's up to you to prove it.
Let me address your points:
You seem to be basing ...
- 179
6
votes
Is there any artificial intelligence that possesses "concentration"?
Concentration, perhaps easier to grasp as "focus" or "attention", has quite some history in AI. This answer mentions CopyCat, and there was work with neural networks in the 80s as well (e.g. from ...
- 1,490
5
votes
Accepted
What is the cost function of a transformer?
I took a look at the Tensor2Tensor's source code implementation, and it seems like the loss function is the cross-entropy between the predicted probability matrix $\|\text{sentence length}\| \times \|\...
- 1,400
5
votes
What is the purpose of Decoder mask (triangular mask) in Transformer?
We give the target input into the transformer decoder while training the model. So it is easy for the model to "peek ahead" and learn what the next word would be. To ensure that this doesn't ...
- 151
5
votes
Accepted
Why does a transformer not use an activation function following the multi-head attention layer?
This goes back to the purpose of self-attention.
Measure between word-vectors is generally computed through cosine-similarity because in the dimensions word tokens exist, it's highly unlikely for two ...
- 446
4
votes
Why don't people use nonlinear activation functions after projecting the query key value in attention?
It seems like doing this would lead to much-needed nonlinearity, otherwise, we're just doing linear transformations.
Attention is broadly defined as a following operation ($\text{softmax}$ is ...
- 2,222
4
votes
What is the purpose of Decoder mask (triangular mask) in Transformer?
the mask is needed to prevent the decoder from "peeking ahead" at ground truth during training, when using its Attention mechanism.
Encoder:
Both runtime or training:
the encoder will ...
- 230
4
votes
What's the difference between content-based attention and dot-product attention?
The Attention is All you Need has this footnote at the passage motivating the introduction of the $1/\sqrt{d_k}$ factor:
To illustrate why the dot products get large, assume that the components of $q$...
- 2,222
4
votes
What kind of word embedding is used in the original transformer?
No, neither Word2Vec nor GloVe is used as Transformers are a newer class of algorithms. Word2Vec and GloVe are based on static word embeddings while Transformers are based on dynamic word embeddings.
...
- 1,678
4
votes
In layman terms, what does "attention" do in a transformer?
Let's start by stressing out that in the literature unfortunately the term attention is still used widely without any precise consensus around the technical details, the only constant across papers is ...
- 4,753
3
votes
Accepted
Transformers: how to get the output (keys and values) of the encoder?
I have read the OpenNMT source code (https://github.com/OpenNMT/OpenNMT-py/blob/cd29c1dbfb35f4a2701ff52a1bf4e5bdcf02802e/onmt/modules/multi_headed_attn.py).
It seems like an extra linear layer learns ...
- 1,400
3
votes
Accepted
Any comparison between transformer and RNN+Attention on the same dataset?
If you go through the main introductory paper of the transformer ("Attention is all you need"), you can find the comparison of the model with other state-of-the-art machine translation ...
- 1,723
3
votes
What is the difference between Attention Gate and CNN filters?
CNNs work by applying filters over the entire image. The same filter is applied at every pixel in the image. That is, the same weights are used at every pixel.
Note, when I say "at every pixel&...
3
votes
Accepted
A mathematical explanation of Attention Mechanism
There's plenty, but keep in mind that these articles do not describe the same approach. They simply have attention shifting automation as part of their approaches and therefore must detect a need for ...
- 7,375
3
votes
Accepted
What is the intuition behind the attention mechanism?
Simply put, the attention mechanism is loosely inspired on well, attention. Consider we are attempting machine translation on the following sentence: "The dog is a Labrador." If you were to ask ...
3
votes
Why does GPT-2 Exclude the Transformer Encoder?
The cases when we use encoder-decoder architectures are typically when we are mapping one type of sequence to another type of sequence, e.g. translating French to English or in the case of a chatbot ...
- 51
3
votes
Isn't attention mask for BERT model useless?
This is just an implementation issue. One reason is the Huggingface implementation (which is not the original implementation by Google) wants to strictly separate the tokenization from the modeling. ...
- 241
3
votes
Accepted
When exactly does the split into different heads in Multi-Head-Attention occur?
The queries, keys and values are calculated then chunked so that each chunk depends on (is a linear combination of) all values of the input embedding.
As for understanding an implementation, I didn't ...
- 288
3
votes
Accepted
What is the most important predecessor of the transformer model?
An influential predecessor paper is indeed the work on NEURAL MACHINE TRANSLATION
BY JOINTLY LEARNING TO ALIGN AND TRANSLATE. The paper outlines an attentional mechanism that is similar to the ...
- 373
3
votes
Accepted
What is the intuition behind self-attention?
First of all, I totally agree that the Iron Man example is a little off the topic and not really clear to explain the concept of self-attention.
But she had a point there. Just like what you said, the ...
- 81
2
votes
Why is dot product attention faster than additive attention?
The additive attention method that the researchers are comparing to corresponds to a neural network with 3 layers (it is not actually straight addition). Computing this will involve one multiplication ...
- 9,037
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
attention × 122transformer × 73
natural-language-processing × 36
deep-learning × 34
neural-networks × 31
recurrent-neural-networks × 15
machine-learning × 12
papers × 11
bert × 11
long-short-term-memory × 10
convolutional-neural-networks × 9
computer-vision × 7
word-embedding × 6
gpt × 6
comparison × 5
reference-request × 4
pytorch × 4
embeddings × 4
python × 3
generative-adversarial-networks × 3
time-series × 3
convolution × 3
weights × 3
geometric-deep-learning × 3
machine-translation × 3