liveBook · Manning

Language model

As explained in Grokking AI Algorithms, Second Edition

A large language model is a neural language model trained on large text corpora to process and generate human language.

A language model predicts language from context. A large language model (LLM) is a neural model trained on extensive text collections to process and generate language. Think of it as autocomplete with much greater capacity: instead of consulting a small probability table, it learns patterns in language through adjustable parameters. section 11.1 section 1.5

From autocomplete to generation

Type “Hey, what are” into a phone keyboard, and it might suggest “you,” “we,” or “the” as the next word. A simple language model can make this choice using learned probabilities. An LLM extends the idea with many more parameters, much more training data, and a more complex architecture, enabling it to generate paragraphs, answer questions, translate, and write code. section 11.1

Modern LLMs commonly use the Transformer architecture. Its attention mechanism helps the model focus on relevant earlier words when predicting what comes next, much as a reader highlights important phrases. Transformer blocks also use feed-forward neural networks to process information and normalization layers. section 11.1

Figure 11.24 A simplistic overview of the Transformer framework
11_24

The overview shows the main parts of the Transformer framework used to design a language model. section 11.11

Designing an LLM involves practical trade-offs:

  • Memory: Larger models can capture more nuance, but their parameters require more memory and potentially specialized hardware. section 11.11
  • Compute: Training a large model on a huge dataset can require substantial processing power, energy, time, and expense. section 11.11
  • Latency: Larger models may take longer to respond, which matters in applications such as chatbots. section 11.11

A model is the trained artifact, not the training algorithm itself. Once trained, it can be used to generate responses; its architecture and size influence the resources needed to do so. section 1.5 section 11.11

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains Transformer components and architectural trade-offs, using a small example configuration alongside real-world model sizes.
Examples
Uses phone autocomplete for “Hey, what are” and compares a toy Transformer configuration with larger models.
What you can do after
Evaluate/understand it by relating next-word prediction, Transformer components, and resource trade-offs to LLM capabilities.
How it connects
Connects language models to neural networks, Transformers, attention, and generative AI.

Also explained in

Compare how 69 books explain language model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.