Repository navigation
Replies: 2 comments
|
Thank you for the detailed and comprehensive report of your findings. Also thank you for your kind words on the project itself. I am glad that someone actually used the built in archive and gave some feedback. That is huge for me as I do not collect any telemetry data where I could look into the real usage of the different modes pp-ai provides. Back to your idea - I fully undestand the problem and this is very valid. For myself I did not encountered this very often but I encountered it before 2-3 times. RAG tuning is a difficult topic as minor changes can cause major issues. The re-ranking and embedding topic is so fine tuned for a specific range of document types (for example contracts, invoices, house hold documents) and therefor the LLM process afterwards likewise. I promise you I will get back to you later on with some changes and hopefully it works well from small documents to larger documents. |
|
As promised, here is the follow-up. You were right about the root cause. Archive questions gave the AI at most three passages per document, no matter how large the context budget was. That is why raising the budget from 8,000 to 24,000 tokens changed nothing in your tests. I could reproduce this exactly: with the old version, the share of needed facts that reached the model was 59.3% at 8,000 tokens and still 59.3% at 24,000 tokens. What changedSearch and ranking are untouched, so the same documents are found as before. What changed is how much of them reaches the model:
This covers your points 1 to 3 without a separate mode or a new setting. The existing Context budget setting now does what it says. Point 4 (showing the context sent to the model) is not part of this change; I'll keep it in mind. How I tested it
ResultsAnswers fully correct:
What this means for your setupThe change will be part of the next release (4.8.2). With your 32k context window, a Context budget of 24,000 and Documents per answer 10 should be a good starting point. I couldn't test with Qwen 27B on Ollama. Please let me know how it works with your setup and your real documents, especially for the electricity bill comparisons you described. Thanks again for the detailed report, it made this easy to track down! |
Uh oh!
There was an error while loading. Please reload this page.
Feature Request: Configurable RAG passages per document and full-document analysis mode
Environment
Description
First of all, thank you for the excellent work on Paperless-AI. The standalone archive, OCR, document classification and individual document chat have performed very well during my evaluation.
However, I encountered recurring accuracy issues when using the archive-wide RAG chat for detailed comparisons of multi-page financial documents.
For example, when comparing two annual electricity bills, the system successfully retrieves the relevant documents but frequently:
The individual document chat and targeted archive queries produce significantly better results.
Tests performed
I tested the following configurations:
None of these changes consistently resolved the issue for general archive-wide queries.
A correct comparison was achieved when explicitly identifying both invoices and restricting the search to invoices.
Possible root cause
The documented RAG architecture appears to limit retrieval to three passages per longer document.
While this approach is efficient for general searches, it may omit essential information when multiple related facts are distributed across different pages of a financial document.
I suspect that passage selection and context assembly contribute to the observed behavior. However, I have not independently inspected the complete context submitted to the LLM.
Proposed improvements
1. Configurable passages per document
Allow users to configure the maximum number of retrieved passages per document.
2. Optional full-document analysis mode
Provide an alternative retrieval mode that first identifies relevant documents using semantic search and then includes their complete extracted text, subject to the available context budget.
3. Two-stage retrieval
4. RAG diagnostics
Optionally display the actual passages and context submitted to the LLM to help users diagnose retrieval and answer-quality issues.
Expected benefits
The current efficient retrieval mode could remain the default, with comprehensive analysis available as an optional mode.
Thank you for considering these suggestions!
All reactions