# Enkoder, dekoder i enkoder–dekoder (BERT, GPT, T5)

EN: **Encoder-only, decoder-only and encoder–decoder models** · id `transformerfamilies` · aliases: encoder-only, decoder-only, encoder-decoder, BERT, GPT, T5, masked language model, seq2seq transformer

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) › Enkoder, dekoder i enkoder–dekoder (BERT, GPT, T5)

## Description

- PL: Trzy układy transformera. Enkodery (BERT) widzą tekst w obie strony i służą do klasyfikacji, wyszukiwania i ekstrakcji; dekodery (GPT, Llama) przewidują następny token i stanowią większość współczesnych LLM; enkoder–dekoder (T5, BART) tłumaczy jeden tekst na drugi, np. w tłumaczeniu i streszczaniu.
- EN: The three transformer layouts. Encoders (BERT) read text bidirectionally and serve classification, search and extraction; decoders (GPT, Llama) predict the next token and make up most modern LLMs; encoder–decoders (T5, BART) map one text to another, e.g. translation and summarisation.

## In one sentence

- PL: To różne układy modeli uwagi przeznaczone do odczytywania danych, tworzenia tekstu lub przekształcania jednego tekstu w drugi.
- EN: These attention-model layouts are designed to read data, generate text or transform one text into another.

## Problem it solves

- PL: Model dobry do porównywania tekstów nie musi być najlepszym wyborem do pisania odpowiedzi.
- EN: A model suited to comparing texts may not be the best choice for writing responses.

## What it does

- PL: Część odczytująca analizuje wejście, część generująca dopisuje kolejne fragmenty, a połączony układ oddziela te dwa zadania.
- EN: An encoder analyses input, a decoder generates successive elements, and a combined layout separates those two jobs.

## Everyday example

- PL: Do sortowania opinii wybierasz model odczytujący tekst, a do tworzenia odpowiedzi model generujący kolejne słowa.
- EN: You choose a text-reading model to sort reviews and a model that generates successive words to write replies.

## This concerns you if you…

- PL: wybierasz model do konkretnego zadania tekstowego
- PL: porównujesz analizowanie tekstu z jego generowaniem
- EN: choose a model for a particular text task
- EN: compare text analysis with text generation

## Keywords

BERT · ModernBERT · GPT · Llama · Gemma · T5 · BART · masked language modeling

## How it works

- PL: Enkoder stosuje kontekst dwukierunkowy, a dekoder przyczynowy przewiduje token z dostępnego prefiksu. Układ enkoder–dekoder przekazuje reprezentacje wejścia przez cross-attention do osobnego generatora, rozdzielając analizę wejścia od tworzenia wyjścia.
- EN: An encoder uses bidirectional context, while a causal decoder predicts tokens from the available prefix. An encoder–decoder passes input representations through cross-attention to a separate generator, separating input analysis from output production.

## Limits

- PL: Cel treningowy i maski ograniczają sposób użycia architektury. Dekoder autoregresyjny generuje kolejno, a enkoder sam nie definiuje generatora; przetwarzanie pary sekwencji zwiększa koszt.
- EN: Training objectives and masks constrain architecture use. Autoregressive decoders generate sequentially, while encoders alone do not define generation; processing paired sequences increases cost.

## Key terms

- PL: **cross-attention**: Uwaga z zapytaniami jednej sekwencji oraz kluczami i wartościami drugiej.
- PL: **kontekst dwukierunkowy**: Dostęp pozycji do wcześniejszych i późniejszych elementów wejścia.
- EN: **cross-attention**: Attention using queries from one sequence and keys and values from another.
- EN: **bidirectional context**: A position's access to both earlier and later input elements.

## Know first

- [Mechanizm self-attention (zapytania, klucze, wartości) (Self-attention (queries, keys, values))](https://aiatlasgraph.com/t/selfattention.md)
- [Tokenizacja tekstu (BPE, WordPiece, SentencePiece) (Text tokenisation (BPE, WordPiece, SentencePiece))](https://aiatlasgraph.com/t/tokenization.md)

## Examples

- PL: BERT, ModernBERT · GPT, Llama, Gemma · T5, BART · maskowane vs przyczynowe modelowanie języka
- EN: BERT, ModernBERT · GPT, Llama, Gemma · T5, BART · masked vs causal language modelling

## Related topics

Untyped, symmetric "see also" links.

- [Klasyfikacja tekstu i analiza sentymentu (Text classification and sentiment analysis)](https://aiatlasgraph.com/t/textclassification.md)
- [Maskowana dyfuzja tekstu (Masked diffusion language models)](https://aiatlasgraph.com/t/maskdiffusion.md)
- [Przewidywanie następnego tokenu (modele autoregresyjne) (Next-token prediction objective)](https://aiatlasgraph.com/t/nexttoken.md)

## Sources

- [Hugging Face LLM Course, chapter 1: 'How do Transformers work?' and 'Transformer Architectures'](<https://huggingface.co/learn/llm-course/chapter1/6>) `hf-llm-course-transformer-arch` · by Hugging Face · sponsored
- [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](<https://arxiv.org/abs/1810.04805>) `bert-2018` · by Jacob Devlin, Ming-Wei Chang, Kenton Lee, Kristina Toutanova
- [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](<https://arxiv.org/abs/1910.10683>) `t5-2019` · by Colin Raffel, Noam Shazeer, Adam Roberts et al.

---

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