CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search

2508.02091v1 cs.LG, cs.AI, cs.CL, cs.DB 2025-08-09
Авторы:

Xiaoya Li, Xiaofei Sun, Albert Wang, Chris Shum, Jiwei Li

Резюме на русском

Статья предлагает CRINN (Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search) — новую подходящую для распределительных систем, таких как Retrieval-Augmented Generation (RAG) и Agent-Based Large Language Models (LLM), алгоритм для решения задачи оптимизации Approximate Nearest Neighbor Search (ANNS). Авторы относят ANNS к задачам об ускорении работы, трактуя её как задачу обучения с подкреплением (RL), где скорость выполнения является сигналом вознаграждения. Таким образом, CRINN автоматически генерирует ANNS-решения, обеспечивая быстродействие и сохраняя точность. Экспериментальные результаты показали, что CRINN превосходит существующие решения на трёх из шести бенчмарков данных, сравнявшись с ними на двух. Это доказывает, что LLMs, оснащённые RL, могут эффективно автоматизировать алгоритмическую оптимизацию, требующую специализированных знаний и трудоёмких работ. Доступен код на GitHub: https://github.com/deepreinforce-ai/CRINN.

Abstract

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

Ссылки и действия