Lab protocol search page from old PDFs
Old PDFs and changing headers keep breaking ranking, and I only have 12GB RAM on the workstation.
I’m building a lab protocol search page from old PDFs, and the documents are a mess. The headers change every year, some scans are crooked, and the model keeps ranking the wrong reagent concentration unless I manually tag each section first.
I spent most of last weekend trying to chunk by page layout instead of raw text. That helped a bit, but the protocol titles often repeat across different years, so the search results still look plausible while being wrong. The worst case is when a 0.1 M buffer gets ranked above the 1 M version because the concentration note is buried in a footer.
Memory is the hard limit here: I only have 12GB RAM on the workstation, so I can’t load a big model and a full PDF index at the same time. I’ve been swapping between smaller embeddings and a lighter reranker, but I keep hitting slowdowns when the index grows past a few hundred files.
I also tried manual tags for section boundaries, and they do improve ranking, but it’s tedious. One old protocol from 2017 has two different header formats in the same file, which throws off both the parser and my sanity. I haven’t found a clean way to generalize that yet.
What surprised me is that the search problem is less about chemistry terms and more about document archaeology. Next I’d probably invest earlier in section normalization, but I still don’t know whether to spend memory on better parsing or on a better reranker.
9 replies
Are you extracting section headers before embedding, or after search?
Before embedding, but only after a rough parse. That’s where the 2017 files break things.
With 12GB RAM, a two-stage pipeline is safer: lightweight section detection first, then rerank only the top 20 results.
The changing headers are the real pain. We ended up keeping a year-by-year mapping table for one archive.
Manual tagging every section may scale badly. If the PDFs are that inconsistent, search quality will plateau no matter what model you use.
我会把 2017 那批单独做一个“低信任”索引,搜出来先打低权重,别让它们硬插到前面。
cropped scan 这块别硬上 OCR 全量重跑,先做版面矫正再分块,省很多内存。12GB 下我会把图像处理和向量化拆成两个进程。
你现在的错排主要发生在同义 reagent 还是数字浓度上?
如果人工 tag 只覆盖少数老 PDF,后面新来的扫描件还是会继续漂,建议先量化一下 top1 命中率。