---
title: "RAG 之前先做本地 OCR：清理扫描件：本周工作台笔记"
url: https://memory.wiki/epcvaba4
updated: 2026-12-05T21:53:32.427Z
source: "memory.wiki"
---
# RAG 之前先做本地 OCR：清理扫描件：本周工作台笔记

## 怎么理解「RAG 之前先做本地 OCR：清理扫描件」

扫描质量差，回答就差；整批入库前先抽样检查 OCR 结果。本地知识库的失败方式很可预测：过期文档排在最新文档前面，表格被压成一团乱码，精确编码因为嵌入的模糊化永远匹配不上。每种失败都有简单而朴素的解决办法。

## 修文档

每个集合指定负责人。文档日期和版本设为必填字段。表格转成结构化文本，或者作为独立记录保存，不要让段落分块器把它拦腰切断。去掉重复内容，免得同一段话霸占检索结果。

## 修检索

使用混合检索：关键词负责编号和罕见词，向量负责语义。排序前先按元数据过滤，例如部门、产品线或有效日期。返回少量段落并附上来源，让用户可以自己核对。

## 修预期

助手应该做摘要并指向来源，而不是发明政策。公布一份简短的“不做清单”：法律解释、医疗建议、薪酬决定。每个回答都显示来源文档名称和日期，并让用户能方便地报告错误。

## 两周试点

1. 选一个团队、一个文档集合。
2. 写三十个真实问题并标注预期来源。
3. 运行试点，收集反馈，优先修入库问题。
4. 之后再扩展到更多集合或用户。

## 一个实际例子

一家小型制造企业希望工程师能查询内部技术规范。第一版只用向量检索，经常返回错误版本的文档。团队把文档日期和版本号加进元数据，排序前过滤掉已被替代的版本，并为零件号保留关键词索引。他们还改写了分块方式，把表格单独存成记录。改完后用同一批评测问题重跑，检查正确来源是否出现在检索结果中。直到检索稳定，他们才开始花时间调整回答提示词。

延伸阅读：[MicroAI One 软件](https://microaione.com/microai-one/)，以及[本地 RAG 知识库教程](https://microaione.com/tutorials/local-rag-knowledge-base/)。


## 速记要点

- 先限并发，再考虑降量化。
- 公布助手会拒绝做的事。
- 商用前先读模型许可证。
- 新模型通过评测前保留旧文件。

*作者：[本地AI 1号网](https://microaione.com/)，深圳团队，专注本地大模型软硬件、装机与私有化部署。*

---

## Summary
提高RAG系统准确性的关键在于优化数据质量，包括通过本地OCR清理扫描件、结构化处理表格以及利用元数据过滤过期文档。在正式部署前，应通过小规模试点验证检索效果，并明确AI的职责范围以确保输出可靠。

## Themes
- RAG optimization strategy
- Document preprocessing workflows
- Retrieval system design
- Local knowledge base management

## Key takeaways
- Perform local OCR and sampling checks on scanned documents before ingestion into a RAG system.
- Use hybrid retrieval combining keyword search for specific identifiers and vector search for semantic meaning.
- Implement metadata filtering based on document dates and versions to ensure users access the latest information.
- Define a clear list of tasks the AI assistant is prohibited from performing to manage user expectations.
- Validate retrieval stability using a set of real questions and expected sources before adjusting prompt engineering.

## Insights
- The quality of RAG output is fundamentally constrained by the quality of the initial OCR and document structure.
- Retrieval performance is often improved more by metadata filtering and data cleaning than by prompt engineering.
- Separating tables from text blocks prevents fragmentation and improves semantic search accuracy.

## Open questions / gaps
- What specific technical criteria define a successful OCR result during the sampling phase?
- How should organizations balance the overhead of manual data cleaning against the benefits of improved retrieval accuracy?

