# Uwaga liniowa

EN: **Linear attention** · id `linearattention` · aliases: linear attention, linear transformers, linear transformer, kernelized attention, uwaga liniowa

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Sieci i modele generatywne](https://aiatlasgraph.com/t/neural.md) › [Architektury efektywne](https://aiatlasgraph.com/t/efficientarch.md) › Uwaga liniowa

## Description

- PL: Rodzina przybliżeń samo-uwagi, w których softmax zastępuje iloczyn map cech jądra; zmiana kolejności mnożeń daje koszt liniowy w długości sekwencji.
- EN: A family of self-attention approximations replacing softmax with a product of kernel feature maps; reordering multiplications gives cost linear in sequence length.

## In one sentence

- PL: Uproszczona uwaga, której koszt rośnie równo z długością tekstu, a nie z jej kwadratem.
- EN: A simplified attention whose cost grows in step with text length rather than with its square.

## Problem it solves

- PL: Zwykła uwaga przy dwa razy dłuższym tekście wymaga mniej więcej czterokrotnie więcej obliczeń, więc długie dokumenty są drogie.
- EN: Standard attention needs roughly four times the compute for text twice as long, so long documents get expensive.

## What it does

- PL: Jak notatki zamiast archiwum: model nie przegląda ponownie każdego wcześniejszego słowa, tylko dopisuje je do zwięzłego podsumowania.
- EN: Like notes instead of an archive: the model does not re-read every earlier word but adds it to a compact summary.

## Everyday example

- PL: Model w telefonie streszcza długie nagranie rozmowy, nie zapychając pamięci przy każdym kolejnym zdaniu.
- EN: A model on a phone summarises a long recorded conversation without filling memory with every new sentence.

## This concerns you if you…

- PL: przetwarzasz bardzo długie teksty lub nagrania
- PL: szukasz modeli taniej generujących długie odpowiedzi
- EN: process very long texts or recordings
- EN: look for models that generate long answers more cheaply

## Keywords

kernelized attention · Performer · RetNet · Gated DeltaNet · gated linear attention · flash-linear-attention · Lightning Attention · delta rule

## How it works

- PL: Softmax(QKᵀ)V zastępuje się φ(Q)(φ(K)ᵀV), gdzie φ to mapa cech. Dzięki łączności mnożenia macierzy suma φ(K)ᵀV ma stały rozmiar i aktualizuje się przyrostowo, więc przy generacji model działa jak sieć rekurencyjna ze stałym stanem. Nowsze warianty dodają bramki zapominania i regułę delta.
- EN: Softmax(QKᵀ)V is replaced by φ(Q)(φ(K)ᵀV), where φ is a feature map. By associativity the sum φ(K)ᵀV has fixed size and updates incrementally, so at generation time the model acts as a recurrent network with constant state. Newer variants add forget gates and the delta rule.

## Limits

- PL: Stały stan ma ograniczoną pojemność, więc dokładne przywoływanie odległych szczegółów (np. kopiowanie) wypada gorzej niż w pełnej uwadze. Dlatego często łączy się ją z kilkoma warstwami zwykłej uwagi; jakość zależy od mapy cech i bramkowania.
- EN: The fixed state has limited capacity, so precise recall of distant details (e.g. copying) is weaker than with full attention. It is therefore often mixed with a few full-attention layers; quality depends on the feature map and gating.

## Key terms

- PL: **mapa cech jądra**: Funkcja przekształcająca wektory tak, by ich iloczyn przybliżał podobieństwo.
- PL: **stan rekurencyjny**: Stałej wielkości podsumowanie dotychczasowego kontekstu.
- PL: **reguła delta**: Aktualizacja pamięci korygująca to, co już w niej zapisano.
- EN: **kernel feature map**: A function transforming vectors so their product approximates similarity.
- EN: **recurrent state**: A fixed-size summary of the context so far.
- EN: **delta rule**: A memory update correcting what is already stored.

## Know first

- [Mechanizm self-attention (zapytania, klucze, wartości) (Self-attention (queries, keys, values))](https://aiatlasgraph.com/t/selfattention.md)
- [Sieci rekurencyjne (RNN) (Recurrent neural networks (RNN))](https://aiatlasgraph.com/t/rnn.md)

## Related topics

Untyped, symmetric "see also" links.

- [Architektury hybrydowe: uwaga + warstwy liniowe (Hybrid architectures: attention plus linear/recurrent layers)](https://aiatlasgraph.com/t/hybridattention.md)
- [Modele przestrzeni stanów (Mamba) (State-space models (Mamba))](https://aiatlasgraph.com/t/ssm.md)
- [RWKV — sieć rekurencyjna trenowana jak transformer (RWKV (Receptance Weighted Key Value))](https://aiatlasgraph.com/t/rwkv.md)

## Sources

- [Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention](<https://arxiv.org/abs/2006.16236>) `katharopoulos-linear-attention-2020` · by Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François Fleuret
- [RWKV: Reinventing RNNs for the Transformer Era](<https://arxiv.org/abs/2305.13048>) `peng-rwkv-2023` · by Bo Peng, Eric Alcaide, Quentin Anthony i in.

---

AI Atlas revision 129 (2026-11-05) · HTML: https://aiatlasgraph.com/t/linearattention · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-05
