Skip to content
RAG Explained Better

IRCoT: Interleaving Retrieval with Chain-of-Thought

Interleaving retrieval and reasoning steps so each thought can fetch what the next one needs.

IRCoT (Interleaved Retrieval guided by Chain-of-Thought) is the Trivedi et al. (ACL 2023; arXiv:2212.10509) retrieve-and-read method that alternates chain-of-thought sentence generation with retrieval, so each reasoning step can fetch the evidence the next step needs. Official code ships as StonyBrookNLP/ircot. Among the named patterns under RAG architectures, IRCoT owns CoT-sentence-as-query interleaving; a classifier that chooses zero-, single-, or multi-step retrieval lives on Adaptive-RAG.

How does IRCoT interleave retrieval with chain-of-thought?

IRCoT turns retrieval into a loop guided by CoT sentences rather than a single question query. Trivedi, Balasubramanian, Khot and Sabharwal (2023, section 3.1 and Figure 2) describe three phases. First, retrieve K paragraphs from the corpus using the user question as the query. Second, generate the next CoT sentence from the question, the paragraphs collected so far, and the CoT sentences generated so far. Third, use that latest CoT sentence as the new query, retrieve K more paragraphs, and add them to the collection.

The loop continues until a termination rule fires. The paper motivating failure is one-shot retrieve-and-read: for a multi-step question such as where Lost Gravity was manufactured, the Wikipedia page returned by the question alone may never mention the manufacturing country. The system must first derive the manufacturer (Mack Rides) and only then retrieve with that entity (Trivedi et al., 2023, Introduction). That is the same surface as iterative multi-hop RAG; IRCoT specific move is to let each CoT sentence be the next retrieval query.

alphaXiv Core Methodology restatement and the StonyBrookNLP companion README keep the same reason-then-retrieve cadence. Related sub-query splitting without the CoT-as-query loop sits at query decomposition.

A three-step loop. One, initial retrieval: retrieve K paragraphs from the corpus using the user question as the query. Two, reason step: generate the next CoT sentence from the question, the paragraphs collected so far, and the CoT sentences generated so far. Three, retrieve step: use that latest CoT sentence as the new query, retrieve K more paragraphs, and add them to the collection. A dashed return arrow marks that the loop repeats until a termination rule fires.
IRCoT loops back from its third step to its second: each new CoT sentence becomes the next retrieval query, and the loop continues until a termination rule fires.

Once the loop exists, the practical question is which stop rule ends it before context and call count explode.

When does the IRCoT loop stop?

IRCoT stops when either of two conditions holds (Trivedi et al., 2023, section 3.1): the generated CoT contains the string answer is:, or the maximum number of reasoning steps is reached. The paper sets that maximum to 8 steps in its experiments. After termination, the full collected paragraph set is returned as the retrieval result and passed to a QA reader that uses either direct prompting or CoT prompting (Trivedi et al., 2023, section 3.2).

AutoRAG-Research IRCoT pipeline docs (as captured for the July 2026 corpus and still matching the paper stop string) document the same stop string and a default max_steps of 8. Without an explicit stop, each new CoT sentence can trigger another retrieve, so termination is a cost control as much as a correctness rule.

That budget mindset also shows up when Adaptive-RAG routes hard queries into an IRCoT-style multi-step branch: the router chooses the strategy, but the branch still needs a max-step ceiling so the multi-step path cannot run unbounded on every hard ticket.

What results did the IRCoT paper publish?

The published gains are from the ACL 2023 paper own measurements, not a production SLA. Using GPT-3 (code-davinci-002), IRCoT improved retrieval by up to 21 points and downstream QA by up to 15 points versus one-step question-based retrieval on HotpotQA, 2WikiMultihopQA, MuSiQue and IIRC (Trivedi et al., 2023, abstract). The body also reports an 11 to 21 recall-point gain under a fixed-budget optimal-recall setup (Trivedi et al., 2023, section 5).

On a manual CoT factuality check of 40 questions per dataset, IRCoT reduced factual errors over one-step retrieval (OneR) by 50% on HotpotQA and 40% on 2WikiMultihopQA (Trivedi et al., 2023, section 5). The paper reports similar trends with Flan-T5 models without additional training, and gains that hold in out-of-distribution demonstration settings. alphaXiv Key Experimental Results and the Semantic Scholar paper card restate those abstract-level deltas.

How those datasets sit in a broader eval map is at RAG benchmarks. Finer per-cell tables that do not appear in the abstract or the cited body sections are omitted here rather than invented.

What does IRCoT cost per iteration?

IRCoT cost is structural: each CoT sentence is a separate language-model call, so call count scales with reasoning length rather than with a single generate pass (Trivedi et al., 2023, Limitations). Every retrieve step also grows the context the next reason step must read. The authors note the need for long-context models: their GPT-3 setup allowed 8K tokens, and Flan-T5 used relative position embeddings.

