liveBook · Manning

Sequence

As explained in Deep Learning with Python, Third Edition

An ordered sequence of integer values used here to represent tokenized text.

A tokenized text sequence is an ordered list of integer IDs, with each ID representing a token. Detokenization reverses the mapping and joins the resulting tokens into text. section 15.1

For text generation, predicting an entire sequence as one classifier output is impractical: a language model instead predicts the next token from the tokens seen so far. section 15.1

Why predict one token at a time?

With a vocabulary of 20,000 words, there are 20,000⁴ possible four-word sequences. Predicting one of 20,000 tokens at each step makes the prediction space more manageable. section 15.1

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines token-to-integer mapping and next-token prediction, without detailing tokenizer implementation.
Examples
Compares the possible four-word outputs from a 20,000-word vocabulary with predicting one token at a time.
What it assumes
Builds on tokenizing strings into integer IDs and describes reversing that mapping through detokenization.
What you can do after
Understand how integer sequences represent text and support next-token generation.
How it connects
Connects tokenization and detokenization with language modeling.

Also explained in

Compare how 22 books explain sequence →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.