liveBook · Manning

What you will learn in LLMs in Production

From language models to successful products

by Christopher Brousseau and Matthew Sharp
Foreword by Joe Reis

Chapter by chapter

Chapter 1: Generative AI: Why large language models have captured attention

The chapter introduction compares the excitement around LLMs to the arrival of the printing press and previews questions the chapter will address.

1.1 Large language models accelerating communication · 1.2 Navigating the build-and-buy decision with LLMs · 1.2.1 Buying: The beaten path · 1.2.2 Building: The path less traveled · 1.2.3 A word of warning: Embrace the future now · 1.3 Debunking myths · 1.4 Summary

What you learn in chapter 1 →

Chapter 2: Large language models: A deep dive into language modeling

This introduction maps the chapter’s path from linguistic foundations and earlier language models to transformers and LLMs, and explains why that background matters in production.

2.1 Language modeling · 2.1.1 Linguistic features · 2.1.2 Semiotics · 2.1.3 Multilingual NLP · 2.2 Language modeling techniques · 2.2.1 N-gram and corpus-based techniques · 2.2.2 Bayesian techniques · 2.2.3 Markov chains · 2.2.4 Continuous language modeling · 2.2.5 Embeddings · 2.2.6 Multilayer perceptrons · 2.2.7 Recurrent neural networks and long short-term memory networks · 2.2.8 Attention · 2.3 Attention is all you need · 2.3.1 Encoders · 2.3.2 Decoders · 2.3.3 Transformers · 2.4 Really big transformers · 2.5 Summary

What you learn in chapter 2 →

Chapter 3: Large language model operations: Building a platform for LLMs

The introduction explains why larger language models require scaled-up operations and infrastructure, then previews the chapter’s focus on deployment challenges, ways to reduce them, and supporting architecture.

3.1 Introduction to large language model operations · 3.2 Operations challenges with large language models · 3.2.1 Long download times · 3.2.2 Longer deploy times · 3.2.3 Latency · 3.2.4 Managing GPUs · 3.2.5 Peculiarities of text data · 3.2.6 Token limits create bottlenecks · 3.2.7 Hallucinations cause confusion · 3.2.8 Bias and ethical considerations · 3.2.9 Security concerns · 3.2.10 Controlling costs · 3.3 LLMOps essentials · 3.3.1 Compression · 3.3.2 Distributed computing · 3.4 Infrastructure, GPUs, and Vector Databases · 3.4.1 Data infrastructure · 3.4.2 Experiment trackers · 3.4.3 Model registry · 3.4.4 Feature stores · 3.4.5 Vector databases · 3.4.6 Monitoring system · 3.4.7 GPU-enabled workstations · 3.4.8 Deployment service · 3.5 Summary

What you learn in chapter 3 →

Chapter 4: Data engineering for large language models: Setting up for success

The chapter introduces the model and data assets to prepare before training or finetuning an LLM, then previews how it will evaluate models and build a reusable dataset.

4.1 Models are the foundation · 4.1.1 GPT · 4.1.2 BLOOM · 4.1.3 LLaMA · 4.1.4 Wizard · 4.1.5 Falcon · 4.1.6 Vicuna · 4.1.7 Dolly · 4.1.8 OpenChat · 4.2 Evaluating LLMs · 4.2.1 Metrics for evaluating text · 4.2.2 Industry benchmarks · 4.2.3 Responsible AI benchmarks · 4.2.4 Developing your own benchmark · 4.2.5 Evaluating code generators · 4.2.6 Evaluating model parameters · 4.3 Data for LLMs · 4.3.1 Datasets you should know · 4.3.2 Data cleaning and preparation · 4.4 Text processors · 4.4.1 Tokenization · 4.4.2 Embeddings · 4.5 Preparing a Slack dataset · 4.6 Summary

What you learn in chapter 4 →

Chapter 5: Training large language models: How to generate the generator

The chapter introduces training an LLM on a prepared dataset and previews the environment, training methods, and practical advice it will cover.

5.1 Multi-GPU environments · 5.1.1 Setting up · 5.1.2 Libraries · 5.2 Basic training techniques · 5.2.1 From scratch · 5.2.2 Transfer learning (finetuning) · 5.2.3 Prompting · 5.3 Advanced training techniques · 5.3.1 Prompt tuning · 5.3.2 Finetuning with knowledge distillation · 5.3.3 Reinforcement learning with human feedback · 5.3.4 Mixture of experts · 5.3.5 LoRA and PEFT · 5.4 Training tips and tricks · 5.4.1 Training data size notes · 5.4.2 Efficient training · 5.4.3 Local minima traps · 5.4.4 Hyperparameter tuning tips · 5.4.5 A note on operating systems · 5.4.6 Activation function advice · 5.5 Summary

What you learn in chapter 5 →

