3 Prompt Engineering
Prompt engineering is presented as a practical communication skill for getting useful results from language models. The chapter uses the analogy of a powerful sports car: a model may be capable of impressive things, but that power matters only if the user knows how to direct it well. Rather than treating AI like traditional software, where instructions specify exactly how to act, prompt engineering focuses on expressing intent clearly so the model can infer how best to respond.
The core of an effective prompt is built from three parts: context, the main point, and action. Context tells the model who you are, what you are trying to do, what constraints matter, and what level of prior knowledge it should assume. The main point states the task itself, such as explaining, comparing, summarizing, or planning. Action shapes the output by specifying details like format, tone, audience, length, language, structure, and perspective. The chapter also shows how roles and examples can further guide behavior, with zero-shot prompting as the default and one-shot or few-shot prompting useful when the desired pattern is hard to describe directly.
Beyond single prompts, the chapter emphasizes working through conversations to refine ideas, zoom into details, zoom out to the bigger picture, or branch into alternatives. It also explains how long conversations can drift or become confusing, and how to recover by restating goals, summarizing progress, or starting a fresh thread with a concise checkpoint. Finally, the chapter stresses that even well-crafted prompts cannot guarantee correctness: models can hallucinate, overstate confidence, reflect biases, or be manipulated by prompt injection and jailbreaking. The takeaway is that prompting can greatly improve AI usefulness, but human judgment and verification remain essential.
The three components of a well-structured prompt, each answering a different question.
Four common types of context that help a model to produce more relevant responses
Two techniques for improving model responses, each answering a different question about how the model should behave
Three common prompting approaches. In zero-shot prompting, the model receives only a task. In one-shot prompting, a single example is provided. In few-shot prompting, multiple examples are provided to establish a clearer pattern.
Four conversation patterns for working effectively with a language model.
Three common risks and limitations of language models, each corresponding to a different question about how a model can fail.
Summary
- Effective prompting is less about clever tricks and more about clear communication. A well-structured prompt typically contains three elements: context, a main point, and an action.
- Context helps the model understand your situation. Useful context often includes who you are, what you are trying to achieve, your constraints, and what you already know.
- The main point defines the task you want the model to perform. Strong prompts focus on a specific objective.
- Actions specify how the response should be delivered, including format, audience, tone, length, level of detail, and perspective.
- Assigning roles can improve responses by guiding the model toward a specific perspective, expertise, or communication style.
- Examples are often more effective than instructions alone. Zero-shot prompting relies on a task description, while one-shot and few-shot prompting provide examples for the model to follow.
- The most powerful AI interactions often happen through conversations. Refinement, Zoom In, Zoom Out, and Branching are common conversation patterns for exploring ideas and improving results.
- Long conversations can lose focus over time. Techniques such as restating instructions, creating summaries, and starting new conversations help keep discussions on track.
- Even well-written prompts cannot eliminate the limitations of language models. Hallucinations, overconfidence, bias, prompt injection, and jailbreaking remain important risks that require critical thinking and human oversight.
- Effective AI users treat model outputs as information to evaluate. The quality of the answer depends both on the model and how it is prompted, verified, and used.
- Bender, E. M., Gebru, T., McMillan-Major, A., & Shmitchell, S. (2021). On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency (pp. 610–623). Association for Computing Machinery. https://doi.org/10.1145/3442188.3445922
- Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., & Amodei, D. (2020). Language models are few-shot learners. Advances in Neural Information Processing Systems, 33, 1877–1901. https://proceedings.neurips.cc/paper_files/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf
- Gibney, E. (2025, July 11). Scientists hide messages in papers to game AI peer review. Nature, 643, 887–888. https://doi.org/10.1038/d41586-025-02172-y
- Ji, Z., Lee, N., Frieske, R., Yu, T., Su, D., Xu, Y., Ishii, E., Bang, Y. J., Madotto, A., & Fung, P. (2023). Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12), Article 248, 1–38. https://doi.org/10.1145/3571730
- Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., & Liang, P. (2024). Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12, 157–173. https://doi.org/10.1162/tacl_a_00638
- Meincke, L., Shapiro, D., Duckworth, A. L., Mollick, E., Mollick, L., Van den Bulte, C., & Cialdini, R. B. (2026). Persuading large language models to comply with objectionable requests. Proceedings of the National Academy of Sciences, 123(21), e2535868123. https://doi.org/10.1073/pnas.2535868123
- White, J., Fu, Q., Hays, S., Sandborn, M., Olea, C., Gilbert, H., Elnashar, A., Spencer-Smith, J., & Schmidt, D. C. (2023). A prompt pattern catalog to enhance prompt engineering with ChatGPT. In Proceedings of the 30th Conference on Pattern Languages of Programs (PLoP '23) (Article 5, pp. 1–31). The Hillside Group.
Understanding AI ebook for free