# CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search

DevFeed: [CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search](<https://devfeed.tech/articles/crinn-contrastive-reinforcement-learning-for-approximate-nearest-neighbor-search-131847.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2508.02091>)

Author: Xiaoya Li, Albert Wang, Guoyin Wang, Chris Shum, Jiwei Li

Published: 2026-11-13T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Databases](<https://devfeed.tech/sources/arxiv-databases.md>), [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [ann](<https://devfeed.tech/topics/ann.md>), [Reinforcement learning](<https://devfeed.tech/topics/reinforcement-learning.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [approximate-nearest-neighbor-search](<https://devfeed.tech/tags/approximate-nearest-neighbor-search.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-cl](<https://devfeed.tech/tags/cs-cl.md>), [cs-db](<https://devfeed.tech/tags/cs-db.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [datasets](<https://devfeed.tech/tags/datasets.md>), [llms](<https://devfeed.tech/tags/llms.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [reinforcement-learning](<https://devfeed.tech/tags/reinforcement-learning.md>), [retrieval-augmented-generation-rag](<https://devfeed.tech/tags/retrieval-augmented-generation-rag.md>), [search](<https://devfeed.tech/tags/search.md>), [speed](<https://devfeed.tech/tags/speed.md>)

## AI overview

CRINN treats approximate nearest-neighbor search optimization as reinforcement learning, using execution speed as the reward while maintaining accuracy constraints. Across six widely used NNS benchmark datasets, it reportedly achieves the best performance on GIST-960-Euclidean and MNIST-784-Euclidean, and ties for first on SIFT-128-Euclidean and GloVe-25-angular. The abstract presents this as evidence that reinforcement-learning-augmented LLMs can automate specialized algorithm optimization that otherwise requires labor-intensive manual refinement. These are abstract-level claims; the supplied text does not describe the implementation or evaluation details.

## Source excerpt

arXiv:2508.02091v5 Announce Type: replace-cross 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/ornith-ai/CRINN