liveBook · Manning

Language model

As explained in Grokking AI Applications

A large language model is a machine-learning model trained on large text collections to predict and generate sequences of natural-language tokens.

A large language model (LLM) is the text-generating core of a generative AI application: it receives natural-language text and produces text in return. Unlike conventional code that follows fixed steps, it works probabilistically, so the same carefully designed prompt cannot guarantee an identical output every time. section 1.2 section 1.3

A bare LLM has important operating characteristics:

  • It is nondeterministic: outputs arise from probabilities rather than fixed logical rules. section 1.3
  • It is stateless: each call starts clean unless an application supplies prior context. section 1.3 section 1.4
  • It is pretrained: its built-in knowledge is fixed after training and does not update through ordinary use. section 1.3
  • It is not explanatory: a response does not reveal why the model produced that particular result. section 1.3

Under the hood, an LLM learns patterns through machine-learning training. GPT-style models represent tokens as numerical embeddings, use context to estimate the most likely next token, and repeat that completion process to form text. Chat-oriented systems can add supervised and reinforcement-learning refinement after initial pretraining. section 1.5 section 1.6 section 1.7

Why a chat can remember a name

After a user says, “Hi, I’m Andrea,” a separate request asking “What’s my name?” has no answer by itself. A chat application can create the appearance of memory by sending relevant earlier conversation history together with the new request; the LLM itself still begins each call without retained state. section 1.4

Useful applications surround the model with components that compensate for these limits. Retrieval-augmented generation can provide current or organization-specific documents; agents and tools can fetch live information, calculate precisely, or trigger external actions. The LLM remains the language and reasoning component rather than the system that inherently stores memory, knows current facts, or performs actions. section 1.7 section 4.0 section 5.1

Figure 1.11 How a GPT architecture generates sentences

Follow the high-level GPT architecture from prompt through token-by-token sentence generation. section 1.6

How Grokking AI Applications covers it

How deep it goes
Explains training stages, embeddings, context, and next-token generation, while allowing readers to skip detailed modern architecture internals.
Examples
Uses ChatGPT conversation memory, an ice-cream shop’s opening hours, live weather, email sending, and calculator-assisted arithmetic.
What you can do after
Build from scratch applications that manage LLM randomness and extend models with memory, retrieval, tools, and agents.
How it connects
Connects LLMs with prompts, embeddings, transformers, fine-tuning, retrieval-augmented generation, agents, tools, and APIs.

Also explained in

Compare how 67 books explain language model →

Related concepts

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