[BUG] Brute-force kNN can return nonzero distances for identical vectors
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cpp, github
调研方向
Read PR #2841 and the existing brute-force kNN tests, including the Go test whose tolerance was adjusted there. Reproduce the float32 self-distance behavior with copied and sliced datasets, then trace the brute-force distance calculation and the existing pairwise-distance diagonal correction. Done means identical finite vectors return zero distance while distinct nearby vectors retain correct nonzero distances; add coverage for the reported input forms and metrics.
由索引模型根据 Issue 内容生成。
描述
#2841 removed a rule that forced small distances to zero when two vectors had equal squared lengths. This addressed a real problem: distinct nearby vectors could incorrectly receive zero distance, affecting neighbor ordering and clustering.
As discussed in the PR, removing that rule also exposes underlying rounding errors when comparing a vector with itself. Negative errors are still clamped to zero, while positive errors remain. Taking the square root makes these errors more visible with the Euclidean metric. The PR documents this tradeoff and adjusts the Go brute-force test tolerance accordingly.
Observed behavior :
In a float32 test with 800 vectors of 32 dimensions, searching an independently allocated copy of the dataset returned nonzero self-distances for 256 vectors:
- Maximum squared Euclidean self-distance: approximately 0.000732.
- Maximum Euclidean self-distance: approximately 0.0271.
This occurred with both k=8 and k=65. The correct self-neighbor IDs were returned. Similar behavior occurs with dataset slices, column-major inputs, and filtered searches.
Expected behavior :
Identical finite vectors should have zero distance, including when queries are copies or slices of the dataset.
Could we preserve this behavior while retaining the improvements from #2841? This would complement the diagonal correction already added for certain pairwise-distance calls, extending support to brute-force kNN.
- 主要语言
- Cuda
- 星标
- 902
- 派生
- 267
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 57
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuvs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
[BUG] CAGRA multi-CTA and multi-kernel search over-allocate the hashmap they use可能已有人在做 @mc8max 于 12 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
[BUG] cuVS Bench Faiss CAGRA b_ratio reads the wrong JSON key可能已有人在做 @arcusbuilds 于 55 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
doc
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Upgrade faiss to v1.16.0可能已有人在做 @aamijar 于 8 天前认领。 未关闭faiss improvement
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
supersonic-lumina/ENM156#50 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
tenstorrent/tt-metal#67322 ·
维护者通常 1 天内回复
-
`mm_fp4(backend="cute-dsl")` on SM107 gives wrong output: `alpha` is rounded to the output dtype before the FP32 epilogue可能已有人在做 @shotsan 今天认领。 未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 62/100
flashinfer-ai/flashinfer#10041 ·
维护者通常 1 天内回复
-
[BUG] Stats API always returns model-level stats, ignoring target_stat_levels and stat filters可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭untriaged
难度 2/5 1-3 小时 新手友好度 72/100
opensearch-project/ml-commons#5293 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] sapo_loss_fn gives a NaN gradient when a masked token's log ratio overflows exp可能已有人在做 @shashank11yadav 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
areal-project/AReaL#2007 ·
维护者通常 1 天内回复