×
Anthropic Introduces ‘Contextual Retrieval’ to Boost Accuracy of RAG Systems
Written by
Published on
Join our daily newsletter for breaking news, product launches and deals, research breakdowns, and other industry-leading AI coverage
Join Now

Revolutionizing AI knowledge retrieval: Anthropic introduces Contextual Retrieval, a method that significantly improves the accuracy of information retrieval for AI models, particularly in Retrieval-Augmented Generation (RAG) systems.

  • Contextual Retrieval addresses the limitations of traditional RAG solutions by preserving context when encoding information, resulting in more accurate and relevant retrievals from knowledge bases.
  • The method combines two techniques: Contextual Embeddings and Contextual BM25, which work together to reduce failed retrievals by up to 49%.
  • When combined with reranking, Contextual Retrieval can reduce failed retrievals by up to 67%, representing a substantial improvement in retrieval accuracy.

Understanding the context conundrum: Traditional RAG systems often struggle with context loss when splitting documents into smaller chunks, leading to retrieval errors and incomplete information.

  • RAG typically breaks down large knowledge bases into smaller text chunks, which are then converted into vector embeddings for semantic searching.
  • This approach can result in individual chunks lacking sufficient context, making it difficult to retrieve the right information or use it effectively.
  • Anthropic’s Contextual Retrieval solves this problem by prepending chunk-specific explanatory context to each chunk before embedding and indexing.

Implementing Contextual Retrieval: The new method leverages Claude, Anthropic’s AI model, to generate concise, chunk-specific context for each piece of information in the knowledge base.

  • A carefully crafted prompt instructs Claude to provide succinct context that situates each chunk within the overall document.
  • The generated contextual text, usually 50-100 tokens, is prepended to the chunk before embedding and creating the BM25 index.
  • Anthropic’s prompt caching feature makes this process cost-effective, with an estimated one-time cost of $1.02 per million document tokens to generate contextualized chunks.

Performance improvements and methodologies: Extensive experimentation across various knowledge domains demonstrates the effectiveness of Contextual Retrieval.

  • Contextual Embeddings alone reduced the top-20-chunk retrieval failure rate by 35% (from 5.7% to 3.7%).
  • Combining Contextual Embeddings with Contextual BM25 further reduced the failure rate by 49% (from 5.7% to 2.9%).
  • The experiments covered diverse domains, including codebases, fiction, ArXiv papers, and science papers, using various embedding models and retrieval strategies.

Enhancing performance with reranking: Anthropic introduces an additional step to further boost retrieval accuracy.

  • Reranking filters the initially retrieved chunks to ensure only the most relevant information is passed to the model.
  • The process involves scoring each chunk based on its relevance to the user’s query and selecting the top-K chunks for final processing.
  • Combining reranking with Contextual Retrieval reduced the top-20-chunk retrieval failure rate by an impressive 67% (from 5.7% to 1.9%).

Key findings and best practices: Anthropic’s comprehensive testing revealed several important insights for optimizing RAG systems.

  • Combining embeddings with BM25 outperforms embeddings alone.
  • Voyage and Gemini embeddings showed the best performance among those tested.
  • Passing the top-20 chunks to the model proved more effective than using fewer chunks.
  • Adding context to chunks significantly improves retrieval accuracy.
  • Reranking provides additional performance benefits.
  • Combining all these techniques yields the best overall results.

Broader implications for AI development: Contextual Retrieval represents a significant advancement in AI knowledge management and retrieval systems.

  • This innovation has the potential to enhance the performance of AI models across various applications, from customer support chatbots to legal analysis tools.
  • By improving the accuracy and relevance of information retrieval, Contextual Retrieval could lead to more reliable and context-aware AI systems.
  • As AI continues to be integrated into diverse fields, techniques like Contextual Retrieval will play a crucial role in ensuring that models can effectively leverage large knowledge bases while maintaining contextual understanding.
Introducing Contextual Retrieval

Recent News

Amazon chief says GenAI is growing 3X faster than cloud computing

Amazon's AWS division sees AI services growing three times faster than traditional cloud offerings as enterprise customers rush to adopt artificial intelligence tools.

Microsoft’s 10 new AI agents fortify its grip on enterprise AI

Microsoft's enterprise AI agents gain rapid adoption as 100,000 organizations deploy automated business tools across customer service, finance, and supply chain operations.

Former BP CEO joins AI data center startup

Energy veterans and tech companies forge new alliances as AI computing centers strain power grids and demand sustainable solutions.