In plain words: Instead of numbering every token in order, this method lets the model decide which tokens bump the count, so it can point to the third noun or sentence. It solved copying and counting tasks that standard position numbering failed, and lowered prediction error on language and code.
Abstract · Contextual Position Encoding: Learning to Count What's Important
The attention mechanism is a critical component of Large Language Models (LLMs) that allows tokens in a sequence to interact with each other, but is order-invariant. Incorporating position encoding (PE) makes it possible to address by position, such as attending to the i-th token. However, current PE methods use token counts to derive position, and thus cannot generalize to higher levels of abstraction, such as attending to the i-th sentence. In this paper, we propose a new position encoding method, Contextual Position Encoding (CoPE), that allows positions to be conditioned on context by incrementing position only on certain tokens determined by the model. This allows more general position addressing such as attending to the $i$-th particular word, noun, or sentence. We show that CoPE can solve the selective copy, counting and Flip-Flop tasks where popular position embeddings fail, and improves perplexity on language modeling and coding tasks.
Olga Golovneva, Tianlu Wang, Jason Weston, Sainbayar Sukhbaatar
arXiv:2405.18719 · cs.CL, cs.AI · submitted May 29, 2024 · updated May 30, 2024
abstract · pdf · html