Skip to content

Current path

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

Evaluation and Iteration

Find Failure Cases

Test normal and edge cases and record where and why the prompt fails before revising it.

In this lesson

Why this matters

A failure case causes an important criterion to fail. Group errors into patterns such as missing data or label overlap, then fix the general rule instead of patching one example.

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: فشل المثال 7؛ أضف استثناءً خاصًا به.

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: الأمثلة 7 و9 و11 تفشل عند غياب المدينة؛ استخدم null للمدينة المفقودة ثم أعد الاختبار.

Short practice

Apply the lesson concept to this task: أنشئ 3 حالات حدّية لتصنيف قد تتداخل فئاته.

Check your understanding

Check: لماذا نجمع حالات الفشل؟
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.