# Kodowanie pozycji (sinusoidalne, RoPE)

EN: **Positional encoding (sinusoidal, RoPE)** · id `posencoding` · aliases: positional encoding, position embedding, kodowanie pozycji, RoPE, rotary position embedding, NoPE, sinusoidal positional encoding

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Sieci i modele generatywne](https://aiatlasgraph.com/t/neural.md) › [Transformery i attention](https://aiatlasgraph.com/t/transformers.md) › Kodowanie pozycji (sinusoidalne, RoPE)

## Description

- PL: Sposób przekazania modelowi informacji o kolejności tokenów, której sama operacja uwagi nie koduje. Oryginalny Transformer dodawał wektory sinusoidalne; wiele współczesnych LLM używa RoPE, które obraca zapytania i klucze zależnie od pozycji. Przy wydłużaniu kontekstu RoPE bywa dodatkowo skalowane lub interpolowane; niektóre architektury część warstw pozostawiają bez jawnego kodowania pozycji.
- EN: A way to provide token-order information that the attention operation alone does not encode. The original Transformer added sinusoidal vectors; many contemporary LLMs use RoPE, which rotates queries and keys according to position. For context extension RoPE is often additionally scaled or interpolated; some architectures leave part of their layers without explicit positional encoding.

## In one sentence

- PL: To przekazywanie modelowi informacji, gdzie w ciągu danych znajduje się każdy fragment.
- EN: This tells a model where each element appears in a sequence.

## Problem it solves

- PL: Te same słowa w innej kolejności mogą znaczyć coś innego, a sam mechanizm uwagi nie zapisuje ich położenia.
- EN: The same words in another order can mean something different, while attention alone does not encode their positions.

## What it does

- PL: Do zapisów fragmentów dodaje się informacje o miejscu albo zmienia porównania między nimi zgodnie z ich położeniem.
- EN: Position information is added to element representations, or comparisons between them are adjusted according to their locations.

## Everyday example

- PL: Model ma odróżnić zdanie o psie goniącym kota od zdania o kocie goniącym psa.
- EN: A model needs to distinguish a dog chasing a cat from a cat chasing a dog.

## This concerns you if you…

- PL: znaczenie zależy od kolejności danych
- PL: wydłużasz tekst obsługiwany przez model
- EN: work with data whose order affects meaning
- EN: extend the text length a model handles

## Keywords

sinusoidal encoding · learned position embeddings · RoPE · NoPE · partial RoPE · relative positions

## How it works

- PL: Informację o pozycji wprowadza się przez dodawane reprezentacje lub przekształcenie zapytań i kluczy. W kodowaniu rotacyjnym obroty zależne od indeksu powodują, że iloczyn skalarny uwzględnia względne odległości pozycji.
- EN: Position information enters through added representations or transformed queries and keys. Rotary encoding applies index-dependent rotations so dot products incorporate relative position distances.

## Limits

- PL: Pozycje spoza zakresu treningowego mogą dawać nietrafne relacje. Skalowanie lub interpolacja zmieniają geometrię kodowania; samo wydłużenie limitu wejścia nie gwarantuje użytecznego długiego kontekstu.
- EN: Positions outside the training range can produce unsuitable relationships. Scaling or interpolation alters encoding geometry; increasing input limits alone does not guarantee useful long context.

## Key terms

- PL: **pozycja względna**: Odległość pomiędzy elementami sekwencji zamiast ich bezwzględnych indeksów.
- PL: **RoPE**: Kodowanie pozycji przez obroty wektorów zapytań i kluczy.
- EN: **relative position**: The distance between sequence elements rather than their absolute indices.
- EN: **RoPE**: Encoding positions through rotations of query and key vectors.

## Know first

- [Algebra liniowa: wektory i macierze (Linear algebra: vectors and matrices)](https://aiatlasgraph.com/t/linearalgebra.md)

## Examples

- PL: kodowanie sinusoidalne · wyuczone pozycje · RoPE · NoPE / częściowy RoPE
- EN: sinusoidal encoding · learned positions · RoPE · NoPE / partial RoPE

## Related topics

Untyped, symmetric "see also" links.

- [Kodowanie położenia geograficznego (Location encoding)](https://aiatlasgraph.com/t/locationencoding.md)
- [Wydłużanie okna kontekstu (Context window extension)](https://aiatlasgraph.com/t/contextextension.md)

## Sources

- [Attention Is All You Need](<https://arxiv.org/abs/1706.03762>) `vaswani-attention-2017` · by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, Illia Polosukhin
- [RoFormer: Enhanced Transformer with Rotary Position Embedding](<https://arxiv.org/abs/2104.09864>) `rope-2021` · by Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, Yunfeng Liu
- [The Big LLM Architecture Comparison — From DeepSeek V3 to GLM-5](<https://magazine.sebastianraschka.com/p/the-big-llm-architecture-comparison>) `raschka-llm-arch-comparison` · by Sebastian Raschka

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/posencoding · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
