Andrew Ng's advice for iteratively writing LLM prompts

When building complex workflows, I see developers getting good results with this process:

  • Write quick, simple prompts and see how it does.
  • Based on where the output falls short, flesh out the prompt iteratively. This often leads to a longer, more detailed, prompt, perhaps even a mega-prompt.
  • If that’s still insufficient, consider few-shot or many-shot learning (if applicable) or, less frequently, fine-tuning.
  • If that still doesn’t yield the results you need, break down the task into subtasks and apply an agentic workflow.