{"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/discriminative-nearest-neighbor-few-shot","title":"Discriminative Nearest Neighbor Few-Shot Intent Detection by Transferring Natural Language Inference","arxiv_id":"2010.13009","date":"2020-10-25","proceeding":"EMNLP 2020 11","authors":["Jian-Guo Zhang","Kazuma Hashimoto","Wenhao Liu","Chien-Sheng Wu","Yao Wan","Philip S. Yu","Richard Socher","Caiming Xiong"],"abstract":"Intent detection is one of the core components of goal-oriented dialog systems, and detecting out-of-scope (OOS) intents is also a practically important skill. Few-shot learning is attracting much attention to mitigate data scarcity, but OOS detection becomes even more challenging. In this paper, we present a simple yet effective approach, discriminative nearest neighbor classification with deep self-attention. Unlike softmax classifiers, we leverage BERT-style pairwise encoding to train a binary classifier that estimates the best matched training example for a user input. We propose to boost the discriminative ability by transferring a natural language inference (NLI) model. Our extensive experiments on a large-scale multi-domain intent detection task show that our method achieves more stable and accurate in-domain and OOS detection accuracy than RoBERTa-based classifiers and embedding-based nearest neighbor approaches. More notably, the NLI transfer enables our 10-shot model to perform competitively with 50-shot or even full-shot classifiers, while we can keep the inference time constant by leveraging a faster embedding retrieval model.","url_abs":"https://arxiv.org/abs/2010.13009v1","url_pdf":"https://arxiv.org/pdf/2010.13009v1.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":"discriminative-nearest-neighbor-few-shot","repo_url":"https://github.com/salesforce/DNNC-few-shot-intent","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"},{"task_slug":"goal-oriented-dialog","task_name":"Goal-Oriented Dialog"},{"task_slug":"intent-detection","task_name":"Intent Detection"},{"task_slug":"natural-language-inference","task_name":"Natural Language Inference"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2010.13009","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2010.13009"}},"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/clinc/oos-eval","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/salesforce/DNNC-few-shot-intent","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":2},"by_repo_kind":{"official":{"samples":2,"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":"48db82b94f4da452","entry":"get_logger","repo":"salesforce/DNNC-few-shot-intent","repo_kind":"official","path":"models/utils.py","file_url":"https://github.com/salesforce/DNNC-few-shot-intent/blob/HEAD/models/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":"48db82b94f4da452"}},{"code_sha256_prefix":"03a18407e67123f1","entry":"get_train_dataloader","repo":"salesforce/DNNC-few-shot-intent","repo_kind":"official","path":"models/utils.py","file_url":"https://github.com/salesforce/DNNC-few-shot-intent/blob/HEAD/models/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":"03a18407e67123f1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}