TipsMake
Newest

Debugging prompt

What to do when the prompt isn't working? A systematic method for diagnosing and troubleshooting prompt issues.

 

The prompt will also malfunction.

In the previous lesson, we learned about prompt templates . Now, let's build on that foundation. Even great prompts sometimes make mistakes. Artificial intelligence (AI) ignores your instructions. Incorrect formatting. Inappropriate tone. Completely irrelevant results.

It's frustrating, isn't it? But everything can be fixed.

Most people react to a faulty prompt by randomly rewriting it—changing wording, adding context, hoping something will work. It's like debugging code by randomly changing lines.

This lesson will teach you how to systematically debug a prompt. Diagnose first, then fix.

Debugging process

Step 1: Identify WHAT IS WRONG

Before fixing anything, be specific about the problem. Vague complaints like 'it doesn't work' won't solve anything.

Common types of problems:

Category Identifying signs
Incorrect formatting The content is correct, but the structure is wrong.
Incorrect content Incomplete information, incorrect information, off-topic information
Incorrect tone Too formal, too casual, inappropriate tone.
Illusion Fabricated information, fictitious details
Instructions were skipped. Artificial intelligence has done something that you explicitly stated is not allowed to do.
Inconsistent Sometimes success, sometimes failure.
Not complete Stopping too early meant missing some sections.

State the problem clearly. For example, "The output is in paragraph format, but I need a table" is fixable. "It's bad" is not.

 

Step 2: Formulate a hypothesis about the cause.

Once you know what the problem is, think about why.

Incorrect formatting?

  1. Have you provided an example of the formatting?
  2. Are the formatting instructions clear and specific?
  3. Have you placed the formatting guidelines in a prominent position?

Incorrect content?

  1. Does the AI ​​have enough context to provide an accurate answer?
  2. Are you asking for knowledge that AI doesn't possess?
  3. Are the instructions vague?

Skip the instructions?

  1. Is the instruction hidden in the middle?
  2. Does this contradict another guideline?
  3. Is it expressed as a suggestion rather than a request?

Inconsistent results?

  1. Is there any ambiguity that the AI ​​is interpreting differently each time?
  2. Are you lacking examples to support your behavior?

Step 3: Test your hypothesis

Make ONE change. Run the prompt again. Check if the specific problem has been resolved.

Don't change five things at once. You'll never know which one will work.

Step 4: Repeat or investigate further.

If it's fixed, then done. If not, propose a new hypothesis.

If you've tried several obvious troubleshooting methods without success, try one of the investigative techniques below.

Investigation techniques

Technique 1: Ask the AI

Seriously, just ask the AI.

Tôi đã đưa cho bạn prompt này: [prompt] Bạn đã trả lời: [câu trả lời] Tôi mong đợi [điều bạn mong đợi] nhưng bạn lại [điều AI đã làm]. Tại sao bạn lại hiểu hướng dẫn của tôi theo cách này? Điều gì trong câu hỏi của tôi đã dẫn đến câu trả lời này?

Artificial intelligence (AI) is often very good at self-diagnosing its own errors. You might be able to detect ambiguities you've never seen before.

Technique 2: Isolation

Remove parts of the prompt one by one until the problem disappears.

  1. Start with your entire prompt.
  2. Remove the last part
  3. Test run - still getting errors?
  4. Yes → remove more. No → you have found the part causing the problem.
  5. Now, let's add the parts back to pinpoint the exact cause of the error.

This is especially useful for complex prompts where you're unsure which part is causing the problem.

 

Technique 3: Simplify

Remove the prompt to a basic level, then rebuild it.

Nguyên văn (bị lỗi): Bạn là một chuyên viên viết tài liệu kỹ thuật cấp cao với 15 năm kinh nghiệm tại các công ty công nghệ thuộc Fortune 500. Chuyên môn của bạn bao gồm viết tài liệu API, hướng dẫn dành cho nhà phát triển và hướng dẫn kỹ thuật. Bạn viết với phong cách rõ ràng, súc tích, ưu tiên tính chính xác hơn ngôn ngữ tiếp thị. Bạn luôn bao gồm các ví dụ code và tuân theo hướng dẫn về phong cách viết tài liệu dành cho nhà phát triển của Google. Viết tài liệu cho điểm cuối API này: POST /users/create Ví dụ đơn giản: Viết tài liệu cho điểm cuối API này: POST /users/create

