Encoder-Decoder Architectures

Encoder-decoder architectures map an input representation into an output representation through separate encoding and generation or prediction stages.

The basic decomposition is:

For autoregressive decoders, the output distribution is usually factorized as:

Key Ideas

  • The encoder builds a representation of the input; the decoder consumes that representation to produce outputs.
  • Decoders may be autoregressive, parallel, iterative, or task-specific prediction heads.
  • Cross-attention is the usual bridge in Transformer encoder-decoder systems.
  • Bottlenecks, latent variables, or pooled states force compression; full cross-attention preserves token-level access.
  • The same pattern appears in translation, captioning, conditional generation, docking-style prediction, and masked reconstruction.

Interface Contract

ComponentInputOutputCommon Failure
Encodersource tokens, graph, image patches, residues, atomshidden states representation drops needed information
Bridgepooled vector, latent variable, cross-attention, pair stateconditioning interfacehidden bottleneck or leakage
Decoderprevious outputs plus contextoutput tokens, coordinates, graph, labelexposure bias or invalid decoding
Headdecoder state or pooled statetask-specific predictionmetric mismatch

Write the interface explicitly:

For non-autoregressive decoders:

where can be noise or a latent seed and can be constraints.

Training vs Inference

PhaseDecoder InputRisk
teacher forcingground-truth previous tokens train-test mismatch
autoregressive inferencemodel samples error accumulation
parallel decodingmask, noise, slots, or queriesoutput alignment and duplicate predictions
iterative refinementprevious predictionstopping rule and compute budget
constrained decodinggrammar, valence, geometry, or schema constraintspost-hoc repair can hide failures

The paper should state whether decoding failures are counted or filtered away.

Domain Examples

DomainEncoderDecoderExtra Constraint
translationsource texttarget textcausal mask and tokenization
image captioningimage patchestext tokensmultimodal alignment
molecule generationgraph/string/latentSMILES, graph, conformerchemical validity
protein modelingsequence, MSA, structuresequence, coordinates, contactsresidue indexing and homolog leakage
dockingprotein pocket and ligandpose, score, interaction graphreceptor state and pose quality
agentstask state, memory, toolsaction or tool callaction schema and verification

Practical Checks

  • Identify what information the encoder exposes to the decoder: pooled vector, token states, graph states, or pair states.
  • Check whether the decoder can see previous outputs, ground-truth outputs, or only its own predictions.
  • Look for train-test mismatch in autoregressive decoding and teacher-forced training.
  • For molecule or protein tasks, check whether constraints are enforced during decoding or repaired afterward.
  • Is the encoder output fixed, retrieved, generated, or updated during decoding?
  • Are decoding compute budget, beam/search policy, and invalid outputs reported?