liveBook · Manning

Decode

As explained in Natural Language Processing in Action, Second Edition

Decoding is the transformation of a machine representation back into a human-interpretable or otherwise target-form output.

Decoding transforms a machine’s numerical representation into human-interpretable language or another target-form output. In natural language generation, it reverses encoding: a model’s output sequence of numbers becomes readable text. section 1.1.2

Transformer decoding adds an architectural and procedural layer:

  • Decoder layers combine attention, normalization, and fully connected layers to process generated sequences. section 9.2.2
  • The previously generated output is shifted and returned to the decoder input, allowing the sequence to develop token by token. section 9.2.2
  • Output-token selection can use alternatives such as beam search or depth-first search. section 9.2.2

From prompt to readable output

A prompt enters a transformer as token embeddings. Decoder layers use the available sequence to select an output token, return that token to the decoder input, and continue until the generated sequence can be rendered as readable language. section 9.2.2 section 1.1.2

Figure 1.2 Decoding: The final step for NLG
figure

Use the decoding pipeline diagram to trace the final conversion from numerical model output to natural language. section 1.1.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains decoding as inverse encoding and extends it to decoder layers, feedback, and token-selection algorithms.
Examples
Uses an NLG decoding diagram and Transformer diagrams showing decoder feedback and alternative output-token selection.
What it assumes
Assumes familiarity with encoding natural language into embedding vectors and introduces decoding as the reverse operation.
What you can do after
Evaluate/understand how generated numerical sequences become readable text and how Transformer decoders select successive tokens.
How it connects
Connects decoding with encoding, embeddings, natural language generation, attention, Transformer architecture, beam search, and depth-first search.

Also explained in

Compare how 15 books explain decode →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.