원클릭으로
self-rag
Use self-reflective loops to make dynamic retrieval decisions and assess response quality.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use self-reflective loops to make dynamic retrieval decisions and assess response quality.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use this skill when building, debugging, or improving Retrieval-Augmented Generation systems, including chunking, vector database selection, hybrid search, reranking, multimodal RAG, code documentation RAG, retrieval latency, and production RAG architecture.
Chunk nested documents into parent-child levels so retrieval can move from broad sections to fine-grained passages.
Use semantic boundaries and embedding similarity to chunk text for higher-relevance retrieval.
Route RAG chunking decisions across semantic, hierarchical, sliding-window, contextual-header, and framework-selection strategies.
Use overlapping windows to preserve context across chunk boundaries while controlling retrieval size.
Reduce retrieval latency with caching, batching, and index-level optimization.
| name | self-rag |
| title | Self-RAG - Self-Reflective Retrieval |
| description | Use self-reflective loops to make dynamic retrieval decisions and assess response quality. |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| category | retrieval-strategies |
| tags | ["self-rag","reflection","retrieval-decision","relevance-evaluation"] |
Self-RAG is a reflective framework that decides whether to retrieve information, evaluates the relevance of retrieved documents, assesses response support, and rates output utility. This dynamic approach optimizes retrieval decisions based on query characteristics and retrieved content quality.
Traditional RAG systems lack introspection:
Use an LLM to determine if the query requires retrieval or can be answered directly.
Why: Not all queries need retrieval - some can be answered from general knowledge or are simple enough that retrieval adds unnecessary cost and latency.
Direct the LLM to make a binary decision: retrieve from documents or answer without retrieval.
Assess each retrieved document for its relevance to the original query.
Why: Not all retrieved documents are equally relevant. Filtering ensures only pertinent information is used for generation, reducing noise and improving answer quality.
For each retrieved document, have the LLM rate its relevance to the query on a scale or classify as relevant/irrelevant.
Build a pipeline that filters documents based on relevance scores.
Why: A systematic filtering process ensures consistent quality and prevents irrelevant information from contaminating the generation process.
Select only documents that meet a relevance threshold for use in response generation.
Generate responses using only relevant context, or without context if none is relevant.
Why: Using only relevant context improves factual grounding. When no relevant context exists, the system can still provide a response (with appropriate caveats) rather than forcing use of irrelevant information.
Generate responses conditioned on whether relevant context was found - using context if available, answering from general knowledge if not.
Evaluate how well the generated response is supported by the context.
Why: Support assessment provides a confidence metric and helps detect hallucinations - responses not supported by context can be flagged or refined.
Have the LLM classify the level of support: fully supported, partially supported, or no support.
Rate the usefulness of the generated response for the original query.
Why: Utility rating provides feedback on response quality and can be used for continuous improvement, A/B testing, or filtering low-quality responses.
Rate the response on a scale (e.g., 1-5) based on how well it addresses the user's query.
Combine all components into a cohesive reflective system.
Why: A complete pipeline with clear decision points allows for monitoring, optimization, and understanding of system behavior.
Chain together the retrieval decision, relevance evaluation, response generation, and assessment steps into a unified workflow.
For implementation patterns, see the Self-RAG paper, LangGraph agentic RAG guide, and LlamaIndex SelfRAG pack.