liveBook · Manning

Language modeling

As explained in Deep Learning with R, Third Edition

Language modeling is the task or technique of learning a probability distribution over sequences of linguistic symbols.

Language modeling learns a probability distribution over linguistic symbol sequences. Its core task is predicting the next token from the tokens that came before it. section 16.6 section 14.1

Predicting the next word

Given an incomplete sentence, a language model estimates which word is most likely to come next. Repeating this prediction produces a longer string of text. section 14.1 section 16.6

Once a probability distribution is available, generation can choose tokens in several ways:

  • Greedy search selects the most likely token at every step. section 16.6
  • Random sampling draws directly from the predicted categorical distribution. section 16.6
  • Top-k sampling limits choices to the k most likely candidates. section 16.6

Language models capture statistical regularities rather than human-like understanding. LSTMs improved text modeling but struggled with long dependencies; Transformers addressed major scalability and parallelization problems. section 14.1 section 14.1

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines next-token prediction, probability distributions, and sampling strategies while treating architecture history comparatively.
Examples
Uses incomplete-sentence next-word prediction and greedy, random, and top-k text generation.
What you can do after
Apply language models to predict tokens and generate text using greedy, random, or top-k sampling.
How it connects
Connects language modeling to Transformers, LSTMs, text generation, natural language processing, and large language models.

Also explained in

Compare how 4 books explain language modeling →

Related concepts

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