Navigate Select ESC Close

The Best RAG Technique Yet? Anthropic’s Contextual Retrieval Explained!

2024-09-22 Science & Technology
127.5k
3.1k
129
Prompt Engineering
Prompt Engineering
241.0k subscribers

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

Anthropic has launched a new retrieval mechanism called contextual retrieval, which combines chunking strategies with re-ranking to significantly improve performance. In this video, I explain how this technique enhances retrieval accuracy, including practical implementation steps and benchmark results. Learn how to optimize your RAG systems by adding contextual embeddings, keyword-based BM25 indexing, and re-ranking to achieve state-of-the-art results. LINKS: https://www.anthropic.com/news/contextual-retrieval https://github.com/anthropics/anthropic-cookbook/blob/main/skills/contextual-embeddings/guide.ipynb https://youtu.be/Fv_j52DDJUE https://youtu.be/kEgeegk9iqo https://youtu.be/DI9Q60T_054 💻 RAG Beyond Basics Course: https://prompt-s-site.thinkific.com/courses/rag Let's Connect: 🦾 Discord: https://discord.com/invite/t4eYQRUcXB ☕ Buy me a Coffee: https://ko-fi.com/promptengineering |🔴 Patreon: https://www.patreon.com/PromptEngineering 💼Consulting: https://calendly.com/engineerprompt/consulting-call 📧 Business Contact: [email protected] Become Member: http://tinyurl.com/y5h28s6h 💻 Pre-configured localGPT VM: https://bit.ly/localGPT (use Code: PromptEngineering for 50% off). Signup for Newsletter, localgpt: https://tally.so/r/3y9bb0 00:00 Introduction to Contextual Retrieval 00:20 Understanding RAG Systems 00:55 Combining Semantic and Keyword Search 01:44 Challenges with Standard RAG Systems 02:48 Anthropic's Contextual Retrieval Approach 03:37 Implementing Contextual Retrieval 07:06 Performance Improvements and Benchmarks 09:02 Best Practices for RAG Systems 12:48 Code Example and Practical Implementation 15:21 Conclusion and Final Thoughts All Interesting Videos: Everything LangChain: https://www.youtube.com/playlist?list=PLVEEucA9MYhOu89CX8H3MBZqayTbcCTMr Everything LLM: https://youtube.com/playlist?list=PLVEEucA9MYhNF5-zeb4Iw2Nl1OKTH-Txw Everything Midjourney: https://youtube.com/playlist?list=PLVEEucA9MYhMdrdHZtFeEebl20LPkaSmw AI Image Generation: https://youtube.com/playlist?list=PLVEEucA9MYhPVgYazU5hx6emMXtargd4z

Top Comments (10)

@BinWang-b7f 2024-09-22

Sending my best to the little one in the background!

276 1 replies
@tvwithtiffani 2024-09-22

For anyone wondering, I did try these methods (contextual retrieval + reranking) with a local model on my laptop. It does work great the rag part but it takes a while to import new documents due to chunking, generating summaries and generating embeddings. Re-ranking on a local model is surprisingly fast and really good with the right model. If you're building an application using rag, I'd suggest you make adding docs the very first step in the on-boarding to your application because you can then do all of the chunking etc in the background. The user might be expecting real-time drag->drop->ask question workflow but it wont work like that unless you're using models in the cloud. Also, remember to chunk, summarize and gen embeddings simultaneously, not one chunk after another as of course that'll take longer for your end-user.

198 27 replies
@megamehdi89 2024-09-22

Best wishes for the kid in the background

70
@jackbauer322 2024-09-22

I think the baby in the background disagrees :p

23
@wwkk4964 2024-09-22

🎉baby voices were cute!

7
@tomwawer5714 2024-09-22

Thanks very interesting. Many ideas came to my head for improving RAG with enhancing chunk

5
@anubis-vibe 2024-12-31

Thought it was my baby, but it was yours in the background 😂😂

3
@vikramn2190 2024-09-23

Thanks for the easy to understand explanation

2
@alexisdamnit9012 2024-10-07

Great explanation 🎉

1
@RohitKumar-fg1qv 2025-03-24

Superb explanation

0

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan • All features unlocked

App screenshot