Skip to content

Current path

Prompt Engineering
Level: Intermediate33 lessons
Progress0/33 · 0%

Prompting Techniques

Zero-shot and Few-shot Prompting

Distinguish prompting without examples from prompting with examples and choose based on the task.

In this lesson

Why this matters

Zero-shot gives no solved examples; few-shot adds input-output examples to demonstrate a pattern. Start with clear instructions and add examples when they prove useful.

How to apply it

  1. Define the task and desired outcome.
  2. Add only context or rules that affect success.
  3. Specify an output form or checkable criterion when needed.
  4. Test on realistic input and revise when a failure pattern appears.

Practical example

Weak example:

text
Weak version of the same task: صنّف الرسالة إلى بيع أو دعم.

The weak version leaves an important part of the task or its boundaries to guesswork. The improved version adds information tied directly to success without treating length or complexity as a goal.

Improved example:

text
Improved version: الفئات: بيع/دعم. «هل لديكم خصم؟»→بيع، «وصل مكسورًا»→دعم. صنّف: «أريد تغيير عنوان الشحن».

Short practice

Apply the lesson concept to this task: جرّب مهمة تصنيف بلا أمثلة ثم بمثالين وقارن.

Check your understanding

Check: متى يفيد Few-shot؟
Answer: عندما توضح الأمثلة النمط أو التنسيق أو حدود التصنيف.

Summary

Keep this concept as one tool rather than a magic formula. Tie it to the goal and success criteria, then build on it in the next lesson.