SelfRAG¶
SelfRAG is implemented here as a generation pipeline that composes an existing retrieval pipeline. This repo does not reproduce the paper's fine-tuned reflection-token model. Instead, it uses a prompt-based approximation that:
- drafts an answer without retrieval,
- reflects on whether evidence is needed,
- retrieves only when reflection requests it,
- revises the answer against retrieved evidence, and
- stops once the answer is judged supported or the reflection budget is exhausted.
Classification¶
SelfRAG is not a pure retrieval pipeline in this repository's architecture. It belongs in generation because retrieval is only one tool inside the answer-generation loop.
Configuration¶
_target_: autorag_research.pipelines.generation.self_rag.SelfRAGPipelineConfig
name: self_rag
retrieval_pipeline_name: bm25
llm: gpt-4o-mini
max_reflection_steps: 3
top_k: 4
Main Parameters¶
retrieval_pipeline_name: retrieval pipeline composed into SelfRAGllm: model used for drafting, reflection, and revisionmax_reflection_steps: maximum number of reflection iterationsinitial_prompt_template: initial answer promptreflection_prompt_template: structured reflection promptrevision_prompt_template: answer revision prompt
Notes¶
- This implementation is a prompt-based approximation suitable for benchmarking within the existing pipeline abstractions.
- The reflection prompt defaults to JSON output (
should_retrieve,is_supported,follow_up_query,critique) and also tolerates simpleKEY: valuelines for experimentation.