{"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-discriminative-generative-training-via","title":"Hybrid Discriminative-Generative Training via Contrastive Learning","arxiv_id":"2007.09070","date":"2020-07-17","proceeding":null,"authors":["Hao Liu","Pieter Abbeel"],"abstract":"Contrastive learning and supervised learning have both seen significant progress and success. However, thus far they have largely been treated as two separate objectives, brought together only by having a shared neural network. In this paper we show that through the perspective of hybrid discriminative-generative training of energy-based models we can make a direct connection between contrastive learning and supervised learning. Beyond presenting this unified view, we show our specific choice of approximation of the energy-based loss outperforms the existing practice in terms of classification accuracy of WideResNet on CIFAR-10 and CIFAR-100. It also leads to improved performance on robustness, out-of-distribution detection, and calibration.","url_abs":"https://arxiv.org/abs/2007.09070v2","url_pdf":"https://arxiv.org/pdf/2007.09070v2.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-discriminative-generative-training-via","repo_url":"https://github.com/lhao499/HDGE","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"}],"methods":[{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"kaiming-initialization","method_name":"Kaiming Initialization"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"wide-residual-block","method_name":"Wide Residual Block"},{"method_slug":"wideresnet","method_name":"WideResNet"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2007.09070","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2007.09070"}},"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/lhao499/HDGE","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_honours":1,"ran_draft_wrong":2,"ran":1,"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":11,"ran":5,"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":"20922c79a0929bbf","entry":"flatten","repo":"lhao499/HDGE","repo_kind":"official","path":"viskit/viskit/core.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/viskit/viskit/core.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"20922c79a0929bbf"}},{"code_sha256_prefix":"00e569acd6b45ef0","entry":"conv3x3","repo":"lhao499/HDGE","repo_kind":"official","path":"wideresnet.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/wideresnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"00e569acd6b45ef0"}},{"code_sha256_prefix":"965e75a1245dd833","entry":"load_progress","repo":"lhao499/HDGE","repo_kind":"official","path":"viskit/viskit/core.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/viskit/viskit/core.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"965e75a1245dd833"}},{"code_sha256_prefix":"40f81b1d5f51ea76","entry":"sliding_mean","repo":"lhao499/HDGE","repo_kind":"official","path":"viskit/viskit/frontend.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/viskit/viskit/frontend.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"40f81b1d5f51ea76"}},{"code_sha256_prefix":"6c7a4a9349a395e9","entry":"unique","repo":"lhao499/HDGE","repo_kind":"official","path":"viskit/viskit/core.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/viskit/viskit/core.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6c7a4a9349a395e9"}},{"code_sha256_prefix":"41279dfcda8b39e4","entry":"dict_to_safe_json","repo":"lhao499/HDGE","repo_kind":"official","path":"logger.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/logger.py","link_basis":"plan_row","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":"41279dfcda8b39e4"}},{"code_sha256_prefix":"6a5225a4bd1230c2","entry":"eval_classification","repo":"lhao499/HDGE","repo_kind":"official","path":"utils.py","file_url":"https://github.com/lhao499/HDGE/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6a5225a4bd1230c2"}},{"code_sha256_prefix":"2be75b7ac1ba23d4","entry":"flatten","repo":"lhao499/HDGE","repo_kind":"official","path":"viskit/viskit/frontend.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/viskit/viskit/frontend.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":"2be75b7ac1ba23d4"}},{"code_sha256_prefix":"c92bfa3e9d7c78c1","entry":"init_random","repo":"lhao499/HDGE","repo_kind":"official","path":"utils.py","file_url":"https://github.com/lhao499/HDGE/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c92bfa3e9d7c78c1"}},{"code_sha256_prefix":"cb06bf4914b94b48","entry":"plot","repo":"lhao499/HDGE","repo_kind":"official","path":"utils.py","file_url":"https://github.com/lhao499/HDGE/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb06bf4914b94b48"}},{"code_sha256_prefix":"d6cc3c153cec4e1d","entry":"simple_separated_format","repo":"lhao499/HDGE","repo_kind":"official","path":"logger.py","file_url":"https://github.com/lhao499/HDGE/blob/HEAD/logger.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":"d6cc3c153cec4e1d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}