Chapter 6: Large language model services: A practical guide

This introduction defines production as putting an LLM to work for real users and previews the chapter’s path from serving and cloud deployment to production challenges and edge devices.

6.1 Creating an LLM service with RAG and more · 6.1.1 Model compilation · 6.1.2 LLM storage strategies · 6.1.3 Adaptive request batching · 6.1.4 Flow control · 6.1.5 Streaming responses · 6.1.6 Feature store · 6.1.7 Retrieval-augmented generation · 6.1.8 LLM service libraries · 6.2 Setting up infrastructure · 6.2.1 Provisioning clusters · 6.2.2 Autoscaling · 6.2.3 Rolling updates · 6.2.4 Inference graphs · 6.2.5 Monitoring · 6.3 Cost engineering, security, latency, and other production challenges · 6.3.1 Model updates and retraining · 6.3.2 Load testing · 6.3.3 Troubleshooting poor latency · 6.3.4 Resource management · 6.3.5 Cost engineering · 6.3.6 Security · 6.4 Deploying to the edge · 6.5 Summary

What you learn in chapter 6 →

Chapter 7: Prompt engineering: Becoming an LLM whisperer

The introduction explains why prompting lets one general-purpose LLM serve many tasks and previews the chapter’s approach to prompt engineering.

7.1 Prompting your model · 7.1.1 Few-shot prompting · 7.1.2 One-shot prompting · 7.1.3 Zero-shot prompting · 7.2 Prompt engineering basics · 7.2.1 Anatomy of a prompt · 7.2.2 Prompting hyperparameters · 7.2.3 Scrounging the training data · 7.3 Tooling for structured outputs, workflows, and more · 7.3.1 LangChain · 7.3.2 Guidance · 7.3.3 DSPy · 7.3.4 Other tooling is available but … · 7.4 Advanced prompt engineering techniques · 7.4.1 Giving LLMs tools · 7.4.2 ReAct · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Applications and Agents: Building an interactive experience

The chapter introduces the shift from building and deploying LLMs to creating user-facing applications, including edge applications and agents.

8.1 Building an application with RAG · 8.1.1 Streaming on the frontend · 8.1.2 Keeping a history · 8.1.3 Chatbot interaction features · 8.1.4 Token counting · 8.1.5 RAG applied · 8.2 Edge applications · 8.3 LLM agents · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: Creating an LLM project: Reimplementing Llama 3

The chapter introduces a hands-on project that brings earlier LLM lessons together by implementing and training a Llama-inspired model, improving it, and deploying it.

9.1 Implementing Meta’s Llama · 9.1.1 Tokenization and configuration · 9.1.2 Dataset, data loading, evaluation, and generation · 9.1.3 Network architecture · 9.2 Simple Llama · 9.3 Making it better · 9.3.1 Quantization · 9.3.2 LoRA · 9.3.3 Fully sharded data parallel–quantized LoRA · 9.4 Deploy to a Hugging Face Hub Space · 9.5 Summary

What you learn in chapter 9 →

Chapter 10: Creating a coding copilot project: Integrating an LLM service into VS Code with RAG

The chapter introduces a project to build a Python-focused coding copilot in VS Code using a pretrained coding model, an LLM service, and local retrieval-augmented generation.

10.1 Our model · 10.2 Data is king · 10.2.1 Our VectorDB · 10.2.2 Our dataset · 10.2.3 Using RAG · 10.3 Build the VS Code extension · 10.4 Lessons learned and next steps · 10.5 Summary

What you learn in chapter 10 →

Chapter 11: Deploying an LLM on a Raspberry Pi: How low can you go?

The chapter introduces a hands-on project to run a locally accessible LLM service on a Raspberry Pi, using its limitations to teach practical deployment lessons.

11.1 Setting up your Raspberry Pi · 11.1.1 Pi Imager · 11.1.2 Connecting to Pi · 11.1.3 Software installations and updates · 11.2 Preparing the model · 11.3 Serving the model · 11.4 Improvements · 11.4.1 Using a better interface · 11.4.2 Changing quantization · 11.4.3 Adding multimodality · 11.4.4 Serving the model on Google Colab · 11.5 Summary

What you learn in chapter 11 →

Chapter 12: Production, an ever-changing landscape: Things are just getting started

The chapter introduction explains why the book emphasizes durable LLM production concepts and previews a review of takeaways, future directions, and closing thoughts.

12.1 A thousand-foot view · 12.2 The future of LLMs · 12.2.1 Government and regulation · 12.2.2 LLMs are getting bigger · 12.2.3 Multimodal spaces · 12.2.4 Datasets · 12.2.5 Solving hallucination · 12.2.6 New hardware · 12.2.7 Agents will become useful · 12.3 Final thoughts · 12.4 Summary

What you learn in chapter 12 →

Concepts explained in this book

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.