稠密检索(Dense Retrieval)把查询和文档映射为向量,再按向量相似度召回候选。它能让不同措辞在嵌入空间靠近,但“靠近”不是精确词项匹配。Dense retrieval maps queries and documents to vectors, then recalls candidates by vector similarity. Different wording can land nearby in embedding space, but proximity is not exact-term matching.
01 · 没写同一个词,也能找到01 · Different words, nearby meaning
查询写“多久能退”,文档写“退货期限”,没有同词匹配,为什么它仍可能排第一?The query says “how long can I send it back,” while the document says “return window.” Why can it still rank first?
q⃗≈d⃗
023D 嵌入邻域:移动查询,实时重排3D Embedding Neighborhood: Move the Query, Rerank Live
查询向量query vector
最近文档Nearest document
D1
退货期限return window
距离Distance
0.00
‖q⃗ − d⃗‖
邻域变化Rank changes
0
自上次移动since last move
正在装载本地 3D 场景…若持续显示,需要 WebGL / three.js 未加载。Loading the local 3D scene… If this remains visible, WebGL is required or three.js did not load.
q⃗
#1
拖拽旋转 · 滚轮缩放 · 停手后缓转drag to orbit · wheel to zoom · idle auto-rotate
03稠密检索的四个零件Four Parts of Dense Retrieval
编码 · 距离 · 排名encode · distance · rank
QUERY
查询变成向量Encode the query
把“多久能退”映射为三维教学向量 q⃗。Map “how long can I return it” into the teaching vector q⃗.
DOCUMENTS
文档预先入空间Place documents in space
每个文档块也有向量 d⃗,近义表述可能聚在一起。Every document chunk has a vector d⃗; paraphrases can cluster together.
DISTANCE
距离衡量相近Distance measures proximity
本页用欧氏距离演示;真实系统常用点积或余弦相似度。This lesson uses Euclidean distance; real systems often use dot product or cosine similarity.
TOP-K
最近邻形成候选Nearest neighbors become candidates
距离从小到大排序,前 k 个进入后续筛选或重排。Sort by increasing distance and pass the first k candidates downstream.
04最小机制:查询移动会改写每个距离Minimal Mechanism: Moving the Query Rewrites Every Distance
rank = sort(distance)
dist(q⃗,d⃗i) = √Σ(qj − dij)2
拖动 q⃗ 的任一分量,所有 dist 都会重算;最近邻不是固定标签,而是当前位置产生的排序。Changing any component of q⃗ recomputes every distance. A nearest neighbor is not a permanent label; it is the ranking produced at the current position.
移动 q⃗Move q⃗查询语义位置改变query position changes
重算距离Recompute distancesdist(q⃗,d⃗i)
重排 Top-3Rerank Top 3颜色、连线、卡片同步color, lines, cards update
05边界实验:精确编号不等于语义近邻Boundary Test: An Exact Identifier Is Not Semantic Proximity
主动制造失败Create a failure
查询“ZX-42 故障码”Query “ZX-42 fault code”
把查询移到“故障排查”语义簇。语义相近文档会靠前,但含精确编号 ZX-42 的手册可能仍在后面;这正是稀疏检索能补足的地方。Move the query into the troubleshooting cluster. Semantically related documents rise, while the manual containing the exact identifier ZX-42 may remain lower. Sparse retrieval can fill that gap.
尚未执行。当前近义“退货期限”位于最近邻。Not run yet. The paraphrase “return window” is currently nearest.
✗ 稠密检索就是关键词包含。Dense retrieval is keyword containment. → ✓ 它比较查询与文档向量的相似度。It compares query and document vectors.
✗ 向量最近就一定事实正确。The nearest vector must be factually correct. → ✓ 相近只代表表示接近,仍需筛选与重排。Proximity means representation similarity; filtering and reranking still matter.
✗ 编号、专名也必然靠语义命中。Identifiers and names are guaranteed semantic hits. → ✓ 精确词项常需要稀疏检索补足。Exact terms often need sparse retrieval support.
06 · 一句话带走06 · One line to keep
稠密检索把查询与文档放进同一向量空间,并按当前位置的相似度召回最近邻;它擅长近义表达,却不保证精确词项或事实正确。Dense retrieval places queries and documents in one vector space and recalls neighbors by current similarity; it handles paraphrases well but does not guarantee exact terms or factual correctness.