1 Peeking inside the black box
Generative AI applications may look simple to use, but they become unusual and harder to design once you try to build them. The chapter explains that the central challenge is not just sending a user message to a model, but managing the mix of natural-language instructions and uncertain, probabilistic outputs. Real GenAI systems need supporting pieces around the model so they can preserve conversation context, supply fresh knowledge, trigger actions, and shape responses into something useful and reliable.
The chapter then peeks inside the model itself and shows why large language models feel so different from traditional software. Unlike deterministic programs that follow explicit steps, an LLM is a stateless, pre-trained black box that turns text into text and cannot remember previous calls unless the application supplies that memory. It also cannot know private or newly updated information unless that knowledge is added to the prompt or retrieved from external sources, which is why applications like chatbots and copilots appear smarter than the model alone actually is.
To build intuition for how language models work, the chapter presents GPT as an enormous sentence-completion system. Text is broken into tokens, converted into embeddings, processed through deep neural networks that compute context, and then used to choose the most likely next token repeatedly until a full response is formed. The chapter emphasizes that this is only possible because of massive pre-training, fine-tuning, and specialized hardware, and it closes by stressing that effective GenAI design means combining the model’s capabilities with memory, updated knowledge, and other architectural elements to overcome its built-in limits.
GenAI applications have an LLM (Magic Black Box) somewhere.
The magic box. Gets text as input and generates text as output.
LLM relationships: every chat is a first date.
Taming the GenAI beast.
The three types of machine learning: Unsupervised, supervised, and reinforcement.
The learning stages of ChatGPT.
Words are numbers in the eyes of an LLM.
Given a prompt, you can calculate the context.
Guess the next best word by combining embeddings with context.
The GPT sentence completion process.
How a GPT architecture generates sentences.
The two stages of GPT-3. First, it gets trained, and then the sentence completion is inferred.
Enhancing a pre-trained model through fine-tuning.
Grokking AI Applications ebook for free