Jump to content

Positional encoding

From Wikipedia, the free encyclopedia

In deep learning, the positional encoding or position embedding is a component of sequence models, especially Transformers. Input data such as text, images, or audio is converted to a sequence of numerical representations called tokens, and the position of each token is encoded as a vector. Positional encoding is used because the standard attention mechanism used in Transformers by default treats all tokens symmetrically over all positions (i.e. permutation-symmetric), thus effectively treating the input as a bag of tokens, rather than a sequence of tokens.[1]

Typology

[edit]

Absolute vs relative positional encoding:

  • In an absolute positional encoding scheme, the position of a token within a context is encoded. That is, it matters whether a token is at position 1 or position 100. This was proposed in 2017, just before Transformer was published.[2]
  • In a relative positional encoding scheme, the relative position of two tokens within a context is encoded. That is, it matters not whether a token is at position 1 or position 100, and it only matters whether one token is in front of another token by 1 or 100. This property is also called translational invariance. This was proposed in 2018, just after Transformer was published.[3]

Learned vs designed positional encoding:

  • In a learned positional encoding scheme, the parameters of positional encoding are learned like any other parameter in a model, usually by backpropagation.
  • In a designed positional encoding scheme, the parameters are not learned, and picked by the researchers. That is, they are hyperparameters.

For example, the original Transformer used designed absolute positional encoding, and the GPT transformer used learned absolute positional encoding. BERT used two levels of positional embeddings, one for the per-token position, and one for per-segment position. Both are absolute and learned.[4][5] It was reported that learned absolute positional encoding generally performs better than relative positional encoding when there are special tokens that always occur in a specific location, such as the [CLS] token of BERT-like architectures. However, with learned absolute positional encoding, a model cannot process contexts longer than what it is trained for.[6]

Other possibly desirable properties of a positional encoding scheme include:[6]

  • Symmetry: In a symmetric positional encoding scheme, the positional encoding of a token tokens before is the same as that of a token tokens after. This property only makes sense for non-causal Transformers, since in a causal Transformer, a token cannot pay any attention to its subsequent tokens.
  • Monotonicity: In a monotonic positional encoding scheme, the positional encoding increases attention weighting on nearby tokens compared to far-away tokens.

Sinusoidal

[edit]
A standard transformer architecture, showing on the left an encoder, and on the right a decoder.

For the original transformer (Attention Is All You Need), published in 2017, each token is converted to a token embedding vector , plus a positional encoding vector .[7]

depends only on the identity of the token, not on . That is, the token "the" would have the same , no matter if it appears in the first or the last position. depends only on the position of the token, not on the identity of the token. That is, the -th token always has the same , no matter if it is "the" or "a".

Both the encoder and the decoder take as input. This is shown in the picture.

Both and have the same number of dimensions, since they must be added. Both of them have even dimensions, since that is what the positional encoding vector requires.

The original paper reported two methods of obtaining . One was the learned absolute positional encoding previously used in convolutional seq2seq.[2] The other was the designed, sinusoidal absolute positional encoding.

Let the dimension be , then the position encoding vector is defined as

Illustration of (absolute) positional encoding with parameters .

where .

Here, is the base frequency, a free parameter that should be significantly larger than the biggest that would be input into the positional encoding function (normally, this is the context length). The original paper uses .

More succinctly,In typical implementations, all operations are done over the real numbers, not the complex numbers, but since complex multiplication can be implemented as real 2-by-2 matrix multiplication, this is a mere notational difference.

Radix interpretation

[edit]

The positional encoding has been interpreted as implementing a base- positional number system for representing real numbers:[8]

Position FrequencyFactorTokens per cycle ("wavelength")Tokens per cycle at
Lowest 16.3
Next lowest 7.5
Highest 52261

The effect of base- positional number system means the attention mechanism is to apportion its attention by coordinate. For low frequency (long wavelength) coordinates, the encoding implicitly states that these coordinates encode information that varies slowly over a sequence, and vice versa for high frequency (low wavelength) coordinates. Concretely, the first 2 coordinates are treated as encoding features that vary quickly every token, while the last 2 coordinates are treated as encoding features that vary slowly over 10000s of tokens.

