Principle:666ghj BettaFish Reflection Loop
| Knowledge Sources | |
|---|---|
| Domains | NLP, Information_Retrieval, LLM_Reasoning |
| Last Updated | 2026-10-08 00:00 GMT |
Overview
Iterative refinement pattern where an LLM reflects on its current output, identifies information gaps, and generates new queries to fill them, repeating until sufficient coverage is achieved.
Description
The Reflection Loop addresses the limitation of single-pass research: a single search query rarely captures all relevant information about a topic. After the initial search and summary, the reflection node examines what has been found and what is missing, then generates a targeted query to fill the gaps. This cycle repeats for a configurable number of iterations, progressively enriching the summary.
Each iteration follows: Search → Summarize → Reflect → Generate New Query. The reflection LLM is prompted to identify weaknesses in the current summary (missing data, shallow analysis, one-sided coverage) and produce a query that specifically addresses those weaknesses.
Usage
Use this principle when building research systems that need comprehensive topic coverage beyond what a single search can provide. It is especially effective when the research target has multiple facets (e.g., sentiment analysis needs both positive and negative viewpoints) or temporal aspects (e.g., historical context plus current developments).
Theoretical Basis
The reflection loop is an iterative improvement process:
The loop terminates when:
- A maximum iteration count is reached
- The reflection determines no significant gaps remain
- The search returns diminishing new information
Pseudo-code Logic:
# Abstract pattern (NOT real implementation)
query = first_search(paragraph)
summary = summarize(search(query))
for i in range(max_iterations):
query = reflect(paragraph, summary) # Identify gaps
new_results = search(query)
summary = summarize(new_results, summary) # Enrich
Related Pages
Implemented By
- Implementation:666ghj_BettaFish_FirstSearchNode_run
- Implementation:666ghj_BettaFish_ReflectionNode_run
- Implementation:666ghj_BettaFish_FirstSummaryNode_run
- Implementation:666ghj_BettaFish_ReflectionSummaryNode_run