News for hackers. Stuff that matters.
Re:Transformer Attention is off by one by sebzim4500 on Monday July 24, 2023 @02:04PM (#36851949)
Don't transformers typically have a <bot> token at the beginning of the prompt? This seems equivalent to letting the network attend to this token, and produce a zero value if that's what it wants.
Re:Transformer Attention is off by one by sp332 on Monday July 24, 2023 @03:04PM (#36852838)
Chat-tuned ones do, but the base models don't. For example, Llama doesn't, but Alpaca has "### Instruction:", "### Input:", and "### Response:".
Re:Transformer Attention is off by one by int_19h on Monday July 24, 2023 @03:19PM (#36852983)
Base LLaMA still has dedicated tokens for beginning/end of string. What you're describing is the instruction format, which is separate.
Re:Transformer Attention is off by one by sp332 on Monday July 24, 2023 @03:30PM (#36853123)
Oh, I had misunderstood something.
Re:Transformer Attention is off by one by refulgentis on Monday July 24, 2023 @03:28PM (#36853088)
not a token, and not the transformers, but yes, commercial chat models are fine-tuned on text transcripts containing dialogues. (i believe llama-2 was as well)
Re:Transformer Attention is off by one by sebzim4500 on Monday July 24, 2023 @03:32PM (#36853143)
Are you sure? I have never seen an LLM that did not have a special token for start of text, I'm certain that llama had one and I don't remember anywhere in the llama-2 paper where they said they removed it.
Re:Transformer Attention is off by one by refulgentis on Monday July 24, 2023 @03:42PM (#36853233)
tl;dr: you're right

it's messy though, bear with me for the full explanation:

- your initial post says "<bot>" token, which looked like a mix of "chatbot" and ChatML, used by OpenAI

- there is a bo_S_ token, which acts as you described

- I averaged my attention over your post and the initial reply, which answers as if you were using "<bot>" in the misunderstood way

- when I go back and read your post, I realize the chatbot interpretation doesn't quite make sense, since you're referring to much more technical aspects than general "how do I AI", i.e. you understand <X> as a way to denote special tokens, not necessarily an XML tag

Re:Transformer Attention is off by one by a1k0n on Monday July 24, 2023 @07:02PM (#36855443)
Yes, it has to in fact. If you have zero context to attend to in a transformer, and you try to predict the first token, you effectively are multiplying a zero-vector by the attention head, making all tokens equally likely in the final softmax (unless the lm_head has a bias, but at least in GPT it does not).

So the <|beginning of text|> token, with no context before it, learns to predict the first-token-in-a-document distribution. That's not quite the same as predicting nothing at all.

Re:Transformer Attention is off by one by llwu on Monday July 24, 2023 @08:28PM (#36856134)
This is a cool idea - it could be tested it by seeing whether W_V tends to map <bot> to 0, and whether <bot> tends to get attended to.

There are interesting things to said whether or not this turns out to be the case.