{"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/search-oriented-differentiable-product","title":"Matching-oriented Product Quantization For Ad-hoc Retrieval","arxiv_id":"2104.07858","date":"2021-04-16","proceeding":null,"authors":["Shitao Xiao","Zheng Liu","Yingxia Shao","Defu Lian","Xing Xie"],"abstract":"Product quantization (PQ) is a widely used technique for ad-hoc retrieval. Recent studies propose supervised PQ, where the embedding and quantization models can be jointly trained with supervised learning. However, there is a lack of appropriate formulation of the joint training objective; thus, the improvements over previous non-supervised baselines are limited in reality. In this work, we propose the Matching-oriented Product Quantization (MoPQ), where a novel objective Multinoulli Contrastive Loss (MCL) is formulated. With the minimization of MCL, we are able to maximize the matching probability of query and ground-truth key, which contributes to the optimal retrieval accuracy. Given that the exact computation of MCL is intractable due to the demand of vast contrastive samples, we further propose the Differentiable Cross-device Sampling (DCS), which significantly augments the contrastive samples for precise approximation of MCL. We conduct extensive experimental studies on four real-world datasets, whose results verify the effectiveness of MoPQ. The code is available at https://github.com/microsoft/MoPQ.","url_abs":"https://arxiv.org/abs/2104.07858v3","url_pdf":"https://arxiv.org/pdf/2104.07858v3.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":"search-oriented-differentiable-product","repo_url":"https://github.com/microsoft/mopq","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"search-oriented-differentiable-product","repo_url":"https://github.com/staoxiao/libvq","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"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=2104.07858","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.07858"}},"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/microsoft/MoPQ","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_violates":1,"unverified":7},"by_repo_kind":{"official":{"samples":8,"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":"7c508037b40522af","entry":"str2bool","repo":"microsoft/MoPQ","repo_kind":"official","path":"parameters.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/parameters.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7c508037b40522af"}},{"code_sha256_prefix":"4702e60a1d1a3d53","entry":"compute_acc","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/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":"4702e60a1d1a3d53"}},{"code_sha256_prefix":"39961e2ee77414a7","entry":"compute_retrive_acc","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/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":"39961e2ee77414a7"}},{"code_sha256_prefix":"29dc941df1dc58d2","entry":"encode","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/recall.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/recall.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":"29dc941df1dc58d2"}},{"code_sha256_prefix":"25fcf1c155aabad7","entry":"get_result_by_dtable","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/recall.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/recall.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":"25fcf1c155aabad7"}},{"code_sha256_prefix":"4381c8db6a0cb61e","entry":"recall_by_dtable","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/recall.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/recall.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":"4381c8db6a0cb61e"}},{"code_sha256_prefix":"6e9e257967094a66","entry":"tokenize_and_infer","repo":"microsoft/MoPQ","repo_kind":"official","path":"preprocess.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/preprocess.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":"6e9e257967094a66"}},{"code_sha256_prefix":"e8dcf12045bcc046","entry":"warmup_linear","repo":"microsoft/MoPQ","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/microsoft/MoPQ/blob/HEAD/utils/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":"e8dcf12045bcc046"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}