Advanced Prompting Techniques

Generative AI & LLM Fundamentals · Prompt engineering · 8 min read · Updated

Once the basics work, these patterns help with harder tasks.

Ask for step-by-step reasoning

For multi-step problems, ask the model to work through the task before answering, or use a model that reasons by default. Separate the thinking from the final answer so you can use only the answer.

Decompose big tasks

One huge prompt that does everything often fails in unpredictable ways. Break the work into stages. For a resume rewrite, you might: (1) extract skills from the job description, (2) match them to the resume, (3) rewrite the weak bullets, (4) check the result for invented facts.

Prompt chaining

A chain passes the output of one prompt into the next. Each step is simple, testable and replaceable. It costs more calls, but it is easier to debug than one giant prompt.

Reflection and critique

Ask the model to review its own draft against a checklist, then fix the problems. This catches many mistakes, such as missing requirements or invented claims. It is not perfect, so keep human or rule-based checks for anything important.

Multi-turn conversations and context management

  • Send the full relevant history, because the model has no memory between calls.
  • Summarise older turns when the conversation gets long.
  • Put stable instructions in the system prompt and the changing data in the user message.

Long-context strategies

  • Put the long document first and your question after it.
  • Label each document clearly so the model can refer to it.
  • Remove text that does not help, which also cuts cost.
  • For very large collections, search first and send only the relevant parts (see the RAG course).

Meta-prompting

You can ask a model to help improve a prompt: show it the prompt, a failing example and what you wanted. Always test the new prompt on your full set of examples before adopting it.

Frequently asked questions

When should I split a prompt into several steps?

When the task has distinct stages, when one big prompt is inconsistent, or when you want to test or replace each stage separately.

Can a model reliably check its own work?

It catches many errors, but not all. Add rule-based checks or human review for important outputs.