S6-14 · 进阶 · 3D S6-14 · Advanced · 3D

稠密检索 · 查询向量走进语义邻域 Dense Retrieval · Move the Query Through Semantic Space

embed(query) → nearest vectors → ranked candidates

稠密检索(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?

02 3D 嵌入邻域:移动查询,实时重排 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 distances dist(q⃗,d⃗i)
重排 Top-3 Rerank 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.