Inferensys

Prompt

Gap-Driven Follow-Up Question Generation Prompt Template

A practical prompt playbook for generating targeted follow-up questions that address specific evidence gaps in conversational RAG systems. Includes copy-ready template, variable definitions, output contract, evaluation rubric, and failure mode analysis.
AI evaluator reviewing output quality on laptop, comparison metrics visible, casual evaluation session.
PROMPT PLAYBOOK

When to Use This Prompt

Identify when gap-driven follow-up question generation is the right tool and when it risks degrading the user experience.

This prompt is designed for conversational RAG systems that encounter evidence gaps during multi-turn interactions. When retrieved context is insufficient to fully answer a user's question, this prompt generates targeted follow-up questions that address specific missing information. It ranks questions by information gain so the system can request clarification efficiently rather than asking generic or redundant questions. Use this prompt when your copilot or chat assistant needs to distinguish between 'answerable with current context' and 'requires user input to proceed' states.

The ideal integration point is after retrieval and evidence sufficiency checking but before answer generation. Your pipeline should already have attempted retrieval, run a pre-answer sufficiency check, and identified that critical information is missing. This prompt takes the gap analysis output—a structured list of what the context cannot address—and converts it into natural, conversational follow-up questions the user can actually answer. It is not a replacement for retrieval expansion or query rewriting. If the gap can be filled by searching a different index, rewriting the query, or expanding the retrieval scope, do that first. Reserve this prompt for gaps that genuinely require human input: missing parameters, ambiguous intent, domain-specific knowledge the user possesses, or clarification between conflicting interpretations.

Do not use this prompt when the system can reasonably infer the missing information from conversation history, user profile data, or additional retrieval rounds. Over-questioning users degrades trust and increases abandonment. Similarly, avoid this prompt for yes/no or trivial clarification requests that a well-designed UI element could handle more efficiently. The prompt works best when each generated question targets a specific, high-value information gap and the question ranking helps the system decide whether to ask one question, present a short list, or escalate to a human agent. Before deploying, test against a golden set of gap scenarios to verify that generated questions are specific, answerable, and correctly prioritized by information gain.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Gap-Driven Follow-Up Question prompt works, where it fails, and what you must provide before deploying it in a conversational RAG system.

01

Good Fit: Multi-Turn Copilots

Use when: the system is already in a conversation and the retrieved context is insufficient to answer the current turn. Guardrail: Only trigger after a sufficiency gate confirms a gap exists. Do not ask follow-ups when a direct answer is possible.

02

Bad Fit: Single-Shot Q&A APIs

Avoid when: the interface is a stateless API that cannot maintain conversation state. A follow-up question with no ability to receive the answer creates a dead end. Guardrail: Fall back to a partial-answer-with-caveats template instead.

03

Required Input: Gap Inventory

What to watch: The prompt cannot generate useful follow-ups without knowing what is missing. Guardrail: Always pass a structured gap list from a prior sufficiency check or gap analysis step. Never ask the model to guess what is missing.

04

Required Input: Conversation History

What to watch: Without prior turns, the model may ask redundant questions or ignore established context. Guardrail: Include the last N turns, with clear speaker labels, and instruct the model to avoid repeating already-answered questions.

05

Operational Risk: Question Fatigue

What to watch: Users abandon sessions when the system asks too many clarifying questions. Guardrail: Cap follow-up questions at 2-3 per turn, rank by information gain, and always offer an 'I don't know, proceed anyway' escape path.

06

Operational Risk: Hallucinated Gaps

What to watch: The model may invent missing information that was actually present in context, leading to unnecessary questions. Guardrail: Validate each generated follow-up against the original retrieved passages before surfacing to the user.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that generates targeted follow-up questions to address specific evidence gaps in conversational RAG systems.

This prompt template is designed for conversational RAG systems that need to request clarification or additional context from users when retrieved evidence is insufficient. It generates follow-up questions that directly target identified evidence gaps, ranked by their potential information gain. The template expects you to provide the current user question, retrieved context, and a structured inventory of what's missing. Replace each square-bracket placeholder with your application's actual data before sending to the model.

