Modern AI Engineering

Module 9 · Build

The Art of Prompting

In this module, we will learn how to talk to an LLM so that it gives better answers, and how to manage everything that goes into its context window.

By the end of this module, we will be able to design prompts and contexts that make an LLM reliable, fast, and cheap.

Lessons

  1. 9.1 Chain-of-Thought Prompting: Making Models Reason Step by Step: What is a prompt? · What is an LLM? · The problem: when the model jumps straight to the answer · What is Chain-of-Thought (CoT) Prompting? · A simple example without CoT and with CoT · Zero-shot CoT vs Few-shot CoT · A step-by-step walkthrough of a reasoning chain · Why does Chain-of-Thought Prompting work? · Where Chain-of-Thought Prompting is useful · Things to keep in mind
  2. 9.2 Prompt Chaining: Decomposing Complex Tasks into Steps: What is a prompt? · What is Prompt Chaining? · Why do we need Prompt Chaining? · How does Prompt Chaining work step by step? · A real example of Prompt Chaining · Code example of Prompt Chaining · Common patterns in Prompt Chaining · Advantages of Prompt Chaining · Things to take care of while using Prompt Chaining · When to use Prompt Chaining
  3. 9.3 Prompt Caching: Reusing Computation Across API Calls: What is a prompt · A quick recap of how an LLM reads a prompt · What is Prompt Caching · Why we need Prompt Caching · The core idea behind Prompt Caching · The exact-prefix rule · Cache write vs cache read and TTL · What we should put in the cache · The benefits of Prompt Caching · Prompt Caching in the real world
  4. 9.4 Context Engineering: Curating the Model's Working Memory: What is Context Engineering? · The Big Picture · Why Context Engineering matters · Prompt Engineering vs Context Engineering · The components of the context · Common patterns in Context Engineering · Common mistakes to avoid · Best practices · Quick Summary
  5. 9.5 Context Compaction: Fitting More Into a Finite Window: What is a Large Language Model · What is the context window · What is context · The problem of long conversations · The naive fix and why it fails · What is context compaction · How summarization powers compaction · A step-by-step walkthrough · Context compaction in code · Compaction in real AI agents · Why context compaction is important

← Module 8: Teaching and Shaping Models · Module 10: Building RAG Systems →