Skip to main content
Duration: 45 minutes

Introduction

Question-answering is one of the most practical applications of LLMs—from customer support chatbots to educational tutors. But getting accurate, reliable answers requires more than just asking questions. In this lesson, you’ll learn patterns that ensure your QA systems provide well-reasoned, verifiable answers.

The QA Challenge

Common QA Problems:
  • Hallucinated facts or made-up information
  • Incomplete reasoning
  • Answers that don’t address the actual question
  • Lack of transparency in how conclusions were reached
The solution? Structured reasoning patterns that make the thinking process explicit.

Basic QA Patterns

Open-Domain QA

Answer questions without provided context.
Output:
Best for: Factual questions with well-established answers. Use with caution for questions requiring current information or specialized knowledge.

QA with Context

Provide relevant context to ground the answer.
Output:
Pro Tip: Always provide context when available—it dramatically improves accuracy and reduces hallucinations.

QA with Source Citation

Request answers with references to the source material.
Output:

Multiple-Choice Questions

Basic Multiple Choice

Output:

Multiple Choice with Reasoning

Request explanation along with the answer.
Output:

Math Word Problems

Structured Math Problem Solving

Use the GSM8K annotation style for clarity.
Output:
GSM8K Format:
  • Use «calculation» for intermediate steps
  • Show #### before the final numerical answer
  • This format helps track reasoning and catch errors

Multi-Step Math Problems

Break complex problems into clear steps.
Output:

Complex QA with Sub-Questions

Decomposition Strategy

Break complex questions into manageable parts.
Output:

Comparative Questions

Answer questions requiring comparison or analysis.
Output:

Handling Uncertainty

Admitting Unknown Information

Output:
Best Practice: Always admit when information isn’t available rather than guessing or hallucinating.

Qualified Answers

Provide answers with appropriate caveats.
Output:

Structured Reasoning Format

Chain of Reasoning

Make the thinking process explicit.
Output:

Verification Step

Include a verification or sanity check.
Output:

Best Practices

Provide Context

Always include relevant context when available

Show Reasoning

Make the thinking process explicit and verifiable

Admit Uncertainty

Acknowledge when information is insufficient

Verify Answers

Include sanity checks for numerical or logical answers

Practice Exercises

Exercise 1: Context-Based QA

Create a QA system that answers questions based only on provided context.

Exercise 2: Math Problem Solver

Design a prompt for solving word problems with clear reasoning.

Exercise 3: Multi-Part Question Handler

Create a system for handling complex questions with multiple components.

Real-World Application: Customer Support QA System

Build a comprehensive customer support QA system:
Example:

Key Takeaways

Always provide context when available to ground answers
Use structured reasoning formats for complex questions
Show step-by-step calculations for math problems
Admit when information is insufficient or uncertain
Include verification steps for numerical answers
Break complex questions into manageable sub-questions

Module 2 Complete!

Congratulations! You’ve mastered task-specific prompting patterns for classification, extraction, generation, transformation, and question-answering. You’re now ready to tackle the Module 2 assessment.

Next: Module 2 Assessment

Test your skills with the Content Moderation System capstone project