07 Causal encoder-decoder

The DeepSeek V4.1 Flash layout: one part of the network reads the context, another generates, and both stay causal so caching still works.

VideoThe idea in a few minutes

The problem

Decoder-only: the same full stack processes prompt tokens and generated tokens.

VisualizationWhere compute goes: prompt vs. generation

The idea

Encoder and decoder halves, both with causal masks, connected so the context is encoded once.

VisualizationArchitecture diagram

The trade-off

Prefill and decode cost compared with a decoder-only model of the same size.

VisualizationCost per phase

Sources

Papers and model reports.