text
You are a follow-up question generator for a conversational RAG system. Your job is to produce targeted questions that address specific evidence gaps in the retrieved context.

## USER QUESTION
[USER_QUESTION]

## RETRIEVED CONTEXT
[RETRIEVED_CONTEXT]

## IDENTIFIED EVIDENCE GAPS
[EVIDENCE_GAPS]

## CONVERSATION HISTORY (IF ANY)
[CONVERSATION_HISTORY]

## INSTRUCTIONS
1. Review each evidence gap and determine whether a follow-up question to the user could resolve it.
2. Generate at most [MAX_QUESTIONS] follow-up questions.
3. Rank questions by information gain: prioritize questions whose answers would unlock the largest portion of the original question.
4. Each question must be:
   - Specific and answerable in a short user response.
   - Directly traceable to a listed evidence gap.
   - Phrased in natural, conversational language.
   - Non-redundant with information already present in the retrieved context.
5. Do not ask questions that the retrieved context already answers.
6. Do not ask questions that require the user to have specialized knowledge they are unlikely to possess.
7. If no useful follow-up questions can be asked, return an empty list and explain why.

## OUTPUT FORMAT
Return a JSON object with this exact structure:
{
  "questions": [
    {
      "question": "string",
      "targets_gap": "string (reference to the specific gap from EVIDENCE_GAPS)",
      "information_gain": "high|medium|low",
      "rationale": "string (why this question is worth asking)"
    }
  ],
  "no_questions_reason": null | "string (only if questions array is empty)"
}

## CONSTRAINTS
- [CONSTRAINTS]

Adaptation guidance: The [EVIDENCE_GAPS] placeholder should contain structured gap descriptions, ideally from an upstream gap detection prompt such as the Retrieval Gap Analysis or Evidence Gap Report Generation templates. The [MAX_QUESTIONS] value should be tuned to your UX: 2-3 questions work well for chat interfaces, while 1 question is safer for voice or mobile. The [CONSTRAINTS] placeholder lets you inject domain-specific rules, such as prohibiting questions about personally identifiable information or restricting questions to a specific taxonomy. If your system lacks conversation history, omit that section entirely rather than passing an empty placeholder. Test the output by verifying that every generated question maps to at least one gap in your input and that no question duplicates information already present in [RETRIEVED_CONTEXT].

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Gap-Driven Follow-Up Question Generation prompt needs to work reliably. Validate each before assembly to prevent hallucinated follow-ups or questions that ignore the evidence gap.

PlaceholderPurposeExampleValidation Notes

[USER_QUESTION]

The original user query that triggered retrieval

What are the side effects of drug X?

Check for empty string, null, or non-question strings (e.g., 'hello'). Minimum 3 tokens required.

[RETRIEVED_CONTEXT]

The set of passages or documents returned by the retrieval system

Passage 1: Drug X is indicated for... Passage 2: Common adverse events include...

Validate non-empty array with at least 1 passage. Each passage must have content and source metadata. Reject if all passages are null content.

[EVIDENCE_GAPS]

Structured list of what the context cannot answer, produced by an upstream gap analysis prompt

["No information on contraindications", "Missing pediatric dosing data"]

Must be a non-empty array of strings. Each gap must reference a specific missing fact, not a vague statement. Validate against [RETRIEVED_CONTEXT] to confirm gaps are genuine.

[CONVERSATION_HISTORY]

Prior turns in the conversation for context continuity

[{"role": "user", "content": "Tell me about drug X"}, {"role": "assistant", "content": "Drug X is an anticoagulant..."}]

Optional. If provided, must be valid JSON array of message objects with role and content fields. Truncate to last 5 turns if exceeding context budget.

[MAX_QUESTIONS]

Upper bound on the number of follow-up questions to generate

3

Must be an integer between 1 and 5. Default to 3 if not provided. Reject values above 5 to prevent question flooding.

[QUESTION_STYLE]

Tone and format directive for generated questions