Symmetry

[edit]

This positional encoding method was designed based on previous work on convolutional neural network language model.[2] In the author's words, "we hypothesized it would allow the model to easily learn to attend by relative position."

A relative position shift is just a linear transformation away:where is the distance one wishes to shift. More generally, any convolution of relative positions is also just a linear transformation away:for any constants . This allows the transformer to take any encoded position and find a linear sum of the encoded locations of its neighbors.

Relative position representations

[edit]

In the original Transformer, positions are encoded by a vector that is added to the token embedding vector , and the Transformer only sees their sum . Several subsequent works produced variations of it. Compared to the original positional encoding scheme, they are relative, additive, and partially decouple the position encoding from the token embedding, by injecting positional encoding directly into each attention mechanism block, rather than adding only to the input.

Setup

[edit]

The attention mechanism block in the original Transformer works as follows. It takes two input sequences , and , then computes three sequencesthen computes attention logits by taking a dot-product, multiplying by a positive scalar , then adding a mask:then computes attention weights by taking a softmax:then computes output vectors by taking a weighted sum of the value vectors:This is more succinctly written as The scalar is usually selected to be where is the dimension of the key vectors .

Relative position representation

[edit]

Relative Position Representation (RPR) was proposed in 2018, and two of the coauthors were coauthors of the original Transformer paper.[3] In RPR, three choices were relative, added to the key and value vectors, and learned.

Concretely, the attention logits are calculated as and the output vectors are calculated asThe key PE vectors and value PE vectors are learned. This is a learned dictionary of embedding vectors for relative positions, the same way as the embedding layer of a Transformer, which is a learned dictionary of embedding vectors for tokens.

The authors additionally clamped the vectors, i.e. for large enough , they designed the identification , and similarly for the value PE vectors, and for small enough . This was designed so as to enforce an inductive bias that "relative position information is not useful beyond a certain distance". That is, the positional encoding scheme does not distinguish between "100 tokens apart" and "101 tokens apart". The authors also claimed that this allowed the model to generalize to sequence lengths longer than those seen during training.[3]

deBERTa

[edit]

The deBERTa transformer was a variant of BERT.[9] It adds relative positional encoding to the query and key vectors.It does not include the 4th term , since this term is a bias term depending purely on position, not token content.

It does not use the masking matrix since it is an all-to-all attention, like the original BERT.

XLNet

[edit]

XLNet transformer adds relative positional encoding to the query and key vectors, and then identifies some of them.[10][11] This was based on the previous Transformer-XL, which uses the same formula, except absolute positional encoding instead of relative positional encoding.[12]

Begin with the expressionwhere play the same roles as , except they map the position encoding vectors, rather than the token encoding vectors. Then expand the brackets to 4 terms, and identify some of the vectors, to obtain

ALiBi

[edit]

ALiBi (Attention with Linear Biases) adds a bias term to encode the relative position.[13]Here, is a scalar, and is an entry in the linear bias matrix defined byin other words, . The idea being that the linear bias matrix is a softened mask. Just as represent full attention paid, and represents no attention paid, the linear bias matrix linearly decreases the attention logit. Note that in the causally masked Transformer, any attention paid to the future is blanked out by the causal mask matrixso the upper triangular part of does not matter.

The original paper designed . Each attention head gets a different one. The first attention head gets , the second attention head gets , and so on.[13]

ALiBi allows pretraining on short context windows, then fine-tuning on longer context windows. Since it is directly plugged into the attention mechanism, it can be combined with any positional encoder that is plugged into the "bottom" of the entire network (which is where the sinusoidal encoder on the original transformer, as well as RoPE and many others, are located).

More generally[14], can be a Toeplitz matrix.with learned entries. The scalar can also be learned.

T5

[edit]

The T5 transformer series used the more general version of ALiBi. Like the original RPR, it also groups the entries into "ranges". This enforces an inductive bias that, as positions become further apart, the resolution decreases. It is important to distinguish between 1 and 2, but less important to distinguish 10 and 12, etc. As the original authors state, the ranges "increase in size logarithmically up to an offset of 128 beyond which we assign all relative positions to the same embedding".[15]

