Core
Transformer families, from encoder-only to hybrid
Encoder-only, decoder-only, encoder–decoder, mixture-of-experts, and the 2025–26 hybrid family differ in visibility, objective, and mixer choice — and Qwen3.8-27B is a dense multimodal hybrid, not an MoE.
Updated
01 · Concept
Concept
You are handed a new model release and one practical question: what kind of thing is it? “Transformer” alone tells you almost nothing — it names a toolkit, not a visibility pattern, an objective, or a mixer choice. The classic taxonomy has three families; the modern one needs two more axes. Working through all five, then classifying Qwen3.8-27B step by step, turns a marketing page into an architecture you can reason about.
An encoder-only model lets every position attend left and right across the whole input. BERT’s masked-language objective corrupts selected tokens and trains the model to reconstruct them using both sides. The output is a contextual representation per position, not an autoregressive generator: classification reads a pooled state, tagging uses per-token states, retrieval derives embeddings. Generation is possible with special procedures but is not the native factorization.
A decoder-only model uses causal self-attention: position reads only positions up to , and its state predicts token . Training evaluates all positions in parallel under a triangular mask; inference appends one token and repeats. GPT-style models live here, and a prompt with its continuation is simply one token sequence, so tasks become completion.
An encoder–decoder model runs two stacks. The encoder reads the source bidirectionally; the decoder reads prior target tokens causally and adds a cross-attention sublayer whose queries come from the evolving target and whose keys and values come from encoder states. Translation is the canonical case; T5 generalizes it by casting many tasks as text-to-text span corruption.
Masks express the distinctions compactly: encoder self-attention is full except padding; decoder self-attention is lower triangular; cross-attention lets every target query read all source keys because the source is already known. Objectives matter as much as topology — architecture and objective jointly decide what signal reaches each position.
The fourth family varies a different axis: parameter sparsity. A mixture-of-experts (MoE) model keeps the visibility of a decoder but replaces each dense FFN with a router and a set of expert FFNs, activating only a few per token. Total parameters can be enormous while per-token compute stays modest. The trade is systems complexity — routing, load balancing, expert parallelism — and the family label answers a different question than the first three: not “who can see whom” but “who pays for which parameters.”
The fifth family, prominent across 2025–26, varies the mixer itself. A hybrid model keeps the decoder’s causal contract but replaces softmax attention in most layers with a fixed-size-state sequence mixer — a linear-attention or state-space recurrence — while retaining full attention in a minority of layers. Jamba-style designs interleaved state-space blocks with attention blocks; IBM’s Granite-H line took a similar path; and Qwen3.8-27B is the specimen this course dissects: three Gated DeltaNet blocks for every attention block, 48 and 16 of the 64 layers respectively. The hybrid axis answers yet another question: not visibility, not sparsity, but “what does token mixing cost as context grows?” Full attention pays per past token; a fixed-size-state mixer pays a constant. Keeping a minority of attention layers preserves direct content-addressed access to arbitrary positions where it earns its cost — the design argument of lesson 4.16.
Now classify Qwen3.8-27B, the way you would any release, and notice where the reflex answer goes wrong. Step one, visibility: it predicts next tokens under a causal mask, one stack, no cross-attention between separate encoder and decoder stacks — decoder-only. Step two, sparsity — and here is the trap. The reflex says “27B parameters, frontier benchmarks, 2026 — surely MoE, everyone routes experts now.” Check the configuration instead: there are no experts and no router; every token passes through every layer’s full gated FFN. Qwen3.8-27B is dense. Its economy move was made on the mixer axis, not the FFN axis. Step three, mixer: 48 DeltaNet layers, 16 attention layers — hybrid. Step four, modality: it accepts images and video alongside text, through a vision encoder whose outputs are projected into the same 5120-dimensional stream the text embeddings use (lesson 4.17) — multimodal in, text out. Verdict: a dense, multimodal, decoder-only hybrid. Four axes, four independent answers, and the popular guess wrong on the one it was most confident about.
The families also differ in serving economics. An encoder processes its source once; an encoder–decoder caches encoder outputs but pays self- plus cross-attention while decoding; a pure decoder leans on KV caching that grows with context; an MoE moves weights around experts; a hybrid shrinks the growing cache to its attention minority. Track 7 quantifies these differences — for now it is enough that the family label predicts where the serving bill comes from.
Prefix language modelling, retrieval modules, and multimodal towers blur every boundary, and real architectures are compositions. But the axes stay useful precisely because they are independent: visibility, objective, parameter sparsity, mixer cost, modality. Ask the five questions in order and any model card — even one without a technical report, as with Qwen3.8-27B, whose architecture is documented only through its configuration and inherited Qwen3.5 lineage — becomes legible.
02 · Analogy
Analogy
Several language teams occupy the same building. The analyst team reads a complete dossier with pages visible in both directions. The novelist team writes left to right behind a curtain hiding unwritten pages. The translator team lets analysts read the source, then writers consult their notes. A newer team splits each desk's work among specialist clerks who are called only when needed. And the newest team keeps most desks running on compact ledgers, seating a full archivist at every fourth desk. Same desks, same building — different institutions.
03 · Teach it back
Teach it back
Compare the classic three Transformer families by visibility and objective, then explain what the MoE and hybrid axes add and where Qwen3.8-27B sits.
Compare with a model answer
Encoder-only models use bidirectional self-attention with corruption objectives to represent full inputs; decoder-only models use causal self-attention with next-token prediction, making generation native; encoder–decoder models encode a source bidirectionally and decode a target causally through cross-attention. Two newer axes are orthogonal to visibility: MoE models replace dense FFNs with routed expert FFNs, activating a subset per token, while hybrid models replace softmax attention in most layers with fixed-size-state mixers, keeping full attention in a minority. Qwen3.8-27B is decoder-only, causal, hybrid (48 Gated DeltaNet layers, 16 attention layers), dense in its FFNs — not MoE — and multimodal through a vision encoder feeding the same stream.
04 · Check your understanding
Check your understanding
Complete the teach-back and answer the quiz correctly to finish this lesson.
◎ · Evidence marker
Sources
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding.
- Alec Radford et al. (2019). Language Models are Unsupervised Multitask Learners.
- Colin Raffel et al. (2020). Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer.
- Qwen Team (2026). Qwen3.8-27B Model Card.
- Opher Lieber et al. (2024). Jamba: A Hybrid Transformer-Mamba Language Model.