Hands-On Large Language Models: Language Understanding and Generation

by Jay Alammar, Maarten Grootendorst

Artificial Intelligence

Book Details

Book Title

Hands-On Large Language Models: Language Understanding and Generation

Author

Jay Alammar, Maarten Grootendorst

Publisher

O'Reilly Media

Publication Date

2024

ISBN

9781098150969

Number of Pages

575

Language

English

Format

PDF

File Size

19.5MB

Subject

Algorithms and Data Structures: Pattern Recognition

Table of Contents

  • Preface
  • I. Understanding Language Models
  • 1. An Introduction to Large Language Models
  • What Is Language AI?
  • A Recent History of Language AI
  • The Moving Definition of a “Large Language Model”
  • The Training Paradigm of Large Language Models
  • Large Language Model Applications: What Makes Them So Useful?
  • Responsible LLM Development and Usage
  • Limited Resources Are All You Need
  • Interfacing with Large Language Models
  • Generating Your First Text
  • Summary
  • 2. Tokens and Embeddings
  • LLM Tokenization
  • Token Embeddings
  • Text Embeddings (for Sentences and Whole Documents)
  • Word Embeddings Beyond LLMs
  • Embeddings for Recommendation Systems
  • Summary
  • 3. Looking Inside Large Language Models
  • An Overview of Transformer Models
  • Recent Improvements to the Transformer Architecture
  • Summary
  • II. Using Pretrained Language Models
  • 4. Text Classification
  • The Sentiment of Movie Reviews
  • Text Classification with Representation Models
  • Model Selection
  • Using a Task-Specific Model
  • Classification Tasks That Leverage Embeddings
  • Text Classification with Generative Models
  • Summary
  • 5. Text Clustering and Topic Modeling
  • ArXiv’s Articles: Computation and Language
  • A Common Pipeline for Text Clustering
  • From Text Clustering to Topic Modeling
  • Summary
  • 6. Prompt Engineering
  • Using Text Generation Models
  • Intro to Prompt Engineering
  • Advanced Prompt Engineering
  • Reasoning with Generative Models
  • Output Verification
  • Summary
  • 7. Advanced Text Generation Techniques and Tools
  • Model I/O: Loading Quantized Models with LangChain
  • Chains: Extending the Capabilities of LLMs
  • Memory: Helping LLMs to Remember Conversations
  • Agents: Creating a System of LLMs
  • Summary
  • 8. Semantic Search and Retrieval-Augmented Generation
  • Overview of Semantic Search and RAG
  • Semantic Search with Language Models
  • Retrieval-Augmented Generation (RAG)
  • Summary
  • 9. Multimodal Large Language Models
  • Transformers for Vision
  • Multimodal Embedding Models
  • Making Text Generation Models Multimodal
  • Summary
  • III. Training and Fine-Tuning Language Models
  • 10. Creating Text Embedding Models
  • Embedding Models
  • What Is Contrastive Learning?
  • SBERT
  • Creating an Embedding Model
  • Fine-Tuning an Embedding Model
  • Unsupervised Learning
  • Summary
  • 11. Fine-Tuning Representation Models for Classification
  • Supervised Classification
  • Few-Shot Classification
  • Continued Pretraining with Masked Language Modeling
  • Named-Entity Recognition
  • Summary
  • 12. Fine-Tuning Generation Models
  • The Three LLM Training Steps: Pretraining, Supervised Fine-Tuning, and Preference Tuning
  • Supervised Fine-Tuning (SFT)
  • Instruction Tuning with QLoRA
  • Evaluating Generative Models
  • Preference-Tuning / Alignment / RLHF
  • Automating Preference Evaluation Using Reward Models
  • Preference Tuning with DPO
  • Summary
  • Afterword
  • Index
  • About the Authors