Apply to my task
arXiv:2510.18297 ★ 73 Oct 21, 2025

MedRGAG: Three-Stage Knowledge Gap-Filling via Summarization, Gap Analysis, and Context Generation

Key result

The problem: Searching a knowledge base (RAG) finds 60% of what you need; the rest is missing. Generating from memory makes up facts. When you just mix the retrieved and the generated, the model gets confused and picks the wrong source. MedRGAG lets you control the balance between facts and generation — the model doesn't make things up when information is incomplete. The trick: the model identifies the knowledge gaps itself ("information about X is missing here"), generates only what's missing, then picks the best fragments. +12.5% accuracy over plain retrieval.

01

TL;DR

MedRGAG is a method that first summarizes the available information, then identifies what's missing for an answer, and only then generates the missing context. Unlike plain retrieval (RAG) or plain generation (GAG), the model takes three sequential steps within a single task.

The problem with classic approaches: searching a knowledge base gives an incomplete picture (60% of what you need turns up, 40% is missing), while generating "from memory" produces hallucinations (made-up facts). When you just mix the retrieved and the generated, the model gets confused and gives a wrong answer because it can't tell which source is more reliable.

MedRGAG solves this with guided generation: the model first reads what was found, flags the gaps ("information about X is missing here"), and generates only the missing pieces. Then it picks the best fragments from both the retrieved and the generated material. On medical benchmarks this gave +12.5% accuracy over plain retrieval and +4.5% over plain generation.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: Summarization
For each retrieved document → extract what's useful for the question
(filter noise, drop the irrelevant)

