References and useful ressources

Stages within RAG

  1. Loading: This refers to getting your data from where it lives - whether it's text files, PDFs, another website, a database or an API - into your pipeline.

  2. Indexing: This means creating a data structure that allows for querying the data. For LLMs this nearly always means creating vector embeddings, numerical representations of the meaning of your data, as well as numerous other metadata strategies to make it easy to accurately find contextually relevant data.

  3. Storing: Once your data is indexed, you will want to store your index, along with any other metadata, to avoid the need to re-index it.

  4. Querying: For any given indexing strategy there are many ways you can utilize LLMs and data structures to query, including sub-queries, multi-step queries, and hybrid strategies.

  5. Evaluation: A critical step in any pipeline is checking how effective it is relative to other strategies, or when you make changes. Evaluation provides objective measures on how accurate, faithful, and fast your responses to queries are.

RAG_system.png

Text-Only RAG vs Multimodal RAG

Text-only RAG

Multimodal RAG

Advanced RAG Querying strategies

⚠️ TODO: explain the strategies

Small-To-Big retrieval

HyDE Query Transform

Multi-Step Query engine

Long LLMLingua

(ReAct) Reason + Act prompting

Used for Common Sense / Math / Problem solving with external tools

ReAct prompts LLMs to generate verbal reasoning traces and actions for a task. This allows the system to perform dynamic reasoning to create, maintain, and adjust plans for acting while also enabling interaction to external environments (e.g., Wikipedia) to incorporate additional information into the reasoning.

RAG_ReAct.png

(CoT) Chain of Thought

Used for Common Sense / Math / Problem solving

Enables complex reasoning capabilities through intermediate reasoning steps.

Few shots CoT

RAG_CoT.png

Zero-shot CoT

Another approach is the zero-shot CoT which essentially involves adding "Let's think step by step" to the original prompt.

RAG_CoT_2.png

Auto CoT

Finally, the Auto-GoT try to reduce the difficulty of crafting effective and diverse examples by hand.

RAG_CoT_3.png

(CoD) Chain of Density

Used for Summarization

CoD prompting is a technique designed to optimize summarization tasks in language models. It focuses on controlling the information density in generated summaries to achieve a balanced output. This approach has practical implications in data science, particularly for tasks requiring high-quality, contextually appropriate summaries.

RAG_CoD.png

(CoN) Chain of Nothing

(CCoT) Contrastive Chain of Thought

(Re2) Re-Reading Improves Reading in LLM

Rerankers

⚠️ TODO: Rerankers section