CRINN:基於對比強化學習的近似最近鄰搜索
CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search
August 4, 2025
作者: Xiaoya Li, Xiaofei Sun, Albert Wang, Chris Shum, Jiwei Li
cs.AI
摘要
近似最近鄰搜索(ANNS)算法在近期的AI應用中變得日益關鍵,特別是在檢索增強生成(RAG)和基於代理的大型語言模型(LLM)應用中。本文介紹了CRINN,一種新的ANNS算法範式。CRINN將ANNS優化視為一個強化學習問題,其中執行速度作為獎勵信號。這種方法能夠在保持精度約束的同時,自動生成逐步更快的ANNS實現。我們的實驗評估展示了CRINN在六個廣泛使用的NNS基準數據集上的有效性。與最先進的開源ANNS算法相比,CRINN在其中三個數據集(GIST-960-Euclidean、MNIST-784-Euclidean和GloVe-25-angular)上取得了最佳性能,並在其中兩個數據集(SIFT-128-Euclidean和GloVe-25-angular)上並列第一。CRINN的成功意義遠超ANNS優化:它驗證了增強強化學習的LLM可以作為自動化複雜算法優化的有效工具,這些優化需要專業知識和勞動密集的手動精煉。代碼可在https://github.com/deepreinforce-ai/CRINN找到。
English
Approximate nearest-neighbor search (ANNS) algorithms have become
increasingly critical for recent AI applications, particularly in
retrieval-augmented generation (RAG) and agent-based LLM applications. In this
paper, we present CRINN, a new paradigm for ANNS algorithms. CRINN treats ANNS
optimization as a reinforcement learning problem where execution speed serves
as the reward signal. This approach enables the automatic generation of
progressively faster ANNS implementations while maintaining accuracy
constraints. Our experimental evaluation demonstrates CRINN's effectiveness
across six widely-used NNS benchmark datasets. When compared against
state-of-the-art open-source ANNS algorithms, CRINN achieves best performance
on three of them (GIST-960-Euclidean, MNIST-784-Euclidean, and
GloVe-25-angular), and tied for first place on two of them (SIFT-128-Euclidean
and GloVe-25-angular). The implications of CRINN's success reach well beyond
ANNS optimization: It validates that LLMs augmented with reinforcement learning
can function as an effective tool for automating sophisticated algorithmic
optimizations that demand specialized knowledge and labor-intensive manual
refinement.Code can be found at https://github.com/deepreinforce-ai/CRINN