NoPE (No Positional Encoding) refers to a Transformer that injects positional encoding nowhere. No position is added to the input embeddings, and no positional term is added to the attention scores. In 2023, Kazemnejad et al. compared position representations in decoder-only Transformers (language models like GPT that do not look at future words) and showed that NoPE generalizes better to problems longer than those seen in training (NeurIPS 2023).
Without position, it might seem that word order would be lost, but decoders are different. An encoder like BERT, in which every word sees every word, becomes a "bag of words" that cannot distinguish word order without position. A decoder, by contrast, hides future words with a causal mask, so the word at position can see only words. This "difference in how many words are visible" serves as a positional cue. Earlier work (Haviv et al., 2022, among others) had also reported that decoders without position information can still learn word order.
The paper's new contributions are the following two points.
- Strongest in length generalization: on 10 tasks such as addition, sorting, and copying, it outperformed sinusoidal positional encoding, RoPE, ALiBi, and the T5 relative position bias on problems longer than in training
- It can represent both absolute and relative positions: without injected position, the model can in theory learn either representation, and in practice it learned attention close to that of the T5 relative position bias
The left side of the figure at the top of the article shows where position information is injected. It uses the same layout as the figures in the ALiBi, RoPE, and other articles; NoPE injects position nowhere and has only the causal mask of an ordinary decoder. The upper right shows a computation on a length-6 sequence of how this mask alone reveals position (Theorem 1 of the paper). The lower right compares performance on problems longer than in training.

