Live data from Hacker News

Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

news.ycombinator.com

51–60 of 240 posts

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#52

The Yannic kilcher review is quite good. https://youtu.be/iDulhoQ2pro I can't ELI5 but I can ELI-junior-dev. Tl;dw: Transformers work by basically being a differentiable lookup/hash table. First your input is tokenized and (N) tokens (this constitutes the attention frame) are encoded both based on token identity and position in the attention frame. Then there is an NxN matrix that is applied to your attention frame "…

How does N relate to the number of parameters that is frequently mentioned?

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#53

What is ELI5? The idea behind the Transformer is nice - but by far not Nobel prize deserving. Don't believe the hype or people like Yegge, whoever that is - in a few years a new architecture will be the "Nobel candidate". Also, the original Transformer paper, if you read is, is horribly written.

explain like i'm 5 (years old)

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#54

The Yannic kilcher review is quite good. https://youtu.be/iDulhoQ2pro I can't ELI5 but I can ELI-junior-dev. Tl;dw: Transformers work by basically being a differentiable lookup/hash table. First your input is tokenized and (N) tokens (this constitutes the attention frame) are encoded both based on token identity and position in the attention frame. Then there is an NxN matrix that is applied to your attention frame "…

What does it mean for a lookup/hash table to be differentiable?

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#55
post #34
post #33

[flagged]

Maybe ELI5 was the wrong level for my ask. I still want to understand it from a technical perspective. Maybe ELI am a software engineer but not in AI/ML?

*Prompt:* I'm a software engineer who has never done anything with AI/ML. Explain to me transformers and the "Attention is all you need" paper.

*GPT4:* "Attention is All You Need" is a seminal paper published in 2017 by Vaswani et al. that introduced the Transformer architecture, a breakthrough in the field of AI and natural language processing (NLP). Transformers have since become the foundation for many state-of-the-art models, including GPT (Generative Pre-trained Transformer) series, BERT (Bidirectional Encoder Representations from Transformers), and more.

At a high level, the Transformer architecture is designed to handle sequential data, like text, in parallel rather than sequentially, as was common with earlier models like Recurrent Neural Networks (RNNs) and Long Short-Term Memory (LSTM) networks. This parallelization allows for faster training and better scalability. The key innovation in Transformers is the attention mechanism, which is used to weigh the importance of different input tokens when generating an output token.

Here's a simplified explanation of the main components of a Transformer:

    Input Embeddings: Transformers take input data in the form of text tokens. These tokens are converted into continuous vectors through an embedding layer.

    Positional Encoding: Unlike RNNs and LSTMs, Transformers don't have an inherent sense of sequence order. To address this, positional encoding is added to the input embeddings to provide information about the position of each token in the sequence.

    Encoder and Decoder: The Transformer architecture consists of an encoder and a decoder. The encoder is a stack of identical layers, each containing two primary components: a multi-head self-attention mechanism and a position-wise feed-forward network. The decoder is also composed of a stack of identical layers, but it has an additional multi-head attention mechanism that attends to the encoder's output.

    Multi-Head Attention: The attention mechanism is the core innovation in the Transformer architecture. It computes a weighted average of input tokens to generate context-aware representations. Multi-head attention allows the model to focus on different aspects of the input by employing multiple attention heads, each with its own set of learnable parameters.

    Feed-Forward Networks: These are simple fully connected layers that follow the attention mechanism in each layer of the encoder and decoder.

    Output: Finally, the decoder generates the output sequence token by token. This is done by applying a linear layer followed by a softmax activation function to get the probabilities of each possible output token.
In summary, the Transformer architecture introduced in the "Attention is All You Need" paper revolutionized NLP by enabling more efficient and powerful models. The key innovation is the attention mechanism, which helps the model learn complex relationships between input tokens and produce context-aware representations. This has led to a wide array of applications, from machine translation and text summarization to sentiment analysis and language modeling.

*Me:* It's okayish but you're probably interested in a more detailed low level explanation. Also transformers are widely used for computer vision nowadays (a bit forgivable because of ChatGPT 2021 cutoff, but they had already taken off by then)

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#56
I argue that the attention mechanism is just Hopf algebra convolution. The QK mechanism selects possible candidates and the OV mechanism picks one of these possible candidates.

I have recently written a paper on this https://arxiv.org/abs/2302.01834

I also have a discord channel https://discord.cofunctional.ai.

Ironically, it's the same mechanism as what renormalization in QFT does. I'm getting increasingly convinced that it's also how the brain works.

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#57
post #48

Earlier quoted context omitted.

Compared to rnns... maybe? The big nxn is really a killer. I don't know how to judge parallelizability of different DNN models, you're comparing apples to oranges

When you train a transformer, you're training what the next expected token is. You can train all positions of the sequence each in parallel rather than having to sequentially build up the memory state as you generate the sequence with an LSTM. Mind you the inference portion of a transformer is still sequentially bottlenecked since you don't know what the output sequence is supposed to be.

I believe the other big thing is it allowed you to parallelize the training as well, so you could split those colossal training sets across many machines in a way you could not do with LSTMs.

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#58
- You can develop a very deep understanding of a sequence by observing how each element interacts with each other over many sequences.

- This understanding can be encapsulated in "compressed" low dimensional vector representation of a sequences.

- You can use this understanding for many different downstream tasks, especially predicting the next item in a sequence.

- This approach scales really well with lots of GPUs and data and is super applicable to generating text.

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#59

The Yannic kilcher review is quite good. https://youtu.be/iDulhoQ2pro I can't ELI5 but I can ELI-junior-dev. Tl;dw: Transformers work by basically being a differentiable lookup/hash table. First your input is tokenized and (N) tokens (this constitutes the attention frame) are encoded both based on token identity and position in the attention frame. Then there is an NxN matrix that is applied to your attention frame "…

What does it mean for a lookup/hash table to be differentiable?

I wanted to ask the same and especially I've always been wondering: How is the meaning of aforementioned 'differentiable' related to the same term in math?

Re: Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?

#60

What is ELI5? The idea behind the Transformer is nice - but by far not Nobel prize deserving. Don't believe the hype or people like Yegge, whoever that is - in a few years a new architecture will be the "Nobel candidate". Also, the original Transformer paper, if you read is, is horribly written.

Nobel prize for the neurel network or perceptron maybe?
Post reply on HN