
Many developers have encountered this exact scenario: You spend weeks building a RAG (Retrieval-Augmented Generation) system or hooking up an Agent to your company’s internal knowledge base, and it looks pretty good during testing. But once you throw in complex, real-world documents — like a 100-page product specification, a financial annual report with deeply nested tables, or a technical whitepaper mixing images, tables, and references — the AI starts hallucinating. It might incorrectly attribute data from Chapter 3 to Chapter 5, creatively “imagine” numbers in a table, or even fabricate conclusions out of thin air for critical information.
These “AI hallucinations” are particularly fatal in scenarios requiring strict information traceability. For financial analysis, the model might swap one quarter’s revenue with another; for legal contract review, it might completely invert the applicable conditions of a clause; for academic research, it might even “invent” non-existent citations for a paper.
What’s even more frustrating is that these errors are inconsistent — sometimes right, sometimes wrong, completely random, and impossible to prevent. You repeatedly tweak Prompts, swap out Embedding models, and try various chunking strategies, but the performance remains unstable. The root of the problem might not be the model itself at all, but rather that the document information handed to the AI was utterly shattered from the very beginning.

The Massive Bug Hidden in Traditional RAG
Before generating answers, today’s Large Language Models (LLMs) often use RAG to retrieve relevant information from extensive document databases to guide the generation process. You can think of RAG as a prep cook, specifically serving the LLM, the “head chef.”
The problem is that most RAG systems process documents in a highly “brute-force” manner: They extract PDFs, Word documents, or web pages into plain text, and then slice the text into chunks using a fixed window size (e.g., 500 tokens). During this process, heading hierarchies are flattened, tables are chopped in half, and the connection between images and text is completely lost. Every chunk becomes an isolated island of information, stripped of context, structure, and attribution.
Using these fragmented pieces to augment AI retrieval is like tearing a book into slips of paper, shuffling them, and asking the AI to answer questions by looking at a few slips that match certain keywords. The AI only sees the few fragmented texts matched by the keywords right in front of it. It doesn’t know which chapter or section a paragraph belongs to, nor does it know which column of which table a string of numbers belongs to. To avoid saying “I don’t know,” it relies on the probabilistic nature of language models to “fill in the blanks,” and that’s exactly how hallucinations are born.
The AI Isn’t Dumb; It’s Just Taking the Blame for “Dirty Data”
This brings us to an open-source project I want to share today: Knowhere (GitHub: Ontos-ai/knowhere). Its mission is highly focused: processing your complex, real-world documents into structured memory that AI can actually understand, retrieve, and trace. It’s not just another document parsing tool, but rather a document memory infrastructure specifically designed for AI Agents and RAG systems.

What Can Knowhere Do?
Simply put, it can automatically transform unstructured documents like PDFs, Word files, PPTs, and Excel spreadsheets into a “knowledge map” complete with hierarchical directories, table positioning, image associations, and cross-document relationships. Consequently, AI can navigate this map to find information just like a human would, instead of fumbling blindly through fragments.
It can significantly improve the experience in the following scenarios:
- Enterprise Q&A or Knowledge Bases: Knowhere makes AI answers more accurate and traceable, allowing every conclusion to be mapped back to a specific location in the original text.
- Vertical-Specific Agent Applications (Finance, Legal, Medical): Knowhere preserves the structure of complex, multi-level tables and charts, ensuring critical data isn’t “chopped up.”
- Academic Literature or Technical Documentation Management: It can build association graphs across different documents, making cross-document reasoning much more reliable for Agents.
How Does Knowhere Stack Up Against Existing Parsers?
According to the project’s public benchmark data, using standard Agent Q&A tasks common in RAG setups as the test scenario, providing the Agent with raw documents or markdown/JSON files generated by some mainstream parsers yields a final answer accuracy of about 53%.
However, after processing the document memory with Knowhere, the accuracy jumped to 79%. Simultaneously, the Agent’s first-search accuracy improved by 36% compared to raw documents, and the recall rate increased by 10%. Moreover, because the Agent no longer wastes time performing ineffective searches across massive amounts of fragmented data, both token consumption and search times decreased significantly.

This proves that high-quality, structured input is far more effective than blindly scaling up model parameters.
How Does Knowhere Achieve This?
It all comes down to its core design. Instead of walking down the old path of “one-size-fits-all chunking,” it adopts a tree-structured memory-building approach capable of preserving document hierarchies. Its workflow can be broken down into three steps:

- Parsing: Knowhere integrates high-quality parsers to read formats like PDF, PPT, images, and tables to obtain a relatively clean initial text draft.
- Structuring: This is where Knowhere truly shines. It repairs structural damage that might have occurred during parsing and rebuilds the document’s heading tree — from H1s down to H2s and H3s. Every piece of text is precisely mounted onto its corresponding chapter path. Tables and images aren’t merely extracted as isolated attachments; they are tightly bound to their inline contextual text, ensuring the AI can see the complete relationship of “which paragraph this table belongs to.”
- Building Memory: After structuring, Knowhere doesn’t just toss this information into the RAG system as plain text. Instead, it constructs a lightweight memory graph comprising chapter trees, text chunks, summaries, image descriptions, and cross-document links. This graph is like equipping the AI with an e-book complete with a detailed table of contents, an index, and hyperlinks. During retrieval, the AI can navigate up, down, left, and right along the paths within the graph to precisely locate the most relevant evidence zones, rather than relying solely on vector similarity to make guesses.

Now Open Source: Try It Out
Ultimately, Knowhere isn’t trying to replace tools like MinerU, which focus on “turning documents into text.” Instead, it aims to build upon that foundation and bridge the final mile from “text” to “AI-usable memory.” The true value it provides is the synchronized repair, restructuring, and knowledge graph construction — the very missing links in other solutions currently on the market.
Finally, for those who want to get their hands dirty and try it out, Knowhere is now open source on GitHub at Ontos-ai/knowhere and supports one-click deployment via Docker.

Today, AI applications are evolving from “able to chat” to “able to work.” But the prerequisite for AI to actually work is that it can truly read and understand you. Knowhere isn’t some disruptive alien technology, but it solves a very tangible pain point in the implementation of RAG and Agents: transforming documents from human reading material into AI memory. If you’re also being tormented by AI hallucinations and poor retrieval results, perhaps it’s time to start by improving your document parsing.
Originally published on Medium.


