How does prompt engineering work?
Microsoft's guide breaks a prompt into parts: instructions, the primary content the model should work on, examples, cues that start the output, and supporting content such as the current date or a user's preferences [1]. The same guide admits that writing a good prompt is more art than science, relies on experience and intuition, and that each model behaves differently [1].
One example in the guide makes the point well. Asked with no examples which sport a news headline belongs to, the model has to guess what is wanted. Add a few headline and topic pairs to the prompt and it picks up the pattern, even producing the label "Basketball" that never appeared in the examples [1]. This is called few-shot prompting; the version with no examples is zero-shot [1].
Which techniques matter most?
The guide recommends stating the task clearly at the start of the prompt, repeating instructions at the end, breaking a task into smaller steps and using a clear syntax such as Markdown or XML [1]. In 2022 Jason Wei and colleagues showed that including a few chain-of-thought examples in a prompt elicits reasoning in large language models. With just eight such examples, a 540-billion-parameter model reached state-of-the-art accuracy on the GSM8K maths word problems [2]. Microsoft notes that this technique is not recommended for reasoning models [1].
How is it different from fine-tuning?
Prompt engineering does not change the model's parameters [3]. Microsoft stresses that examples in a prompt do not permanently change the model; they only steer it for the current inference [1].