Skip to content

deepreinforce-ai/CRINN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUDA-L1: Improving CUDA Optimization via Contrastive Reinforcement Learning

License     |     🏠  Project Page     |     📄  Paper

CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search

Introduction

This repo contains the code for CRINN, a reinforcement learning-augmented LLM framework for automated optimization of approximate nearest-neighbor search (ANNS) algorithms. CRINN achieves best-in-class performance on three out of six widely-used NNS benchmark datasets (GIST-960-Euclidean, MNIST-784-Euclidean, and GloVe-25-angular) and tied for first place on two (SIFT-128-Euclidean and GloVe-25-angular). The current version uses GLASS as the starting point for RL training.

Evaluation Results

🥳 News

Stay tuned!

  • [3 Aug, 2025] The repository is created and we release the first version.

To-do List

  • Add RL version based on ParlayANN
  • Incorporate both Euclidean and angular distances as RL training rewards

Key Optimization Discoveries

  • Adaptive Search Scaling: Dynamic ef parameter adjustment based on recall requirements
  • Multi-Level Prefetching: Intelligent prefetching considering neighbor density and search layer
  • Multi-Entry Point Architecture: Parallel exploration from diverse entry points
  • Convergence Detection: Smart early termination to avoid unnecessary exploration

Usage

Installation from Source

sudo apt-get update && sudo apt-get install -y build-essential git python3 python3-distutils python3-venv
pip3 install numpy
pip3 install pybind11
bash build.sh

Quick Start

python examples/main.py

Citation

@article{deepreinforce2025crinn,
  title={CRINN: Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search},
  author={Li, Xiaoya and Sun, Xiaofei and Wang, Albert and Chris, Shum and Li, Jiwei},
  journal={arXiv preprint arXiv:2508.02091},
  year={2025}
}

Acknowledgement

Contact

Feel free to raise github issues or directly reach out to us at research@deep-reinforce.com.

About

CRINN - Free & Fast Framework for Approximate Nearest Neighbors Search Via Contrastive Reinforcement Learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages