Loading video...

Video Failed to Load

Go Home

Introducing Self-RAG, a new easy-to-train, customizable, and powerful framework for making an LM learn to retrieve, generate, and critique its own outputs and retrieved passages, by using model-predicted reflection tokens. 📜: 🌐:

170,979 views • 3 years ago •via X (Twitter)

10 Comments

Akari Asai's profile picture
Akari Asai3 years ago

Augmenting the input space of LMs with retrieved passages (often called RAG) is powerful. Yet, it may still result in hallucinations as LMs can still ignore passages and irrelevant passages can distract LMs. Unnecessary retrieval can also hurt the quality or efficiency. [2/N]

Akari Asai's profile picture
Akari Asai3 years ago

Self-RAG enables an LM to learn to retrieve on demand and criticize its own generations & passages by decoding special tokens (reflection tokens) while standard RAG often retrieves fixed times e.g., once at the beginning, and never second revisits the passages/outputs. [3/N]

Akari Asai's profile picture
Akari Asai3 years ago

Self-RAG trains an LM on augmented diverse instruction-output data with intermitting passages and reflection tokens. As it is a simple LM training with expanded vocabularies, it’s much easier & memory-efficient than RLHF / end-to-end RAG training. [4/N]

Akari Asai's profile picture
Akari Asai3 years ago

During decoding, Self-RAG uses reflection tokens probabilities as fine-grained critique scores and chooses the best output, enabling the LM to tailor its behavior to diverse task requirements (e.g., creativity/fluency v.s. citation precision/factuality). [5/N]

Akari Asai's profile picture
Akari Asai3 years ago

So how good they are? Self-RAG outperforms many powerful LLMs (incl. ChatGPT) w/ and w/o standard RAG on six tasks and improves factuality and citation accuracy in long-form generations. Also, Self-RAG can tailor its behaviors for different preferences at inference time. [6/N]

Akari Asai's profile picture
Akari Asai3 years ago

Our model checkpoints and codes are available, and you can download and try out self-rag (7B, 13b) easily! [7/N] We also provide an inference script run Self-RAG w/ Contriever on 1 GPU

Akari Asai's profile picture
Akari Asai3 years ago

Work done with my fantastic collaborators @zeqiuwu1 @yizhongwyz @aviaviavi__ @HannaHajishirzi at @uwnlp!

Owen Colegrove's profile picture
Owen Colegrove3 years ago

this is really cool! Currently working on building a massive RAG database + pipeline - I would love to hook this up to it for some tests.

neron's profile picture
neron3 years ago

Nice! How does it compares to reranking models? I use them for this specific case, it’s not perfect but it’s an easy and fast way to improve context—without burning tokens on a multi LLM step solution

Akari Asai's profile picture
Akari Asai3 years ago

Reranking context is another way to measure the relevance of documents to improve RAG quality. Yet, feeding the highest ranked passages may still result in unsupported generation ( which Self-RAG’s fine-grained critique guided decoding can address.

Related Videos

New Short Course: Getting Structured LLM Output! Learn how to get structured outputs from your LLM applications in this course, built in partnership with .txt, and taught by Will Kurt, a Founding Engineer, and , Developer Relations Engineer. It's challenging for software to automatically parse through an LLM's freeform text outputs. Structured outputs—like JSON—solve this by converting natural language into consistent, clear, data that a machine can read and process. This course teaches you how to generate structured outputs while building several use cases, including a social media analysis agent. You’ll learn about structured outputs and efficient ways to generate outputs in your defined schema or format. You’ll begin by using structured output APIs, then use re-prompting libraries like “instructor” to generate structured output. Finally, you’ll learn how constrained decoding works; this is a very clever technique in which constraints are applied on each subsequent token generated, blocking any tokens that don’t fit your defined schema. In detail, you’ll: - Learn why structured outputs are important, how they allow for scalable software development, and the different approaches to generate them, including vendor-provided APIs, re-prompting libraries, and structured generation. - Build a simple social media agent using OpenAI’s structured output API, learn how to define a model's desired structured output using Pydantic, and perform basic programming with your outputs, such as importing structured data into a data frame using pandas. - Learn how to use the open-source library "instructor," which checks the structured output of the model and re-prompts the model until it validates the desired output, and explore the limitations of this approach. - Understand how structured generation by the “outlines” library works by modifying LLM logits, on a per-generated-token basis based on the desired format, to give a particular output structure. - Learn how regular expressions, which outlines works with, are represented as finite-state machines, and how they can be used to develop a range of structured outputs beyond JSON. By the end of this course, you’ll have broadened your knowledge of the approaches you can use to get structured outputs from your LLM applications. Please sign up here:

Andrew Ng

89,792 views • 1 year ago

Announcing a new Coursera course: Retrieval Augmented Generation (RAG) You'll learn to build high performance, production-ready RAG systems in this hands-on, in-depth course created by and taught by , experienced AI and ML engineer, researcher, and educator. RAG is a critical component today of many LLM-based applications in customer support, internal company Q&A systems, even many of the leading chatbots that use web search to answer your questions. This course teaches you in-depth how to make RAG work well. LLMs can produce generic or outdated responses, especially when asked specialized questions not covered in its training data. RAG is the most widely used technique for addressing this. It brings in data from new data sources, such as internal documents or recent news, to give the LLM the relevant context to private, recent, or specialized information. This lets it generate more grounded and accurate responses. In this course, you’ll learn to design and implement every part of a RAG system, from retrievers to vector databases to generation to evals. You’ll learn about the fundamental principles behind RAG and how to optimize it at both the component and whole-system levels. As AI evolves, RAG is evolving too. New models can handle longer context windows, reason more effectively, and can be parts of complex agentic workflows. One exciting growth area is Agentic RAG, in which an AI agent at runtime (rather than it being hardcoded at development time) autonomously decides what data to retrieve, and when/how to go deeper. Even with this evolution, access to high-quality data at runtime is essential, which is why RAG is a key part of so many applications. You'll learn via hands-on experiences to: - Build a RAG system with retrieval and prompt augmentation - Compare retrieval methods like BM25, semantic search, and Reciprocal Rank Fusion - Chunk, index, and retrieve documents using a Weaviate vector database and a news dataset - Develop a chatbot, using open-source LLMs hosted by Together AI, for a fictional store that answers product and FAQ questions - Use evals to drive improving reliability, and incorporate multi-modal data RAG is an important foundational technique. Become good at it through this course! Please sign up here:

Andrew Ng

124,656 views • 1 year ago