liveBook · Manning

Chapter 1: Understanding large language models

What you will learn in chapter 1 of Build a Large Language Model (From Scratch)

The introduction contrasts LLMs with earlier NLP models, clarifies what their apparent understanding means, and attributes their broader capabilities to transformer architectures and large-scale text training.

After this chapter you will be able to

Section by section

Introduction

The introduction contrasts LLMs with earlier NLP models, clarifies what their apparent understanding means, and attributes their broader capabilities to transformer architectures and large-scale text training.

Key terms: LLMs, NLP, earlier NLP models, understand, contextually relevant, human-like consciousness, transformer architecture, vast amounts of data, linguistic nuances

1.1 What is an LLM?

This section defines LLMs, explains why they are called large and how next-word prediction relates to language learning, and places them within the broader fields of AI and deep learning.

Key terms: LLM, deep neural network, parameters, text data, next-word prediction, context, transformer, selective attention, input, generative AI

1.2 Applications of LLMs

This section surveys how LLMs are used for text tasks, conversational assistance, and knowledge retrieval.

Key terms: unstructured text data, machine translation, generation of novel texts, sentiment analysis, text summarization, chatbots, virtual assistants, knowledge retrieval

1.3 Stages of building and using LLMs

This section explains why someone might build a custom LLM and how pretraining on raw text leads to a base model that can be fine-tuned for specific tasks.

Key terms: custom-built LLMs, domain-specific datasets, data privacy, pretraining, pretrained model, fine-tuning, raw text, self-supervised learning, next word, base or foundation model

1.4 Introducing the transformer architecture

Introduces the transformer's encoder, decoder, and self-attention, then contrasts BERT and GPT and clarifies how transformers relate to LLMs.

Key terms: transformer architecture, encoder, decoder, vectors, self-attention mechanism, tokens, long-range dependencies, contextual relationships, BERT, GPT

1.5 Utilizing large datasets

This section explains why large, diverse text datasets matter for LLMs and why reusing pretrained models is more practical than pretraining from scratch.

Key terms: pretraining, text corpora, scale, diversity, token, Number of Tokens, GPT-3, pretrained LLMs, base models, foundation models

1.6 A closer look at the GPT architecture

The section explains how GPT’s decoder-only architecture and next-word pretraining produce coherent text and can support tasks beyond text completion.

Key terms: next-word prediction, self-supervised learning, self-labeling, unlabeled text datasets, decoder, encoder, autoregressive model, previous outputs, emergent behavior, translation

1.7 Building a large language model

The section explains why the book uses a small dataset to demonstrate LLM pretraining rather than attempting a full-scale GPT-like pretraining run.

Key terms: pretraining, GPT-like models, small dataset

1.8 Summary

The section summarizes how LLMs are trained, how transformer architecture supports text generation, and why next-word prediction can produce broader language capabilities.

Where this is used later

Concepts explained in this chapter

Chapter 2: Working with text data →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.