A practitioner control documented by AutoRAG-Research (corpus capture 2026-07-28), not as a paper hyperparameter table, is paragraph_budget (example default 15) with a FIFO drop of earlier paragraphs so the collection cannot grow without bound. Exact dollars-per-query for a private corpus are not published, so teams measure on their own stack.

Stores that serve the retrieve step can still be hybrid indexes. Weaviate, Qdrant, and Pinecone can answer each CoT-sentence query with BM25F-plus-vector fusion when the thought mixes lexical entities and paraphrases; Weaviate hybrid search configuration as of September 2026 is documented on docs.weaviate.io. Broader pipeline spend framing is at pipeline cost.

The cost curve is why teams instrument step count and stop rate beside EM or F1. A run that hits the 8-step ceiling on every query is paying for multi-step retrieval even when the answer string never appears, and a run that never stops early is accumulating paragraphs that may never enter the final reader prompt. Logging whether termination came from answer is: or from max steps turns the paper stop rule into an operable budget signal.

When should you use IRCoT, and when should you avoid it?

IRCoT earns its multi-call overhead when later retrieval genuinely depends on entities derived mid-reasoning. It is usually the wrong default when one-shot retrieve-and-read already returns the supporting paragraphs.

Use IRCoT for multi-step evidence chains: questions where the second or later fact is not lexically available from the original question, which is the paper open-domain multi-step setting (Trivedi et al., 2023, Introduction). The er-aditya GitHub comparison of NoR, OneR, and IRCoT QA makes the same expected-trend point at overview depth: interleaved retrieval helps when one-shot misses the hop entity.

Avoid IRCoT for single-fact lookups. AutoRAG-Research when-to-use guidance (captured 2026-07-28) routes simple factual queries to basic one-shot RAG because IRCoT makes multiple LM calls. Respect the paper adoption limits: IRCoT assumes a base LM with zero- or few-shot CoT ability and enough context for many paragraphs; the authors also note that code-davinci-002 was deprecated after submission, while Flan-T5 trends remain reproducible from public weights (Trivedi et al., 2023, Limitations).

If traffic needs a classifier that chooses zero-retrieval, single-step, or multi-step (IRCoT) per query, that routing architecture is Adaptive-RAG rather than hard-wiring IRCoT for every ticket. The one-shot baseline is Naive RAG. Teams that already know almost every query is multi-hop can keep IRCoT as the default strategy and skip the router; teams with mixed traffic usually measure the fraction of queries that need a second retrieve before they pay for always-on interleaving.

How does IRCoT differ from ReAct and multi-hop RAG?

IRCoT, ReAct and multi-hop RAG all iterate, but they do not iterate for the same reason. IRCoT interleaves retrieval with CoT sentences used as retrieval queries (Trivedi et al., 2023, section 3.1). ReAct frames a Thought-Action-Observation loop where actions can be more general tool calls; the IRCoT paper contrasts that line in related work and notes ReAct original multi-step ODQA setup relied on much larger models and fine-tuning to beat CoT (Trivedi et al., 2023, section 2, citing Yao et al., 2022).

Multi-hop RAG is the broader iterative retrieve-and-compose family; IRCoT is one CoT-guided instantiation of that family. Adaptive-RAG routes some queries into an IRCoT strategy; the router itself is a different mechanism from the interleave loop.

Depth lives on the siblings: ReAct RAG, multi-hop RAG, and Adaptive-RAG. Hop-miss versus composition-miss diagnosis stays on multi-hop failure diagnosis.

How do you implement IRCoT?

Implementing IRCoT is a handoff checklist, not a full reproduction notebook. Wrap a base retriever (the paper experiments use BM25) and a CoT-capable language model; run reason then retrieve with a max-step budget and an answer is: stop check; pass the collected paragraphs to a direct or CoT reader (Trivedi et al., 2023, sections 3.1 to 3.2).

Start from the official StonyBrookNLP/ircot companion release when paper fidelity matters. Cap the loop with max steps (paper experiments use 8) and enforce the answer-string stop so the loop cannot spin. Bound collected context with a paragraph budget and FIFO eviction so later reason steps stay inside the model window. Hybrid retrieval behind each CoT query can sit on Weaviate or another native-hybrid store without changing the interleave logic.

End-to-end build steps, including chunking and serving, belong at building a RAG pipeline. Framework ports such as AutoRAG-Research IRCoTGenerationPipeline and Adaptive-RAG ircot_qa configs are assembly references, not substitutes for measuring stop rate and paragraph growth on your corpus.

IRCoT is CoT-guided interleaved retrieval: retrieve with the question, reason a sentence, retrieve with that sentence, and stop on answer is: or a max-step ceiling. Trivedi et al. (2023) report up to 21 retrieval points and 15 QA points over one-step retrieval on multi-hop open-domain sets, at the price of one LM call per CoT sentence and growing context. Choose IRCoT when hop entities appear mid-reasoning; choose Naive RAG when one retrieve already suffices; choose Adaptive-RAG when the product must route among those strategies per query.