---
title: "本地知识库里的中文扫描件怎么处理：大家常跳过的部分"
url: https://memory.wiki/AhRlvNUC
updated: 2026-12-03T21:53:14.959Z
source: "memory.wiki"
---
# 本地知识库里的中文扫描件怎么处理：大家常跳过的部分

## 为什么「本地知识库里的中文扫描件怎么处理」对本地 RAG 很重要

OCR 质量参差不齐，先抽查部分页面并修好流程，再全部入库。检索增强生成通常是团队基于本地模型做的第一个正经项目，因为文档留在内网，也不用微调。它同样是小设计决定大信任的地方。

## 先做好入库

垃圾输入会产出自信的错误答案。在考虑嵌入模型之前：

- 保留结构：PDF 或 Office 文件转换后，标题、表格和列表要还在。
- 每个分块都带元数据：来源文件、章节、版本和文档日期。
- 没有负责人或没有日期的文档拒收，过期政策是负债。
- 保留原始文件，分块器改进后可以重新入库。

## 分块与检索

先用中等分块大小加一定重叠，再用你自己的问题评测，而不是照搬博客参数。中文需要按句子切分的分块器，不能套用英文的空格规则。纯向量检索会漏掉零件号、合同编号、SKU 这类精确标识，所以要在向量库旁边保留关键词索引并合并结果。政策随时间变化时，检索要偏向最新的有效版本。

## 可重复的评测

整理一组真实问题，附上标准答案和应当支撑答案的文档。每次修改分块、嵌入模型或提示词后都跑一遍，同时看答案和检索到的段落。如果正确段落没有被检索出来，提示词再怎么改也没用。

## 运维

- 备份向量库，并实际演练一次恢复。
- 按部门或客户拆分集合，方便执行权限规则。
- 记录每个回答引用了哪些来源。
- 明确助手必须拒答的内容，并公布出来。

## 一个实际例子

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

相关资料可参考[本地 RAG 知识库教程](https://microaione.com/tutorials/local-rag-knowledge-base/)，另见[本地 AI 教程中心](https://microaione.com/tutorials/)。


## 速记要点

- 商用前先读模型许可证。
- 所有运行时共用一个模型目录。
- 每次请求都记录模型名称和版本。
- 驱动和运行时版本一起固定。

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

---

## Summary
构建高质量本地知识库的关键在于确保入库数据的结构完整性与元数据准确性，并优先通过关键词索引和针对性的分块策略优化检索效果。只有在检索结果稳定可靠的前提下，后续的提示词调整与模型优化才能真正发挥作用。

## Themes
- Local RAG optimization
- OCR data quality
- Document indexing strategies
- Retrieval evaluation methods

## Key takeaways
- OCR quality must be verified through sampling before full-scale ingestion into a knowledge base.
- Metadata including source, chapter, version, and date is essential for effective retrieval and filtering.
- Keyword indexing should be combined with vector search to ensure accurate retrieval of precise identifiers.
- Retrieval systems must prioritize the latest document versions to avoid providing outdated information.
- Evaluation must verify that the correct source document is retrieved before attempting to optimize the LLM prompt.

## Insights
- The quality of the RAG output is primarily constrained by input data integrity rather than the embedding model itself.
- Pure vector search is insufficient for technical documents containing specific identifiers like SKU or part numbers.
- Systematic evaluation requires a fixed set of test questions paired with ground truth documents to isolate the impact of pipeline changes.

## Open questions / gaps
- What specific tools or libraries are recommended for implementing the hybrid vector and keyword indexing mentioned?

