Quick Start Guide to Large Language Models, 2nd Edition, 2nd edition
Published by Addison-Wesley Professional (October 3, 2024) © 2025
- Sinan Ozdemir
eTextbook
Available for purchase from all major ebook resellers, including InformIT.com.
To request a review copy, click on the "Request a Review Copy" button.
A print text (hardcover or paperback)
Free shipping
Also available for purchase as an ebook from all major ebook resellers, including InformIT.com
Table of contents
Foreword xi
Preface xiii
Acknowledgments xix
About the Author xxi
Part I: Introduction to Large Language Models 1
Chapter 1: Overview of Large Language Models 3
What Are Large Language Models? 4
Popular Modern LLMs 7
Applications of LLMs 25
Summary 31
Chapter 2: Semantic Search with LLMs 33
Introduction 33
The Task 34
Solution Overview 36
The Components 37
Putting It All Together 53
The Cost of Closed-Source Components 57
Summary 58
Chapter 3: First Steps with Prompt Engineering 59
Introduction 59
Prompt Engineering 59
Working with Prompts Across Models 70
Summary 74
Chapter 4: The AI Ecosystem: Putting the Pieces Together 75
Introduction 75
The Ever-Shifting Performance of Closed-Source AI 76
AI Reasoning versus Thinking 77
Case Study 1: Retrieval Augmented Generation 79
Case Study 2: Automated AI Agents 87
Conclusion 93
Part II: Getting the Most Out of LLMs 95
Chapter 5: Optimizing LLMs with Customized Fine-Tuning 97
Introduction 97
Transfer Learning and Fine-Tuning: A Primer 99
A Look at the OpenAI Fine-Tuning API 102
Preparing Custom Examples with the OpenAI CLI 104
Setting Up the OpenAI CLI 108
Our First Fine-Tuned LLM 109
Summary 119
Chapter 6: Advanced Prompt Engineering 121
Introduction 121
Prompt Injection Attacks 121
Input/Output Validation 123
Batch Prompting 126
Prompt Chaining 128
Case Study: How Good at Math Is AI? 135
Summary 145
Chapter 7: Customizing Embeddings and Model Architectures 147
Introduction 147
Case Study: Building a Recommendation System 148
Summary 166
Chapter 8: AI Alignment: First Principles 167
Introduction 167
Aligned to Whom and to What End? 167
Alignment as a Bias Mitigator 173
The Pillars of Alignment 176
Constitutional AI: A Step Toward Self-Alignment 195
Conclusion 198
Part III: Advanced LLM Usage 199
Chapter 9: Moving Beyond Foundation Models 201
Introduction 201
Case Study: Visual Q/A 201
Case Study: Reinforcement Learning from Feedback 218
Summary 228
Chapter 10: Advanced Open-Source LLM Fine-Tuning 229
Introduction 229
Example: Anime Genre Multilabel Classification with BERT 230
Example: LaTeX Generation with GPT2 244
Sinan's Attempt at Wise Yet Engaging Responses: SAWYER 248
Summary 271
Chapter 11: Moving LLMs into Production 275
Introduction 275
Deploying Closed-Source LLMs to Production 275
Deploying Open-Source LLMs to Production 276
Summary 297
Chapter 12: Evaluating LLMs 299
Introduction 299
Evaluating Generative Tasks 300
Evaluating Understanding Tasks 317
Conclusion 328
Keep Going! 329
Part IV: Appendices 331
Appendix A: LLM FAQs 333
Appendix B: LLM Glossary 339
Appendix C: LLM Application Archetypes 345
Index 349
Author bios
Sinan Ozdemir is currently the founder and CTO of LoopGenius and an advisor to several AI companies. Sinan is a former lecturer of Data Science at Johns Hopkins University and the author of multiple textbooks on data science and machine learning. Additionally, he is the founder of the recently acquired Kylie.ai, an enterprise-grade conversational AI platform with RPA capabilities. He holds a master's degree in Pure Mathematics from Johns Hopkins University and is based in San Francisco, CA.
Need help?Get in touch

Pearson eTextbook: What’s on the inside just might surprise you
They say you can’t judge a book by its cover. It’s the same with your students. Meet each one right where they are with an engaging, interactive, personalized learning experience that goes beyond the textbook to fit any schedule, any budget, and any lifestyle.