Preface: Why This Book Exists¶
A Note on AI Assistance¶
I planned, wrote, and heavily edited this book, made its figures and illustrations, and tested all the code on my own local machine. I used AI tools only to assist with planning, language editing, and code checking, while keeping full control and taking full responsibility for the book.
There's plenty of information available to learn about AI and LLMs. So why create another one?
Well, most either fall into one of three traps or lead you down a rabbit hole of tutorial hell.
Tutorial hell is a state of learning paralysis where you're constantly consuming content on how to code from others. You may feel as though you are learning, but you never build anything on your own. After running someone's code and getting a successful result, you feel good. Why did it work? Close your laptop and think about it, and you have no idea. You've been watching someone cook a hundred times, but you have not cooked anything yourself.
The three traps that lead there:
- Too shallow. You copy and paste the code and follow along. You generate an output, but you know nothing about why any decisions were made. When something breaks or changes, you are lost.
- Too deep. They read like academic papers. They expect prior courses in linear algebra and calculus, and they expect that you already have graduate-level knowledge. Most readers drop off in chapter two.
- Too demanding on hardware. The subject matter itself can be excellent, but it assumes you have a modern GPU, a cloud computing account, and multiple weekends with nothing else to do. That rules out most people.
This book takes a different approach.
It's going to balance theory and code. There will be explanation so you can grasp what you're creating and why each piece is there. There will be code that you can run on your computer today.
Each chapter will be composed of an explanation with an analogy, followed by code that implements it and then a quick recap of the lesson. Nothing will be hand-waved. If there is code doing something, there will be a reason given in that chapter.
Today means on your computer. No GPUs or cloud providers needed. I have done this on a ThinkPad T14 Gen 1 (Intel Core i7, 32GB RAM, 2020). It's an old business laptop without a GPU. It took roughly 20-30 minutes to complete one full training run. So if it can run on my machine it will run on yours.
Python and PyTorch, that's it. No sign-ups.
Who Is This Book For?¶
Students across business, analytics, and other fields. You will be using AI tools on a weekly basis and will purchase them, oversee them or answer for them at some point in your career. You just want to understand what they are doing without a technical degree. I provided an image for each concept along with a real-life analogy and business scenario. All scripts are already coded. Just copy them, run them and understand what each line does. Then play with the values one at a time.
Beginners who learn by building. So you know Python. You want to learn AI. Using someone else's model won't cut it. You want to understand what's going on under the hood of an AI model. We're going to create a working language model from scratch. Learn what every line does. No more tutorial hell.
Instructors and professors. You want content prepared for class, with concepts distilled down to teachable material, code that can execute on a student's laptop within the time frame of a class period, and a structure that cleanly aligns to a lecture format. This book is designed to do that for you. Every chapter contains a lecture deck, a 15-minute assignment and an accompanying notebook that runs in the browser.
IT/IS professionals. You use AI tools daily, but you want to know what's going on under the hood. You don't need a PhD to understand how they work. All you need is an easy explanation of the architecture, a working example, and readable code that you can tweak.
Parents teaching their kids. Do you want your child to understand how AI works and how to use it? Learn about AI with this book by building a project with your child. You can build something, learn why things work, break it and repair it. Learning by doing.
Truong (Jack) Luu, PhD jackluu.io