concise and neutral

Must be one of: 'concise and neutral', 'exploratory and open-ended', 'confirmatory and closed'. Reject unknown values. Default to 'concise and neutral'.

[OUTPUT_SCHEMA]

Expected JSON structure for the generated questions

{"questions": [{"question": "...", "gap_addressed": "...", "information_gain": "high"}]}

Validate as valid JSON schema. Must include 'questions' array with required fields: question, gap_addressed, information_gain. Reject schemas missing required fields.

[INFORMATION_GAIN_THRESHOLD]

Minimum information gain level required to include a question in output

medium

Must be one of: 'low', 'medium', 'high'. Questions below this threshold are filtered from output. Default to 'medium' to suppress low-value questions.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Gap-Driven Follow-Up Question prompt into a conversational RAG application with validation, retries, and human-review gates.

This prompt operates inside a conversational RAG loop where the system has already retrieved context and determined that evidence is insufficient to answer the user's question. The harness should invoke this prompt only after an upstream sufficiency check (such as a Pre-Answer Sufficiency Check or Answer Readiness Gate) returns a negative decision. The prompt's output—a ranked list of follow-up questions—must be validated before surfacing to the user, because a poorly formed question can degrade trust faster than a simple 'I don't know.' Wire the prompt as a conditional branch: if the sufficiency score falls below your configured threshold, call this prompt with the original question, the retrieved context, and the gap categories identified by the upstream check.

Validation should enforce three constraints. First, each generated question must be answerable from the system's known document corpus—run a quick retrieval check on each question and discard any that return zero results or only low-relevance passages. Second, questions must not repeat the user's original query verbatim; use a simple string-similarity threshold (e.g., cosine similarity below 0.85) to filter near-duplicates. Third, validate the output schema: each question object must contain a non-empty question string, a gap_addressed category matching one of the upstream gap labels, and an information_gain score between 0.0 and 1.0. If validation fails, retry once with the validation errors appended to the prompt as [CONSTRAINTS] feedback. After two failed attempts, fall back to a static clarification template rather than looping indefinitely.

Human review gates are appropriate when the system is deployed in high-stakes domains (healthcare, legal, finance) or when the information gain scores cluster below 0.3, indicating that even the best follow-up questions are unlikely to resolve the gap. In these cases, route the generated questions to a review queue with the original user query, the retrieved context, and the sufficiency report. The reviewer can approve, edit, or reject the questions before they reach the user. Log every invocation—including the sufficiency score, gap categories, generated questions, validation results, and final action (shown, retried, escalated, or reviewed)—to build a dataset for tuning your abstention and follow-up thresholds over time. Avoid wiring this prompt directly into a customer-facing loop without these guardrails; an over-eager clarification request feels like a broken bot.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when generating follow-up questions from evidence gaps and how to guard against it.

01

Questions That Assume Missing Facts

What to watch: The model generates a follow-up question that presupposes an unverified fact, leading the user toward a false premise. For example, asking 'What version of the API caused the error?' when no error was confirmed. Guardrail: Add a constraint to only ask questions about entities and events explicitly mentioned in the retrieved context or the user's original query. Validate generated questions against the gap list before surfacing them.

02

Low-Information-Gain Questions

What to watch: The model asks trivial or already-answered questions that waste a user turn without narrowing the evidence gap. This often happens when the gap list is vague or the model defaults to generic clarification. Guardrail: Require each generated question to include a one-sentence rationale linking it to a specific, unsupported sub-claim. Rank questions by estimated information gain and discard any that duplicate existing context.

03

Over-Questioning the User

What to watch: The model produces a long list of follow-up questions, overwhelming the user and degrading the conversational experience. This is common when multiple evidence gaps exist but the system fails to prioritize. Guardrail: Set a hard limit of 1-3 questions per turn. Use a priority scoring step that considers gap severity, question dependency, and user fatigue before selecting which questions to surface.

04

Leading or Biased Question Framing

