Andrew Ng's Prompt Engineering Course: How Developers Call LLMs via API

Andrew Ng's developer-focused course on prompt engineering, API calls, and LLM best practices explained.
Andrew Ng and OpenAI's Isa Fulford co-created a developer-focused course on prompt engineering that goes beyond chat interfaces. This article covers the key distinctions between base and instruction-tuned LLMs, the role of RLHF in alignment, and two foundational prompting principles — clarity and chain-of-thought reasoning — essential for building real LLM-powered applications via API.
Before diving into Agent development, mastering prompt engineering and API calls is an unavoidable foundation. The course ChatGPT Prompt Engineering for Developers, co-created by Andrew Ng and OpenAI technical team member Isa Fulford, is exactly the hands-on introductory tutorial built for developers. This article summarizes the core ideas of the course to help you build the right mental model for programming with large language models.
What is Prompt Engineering? Prompt engineering is the discipline of designing and optimizing input text to guide large language models toward desired outputs. With the rise of models like GPT-3 and GPT-4, it has evolved from a lab trick into a core software engineering skill. API calls are the critical bridge that turns this capability into engineering practice — developers send structured messages to a model service via HTTP requests and handle the responses programmatically, seamlessly embedding LLM capabilities into any application.
From Web Interface to API: The Underrated Developer Tool
There's no shortage of prompt tutorials on the internet — articles like "30 Prompts Everyone Must Know" are everywhere. But Andrew Ng points out that most of these focus on ChatGPT's web interface, where users complete specific, one-off tasks.
Yet the real power of large language models (LLMs) as developer tools — rapidly building software applications via API calls — remains severely underestimated. Ng mentioned that his AI Fund (a sister company to DeepLearning.AI) works with numerous startups applying these technologies across various use cases, witnessing firsthand how LLM APIs enable developers to build products at remarkable speed.
This is precisely where the course delivers its value: rather than teaching you to type a few prompts into a chat box, it systematically explains how to embed LLMs into real software development workflows. The curriculum covers prompt best practices for software development, common application scenarios (summarization, inference, transformation, expansion), and ultimately guides you to build a chatbot from scratch using an LLM.

Two Types of LLMs: Base Models vs. Instruction-Tuned Models
To truly get the most out of large models, you first need to understand the two main types. Andrew Ng clearly distinguishes between Base LLMs and Instruction-Tuned LLMs in the course.
Base LLMs: Predicting the Next Word
Base LLMs are trained to predict the next most likely word based on massive amounts of text — typically sourced from the internet and other corpora. For example, if you input "Once upon a time, there was a unicorn," it might naturally continue with "living in a magical forest with many unicorn friends."
The Essence of Self-Supervised Learning: The core training paradigm for base models is called self-supervised learning. The model learns the statistical patterns of language through a "next token prediction" task on trillions of tokens of text, requiring no human annotation. This paradigm gives the model powerful language understanding and generation capabilities, but it also means the model is fundamentally "simulating the distribution of its training data" rather than truly understanding instructional intent — which is the fundamental reason why base models have inherent limitations in following instructions.
The problem is, if you ask it "What is the capital of France?", a base model will likely not answer directly. Instead, it might generate a series of similar questions like "What is the largest city in France?" or "What is the population of France?" — because in training data, such questions often appear in clusters as quiz lists.
Instruction-Tuned LLMs: Learning to Follow Instructions
In contrast, instruction-tuned models are specifically trained to follow instructions. When you ask "What is the capital of France?", it directly outputs "The capital of France is Paris."

The training path for these models is: first train a base model on massive text, then fine-tune it on "instruction + high-quality response" data pairs, and finally further optimize using Reinforcement Learning from Human Feedback (RLHF) to make the system better at being helpful and following instructions.
RLHF in Detail: Reinforcement Learning from Human Feedback (RLHF) is the core alignment technique for modern instruction-tuned models. The process has three stages: first, supervised fine-tuning (SFT) on high-quality instruction-response pairs; second, training a "Reward Model" where human annotators rank multiple model outputs to provide preference signals; and finally, using reinforcement learning algorithms like PPO (Proximal Policy Optimization) to optimize the language model based on reward model scores, aligning outputs more closely with human preferences. InstructGPT and ChatGPT are the representative products of this pipeline, which is why they follow user instructions far better than the original GPT base model.
Why Instruction-Tuned Models Are Recommended
The training objectives of instruction-tuned models can be summarized in three key words: Helpful, Honest, and Harmless. Compared to base models, they are far less likely to produce harmful or toxic content.
The Origin of the HHH Alignment Framework: "Helpful, Honest, Harmless" (HHH) was originally proposed by Anthropic and has since become a widely recognized AI safety standard in the industry. "Helpful" requires the model to genuinely address users' substantive needs, not just surface-level requests. "Honest" requires the model to avoid fabricating facts, acknowledge uncertainty, and prevent hallucinations. "Harmless" requires the model to refuse generating content that could cause physical, psychological, or social harm. Notably, there is inherent tension among these three dimensions — over-emphasizing "harmless" can lead to excessive refusals of legitimate requests, and dynamically balancing all three remains a core ongoing challenge for model training teams.
Andrew Ng explicitly recommends that while many prompt tricks circulating online are better suited for base models, for the vast majority of real-world applications today, developers should focus on instruction-tuned models. They are not only easier to work with, but thanks to continuous investment from companies like OpenAI, they are becoming increasingly safe and aligned.

