[BUG] Binary quantizer sampling_median thresholds are wrong when trained on device data
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 88/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu từ overload train() trên thiết bị trong cpp/src/preprocessing/quantize/detail/binary.cuh:240-246 và theo dõi cách mẫu chuyển vị đã sắp xếp được dùng để chọn từng trung vị. Thêm một kiểm thử hồi quy so sánh các ngưỡng sampling_median được huấn luyện trên thiết bị và trên host, với dữ liệu có độ lệch cột khác nhau. Các ngưỡng cần khớp nhau, với 5000 bit được đặt cho mỗi chiều đối với mẫu 10001 hàng đã mô tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The binary quantizer's sampling_median threshold is wrong when it is trained on a device dataset. In the device train() overload (cpp/src/preprocessing/quantize/detail/binary.cuh:240-246 on main 2450691e), the sampled rows are transposed into transposed_sampled_dataset_chunk and each row of that buffer is sorted, but raft::copy_matrix then reads the medians from sampled_dataset_chunk, the unsorted and untransposed buffer:
raft::copy_matrix(threshold_ptr + dim_offset,
size_t(1),
sampled_dataset_chunk.data_handle() + (num_samples - 1) / 2, // should be transposed_sampled_dataset_chunk
num_samples, ...
So the threshold for dimension j is an arbitrary sampled value, usually from a different column. Nothing fails, the thresholds are just wrong. The host train() overload takes the median from the sorted column and is correct. mean (the default) and the zero threshold are not affected. The existing test compares GPU and CPU transforms using the same quantizer, so it does not check the thresholds.
Steps/Code to reproduce bug
Through the C API: 10001 rows and 12 dimensions, where column j is 1000*j + 0.05*perm_j for a random permutation perm_j of 0..10000. Train one quantizer with threshold = SAMPLING_MEDIAN and sampling_ratio = 1.0 on a device copy of the data and one on the host copy, transform the same data with each, and count the set bits per dimension. With sampling_ratio = 1.0 the sample is all rows, so the median of each column is its exact median and exactly 5000 of 10001 bits should be set in every dimension.
Output on a GH200 with the libcuvs-cu13 26.08.1 wheel:
dim | bits set: device-trained / host-trained (expect 5000 / 5000)
0 | 0 / 5000
1 | 5632 / 5000
2 | 0 / 5000
3 | 0 / 5000
4 | 451 / 5000
5 | 0 / 5000
6 | 10001 / 5000
7 | 1453 / 5000
8 | 10001 / 5000
9 | 10001 / 5000
10 | 2113 / 5000
11 | 10001 / 5000
All 12 device-trained thresholds are wrong; all host-trained ones are right.
Expected behavior
Device-trained and host-trained sampling_median thresholds agree. The fix is to read from transposed_sampled_dataset_chunk in that copy_matrix call. A regression test could train both ways on data with a different offset per column and compare the thresholds. I can open a PR with the fix and that test.
Environment details (please complete the following information):
- Environment location: Bare-metal, GH200 (aarch64), driver 595.58.03
- Method of cuVS install: pip wheel (
libcuvs-cu1326.08.1), C API
Additional context
The code has read from sampled_dataset_chunk since sampling_median was added in #716.
- Ngôn ngữ chính
- Cuda
- Star
- 902
- Fork
- 267
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 57
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/cuvs
-
[BUG] CAGRA multi-CTA and multi-kernel search over-allocate the hashmap they useCó thể đã có người làm @mc8max đã nhận 12 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NVIDIA/cuvs#2856 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] cuVS Bench Faiss CAGRA b_ratio reads the wrong JSON keyCó thể đã có người làm @arcusbuilds đã nhận 55 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
doc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Upgrade faiss to v1.16.0Có thể đã có người làm @aamijar đã nhận 8 ngày trước. Đang mởfaiss improvement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Specifically suppress IsEnoughWorkspace, instead of all MIopen warnings in denoiser/config.pyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
supersonic-lumina/ENM156#50 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tenstorrent/tt-metal#67322 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`mm_fp4(backend="cute-dsl")` on SM107 gives wrong output: `alpha` is rounded to the output dtype before the FP32 epilogueCó thể đã có người làm @shotsan đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
flashinfer-ai/flashinfer#10041 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Stats API always returns model-level stats, ignoring target_stat_levels and stat filtersCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
opensearch-project/ml-commons#5293 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] sapo_loss_fn gives a NaN gradient when a masked token's log ratio overflows expCó thể đã có người làm @shashank11yadav đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
areal-project/AReaL#2007 ·
Maintainer thường phản hồi trong vòng 1 ngày