In detail, the T5 encoder encodes as follows: , then the entries are distinct, then , and so on, until unto infinity. Same on the other direction with etc.[16]

RoPE

[edit]

RoPE (Rotary Positional Encoding) is another scheme for relative positional encoding. It works by rotating the query and key vectors input into an attention mechanism block.[17] It was proposed in 2021 in a Chinese blog,[18] and then verified experimentally by Eleuther AI.[19] Eleuther AI used it in their GPT-NeoX in early 2022,[20] and it subsequently spread in popularity.

Consider a feature vector with even dimensions: . Like in the original sinusoidal positional encoding scheme, it can be written as a complex vector . Then, to encode it as positioned at , the -th feature vector is represented by rotating its entries:where the frequencies are usually designed by hand. A standard design is where is the base frequency hyperparameter, as in the original Transformer.

In the original RoPE paper and Llama, .[17][21] Larger values of are often used for models with longer contexts.[22] For example, during the training of Llama 3, the context length was 8192, but its , to "better support longer contexts".[23]

More succinctly, we define to be the diagonal matrix of , so that rotating a vector is the same as multiplying by the matrix on the right, as in . In real space, it is converted to a block-diagonal matrix, each block being 2×2.

In an attention mechanism, RoPE is implemented asThis exploits properties of the rotation matrix: and .

Like the original positional encoding, it behaves as a base- positional number system.

Variants

[edit]

Several variants begin by an observation about RoPE. In the equationthe RoPE part is in the middle, and by the translational invariance of RoPE, is equal to . The idea is to modify the term.

  • In ReRoPE ("ReLU RoPE"), it is clamped at some maximal length . That is, is replaced by for all .
  • In Leaky ReRoPE ("leaky ReLU RoPE"), is replaced by for all , where is some scale factor, a constant picked between 0 and 1.
  • In Self-Extend, is replaced by .[24]

These variants have seen use in context extension.

Extrapolatable Position Embedding (xPos) adds decay terms to the rotation of RoPE, designed to damp out the high-frequency oscillations at long distances.[25]This, as before, is represented as a diagonal matrix in complex space, which is equivalent to a 2×2 block-diagonal matrix in real space.The original paper suggested . xPos is also limited to causal attention masking, since otherwise the attention logits will diverge.

RoPE-2D applies RoPE to tokens that are arranged on a plane. They are used in vision transformers. A vector representing a token at location is split into two halves, the first half rotated by , and the second half rotated by . Here, and do not have to be the same sequence of angular frequencies.

Similarly, Transformers that process videos may use RoPE-3D. It can also be used for other purposes. For example, the vision-language model Qwen-VL uses a version of RoPE-3D that they call "M-RoPE" (multimodal RoPE). Each token is given a triple index . A video is divided into individual frames, then patches. The first index increments every image, frame, or textual token. For a patch, count the horizontal and vertical position. For a textual token, .[26]

RoPE with Relative distances (RoPER), or value-output RoPE (VO-RoPE), applies RoPE to value vectors.[27][28]

NoPE

[edit]
A worked example of performing a convolution. The convolution has stride 1, zero-padding, with kernel size 3-by-3. The zero-padding allows the convolution to implicitly acquire absolute position of each pixel.

In NoPE (No Positional Encoding), there is no positional encoding. The idea is that a decoder's causal masking lets each token to see only tokens , which is an implicit kind of positional encoding.[29][30][31] Relatedly, pure convolutional networks are capable of implicit absolute positional encoding, by exploiting the zero-padding on the edge.[32]

NoPE can represent both absolute and relative positional encodings. Empirically, when trained with gradient descent, a NoPE transformer and a transformer using T5-style positional encoding (ALiBi, learned) produce similar distributions of attention weights for the same input sequences, measured using Jensen–Shannon divergence.[33] It was also shown theoretically and empirically that a trained NoPE transformer represents the first few tokens distinctly in the representational space compared to other positions, which it is capable of distinguishing via causal masking.[34]

