Daten fließen von Dokumenten in eine Datenbank für Analyse und Suche.

Advanced RAG: How AI understands spreadsheets and invoices without making mistakes

The automated answering of questions from internal documents via Retrieval-Augmented Generation (RAG) is a major driver of efficiency.

However, standard systems regularly fail when dealing with business-critical structures such as nested tables, graphics and invoices.  

Traditional text chunkers rigidly split documents based on character length. Geometric relationships (row-column) are squeezed into a one-dimensional text stream. Without column headings, the AI loses context: numerical values are left hanging, which leads to incorrect data and hallucinations in production systems. In our latest white paper, we present three tried-and-tested solution architectures to address this shortcoming:  

  • Visual Retrieval (ColPali Paradigm): This approach completely dispenses with error-prone text extraction (OCR). Each PDF page is processed as an image matrix. Search queries are matched directly against visual elements (such as table headers or total lines) via their spatial arrangement. The generative AI then analyses the high-resolution image directly.  
  • Multi-vector retrieval & HTML injection: Tables and diagrams are neatly isolated and summarised textually for search purposes. In the background, however, the table is stored as HTML code. Research at the rms. LLM Lab shows that language models process native HTML tables with up to 32% higher precision than CSV formats, as the logical structure is optimally preserved.  
  • Hybrid search for invoices: Statistical approximations are dangerous when dealing with financial data. Each invoice is therefore converted into precise metadata (e.g. amount, supplier) via a JSON schema. Upon a query, the system first filters the database deterministically before the mathematical similarity search operates on this exact subset – this rules out incorrect results.  

The optimised enterprise tech stack

To implement these pipelines in practice (as already done for the AI search at KW Voerde or Solarize’s Slack bot), we rely on a coordinated ecosystem:
tools such as Kreuzberg-PDF, Tesseract and PaddleOCR are used for precise parsing. ChromaDB serves as the vector database, whilst orchestration is managed via LangChain and LangGraph. A two-stage post-retrieval process – consisting of an RRF algorithm and deep cross-encoder reranking (e.g. via Jina or IONOS Qwen3-VL) – filters out mathematical noise, ensuring that only the top five documents end up in the AI’s context window.  

Conclusion 

Anyone wishing to transform historical PDF collections into mathematically precise and auditable knowledge networks must firmly embed layout awareness and hybrid filtering methods within their software architecture. 

Download white paper