r/Rag • u/PaceZealousideal6091 • 10h ago
Tools & Resources In RAG, what goes in determines what comes out. Prajnya: a local ingestion engine for scientific PDFs
I'm a researcher with background in Developmental biology, biochemistry and biophysics. I kept finding that retrieval failures started at ingestion: figures dissolved into prose, tables flattened, captions merged with body text, reference lists polluting search. So I built the ingestion layer first. I am now building the RAG part and after having dealt with many issues, I feel a bit confident in sharing this project with you all. Prajnya is open source (Apache-2.0) and fully offline by default.
How it works
- A CPU pre-pass classifies each document (paper, book or chapter) and every page.
- Plain prose comes straight from the PDF's text layer. Scans and visually complex pages go to a local vision model.
- A layout model finds figures and tables, and each is cut out and handled as its own object.
- Everything lands in one JSON per document, with a documented schema.
What you get, and why it matters for retrieval
- Evidence objects, not chunks. Figures are cropped and captioned with stable IDs, and panels are grouped under the label a reader cites ("Fig. 3"). Tables carry a reconstructed grid, so numbers are searchable while the image stays available to a multimodal model. Tables that run onto the next page keep their headers.
- Provenance. Every item records its page and how it was read (text layer, model read or repaired read), because those differ in reliability.
- Citations linked conservatively. In-text citations, numbered and author-year, link to the reference list. A wrong link is worse than none, so ambiguous ones stay unlinked.
- Metadata verified, not believed. The model's reading of the title page, the PDF text and an optional authority (Zotero, or Crossref/OpenAlex sent only the DOI or title) are reconciled, with the source of each value recorded.
What it doesn't do (yet)
- No chunking, embedding or retrieval. Thatās the next layer, Shastrasaara (in development), which builds on these evidence objects.
- PDFs only. No DOCX, HTML or slides.
- It isnāt one-click. Local mode needs llama.cpp and the model weights. Cloud models are optional, per role.
- It doesnāt race to be the fastest. It aims for the most faithful data, and would rather take longer than hand you a wrong table, caption or citation.
How it compares
- NotebookLM: for public papers and quick cited Q&A, use it. But your PDFs leave your machine, and you get a chat, not structured data you can index your own way.
- GROBID: the standard for metadata and references, fast on CPU. Its weak spot is pages where figures and tables break the reading order. Prajnya is built around those pages.
- Docling, Marker and MinerU: solid general converters. Prajnya is narrower and specific to scientific documents, aimed at what a literature RAG needs to cite and trace.
Repo: Prajnya-Academic-PDF-Processor
Question for this sub: how do you index figures and tables in scientific RAG? Captions, images, both, or one-hop expansion from the text that cites them?