NoPE is rarely used for all attention modules of a Transformer, since it would degrade performance significantly. However, NoPE may be used for a fraction of attention modules. This was found in practice to be a worthwhile trade off of performance for computing cost. For example, Llama 4 alternates layers of NoPE and RoPE, with RoPE in 3 layers and NoPE in the 4th. They call it iRoPE ("interleaved RoPE").[35]

Context extension

[edit]

Since the per-token cost of inference scales with context length, training cost is decreased by using shorter contexts during training. However, this would make the resulting model bad at using longer contexts. Consequently, a common way to train a model is to "train short, test long", i.e. training a model on short contexts, and use it on long contexts.[36]

Context extension faces two types of distributional shift:[34]

  • Of positional encoding. A longer context results in positional encoding vectors never seen in short contexts. This tends to make attention logits diverge at long contexts.
  • Of attention weights. A longer context results in more entries to spread the attention weights, thus tends to produce flatter attention logits than shorter contexts. Empirically, the entropy of the attention weight distribution grows as , where is the context length.

Context extension was a concern since the original Transformer paper. In it, the authors reported trying both learned positional encoding and designed positional encoding. They found both to result in similar performance, and decided to use the designed positional encoding, since it "may allow the model to extrapolate to sequence lengths longer than the ones encountered during training".[7]

A slightly more sophisticated method is to train according to a curriculum: Begin by training on a short context length, then train on a longer context length. This can be repeated. For example, the model can be pretrained on context lengths up to 8K tokens, then up to 64K, then up to 512K.

Context lengths can even be mixed during training. It was found that given a fixed training budget, training on a mixture of long contexts and short contexts resulted in higher performance than purely training on long contexts.[37]

In general, context extension using RoPE consists of training a model on one context length with one set of RoPE angles , then its RoPE angles are modified to , and it is trained further on context length for some .

Some architectures natively support context extension. For example, convolutional seq2seq,[2] and sliding window attention,[38] are both insensitive to context length.

YaRN

[edit]

YaRN (Yet another RoPE extensioN) is a common way to extend context, used across many models, including DeepSeek, Qwen, Kimi, and GPT-OSS.[39] It was built in steps.

In Positional Interpolation (PI),[40] frequencies are stretched equally: . This was found to degrade performance beyond , as the model loses the high-frequency resolution that tells adjacent tokens apart.

In Adjusted Base Frequency (ABF)[22] (other names include "NTK-aware", "NTK-RoPE", "RoPE-ABF"), the base is increased: , where is designed so thatEquivalently, . The effect is that the highest frequency is not stretched, the lowest frequency is stretched by , and those in-between are interpolated.

In "NTK-by-parts", high frequencies are not stretched, low frequencies are stretched by , and those in-between are interpolated:where

  • if the feature rotates by more than times over the length of a context: . Equivalently, the wavelength is short enough: .
  • if the feature rotates by less than times over the length of a context: . Equivalently, the wavelength is long enough: .
  • is linearly interpolated otherwise: .

YaRN uses NTK-by-parts with frequency scales , meaning that wavelengths shorter than are not stretched, wavelengths longer than are fully stretched by , and those in-between are stretched by an in-between value.

YaRN also scales up the logits in the attention mechanism. A longer context results in more entries to spread the attention weights, thus tends to produce flatter attention weights than shorter contexts. Scaling up the logits un-flattens them. The authors experimented with context-extending models from the Llama and Llama 2 series, and found empirically that worked well.[39]

Dynamic scaling

[edit]

Because extending the context length involves a degradation of performance, during deployment, a model is used with its original context length , and when the context exceeds , switch to the extended context length . This was found to cause a sudden drop of performance at the switching point. Consequently, dynamic scaling ("dynamic NTK") was used to allow graceful degradation.[39]

The algorithm:

  • When context length is lower than the short context length , use the positional encoding of .
  • When context length is longer than the short context length , use the positional encoding obtained by extending the context by a factor of .

Dynamic scaling can be used even with no extra training on extended context .[39] It was first proposed in a post in the subreddit r/LocalLLaMA.[41]

See also

[edit]

References

