# Encoder (Transformer)

> The part of a transformer that reads text and finds its meaning.

**Field:** Artificial Intelligence  
**Category:** LLMs  
**Also known as:** Encoder, Encoder-Only Model

## Think of it like

Think of it like a reader who reads the whole page. Then they tell you what it means.

## Definition

An encoder is the part of a transformer that reads a whole text. It turns the text into vectors that hold its meaning. Each token can look at all the others, both before and after it. An encoder does not write; it is used to sort text, find names and help search. In a translator, the encoder reads the sentence and the decoder writes it out anew.

## Example

Emma's search tool uses a model that is only an encoder, a kind made popular by BERT in 2018. It turns each help page into a vector, so a question finds the right page.

## Why it matters

Encoders do quiet work behind search and spam filters. They also sort lots of text.

## Common mistake

Expecting an encoder-only model to chat. It reads and understands, but it has no part that writes.

## Three principles

- **Reads the whole text.** Both directions.
- **Gives vectors.** The meaning as numbers.
- **Does not write.** Used for search and sorting.

## Related terms

- [Decoder (Transformer)](https://learn.benibix.com/term/ai/decoder)
- [Transformer](https://learn.benibix.com/term/ai/transformer)
- [Word Embedding](https://learn.benibix.com/term/ai/word-embedding)
- [Self-Attention](https://learn.benibix.com/term/ai/self-attention)
- [BERT (Language Model)](https://learn.benibix.com/term/ai/bert)

## Told apart from

- [Encoder vs Decoder](https://learn.benibix.com/compare/encoder-vs-decoder): People often think every transformer has both an encoder and a decoder. Many have only one. An encoder reads a whole text, looking both ways. It turns the text into meaning for search or sorting. A decoder writes text one token at a time, looking only back. Chat models use just a decoder.

## Taught in

- [Transformer Architecture](https://learn.benibix.com/learn/ai-llms/transformer-architecture): LLMs, 5/15

![Three shapes of transformer side by side. Encoder only reads text and gives back its meaning. Decoder only writes text one token at a time. Encoder and decoder together read a sentence and write a new one, as in translation.](https://learn.benibix.com/diagrams/llm-encoder-decoder.svg)

---

Source: https://learn.benibix.com/term/ai/encoder
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