What to watch: The model frames questions that nudge the user toward a specific answer, especially when the retrieved context contains opinionated or persuasive language. This compromises the objectivity of the information-gathering process. Guardrail: Include an instruction to phrase all follow-up questions neutrally. Run a secondary check that flags questions containing adjectives like 'correct,' 'best,' or 'obvious' unless directly quoting the user.

05

Ignoring Temporal Context

What to watch: The model asks for information that was already provided in a prior turn or that is time-sensitive without acknowledging the temporal constraint. For example, asking 'What is the current status?' when the user already said 'as of yesterday.' Guardrail: Inject conversation history and document timestamps into the prompt. Require the model to reference the relevant time window explicitly in the question, e.g., 'To confirm, has the status changed since yesterday?'

06

Hallucinated Gap Categories

What to watch: The model invents a missing piece of information that is not actually required to answer the user's question, creating a phantom gap. This leads to unnecessary back-and-forth and erodes user trust. Guardrail: Ground every identified gap in a direct quote or reference to the user's original question. If a gap cannot be traced back to a specific information need in the query, discard it before generating follow-up questions.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of generated follow-up questions before integrating the prompt into a production RAG system. Each criterion should be tested with a representative sample of gap scenarios.

CriterionPass StandardFailure SignalTest Method

Gap Relevance

Each follow-up question directly addresses a specific evidence gap identified in the [GAP_ANALYSIS] input

Questions ask about topics already covered in retrieved context or ignore documented gaps

Manual review of 20 gap-question pairs; check that each question maps to a gap category from the input

Information Gain Ranking

Questions are ordered from highest to lowest expected information gain, with the most critical gap addressed first

Ordering appears random or prioritizes low-impact gaps over critical missing evidence

Pairwise comparison test: present two questions and ask evaluators which would resolve more uncertainty; check alignment with prompt output order

Question Specificity

Each question is specific enough to elicit a targeted answer, not a vague or open-ended restatement of the gap

Questions are generic (e.g., 'Can you provide more details?') rather than referencing specific missing entities, dates, or values

Parse questions for entity presence; flag questions without at least one specific noun phrase from the gap description

Single-Question Discipline

Each generated item is a single, answerable question, not a compound question or multi-part request

Output contains questions joined by 'and' or semicolons that should be separate items

Regex check for question marks and conjunction patterns; split test: can the question be answered with one piece of information?

Conversational Appropriateness

Questions are phrased naturally for a user-facing assistant, not as database queries or internal system prompts

Questions use technical retrieval syntax, field names, or read as system instructions rather than user-facing dialogue

Blind review by non-technical evaluators; flag questions that would confuse an end user

Context Non-Leakage

Questions do not reveal internal system state, confidence scores, or gap analysis metadata to the user

Questions include phrases like 'based on my confidence score' or reference retrieval failure modes

Keyword scan for internal terms: confidence, retrieval, chunk, embedding, source_id; flag any matches

Question Count Appropriateness

Number of questions matches the [MAX_QUESTIONS] constraint and does not exceed what a user can reasonably answer in one turn

Output generates more questions than specified or overwhelms with 10+ questions for a minor gap

Count validation against [MAX_QUESTIONS]; heuristic check: flag if question count exceeds 5 for a single-turn interaction

Answerability Check

Each question can reasonably be answered by the target user persona defined in [USER_CONTEXT]

Questions assume knowledge the user would not have or ask for system-level details the user cannot provide

Persona-based simulation: have a subject-matter expert role-play the user and attempt to answer each question; flag unanswerable items

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single-turn conversation and minimal validation. Remove ranking requirements and ask for 2-3 follow-up questions without strict JSON output. Accept plain text questions separated by newlines.

Prompt modification

code
You are a helpful assistant. Given the user's question and retrieved context, identify what information is missing and generate 2-3 follow-up questions that would fill those gaps.

User question: [USER_QUESTION]
Retrieved context: [RETRIEVED_CONTEXT]

Watch for

  • Questions that repeat the user's original query
  • Generic questions that don't target specific gaps
  • Missing gap justification before question generation
  • Overly broad questions that won't improve retrieval
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.