[edit]
  1. ↑ Dufter, Philipp; Schmitt, Martin; Schütze, Hinrich (2022-09-01). "Position Information in Transformers: An Overview". Computational Linguistics. 48 (3): 733–763. doi:10.1162/coli_a_00445. ISSN 0891-2017.
  2. 1 2 3 4 Gehring, Jonas; Auli, Michael; Grangier, David; Yarats, Denis; Dauphin, Yann N. (2017-07-17). "Convolutional Sequence to Sequence Learning". Proceedings of the 34th International Conference on Machine Learning. PMLR: 1243–1252. ISSN 2640-3498.
  3. 1 2 3 Shaw, Peter; Uszkoreit, Jakob; Vaswani, Ashish (2018). "Self-Attention with Relative Position Representations". arXiv:1803.02155 [cs.CL].
  4. ↑ Google Research. "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding". GitHub. modeling.py, line 496. Commit eedf5716ce1268e56f0a50264a88cafad334ac61. {{cite web}}: |author= has generic name (help)
  5. ↑ Devlin, Jacob; Chang, Ming-Wei; Lee, Kenton; Toutanova, Kristina (11 October 2018). "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding". arXiv:1810.04805v2 [cs.CL].
  6. 1 2 Wang, Benyou; Shang, Lifeng; Lioma, Christina; Jiang, Xin; Yang, Hao; Liu, Qun; Simonsen, Jakob Grue (2021). "On Position Embeddings in BERT". International Conference on Learning Representations.
  7. 1 2 Vaswani, Ashish; Shazeer, Noam; Parmar, Niki; Uszkoreit, Jakob; Jones, Llion; Gomez, Aidan N; Kaiser, Łukasz; Polosukhin, Illia (2017). "Attention is All You Need" (PDF). 31st Conference on Neural Information Processing Systems (NIPS 2017), 4-9 December 2017, Long Beach, CA, USA. Vol. 30. Curran Associates, Inc. arXiv:1706.03762. ISBN 978-1-5108-6096-4. Archived from the original (PDF) on 2024-02-21. Retrieved 2023-10-31.
  8. ↑ 苏, 剑林 (2023-07-06). "Transformer升级之路:10、RoPE是一种β进制编码" [The Road to Transformer Upgrades: 10. RoPE Is a Base-β Encoding]. 科学空间 (in Chinese).
  9. ↑ He, Pengcheng; Liu, Xiaodong; Gao, Jianfeng; Chen, Weizhu (2021-10-06). "DeBERTa: Decoding-enhanced BERT with Disentangled Attention". arXiv:2006.03654 [cs.CL].
  10. ↑ "xlnet". GitHub. Retrieved 2 January 2024.
  11. ↑ Yang, Zhilin; Dai, Zihang; Yang, Yiming; Carbonell, Jaime; Salakhutdinov, Ruslan; Le, Quoc V. (2 January 2020). "XLNet: Generalized Autoregressive Pretraining for Language Understanding". arXiv:1906.08237 [cs.CL].
  12. ↑ Dai, Zihang; Yang, Zhilin; Yang, Yiming; Carbonell, Jaime; Le, Quoc; Salakhutdinov, Ruslan (2019-07). Korhonen, Anna; Traum, David; Màrquez, Lluís (eds.). "Transformer-XL: Attentive Language Models beyond a Fixed-Length Context". Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. Florence, Italy: Association for Computational Linguistics: 2978–2988. doi:10.18653/v1/P19-1285. {{cite journal}}: Check date values in: |date= (help)
  13. 1 2 Press, Ofir; Smith, Noah A.; Lewis, Mike (2021-08-01). "Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation". arXiv:2108.12409 [cs.CL].
  14. ↑ Ke, Guolin; He, Di; Liu, Tie-Yan (2021-03-15). "Rethinking Positional Encoding in Language Pre-training". arXiv:2006.15595 [cs.CL].
  15. ↑ Raffel, Colin; Shazeer, Noam; Roberts, Adam; Lee, Katherine; Narang, Sharan; Matena, Michael; Zhou, Yanqi; Li, Wei; Liu, Peter J. (2020). "Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer". Journal of Machine Learning Research. 21 (140): 1–67. arXiv:1910.10683. ISSN 1533-7928.
  16. ↑ Hugging Face. "Transformers". GitHub. src/transformers/models/t5/modeling_t5.py.
  17. 1 2 Su, Jianlin; Ahmed, Murtadha; Lu, Yu; Pan, Shengfeng; Bo, Wen; Liu, Yunfeng (2024-02-01). "RoFormer: Enhanced transformer with Rotary Position Embedding". Neurocomputing. 568 127063. arXiv:2104.09864. doi:10.1016/j.neucom.2023.127063. ISSN 0925-2312. Archived from the original on 2026-01-15.
  18. ↑ 苏, 剑林 (2021-02-03). "让研究人员绞尽脑汁的Transformer位置编码" [Transformer Position Encoding That Has Researchers Racking Their Brains]. 科学空间 (in Chinese).
  19. ↑ Biderman, Stella; Black, Sid; Foster, Charles; Gao, Leo; Hallahan, Eric; He, Horace; Wang, Ben; Wang, Phil (2021). "Rotary Embeddings: A Relative Revolution". EleutherAI.
  20. ↑ EleutherAI. "GPT-NeoX". GitHub. megatron/model/transformer.py, line 908. Commit 8b43196fbd832b797be9f3d88d54481171010507.
  21. ↑ Touvron, Hugo; Lavril, Thibaut; Izacard, Gautier; Martinet, Xavier; Lachaux, Marie-Anne; Lacroix, Timothée; Rozière, Baptiste; Goyal, Naman; Hambro, Eric; Azhar, Faisal; Rodriguez, Aurelien; Joulin, Armand; Grave, Edouard; Lample, Guillaume (2023). "LLaMA: Open and Efficient Foundation Language Models". arXiv:2302.13971 [cs.CL].
  22. 1 2 Xiong, Wenhan; Liu, Jingyu; Molybog, Igor; Zhang, Hejia; Bhargava, Prajjwal; Hou, Rui; Martin, Louis; Rungta, Rashi; Sankararaman, Karthik Abinav; Oguz, Barlas; Khabsa, Madian; Fang, Han; Mehdad, Yashar; Narang, Sharan; Malik, Kshitiz (June 2024). Duh, Kevin; Gomez, Helena; Bethard, Steven (eds.). "Effective Long-Context Scaling of Foundation Models". Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers). Mexico City, Mexico: Association for Computational Linguistics: 4643–4663. doi:10.18653/v1/2024.naacl-long.260.
  23. ↑ AI @ Meta, Llama Team (2024-11-23). "The Llama 3 Herd of Models". arXiv:2407.21783 [cs.AI].
  24. ↑ Jin, Hongye; Han, Xiaotian; Yang, Jingfeng; Jiang, Zhimeng; Liu, Zirui; Chang, Chia-Yuan; Chen, Huiyuan; Hu, Xia (2024-07-11). "LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning". arXiv:2401.01325 [cs.CL].
  25. ↑ Sun, Yutao; Dong, Li; Patra, Barun; Ma, Shuming; Huang, Shaohan; Benhaim, Alon; Chaudhary, Vishrav; Song, Xia; Wei, Furu (2022-12-20). "A Length-Extrapolatable Transformer". arXiv:2212.10554 [cs.CL].
  26. ↑ Hugging Face. "Transformers". GitHub. src/transformers/models/qwen2_vl/modeling_qwen2_vl.py, line 1357. Commit 1759bb9126e59405f58693a17ef9f58040c2008b.
  27. ↑ 苏, 剑林 (2025-04-18). "Transformer升级之路:19、第二类旋转位置编码" [The Road to Transformer Upgrades: 19. The Second Type of Rotary Position Encoding]. 科学空间 (in Chinese).
  28. ↑ "Rotary Positional Embeddings with Relative distances (RoPER)". labml.ai research blog. 2022. Retrieved 2026-10-26.
  29. ↑ Haviv, Adi; Ram, Ori; Press, Ofir; Izsak, Peter; Levy, Omer (December 2022). Goldberg, Yoav; Kozareva, Zornitsa; Zhang, Yue (eds.). "Transformer Language Models without Positional Encodings Still Learn Positional Information". Findings of the Association for Computational Linguistics: EMNLP 2022. Abu Dhabi, United Arab Emirates: Association for Computational Linguistics: 1382–1390. doi:10.18653/v1/2022.findings-emnlp.99.
  30. ↑ Wang, Jie; Ji, Tao; Wu, Yuanbin; Yan, Hang; Gui, Tao; Zhang, Qi; Huang, Xuanjing; Wang, Xiaoling (August 2024). Ku, Lun-Wei; Martins, Andre; Srikumar, Vivek (eds.). "Length Generalization of Causal Transformers without Position Encoding". Findings of the Association for Computational Linguistics: ACL 2024. Bangkok, Thailand: Association for Computational Linguistics: 14024–14040. doi:10.18653/v1/2024.findings-acl.834.
  31. ↑ Zuo, Chunsheng; Guerzhoy, Pavel; Guerzhoy, Michael (January 2025). Rambow, Owen; Wanner, Leo; Apidianaki, Marianna; Al-Khalifa, Hend; Eugenio, Barbara Di; Schockaert, Steven (eds.). "Position Information Emerges in Causal Transformers Without Positional Encodings via Similarity of Nearby Embeddings". Proceedings of the 31st International Conference on Computational Linguistics. Abu Dhabi, UAE: Association for Computational Linguistics: 9418–9430.
  32. ↑ "dblp: How Much Position Information Do Convolutional Neural Networks Encode?". dblp.org. Retrieved 2026-10-27.
  33. ↑ Kazemnejad, Amirhossein; Padhi, Inkit; Natesan Ramamurthy, Karthikeyan; Das, Payel; Reddy, Siva (2023). "The Impact of Positional Encoding on Length Generalization in Transformers". Advances in Neural Information Processing Systems. 36. Curran Associates, Inc.: 24892–24928. arXiv:2305.19466. doi:10.52202/075280-1082. ISBN 978-1-7138-9911-2.{{cite journal}}: CS1 maint: periodical has ISBN (link)
  34. 1 2 Han, Chi; Wang, Qifan; Peng, Hao; Xiong, Wenhan; Chen, Yu; Ji, Heng; Wang, Sinong (June 2024). Duh, Kevin; Gomez, Helena; Bethard, Steven (eds.). "LM-Infinite: Zero-Shot Extreme Length Generalization for Large Language Models". Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers). Mexico City, Mexico: Association for Computational Linguistics: 3991–4008. doi:10.18653/v1/2024.naacl-long.222.
  35. ↑ "The Llama 4 herd: The beginning of a new era of natively multimodal AI innovation". ai.meta.com. Archived from the original on 2026-10-21. Retrieved 2026-10-26.
  36. ↑ Press, Ofir; Smith, Noah A.; Lewis, Mike (2022-04-22). "Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation". arXiv:2108.12409 [cs.CL].
  37. ↑ Gao, Tianyu; Wettig, Alexander; Yen, Howard; Chen, Danqi (July 2025). Che, Wanxiang; Nabende, Joyce; Shutova, Ekaterina; Pilehvar, Mohammad Taher (eds.). "How to Train Long-Context Language Models (Effectively)". Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Vienna, Austria: Association for Computational Linguistics: 7376–7399. doi:10.18653/v1/2025.acl-long.366. ISBN 979-8-89176-251-0.{{cite journal}}: CS1 maint: periodical has ISBN (link)
  38. ↑ Child, Rewon; Gray, Scott; Radford, Alec; Sutskever, Ilya (2019-04-23). "Generating Long Sequences with Sparse Transformers". arXiv:1904.10509 [cs.LG].
  39. 1 2 3 4 Peng, Bowen; Quesnelle, Jeffrey; Fan, Honglu; Shippole, Enrico (2024-05-31). "YaRN: Efficient Context Window Extension of Large Language Models". International Conference on Learning Representations. 2024: 31932–31951.
  40. ↑ Chen, Shouyuan; Wong, Sherman; Chen, Liangjian; Tian, Yuandong (2023-06-28). "Extending Context Window of Large Language Models via Positional Interpolation". arXiv:2306.15595 [cs.CL].
  41. ↑ emozilla (2023-06-30). "Dynamically Scaled RoPE further increases performance of long context LLaMA with zero fine-tuning". Reddit.