arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.29517cs.IR
收藏

FLASH-MAXSIM: 面向IO感知的融合内核用于晚期交互评分

FLASH-MAXSIM: IO-Aware Fused Kernels for Late-Interaction Retrieval

IBM Research Israel(IBM 以色列研究院)

Roi Pony, Daniel Ezer, Adi Raz Goldfarb, Idan Friedman, Oshri Naparstek, Udi Barzelay

AI总结:

提出Flash-MaxSim,一种IO感知的融合GPU内核,通过流式分块和片上SRAM折叠行最大规约,避免物化完整相似度张量,显著降低内存占用并加速晚期交互检索(如ColBERT、ColPali)的MaxSim评分。

摘要:

晚期交互检索(ColBERT, ColPali)使用MaxSim算子对查询和文档进行评分:对于每个查询词元,取与文档词元的最大相似度,然后对所有查询词元求和。标准实现会在GPU内存中物化完整的查询词元×文档词元相似度张量;对于视觉ColPali处理10K文档,仅该张量在FP16下就占用21 GB,创建后仅为了减少为每个文档一个分数然后丢弃。这会耗尽40 GB GPU,并限制了推理和训练中可实现的批大小。我们提出Flash-MaxSim,一种IO感知的融合GPU内核,通过将查询和文档分块流式传输到片上SRAM,并在同一遍中折叠行最大规约,从而在不物化张量的情况下精确计算相同的分数。我们将IO感知原理扩展到训练反向传播:一种逆网格CSR构造,重用前向argmax实现无原子操作、目标拥有的梯度规约;以及INT8×INT8量化和可变长度(无填充)评分。在A100上,Flash-MaxSim比同等精度的朴素PyTorch快3.9倍(H100上快4.7倍),推理内存减少16倍,训练内存减少约28倍,解锁了PyTorch完全无法处理的语料库和批大小,并保持了精确的排序(与FP32参考的top-20一致性为100%)。

英文摘要:

Late-interaction retrieval (ColBERT, ColPali) scores a query against a document via the MaxSim operator. The standard PyTorch implementation materialises the full query-token $\times$ document-token similarity tensor only to reduce it away. At ColPali scale this is the single largest tensor in the pipeline (e.g. 21 GB in FP16 for 10K documents) and limits both candidate set size at inference and batch size during contrastive training. We present FLASH-MAXSIM (FM), an IO-aware fused GPU kernel that computes the same MaxSim scores without ever materialising the tensor, and extends the same principle to the training backward. At ColPali scale on A100, FM reduces inference peak memory by 1.4-2.6$\times$ relative to the deployed chunked baseline (4.9-8.9$\times$ relative to unchunked eager execution) and reduces MaxSim-operator training memory by two orders of magnitude, enabling exact reranking over larger resident candidate pools and contrastive batch sizes that vanilla autograd cannot fit on a single GPU. The kernel is a drop-in replacement, exact up to floating-point evaluation order under its stated FP32-accumulation protocol: nDCG@10 differs from the FP32 reference by at most $5\times10^{-4}$ on BEIR and REAL-MM-RAG. A separate INT8 path trades exactness for halved index storage at high fidelity. Code, benchmark scripts, and raw results: https://github.com/roipony/flash-maxsim

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