klotz: context* + rag*

0 bookmark(s) - Sort by: Date ↓ / Title / - Bookmarks from other users for this tag

  1. RAG combines language models with external knowledge. This article explores context & retrieval in RAG, covering search methods (keywords, TF-IDF, embeddings/FAISS/Chroma), context length challenges (compression, re-ranking), and contextual retrieval (query & conversation history).
  2. Here’s the simplest version — key sentence extraction:


    <pre>
    ```
    def extract_relevant_sentences(document, query, top_k=5):
    sentences = document.split('.')
    query_embedding = embed(query)
    scored = »
    for sentence in sentences:
    similarity = cosine_sim(query_embedding, embed(sentence))
    scored.append((sentence, similarity))
    scored.sort(key=lambda x: x 1 » , reverse=True)
    return '. '.join( s[0 » for s in scored :top_k » ])
    ```
    </pre>

    For each sentence, compute similarity to the query. Keep the top 5. Discard the rest
  3. This article discusses the importance of knowledge graphs in providing context for AI agents, highlighting their advantages over traditional retrieval systems in terms of precision, reasoning, and explainability.
  4. "Contextual Retrieval tackles a fundamental issue in RAG: the loss of context when documents are split into smaller chunks for processing. By adding relevant contextual information to each chunk before it's embedded or indexed, the method preserves critical details that might otherwise be lost. In practical terms, this involves using Anthropic’s Claude model to generate chunk-specific context. For instance, a simple chunk stating, “The company’s revenue grew by 3% over the previous quarter,” becomes contextualized to include additional information such as the specific company and the relevant time period. This enhanced context ensures that retrieval systems can more accurately identify and utilize the correct information."
  5. Mem0: The Memory Layer for Personalized AI. Provides an intelligent, adaptive memory layer for Large Language Models (LLMs), enhancing personalized AI experiences.
    2024-07-29 Tags: , , , , , by klotz
  6. The article proposes a new framework, LongRAG, that aims to improve the performance of Retrieval-Augmented Generation (RAG) by using long retriever and reader components. LongRAG processes Wikipedia into larger 4K-token units, reducing the total units from 22M to 600K, thus decreasing the burden on the retriever. The top-k retrieved units (≈30K tokens) are then fed to a long-context Language Model for zero-shot answer extraction. LongRAG achieves EM of 62.7% on NQ and 64.3% on HotpotQA (full-wiki), which is on par with the state-of-the-art model.
  7. 2023-12-13 Tags: , , , , , by klotz

Top of the page

First / Previous / Next / Last / Page 1 of 0 SemanticScuttle - klotz.me: Tags: context + rag

About - Propulsed by SemanticScuttle