Quick check : Before we continue, do you remember the main concept we just learned? Try to explain it in your own words before we move on.

If the simplified version works, add the parts back until it fails. If the simplified version also fails, the problem lies in a more fundamental aspect.

Technique 4: Inserting examples

If instructions don't work, try illustrating them instead of just talking.

Trước (chỉ hướng dẫn): Định dạng đầu ra dưới dạng bảng Markdown với các cột Tính năng, Trạng thái và Ghi chú. Sau (hướng dẫn + ví dụ): Định dạng đầu ra dưới dạng bảng Markdown. Ví dụ: | Tính năng | Trạng thái | Ghi chú | |---------|--------|-------| | Đăng nhập người dùng | Hoàn thành | Đã phát hành phiên bản 2.1 | | Reset mật khẩu | Đang tiến hành | Dự kiến ​​tuần sau |

Examples are often more successful than instructions.

Common problems and solutions

Problem: Incorrect formatting

Symptom : The output structure does not match the requirements.

How to fix it :

  1. Add more specific examples of formatting.
  2. Move the formatting instructions to the END of the question.
  3. Add 'You MUST reply in this exact format:'
  4. If JSON is required, specify: 'Respond only with valid JSON. Do not use Markdown formatting.'

Problem: Hallucinations

Signs : AI fabricates facts, cites non-existent sources, and invents details.

How to fix it :

  1. Additionally: 'Only use information that is explicitly provided. Do not make assumptions.'
  2. Add: 'If you don't know or aren't sure, say, "I don't have enough information to answer this question."'
  3. For questions of fact: 'Cite specific sources for each statement'.
  4. Provide all the necessary context – illusions often fill in the gaps in the information provided.

Problem: Instructions ignored

Sign : The AI ​​is doing something you explicitly told it not to do.

How to fix it :

  1. Move the instructions to the beginning or end (where the attention is higher).
  2. Make the instructions stronger: Add the prefix 'IMPORTANT:'
  3. Turn it into a constraint: 'You MUST NOT…' instead of 'Please avoid…'
  4. Here's another negative example showing what NOT to do.

 

Problem: Too general.

Symptoms : The output is accurate but bland, obvious, and lacks specificity.

How to fix it :

  1. Add specific context about your situation.
  2. Add: 'Be specific, not general. Use concrete examples.'
  3. Add specific constraints: 'Include at least 3 specific examples from [field]'.
  4. Give an example of the level of specificity you want.

Problem: Inconsistent results

Symptom : The same prompt produces different results each time.

How to fix it :

  1. Here are a few more examples to clarify the behavior.
  2. Please be more specific about exactly what you want.
  3. Lower the temperature setting if necessary.
  4. Add: 'Please adhere to this exact format every time:'

Problem: It's been cut short.

Symptoms : Output stops mid-sentence or is incomplete.

How to fix it :

  1. The output request should be in parts: 'First give X, then Y, then Z'
  2. If you reach the word limit: 'Keep it brief. Maximum 500 words.'
  3. Request a specific number of items: 'List exactly 5 points'

Debugging log

For developing complex prompts, keep the log simple:

Prompt v1: [mô tả] Vấn đề: [điều gì đã xảy ra sai] Giả thuyết: [nguyên nhân nghi ngờ] Thay đổi: [những gì bạn đã sửa đổi] Kết quả: [đã sửa/chưa sửa/sửa một phần] Prompt v2: [mô tả] .

This helps avoid loop debugging—trying the same fix over and over again.

When should you give up?

Sometimes a simple prompt creation method won't work. Signs that you should try a different approach:

  1. You have tried more than 5 significantly different approaches.
  2. The task may exceed the current capabilities of AI.
  3. It may be necessary to break it down into smaller tasks.

Not every task can be solved with a single prompt. Sometimes you need to combine multiple prompts, use tools, or approach the problem in a different way.

Key points to remember

  1. A thorough diagnosis before repair – accurately identifying the problem.
  2. Change things one at a time to see what works.
  3. Ask the AI ​​why it responded that way - it can usually explain.
  4. Use isolation and simplification techniques to identify problem areas.
  5. Most problems have standard solutions: Add examples, reposition instructions, add clear constraints.
  6. Save debug logs for complex prompt development.
Discover more prompt prompt AI
Jessica Tanner
Share by Jessica Tanner
Update 03 March 2026