STEP 2: Gap analysis
Read all summaries → identify 2-3 key knowledge gaps
(what's CRITICAL for the answer but missing)

STEP 3: Context generation
For each gap → generate a reference document
(fill in what's missing)

STEP 4: Document selection
Group retrieved + generated by topic → pick the top 5 sources
(balance: facts from retrieval + context from generation)

STEP 5: Final answer
Use the 5 selected sources → give the answer

Each step runs as a separate request. Every stage is a new prompt that takes the previous one's results.

03

Example in Practice

Task: You're a consultant helping a startup choose a business model for a B2B SaaS product. You have a few articles on monetization, but the information is scattered.

Prompt:

I have 3 articles on SaaS monetization:

[Article 1]: The freemium model drives high conversion in paid segments...
[Article 2]: Enterprise sales require a long deal cycle...  
[Article 3]: A PLG approach lowers CAC through virality...

TASK: Determine the optimal monetization strategy for a B2B reporting-automation tool (target customers: mid-sized businesses in the US, 50-500 employees).

Do the following in order:

1. SUMMARIZATION: For each article, pull out only what's relevant to my case (mid-market B2B, US). If an article has nothing useful, write "No useful information".

2. GAP ANALYSIS: Read all the summaries. Identify 2-3 critical knowledge gaps — what do I need to know to choose a model that's missing from the articles?

3. CONTEXT GENERATION: For each gap, write a short brief (3-4 sentences) with the missing information.

4. SELECTION: From all sources (3 articles + briefs), pick the top 5 most relevant for the decision. Explain why these.

5. FINAL ANSWER: Based on the selected sources, recommend a monetization strategy.

Result:

The model will produce a structured process:

  • Step 1: A summary of each article focused on mid-market B2B
  • Step 2: For example, "Gap 1: no data on mid-sized US businesses' willingness to pay", "Gap 2: the risks of freemium in B2B aren't covered"
  • Step 3: Short briefs for each gap
  • Step 4: A list of the chosen sources with the rationale
  • Step 5: A final recommendation grounded in the sources

You get explicit reasoning behind the decision — you can see where each idea came from (an article or a generated brief) and why the model reached its conclusion.

04

Why It Works

The LLM's weakness: The model doesn't know what it doesn't know. Asked directly, it either makes things up (hallucinates) or ignores the knowledge gaps and gives a shallow answer.

The LLM's strength: The model is great at analyzing what's there and logically inferring what's missing — if you explicitly ask it to. It's also good at generating context on a specific request ("write a brief on X"), but bad at generating "in general".

How the method uses that strength:

  1. Summarization filters out noise — instead of "here are 10 documents, sort it out", the model first extracts the essence of each one. That lowers the cognitive load at the final stage.
  2. Explicitly identifying gaps turns an abstract task ("give a good answer") into a concrete one ("what exactly is missing?"). The model stops making things up and honestly says "I don't know about X".
  3. Targeted generation creates context pinpoint-style ("a brief on X") rather than broadly ("tell me everything about the topic"). This sharply reduces hallucinations, because the request is narrow and checkable.
  4. Selection keeps the model from drowning in information — it picks the top 5 sources itself, balancing facts (from retrieval) and logic (from generation). Without this step the model may overrate the generated context (it reads more coherently) or underrate the retrieved facts (they're fragmentary).

Prompt control levers:

  • Number of gaps (2-3) → raise to 5 for complex tasks, drop to 1 for simple ones — controls the depth of analysis
  • Number of final sources (top 5) → more sources = more context, but a higher risk of noise
  • Generation format ("3-4 sentences") → set the brief length for your task
  • Selection criteria → add "prioritize facts from retrieval" or "prioritize recent data"
05

Prompt Template

I have {information_sources}.

TASK: {your_task}.

Do the following in order:

1. SUMMARIZATION: For each source, pull out only what's relevant to the task. If a source has nothing useful, write "No useful information".

2. GAP ANALYSIS: Read all the summaries. Identify 2-3 critical knowledge gaps — what do I need to know to solve this that's missing from the sources?

3. CONTEXT GENERATION: For each gap, write a short brief (3-4 sentences) with the missing information.

4. SELECTION: From all materials (original sources + briefs), pick the top 5 most relevant for the solution. Explain why these.

5. FINAL ANSWER: Based on the selected sources, solve the task.

Placeholders:

  • {information_sources} — documents, articles, notes, or "I ran a search and found..."
  • {your_task} — a specific question or problem

If you DON'T have sources ready:

Replace Step 1 with:

1. SEARCH + SUMMARIZATION: Find relevant information on the topic in your own knowledge. Split it into 3-4 thematic blocks and summarize each.

The model uses its internal knowledge as "pseudo-documents" and follows the same scheme from there.

06

Limitations

⚠️ Number of requests: The method takes 1 request for all steps (they fit in one prompt) or 5 separate requests (if you want to control each stage). For simple questions this is overkill — a direct answer is faster.

⚠️ Generation quality: In Step 3 the model may generate inaccurate briefs if the gap is beyond its knowledge. In medicine that's critical (wrong fact → wrong diagnosis); in business it's tolerable.

⚠️ Overhead on simple tasks: If the question is simple ("capital of France?"), the 5-step process hurts — the model may "find" gaps that don't exist and overcomplicate the answer.

⚠️ Subjective criteria: The method works worse when you need judgment (creativity, style) rather than facts. The model doesn't know which gap is more critical: "missing data on metric X" vs "missing expert Y's opinion".

07

How They Tested It

The team took five medical datasets (medical licensing exams, PubMed questions) — about 8,000 questions in total. They compared three approaches: RAG (retrieval from medical textbooks + Wikipedia), GAG (the model generating context "from memory"), and MedRGAG (their method).

They tested on three reader models (Qwen2.5-7B, LLaMA-3.1-8B, Ministral-8B) — the models that read the context and give the final answer. Generation used LLaMA-3.1-8B; the helper steps (summarization, gap analysis, selection) used GPT-4o-mini.

Why the results look like this:

In medicine, documents are often fragmentary — one covers symptoms, another treatment, a third the disease mechanism. RAG returns all three and the model gets lost in the volume. GAG generates coherent text but invents details (such as a wrong dosage).

MedRGAG first reads what was found, realizes "symptoms are covered, but the disease mechanism isn't", generates specifically the disease mechanism, and then chooses: it takes the factual symptoms from retrieval + the generated mechanism. That gives +12.5% accuracy over pure RAG.

The most interesting part: when they removed document selection (Step 4) and just mixed all 10 sources (5 retrieved + 5 generated), accuracy dropped. It turned out the reader model overrates the generated documents (they read more coherently) and ignores the retrieved facts (they look scattered). Selection balances this — it explicitly says "take 2 from retrieval, 3 from generation".

Why the method works better:

Classic RAG takes the top 5 documents by similarity to the question. But similar ≠ useful. You might get 5 documents on symptoms and none on treatment. MedRGAG analyzes what was found and deliberately generates what's missing.

Classic GAG generates 5 documents "about the question in general". The model invents details because it doesn't know what exactly is needed. MedRGAG first identifies the gaps ("I need information about X"), and only then generates — which reduces hallucinations.

08

Adaptations and Extrapolations

1. Simplified single-request version

If you don't want to make 5 separate requests, combine everything into one prompt with an explicit structure:

Task: {your_task}

Source materials: {sources}

Do this as an internal monologue (don't show me the intermediate steps):
1. Summarize each source
2. Identify 2-3 knowledge gaps  
3. Generate briefs for the gaps
4. Pick the top 5 sources (original + briefs)

In the final answer show:
- Which sources you used (mark retrieved vs generated)
- The answer to the task

The model will run all the steps internally but show only the result. The downside: you lose control over each stage.

2. Simplified two-stage version

For situations where you have no sources at all (working purely from the model's knowledge):

STEP 1:
Topic: {your_topic}

Find all relevant information in your knowledge. Split it into 3-4 thematic blocks. For each block, state WHAT you know and what's MISSING for the full picture.

STEP 2:  
Based on the gaps from Step 1, write the missing briefs. Use the blocks + briefs to answer the question: {your_question}.

This is an adaptation for when there are no external documents but you still need structured thinking.

3. Combining with Chain-of-Thought

If the task needs not just knowledge but also logical steps (say, diagnosing a problem):

Task: {your_task}

Materials: {sources}

1. KNOWLEDGE: Run MedRGAG (summarization → gaps → generation → selection)

2. REASONING: Based on the selected sources, reason step by step:
   - What is known?
   - What are the hypotheses?
   - How can we test them?
   - Final conclusion

Show both processes separately.

This lets you separate knowledge gathering (MedRGAG) from logical inference (CoT).


Research digest

Key result

The problem: Searching a knowledge base (RAG) finds 60% of what you need; the rest is missing. Generating from memory makes up facts. When you just mix the retrieved and the generated, the model gets confused and picks the wrong source. MedRGAG lets you control the balance between facts and generation — the model doesn't make things up when information is incomplete. The trick: the model identifies the knowledge gaps itself ("information about X is missing here"), generates only what's missing, then picks the best fragments. +12.5% accuracy over plain retrieval.

Principle

A five-step process instead of a single request. Step 1 (Summarization): For each retrieved document → extract what's useful for the question. Noise filter. Step 2 (Gap analysis): Read all the summaries → identify 2-3 critical gaps — what's needed for the answer but missing. Step 3 (Context generation): For each gap → write a brief. Generation is targeted ("a brief on X"), not general ("tell me everything"). Step 4 (Selection): From retrieved + generated → pick the top 5 sources. Balance: facts from retrieval + logic from generation. Step 5 (Final answer): Use the selected sources.

Why it works

The model doesn't know the limits of its own knowledge. Asked directly, it makes things up or ignores the gaps. The fun part: when you explicitly ask it to find the gaps, the model honestly says "I don't know about X". It stops fantasizing. Targeted generation ("write a brief on X") reduces hallucinations — the request is narrow and checkable rather than abstract. Summarization strips out noise before the final stage. Selection keeps the model from drowning in information — it balances coherent generated texts (which look more convincing) against fragmentary retrieved facts (less coherent but more accurate).

When to apply

Analysis and consulting → when information is scattered (articles, notes, reports) and it's unclear what's missing for a conclusion. Especially for tasks where mistakes are costly (medicine, finance, legal opinions). NOT a fit for simple questions ("capital of France?") — 5 steps add needless overhead. Not a fit for subjective judgments (creativity, style) — the model doesn't know which gap matters more: "no data on metric X" vs "no opinion from expert Y".

Mini recipe

1. Summarization: For each source, pull out only what's relevant to the task. If a source is empty, write "No useful information". 2. Gap analysis: Read all the summaries. Identify 2-3 critical gaps — what do you need to know to solve this that's missing from the sources? 3. Context generation: For each gap, write a short brief (3-4 sentences) with the missing information. 4. Selection: From all materials (original sources + briefs), pick the top 5 most relevant. Explain why these. 5. Final answer: Based on the selected sources, give the solution. Control via parameters: Number of gaps (2-3 for simple tasks, 5 for complex ones), number of final sources (top 5 is standard), brief length (3-4 sentences), selection criteria ("prioritize facts from retrieval" or "prioritize recent data").

Examples

[BAD]: `I have 3 articles on SaaS monetization. Determine the optimal strategy for a B2B reporting-automation tool (mid-sized businesses, US, 50-500 employees)` (The model will mix retrieved and invented material with no structure. You can't tell where the conclusions came from — the articles or thin air.) [GOOD]: `I have 3 articles on SaaS monetization: [Article 1 on freemium], [Article 2 on enterprise sales], [Article 3 on a PLG approach]. TASK: Determine the strategy for a B2B tool (mid-sized businesses, US, 50-500 employees). Do the following in order: 1) SUMMARIZATION: For each article, what's relevant to my case. 2) GAP ANALYSIS: Identify 2-3 knowledge gaps (critical but missing). 3) GENERATION: For each gap, write a brief (3-4 sentences). 4) SELECTION: Pick the top 5 sources (articles + briefs). Explain the choice. 5) FINAL ANSWER: A recommendation that cites the sources.` (Explicit reasoning — you can see where each idea came from: an article or a brief. The model doesn't make things up; it admits the gaps and fills them deliberately.)

In plain words

Medical AI models screw up because they either try to recall a textbook they've never seen or blindly trust search snippets that may have nothing to do with the case. The point of MedRGAG is to make the model use its head first and take stock of what it knows. Instead of blurting out an answer right away, the system first condenses what it has already found and then honestly asks itself: "What am I missing so I don't kill the patient?". It's a fundamental shift from plain search to deliberately generating the missing links.

It's like going to a doctor with a rare rash, and instead of immediately googling your symptoms, the doctor first jots down on a napkin everything they've gathered from your story, realizes they don't have your blood test results, and only then goes looking for that specific detail. Technically they could have guessed right away, but without that intermediate step they'd just be shooting in the dark. MedRGAG cuts out the flailing and makes the model follow a clear algorithm: summarization, gap-finding and only then the final answer.

Underneath are three concrete stages that turn chaos into a system. First comes context summarization — throw out the junk and keep the meat. Then comes identifying missing knowledge: the model literally writes a list of questions the current text doesn't answer. And the finale is generating the augmented context, where the LLM builds the logical bridges itself from its internal memory, but strictly targeted at those gaps. That cuts the risk of hallucinations many times over, because the model no longer tries to guess everything at once.

Although the method was battle-tested in medicine, where a mistake can cost a life, the principle is universal. It's an ideal setup for any complex field: law, fintech, or deep consulting. Anywhere there's a mountain of documents and a high risk of saying something dumb, MedRGAG will outperform standard RAG. Regular search just hands you similar-looking texts, while this method forces the model to structure what it doesn't know, which is critical for making decisions when data is scarce.

Bottom line: the era of feeding a model a PDF and waiting for a miracle is ending. The future belongs to hybrid setups, where the model first analyzes its own limits and then patches them precisely. If your AI assistant still spits out shallow junk, it's missing exactly this kind of three-stage filter. Either you teach the model to admit gaps in its knowledge, or you keep getting answers that sound greatbut are completely useless in practice.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on MedRGAG: Three-Stage Knowledge Gap-Filling via Summarization, Gap Analysis, and Context Generation arXiv:2510.18297

Sign in to apply this study New accounts get 50 free credits.