# Encoder-decoder

> Canonical: https://skillalmanac.com/glossary/encoder-decoder | Last verified: 2026-11-24 | Index status: not offered to search engines

An encoder-decoder is a neural network design with two parts: an encoder that reads an input sequence and builds an intermediate representation, and a decoder that uses it to generate an output sequence, word by word.

Also called: encoder-decoder model, encoder decoder architecture.

## In plain language

An encoder-decoder model works in two steps, like a human translator who first reads a whole sentence and then writes it out in another language. The first part, the encoder, reads the input, for example a French sentence, and boils it down into an internal summary. The second part, the decoder, uses that summary to write the output, for example the English sentence, one word at a time. The design suits jobs where one piece of text becomes another, such as translation. It is one design among several.

## Technical definition

In the description in Speech and Language Processing (Jurafsky and Martin, chapter 13), the encoder takes the input words x = [x1, ..., xn] and produces an intermediate context h; at decoding time the system takes h and generates the output y word by word. The textbook calls this the standard algorithm for machine translation and says encoder-decoder or sequence-to-sequence models map an input sequence to an output sequence that is a complex function of the whole input. The Transformer paper's abstract notes that dominant models used an encoder-decoder configuration and that the best ones connected encoder and decoder through an attention mechanism.

## How it shows up when you use agents

You do not choose an encoder-decoder when you run Claude Code, Codex or Cursor, but the idea explains how the models behind them are described. Machine translation is the textbook use of encoder-decoder models. The Transformer paper's abstract describes the dominant models of its time as being in an encoder-decoder configuration, and the [transformer](/glossary/transformer) keeps that pairing, linked by attention.

When it shows up: in a model card or paper that says a model is encoder-decoder, in a translation feature built on one, or when someone asks why a retrieval system used a sequence-to-sequence generator. What breaks when it is misunderstood: readers assume every language model reads and writes with two separate parts, or that an encoder-only model such as [BERT](/glossary/bert) can write long text. The next action is to read the model card to see which parts the model has before deciding what to use it for.

## Common confusions

- **Encoder-decoder versus decoder-only.** An encoder-decoder has a separate reading part and writing part. A decoder-only model generates from the prompt it is given. Check the model card, since both are called transformers.
- **Encoder-decoder versus encoder-only.** An encoder-only model such as [BERT](/glossary/bert) produces representations of text for understanding tasks and does not generate an output sequence by itself.
- **Encoder-decoder versus seq2seq.** The two names are used together in SLP3, which writes encoder-decoder or sequence-to-sequence models. Seq2seq names the task shape, and encoder-decoder names the two-part design.
- **Myth: attention replaced the encoder-decoder idea.** The Transformer abstract describes the best earlier models as connecting encoder and decoder through attention, and the Transformer keeps that pairing.

## Worked examples in this catalogue

### [What Is an LLM? The Facts Agent Users Need](https://skillalmanac.com/learn/what-is-an-llm-for-agent-users)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The guide explains that an LLM predicts text one token at a time inside a fixed context window, and what that means for cost and reliability.

Why it exercises the concept: That one-token-at-a-time loop is the generation step the decoder performs. The guide does not discuss encoder-decoder designs, so use it to see the decoding half in isolation.

### [What Is RAG? Retrieval-Augmented Generation Explained](https://skillalmanac.com/learn/what-is-rag)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The guide's facts note that the original RAG paper pairs a retriever over a dense vector index with a seq2seq generator, and the guide explains how retrieved passages are placed in the prompt.

Why it exercises the concept: It shows a sequence-to-sequence model used as one part of a larger system, which is where encoder-decoder models often appear. Most agent setups today place retrieved text in the prompt instead.

### [pseudo-localization-tester](https://skillalmanac.com/skills/skill-almanac/pseudo-localization-tester)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill's catalogue line says it builds a pseudo-locale from a resource file and reports truncation, fragment and hard-coded-text risks before translation.

Why it exercises the concept: Translation is the textbook use of encoder-decoder models. This skill does not translate; it prepares software text for translation, so it is a contrast case about the task rather than the architecture.

## Related terms

- [Transformer](https://skillalmanac.com/glossary/transformer.md)
- [Autoregressive model](https://skillalmanac.com/glossary/autoregressive-model.md)
- [Attention mechanism](https://skillalmanac.com/glossary/attention-mechanism.md)
- [Machine translation](https://skillalmanac.com/glossary/machine-translation.md)
- [BERT](https://skillalmanac.com/glossary/bert.md)
- [Natural language processing (NLP)](https://skillalmanac.com/glossary/natural-language-processing.md)

## Sources

- [Attention Is All You Need](https://arxiv.org/abs/1706.03762), arXiv (Vaswani et al., 2017) (accessed 2026-11-24)
- [Speech and Language Processing, chapter 13: Machine Translation](https://web.stanford.edu/~jurafsky/slp3/13.pdf), Stanford University (Jurafsky and Martin) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