As a result, the entire course focuses on best practices for instruction-tuned models, and this is the direction the authors recommend prioritizing for most application scenarios.
The Core Mental Model: Think of the Model as a Smart Intern
Before getting into specific techniques, Andrew Ng offers a highly practical mental framework: When using an instruction-tuned model, think of it as giving instructions to another person — someone who is smart but doesn't know the specific details of your task.
Many times when a model seems to "misbehave," it's not a lack of capability — it's a lack of clarity in the instructions. For example, if you say "Write something about Alan Turing," the model has no way to determine your actual needs:
- Do you want to focus on his scientific achievements, personal life, or historical significance?
- What tone do you want? The precise style of a professional journalist, or a casual note to a friend?
- Can you provide some reference text for the model to work from?

Ng uses a vivid analogy: it's like asking a recent college graduate to help you complete a task. If you can clearly tell them what to focus on, what style to use, and what materials to read beforehand, you dramatically increase the chances of a successful delivery. The same logic applies perfectly to large models.
Two Core Prompting Principles: Be Clear and Specific + Give the Model Time to Think
The rest of the course is built around two core prompting principles:
-
Be clear and specific: Don't assume "clear" means "short." On the contrary, more detailed prompts often provide more context, guiding the model toward more relevant and accurate outputs.
-
Give the model time to think: For complex tasks, rather than asking the model to jump straight to an answer, guide it to reason step by step — reducing hasty and erroneous outputs.
The Science Behind Chain-of-Thought Prompting: The principle of "giving the model time to think" corresponds technically to Chain-of-Thought (CoT) Prompting. Google researchers Wei et al. (2022) found that adding "Let's think step by step" to a prompt, or providing step-by-step reasoning examples, significantly improves model accuracy on complex tasks like math reasoning and logical judgment — sometimes by tens of percentage points. The underlying mechanism: generating intermediate reasoning steps gives the model a "scratch pad," allowing it to decompose problems within a limited context window and reducing hallucination errors from leaping directly to an answer. This finding has profoundly influenced the design philosophy of later "slow thinking" models like GPT-o1.
These two principles run throughout all of prompt engineering practice and represent the critical dividing line between "knowing how to use ChatGPT" and "building applications with APIs."
Conclusion: The Path to Agents Starts with a Solid Foundation
For those looking to enter AI Agent development, this course provides the most solid prerequisite foundation. Understanding the difference between base models and instruction-tuned models, mastering API calls, and internalizing the two core prompting principles are the essential groundwork before building complex Agent systems.
It's worth noting that this course was developed collaboratively by Andrew Ng, the OpenAI team (including Andrew Main, Lillian Wang, and others), and the DeepLearning.AI team — combining authoritative expertise with hands-on practicality. If you want to truly unlock the potential of large models as developer tools, starting here is a wise choice.
Key Takeaways
Related articles

Disaster and Glory of the Apollo Program: The History We Must Revisit Before Returning to the Moon
From the fatal Apollo 1 fire to Apollo 8's daring lunar orbit to Apollo 11's successful landing—revisiting the disasters, fears, and compromises of the Apollo program and their lessons for today's return to the Moon.

Netflix Trust Exercise Turns Into Firing Trap: Where Are the Boundaries of Corporate Trust?
A Netflix employee was fired after sharing private info in a trust exercise. We analyze the risks of corporate trust exercises and how employees can protect themselves.

AMD CDNA5 Architecture Deep Dive: Technical Evolution and the AI Computing Competition Landscape
Deep analysis of AMD's CDNA5 architecture covering Chiplet packaging upgrades, HBM memory evolution, and low-precision compute optimization, examining how AMD challenges NVIDIA's AI chip dominance.