Skip to content

Empty Context with Focused Retrieval in RAG #10747

Description

@bgeneto

Bug Report

Installation Method

Docker, via docker compose.

Environment

  • Open WebUI Version: v0.5.16

  • Ollama (if applicable): N/A

  • Operating System: Ubuntu 22.04

  • Browser (if applicable): Firefox 125.0.3

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

When using RAG with Focused Retrieval enabled (Full Context Mode disabled), the context should be populated with relevant information extracted from the uploaded document, even if the document is small. The LLM should be able to answer at least specific questions based on this context.

Actual Behavior:

When using RAG with Focused Retrieval enabled, the context is often empty, even with very small documents. The LLM reports that the context is empty and cannot answer questions related to the document's content. Disabling Focused Retrieval (enabling Full Context Mode) resolves the issue, and the context is correctly populated. In both cases, nevertheless, the vector db (prismas, milvus, pgvector...) is correctly populated with embeddings.

Description

Bug Summary:
RAG with Focused Retrieval often results in an empty context, preventing the LLM from answering questions about uploaded documents, even minimal ones. Disabling Focused Retrieval fixes the problem.

Reproduction Details

Steps to Reproduce:

  1. Start a new chat in OpenWebUI.
  2. Ensure "Full Context Mode" is disabled in Settings (or that "Focused Retrieval" is enabled in the right pane. This is the default setting (unfortunately).
  3. Upload a small document (e.g., a simple text file with a few sentences, a small PDF, or a minimal DOCX/XLSX). I used a TXT file containing only "This is a test document for RAG dated 2025-02-25."
  4. Select any LLM.
  5. Ask the LLM a question about the document's content, such as "What is in the context?" or "What does the document say?", "Are there dates in the context?".
  6. Observe that the LLM responds that the context is empty.
  7. Go to Settings and enable "Full Context Mode" (or disable "Focused Retrieval" in the RAG section).
  8. Repeat steps 5 and 6. Observe that the LLM now correctly answers based on the document's content.

Logs and Screenshots

Browser Console Logs:
(No relevant errors in the browser console.)

Docker Container Logs:
(No relevant errors in the Docker container logs related to RAG processing. Happy to provide full logs if needed, but they are quite verbose.)

Screenshots/Screen Recordings (if applicable):

I can provide screenshots if necessary, but the steps above are very straightforward to reproduce. The key visual difference is the LLM's response indicating an empty context vs. a response based on the document.

Additional Information

This issue seems to be related to how Focused Retrieval processes and selects relevant chunks from the document. Maybe the "Full Context Mode" bypasses this chunk selection and provides the entire processed document to the LLM, which explains why it works correctly. The issue is consistent across different LLMs and document types (txt, pdf, docx, xlsx). I would like to know better how Focused Retrieval is supposed to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions