[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-85437-en":3,"doc-seo-85437-105":30,"detail-sidebar-cat-0-en-105":95},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":21,"is_downloadable":21,"audit_status":21,"page_count":22,"language":23,"language_code":24,"site_id":25,"html_lang":24,"table_of_contents":26,"faqs":27,"seo_title":13,"seo_description":14,"update_tm":28,"read_time":29},85437,687197100911,"Himbo","https://ap-avatar.wpscdn.com/avatar/a000239b6f1da00475?x-image-process=image/resize,m_fixed,w_180,h_180&k=1782698725881665579",8,"Research & Report","CRINN Contrastive Reinforcement Learning for Approximate Nearest Neighbor Search","Approximate nearest-neighbor search (ANNS) underpins modern AI retrieval, especially retrieval-augmented generation (RAG) and agent-based LLM applications that require fast access to large vector databases. This paper introduces CRINN, a reinforcement-learning reformulation of ANNS where execution speed becomes the reward signal. CRINN automatically generates progressively faster implementations while enforcing accuracy constraints, and evaluates effectiveness on six NNS benchmarks. Compared with leading open-source ANNS methods, CRINN achieves top results on multiple datasets and demonstrates RL-augmented LLMs can automate expert-level algorithm optimization.","arXiv :2508 .02091v3 [ cs .LG] 13 Jul 2026  \nQueries per second (1/s)  \nCRINN: Contrastive Reinforcement Learning for Approximate  \nNearest Neighbor Search  \nXiaoya Li, Albert Wang, Guoyin Wang, Chris Shum and Jiwei Li  \nDeepReinforce Team  \n [github.com/deepreinforce-ai/crinn](github.com/deepreinforce-ai/crinn)  \nAbstract  \nApproximate 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. B  \n  GLASS  NN-Descent  ParlayANN  PyNNDescent  Vearch  Voyager  CRINN   \n104  \n103  \n104  \n103  \n102  \n(a) sift-128-euclidean  \n(d) glove-100-angular  \n104  \n103  \n102  \n105  \n104  \n103  \n(b) gist-960-euclidean  \n(e) glove-25-angular  \n(c) mnist-784-euclidean  \n104  \n103  \n0.9 0.99 0.999 0.9999 1  \n(f) nytimes-256-angular  \n0.1 0.5 0.9 0.99 0.999  \nRecall  \nFigure 1: QPS versus recall curves for different models across six datasets. CRINN achieves achieves best-in-class performance on three out of them (GIST-960-Euclidean, MNIST-784-Euclidean, and GloVe-25-angular) and matching state-of-the-art resultson two (SIFT-128 and GloVe-25) .  \nB Email: {xiaoya_li, albert_wang, chris_shum, [jiwei_li}@deep-reinforce.com](jiwei_li}@deep-reinforce.com)  \n1 Introduction  \nApproximate nearest-neighbor search (ANNS) [20, 21, 6, 7, 19, 12, 5] aims at finding data points that are closest to a query point in high-dimensional spaces while trading off a small amount of accuracy for significant speedup over exact search methods. ANNS is of growing importance due to the unprecedented popularity of retrieval-augmented generation (RAG) [16, 10, 23] and agent-based LLM applications [25], which require fast retrieval of relevant information from massive vector databases. Existing widely-used open-source projects use fundamental algorithms such as Vamana [12] and HNSW [20] as the backbone: DiskANN and ParlayANN [21] build upon Vamana, while FAISS [6], Vespa1 , Weaviate2 , Qdrant3 , Milvus4 , and GLASS [29]5 leverage HNSW, proposing different levels of optimization to cater for various scenarios.  \nExisting optimizations for ANNS are mostly manual, where humans identify bottlenecks through profiling tools, analyze cache miss patterns, hand-tune parameters like graph degree and search beam width, carefully design data structures for memory locality, and iteratively experiment with different algorithmic variants based on hardware characteristics. This process requires deep expertise in computer architecture, parallel programming, and the mathematical properties of ANNS algorithms. With the increasing power of LLMs in code generation [9, 11], a natural question arises: can LLMs facilitate optimization by automatically generating and testing algorithmic improvements, learning from the execution speeds of previous implementations to propose better solutions, and discovering novel optimization patterns that human engineers might overlook?  \nIn this paper, we propose ","cbCaiglrrsk59O5n","https://ap.wps.com/l/cbCaiglrrsk59O5n","pdf",432411,4,1,13,"English","en",105,"# Abstract\n# Introduction\n# Background: HNSW","[{\"question\":\"What is CRINN and what problem does it target?\",\"answer\":\"CRINN is a new paradigm for approximate nearest-neighbor search (ANNS). It targets speeding up ANNS while keeping accuracy within constraints, which is important for fast retrieval in RAG and agent-based LLM systems.\"},{\"question\":\"How does CRINN use reinforcement learning for ANNS optimization?\",\"answer\":\"CRINN treats ANNS optimization as a reinforcement learning problem. Execution speed serves as the reward signal, so faster implementations receive higher rewards during iterative training and code generation.\"},{\"question\":\"How does CRINN perform compared with state-of-the-art open-source ANNS algorithms?\",\"answer\":\"CRINN is evaluated on six benchmark datasets and achieves best performance on three datasets (including GIST-960-Euclidean, MNIST-784-Euclidean, and GloVe-25-angular) and ties for first on two others (SIFT-128-Euclidean and GloVe-25-angular).\"},{\"question\":\"What broader implication does the paper claim beyond ANNS?\",\"answer\":\"The paper argues that RL-augmented LLMs can automate sophisticated algorithmic optimizations that normally require deep domain expertise and extensive manual tuning, helping maintain performance as hardware and application requirements evolve.\"}]",1784203512,33,{"code":4,"msg":31,"data":32},"ok",{"site_id":25,"language":24,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":90,"head_meta":92,"extra_data":94,"updated_unix":28},"crinn-contrastive-reinforcement-learning-for-approximate-nearest-neighbor-search","",{"@graph":36,"@context":89},[37,53,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":21},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/research-report/",3,{"item":52,"name":13,"@type":43,"position":20},"https://docshare.wps.com/document/crinn-contrastive-reinforcement-learning-for-approximate-nearest-neighbor-search/85437/",{"url":52,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":24,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":41,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-25","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81,85],{"name":72,"@type":73,"acceptedAnswer":74},"What is CRINN and what problem does it target?","Question",{"text":75,"@type":76},"CRINN is a new paradigm for approximate nearest-neighbor search (ANNS). It targets speeding up ANNS while keeping accuracy within constraints, which is important for fast retrieval in RAG and agent-based LLM systems.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does CRINN use reinforcement learning for ANNS optimization?",{"text":80,"@type":76},"CRINN treats ANNS optimization as a reinforcement learning problem. Execution speed serves as the reward signal, so faster implementations receive higher rewards during iterative training and code generation.",{"name":82,"@type":73,"acceptedAnswer":83},"How does CRINN perform compared with state-of-the-art open-source ANNS algorithms?",{"text":84,"@type":76},"CRINN is evaluated on six benchmark datasets and achieves best performance on three datasets (including GIST-960-Euclidean, MNIST-784-Euclidean, and GloVe-25-angular) and ties for first on two others (SIFT-128-Euclidean and GloVe-25-angular).",{"name":86,"@type":73,"acceptedAnswer":87},"What broader implication does the paper claim beyond ANNS?",{"text":88,"@type":76},"The paper argues that RL-augmented LLMs can automate sophisticated algorithmic optimizations that normally require deep domain expertise and extensive manual tuning, helping maintain performance as hardware and application requirements evolve.","https://schema.org",{"og:url":52,"og:type":91,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":93,"canonical":52},"index,follow",{"doc_id":7,"site_id":25},{"code":4,"msg":5,"data":96},[97,101,105,109,114,119,124,127,132,135,139],{"id":21,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Literature",80,"literature",{"id":20,"doc_module":4,"doc_module_name":46,"category_name":106,"show_sort_weight":107,"slug":108},"Exam",70,"exam",{"id":110,"doc_module":4,"doc_module_name":46,"category_name":111,"show_sort_weight":112,"slug":113},5,"Comic",60,"comic",{"id":115,"doc_module":4,"doc_module_name":46,"category_name":116,"show_sort_weight":117,"slug":118},6,"Technology",50,"technology",{"id":120,"doc_module":4,"doc_module_name":46,"category_name":121,"show_sort_weight":122,"slug":123},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":125,"slug":126},30,"research-report",{"id":128,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":130,"slug":131},9,"Religion & Spirituality",20,"religion-spirituality",{"id":130,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":130,"slug":134},"World Cup","world-cup",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":136,"slug":138},10,"Lifestyle","lifestyle",{"id":140,"doc_module":4,"doc_module_name":46,"category_name":141,"show_sort_weight":110,"slug":142},19,"General","general"]