{"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/hybrid-generative-contrastive-representation","title":"Hybrid Generative-Contrastive Representation Learning","arxiv_id":"2106.06162","date":"2021-06-11","proceeding":null,"authors":["Saehoon Kim","Sungwoong Kim","Juho Lee"],"abstract":"Unsupervised representation learning has recently received lots of interest due to its powerful generalizability through effectively leveraging large-scale unlabeled data. There are two prevalent approaches for this, contrastive learning and generative pre-training, where the former learns representations from instance-wise discrimination tasks and the latter learns them from estimating the likelihood. These seemingly orthogonal approaches have their own strengths and weaknesses. Contrastive learning tends to extract semantic information and discards details irrelevant for classifying objects, making the representations effective for discriminative tasks while degrading robustness to out-of-distribution data. On the other hand, the generative pre-training directly estimates the data distribution, so the representations tend to be robust but not optimal for discriminative tasks. In this paper, we show that we could achieve the best of both worlds by a hybrid training scheme. Specifically, we demonstrated that a transformer-based encoder-decoder architecture trained with both contrastive and generative losses can learn highly discriminative and robust representations without hurting the generative performance. We extensively validate our approach on various tasks.","url_abs":"https://arxiv.org/abs/2106.06162v1","url_pdf":"https://arxiv.org/pdf/2106.06162v1.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":"hybrid-generative-contrastive-representation","repo_url":"https://github.com/kakaobrain/scrl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"representation-learning","task_name":"Representation Learning"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2106.06162","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.06162"}},"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/kakaobrain/scrl","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":10},"by_repo_kind":{"official":{"samples":10,"ran":0,"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":"ded50c9b95170f58","entry":"all_gather","repo":"kakaobrain/scrl","repo_kind":"official","path":"distributed/comm.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/distributed/comm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ded50c9b95170f58"}},{"code_sha256_prefix":"c5744484ed18b5c3","entry":"bbox_iou","repo":"kakaobrain/scrl","repo_kind":"official","path":"models/box_generator.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/models/box_generator.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c5744484ed18b5c3"}},{"code_sha256_prefix":"fac6d4127f49a1a3","entry":"bisect_params_with_names","repo":"kakaobrain/scrl","repo_kind":"official","path":"optim/getters.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/optim/getters.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fac6d4127f49a1a3"}},{"code_sha256_prefix":"bee36a96a86e2857","entry":"clip_box","repo":"kakaobrain/scrl","repo_kind":"official","path":"models/box_generator.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/models/box_generator.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bee36a96a86e2857"}},{"code_sha256_prefix":"b416f49365bfa24d","entry":"free_pass_trans_info","repo":"kakaobrain/scrl","repo_kind":"official","path":"augment/transforms.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/augment/transforms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b416f49365bfa24d"}},{"code_sha256_prefix":"0ae40a93ce2b44c0","entry":"gather","repo":"kakaobrain/scrl","repo_kind":"official","path":"distributed/comm.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/distributed/comm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0ae40a93ce2b44c0"}},{"code_sha256_prefix":"5c3bb378846a1c57","entry":"get_dist_url","repo":"kakaobrain/scrl","repo_kind":"official","path":"distributed/getters.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/distributed/getters.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5c3bb378846a1c57"}},{"code_sha256_prefix":"1bc251af2efa1bd9","entry":"get_mean_and_std","repo":"kakaobrain/scrl","repo_kind":"official","path":"augment/normalize.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/augment/normalize.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1bc251af2efa1bd9"}},{"code_sha256_prefix":"df3c1450c6cebedb","entry":"jitter_box","repo":"kakaobrain/scrl","repo_kind":"official","path":"models/box_generator.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/models/box_generator.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"df3c1450c6cebedb"}},{"code_sha256_prefix":"e1d95008530ae31a","entry":"scatter","repo":"kakaobrain/scrl","repo_kind":"official","path":"distributed/comm.py","file_url":"https://github.com/kakaobrain/scrl/blob/HEAD/distributed/comm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e1d95008530ae31a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}