liveBook · Manning

Decode

As explained in Generative AI in Action

A decoder is a neural-network component that generates or reconstructs output data from an internal representation or sampled latent state.

A decoder is a neural-network component that turns an internal representation into generated or reconstructed output. In language models, it produces text from encoder hidden states or, in decoder-only systems, from previously generated tokens. section 2.3

A decoder typically works through an iterative generation process:

  • Receives encoder hidden states and a start token, or uses the tokens already generated as its context. section 2.8
  • Predicts the next token, converts the prediction into text, and repeats the loop until the output sequence is complete. section 2.8
  • In a variational autoencoder, samples a latent state and reconstructs an image, with randomness enabling varied outputs similar to the input. section 4.1.1

Two decoder roles

For text completion, a decoder predicts one token at a time until it forms a response. For image generation or restoration, a VAE decoder transforms sampled latent states into images, including reconstructed or inpainted content. section 2.8 section 4.1.1

Figure 2.3 Conceptual architecture of an LLM
figure

Use the conceptual architecture to trace how tokenized input becomes embeddings, hidden states, decoder predictions, and final text. section 2.8

How Generative AI in Action covers it

How deep it goes
Explains inputs, iterative token prediction, and latent-state reconstruction without deriving decoder internals mathematically.
Examples
Uses next-token text completion, image generation, reconstruction, inpainting, and varied outputs from sampled latent states.
What it assumes
Assumes basic awareness of prompts, tokens, embeddings, encoders, and latent representations.
What you can do after
Evaluate how language and image-generation systems transform representations into sequential or reconstructed outputs.
How it connects
Connects decoders to encoders, hidden states, tokenization, embeddings, latent spaces, and variational autoencoders.

Also explained in

Compare how 15 books explain decode →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.