{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/adanns-a-framework-for-adaptive-semantic","title":"AdANNS: A Framework for Adaptive Semantic Search","arxiv_id":"2305.19435","date":"2023-05-30","proceeding":"NeurIPS 2023 11","authors":["Aniket Rege","Aditya Kusupati","Sharan Ranjit S","Alan Fan","Qingqing Cao","Sham Kakade","Prateek Jain","Ali Farhadi"],"abstract":"Web-scale search systems learn an encoder to embed a given query which is then hooked into an approximate nearest neighbor search (ANNS) pipeline to retrieve similar data points. To accurately capture tail queries and data points, learned representations typically are rigid, high-dimensional vectors that are generally used as-is in the entire ANNS pipeline and can lead to computationally expensive retrieval. In this paper, we argue that instead of rigid representations, different stages of ANNS can leverage adaptive representations of varying capacities to achieve significantly better accuracy-compute trade-offs, i.e., stages of ANNS that can get away with more approximate computation should use a lower-capacity representation of the same data point. To this end, we introduce AdANNS, a novel ANNS design framework that explicitly leverages the flexibility of Matryoshka Representations. We demonstrate state-of-the-art accuracy-compute trade-offs using novel AdANNS-based key ANNS building blocks like search data structures (AdANNS-IVF) and quantization (AdANNS-OPQ). For example on ImageNet retrieval, AdANNS-IVF is up to 1.5% more accurate than the rigid representations-based IVF at the same compute budget; and matches accuracy while being up to 90x faster in wall-clock time. For Natural Questions, 32-byte AdANNS-OPQ matches the accuracy of the 64-byte OPQ baseline constructed using rigid representations -- same accuracy at half the cost! We further show that the gains from AdANNS translate to modern-day composite ANNS indices that combine search structures and quantization. Finally, we demonstrate that AdANNS can enable inference-time adaptivity for compute-aware search on ANNS indices built non-adaptively on matryoshka representations. Code is open-sourced at https://github.com/RAIVNLab/AdANNS.","url_abs":"https://arxiv.org/abs/2305.19435v2","url_pdf":"https://arxiv.org/pdf/2305.19435v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"adanns-a-framework-for-adaptive-semantic","repo_url":"https://github.com/raivnlab/adanns","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"natural-questions","task_name":"Natural Questions"},{"task_slug":"quantization","task_name":"Quantization"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.19435","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.19435"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/RAIVNLab/AdANNS","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/raivnlab/adanns","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"unverified":5},"by_repo_kind":{"official":{"samples":6,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"6d4d4dcc43eb7a74","entry":"MRL_Linear_Layer","repo":"raivnlab/adanns","repo_kind":"official","path":"MRL.py","file_url":"https://github.com/raivnlab/adanns/blob/HEAD/MRL.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6d4d4dcc43eb7a74"}},{"code_sha256_prefix":"42855fe8dc821c2e","entry":"get_activation","repo":"RAIVNLab/AdANNS","repo_kind":"official","path":"utils.py","file_url":"https://github.com/RAIVNLab/AdANNS/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"42855fe8dc821c2e"}},{"code_sha256_prefix":"08f2259843ec19ec","entry":"get_ckpt","repo":"RAIVNLab/AdANNS","repo_kind":"official","path":"utils.py","file_url":"https://github.com/RAIVNLab/AdANNS/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"08f2259843ec19ec"}},{"code_sha256_prefix":"11a69b869864eb2e","entry":"load_embeddings","repo":"RAIVNLab/AdANNS","repo_kind":"official","path":"adanns/utils.py","file_url":"https://github.com/RAIVNLab/AdANNS/blob/HEAD/adanns/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"11a69b869864eb2e"}},{"code_sha256_prefix":"90e640a68fafb411","entry":"load_from_old_ckpt","repo":"RAIVNLab/AdANNS","repo_kind":"official","path":"utils.py","file_url":"https://github.com/RAIVNLab/AdANNS/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"90e640a68fafb411"}},{"code_sha256_prefix":"500c10080bc80827","entry":"normalize_embeddings","repo":"RAIVNLab/AdANNS","repo_kind":"official","path":"adanns/utils.py","file_url":"https://github.com/RAIVNLab/AdANNS/blob/HEAD/adanns/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"500c10080bc80827"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}