{"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/container-few-shot-named-entity-recognition","title":"CONTaiNER: Few-Shot Named Entity Recognition via Contrastive Learning","arxiv_id":"2109.07589","date":"2021-09-15","proceeding":"ACL 2022 5","authors":["Sarkar Snigdha Sarathi Das","Arzoo Katiyar","Rebecca J. Passonneau","Rui Zhang"],"abstract":"Named Entity Recognition (NER) in Few-Shot setting is imperative for entity tagging in low resource domains. Existing approaches only learn class-specific semantic features and intermediate representations from source domains. This affects generalizability to unseen target domains, resulting in suboptimal performances. To this end, we present CONTaiNER, a novel contrastive learning technique that optimizes the inter-token distribution distance for Few-Shot NER. Instead of optimizing class-specific attributes, CONTaiNER optimizes a generalized objective of differentiating between token categories based on their Gaussian-distributed embeddings. This effectively alleviates overfitting issues originating from training domains. Our experiments in several traditional test domains (OntoNotes, CoNLL'03, WNUT '17, GUM) and a new large scale Few-Shot NER dataset (Few-NERD) demonstrate that on average, CONTaiNER outperforms previous methods by 3%-13% absolute F1 points while showing consistent performance trends, even in challenging scenarios where previous approaches could not achieve appreciable performance.","url_abs":"https://arxiv.org/abs/2109.07589v2","url_pdf":"https://arxiv.org/pdf/2109.07589v2.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":"container-few-shot-named-entity-recognition","repo_url":"https://github.com/psunlpgroup/container","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"few-shot-ner","task_name":"Few-shot NER"},{"task_slug":"named-entity-recognition-1","task_name":"Named Entity Recognition"},{"task_slug":"named-entity-recognition-ner","task_name":"Named Entity Recognition (NER)"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/few-shot-ner-on-few-nerd-inter","task":"Few-shot NER","dataset":"Few-NERD (INTER)","model":"CONTaiNER","rank_in_archive_order":10,"of":13,"metrics":{"10 way 1~2 shot":"48.35","10 way 5~10 shot":"57.12","5 way 1~2 shot":"55.95","5 way 5~10 shot":"61.83"},"uses_additional_data":true},{"leaderboard":"/sota/few-shot-ner-on-few-nerd-intra","task":"Few-shot NER","dataset":"Few-NERD (INTRA)","model":"CONTaiNER","rank_in_archive_order":9,"of":13,"metrics":{"10 way 1~2 shot":"33.84","10 way 5~10 shot":"47.49","5 way 1~2 shot":"40.43","5 way 5~10 shot":"53.70"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2109.07589","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2109.07589"}},"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/psunlpgroup/container","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":5},"by_repo_kind":{"official":{"samples":5,"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":"5cce77f5781d6ef6","entry":"entitywise_max","repo":"psunlpgroup/container","repo_kind":"official","path":"src/container.py","file_url":"https://github.com/psunlpgroup/container/blob/HEAD/src/container.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":"5cce77f5781d6ef6"}},{"code_sha256_prefix":"5c8c4a2b8ca7176f","entry":"euclidean_distance","repo":"psunlpgroup/container","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/psunlpgroup/container/blob/HEAD/src/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":"5c8c4a2b8ca7176f"}},{"code_sha256_prefix":"e023fe74e0952252","entry":"extract_target_labels","repo":"psunlpgroup/container","repo_kind":"official","path":"src/container.py","file_url":"https://github.com/psunlpgroup/container/blob/HEAD/src/container.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":"e023fe74e0952252"}},{"code_sha256_prefix":"a99a54e61796f3a9","entry":"loss_kl","repo":"psunlpgroup/container","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/psunlpgroup/container/blob/HEAD/src/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":"a99a54e61796f3a9"}},{"code_sha256_prefix":"b0c5474e5dc4f45f","entry":"nt_xent","repo":"psunlpgroup/container","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/psunlpgroup/container/blob/HEAD/src/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":"b0c5474e5dc4f45f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}