{"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/rethinking-positive-sampling-for-contrastive","title":"Integrating Prior Knowledge in Contrastive Learning with Kernel","arxiv_id":"2206.01646","date":"2022-06-03","proceeding":null,"authors":["Benoit Dufumier","Carlo Alberto Barbano","Robin Louiset","Edouard Duchesnay","Pietro Gori"],"abstract":"Data augmentation is a crucial component in unsupervised contrastive learning (CL). It determines how positive samples are defined and, ultimately, the quality of the learned representation. In this work, we open the door to new perspectives for CL by integrating prior knowledge, given either by generative models -- viewed as prior representations -- or weak attributes in the positive and negative sampling. To this end, we use kernel theory to propose a novel loss, called decoupled uniformity, that i) allows the integration of prior knowledge and ii) removes the negative-positive coupling in the original InfoNCE loss. We draw a connection between contrastive learning and conditional mean embedding theory to derive tight bounds on the downstream classification loss. In an unsupervised setting, we empirically demonstrate that CL benefits from generative models to improve its representation both on natural and medical images. In a weakly supervised scenario, our framework outperforms other unconditional and conditional CL approaches.","url_abs":"https://arxiv.org/abs/2206.01646v2","url_pdf":"https://arxiv.org/pdf/2206.01646v2.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":"rethinking-positive-sampling-for-contrastive","repo_url":"https://github.com/duplums/contrastive-decoupled-uniformity","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"data-augmentation","task_name":"Data Augmentation"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"infonce","method_name":"InfoNCE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2206.01646","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2206.01646"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/duplums/contrastive-decoupled-uniformity","reach":null}],"summary":{"ran":3,"ran_fixture":3},"by_repo_kind":{"official":{"samples":4,"ran":4,"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":2,"samples":[{"code_sha256_prefix":"6cf407f3f9817042","entry":"CosineKernel","repo":"duplums/contrastive-decoupled-uniformity","repo_kind":"official","path":"src/decoupled_uniformity.py","file_url":"https://github.com/duplums/contrastive-decoupled-uniformity/blob/HEAD/src/decoupled_uniformity.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6cf407f3f9817042"}},{"code_sha256_prefix":"b0a042ebf77aa022","entry":"DecoupledUniformityLoss","repo":"duplums/contrastive-decoupled-uniformity","repo_kind":"official","path":"src/decoupled_uniformity.py","file_url":"https://github.com/duplums/contrastive-decoupled-uniformity/blob/HEAD/src/decoupled_uniformity.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b0a042ebf77aa022"}},{"code_sha256_prefix":"f9d3a517dc83b040","entry":"RBFKernel","repo":"duplums/contrastive-decoupled-uniformity","repo_kind":"official","path":"src/decoupled_uniformity.py","file_url":"https://github.com/duplums/contrastive-decoupled-uniformity/blob/HEAD/src/decoupled_uniformity.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f9d3a517dc83b040"}},{"code_sha256_prefix":"131a82fd65128218","entry":"accuracy","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"131a82fd65128218"}},{"code_sha256_prefix":"cec655a124623d68","entry":"train","repo":"duplums/contrastive-decoupled-uniformity","repo_kind":"official","path":"main_lincls.py","file_url":"https://github.com/duplums/contrastive-decoupled-uniformity/blob/HEAD/main_lincls.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cec655a124623d68"}},{"code_sha256_prefix":"63ce1d5edf8fb0a0","entry":"validate","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"63ce1d5edf8fb0a0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}