{"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/one-embedder-any-task-instruction-finetuned","title":"One Embedder, Any Task: Instruction-Finetuned Text Embeddings","arxiv_id":"2212.09741","date":"2022-12-19","proceeding":null,"authors":["Hongjin Su","Weijia Shi","Jungo Kasai","Yizhong Wang","Yushi Hu","Mari Ostendorf","Wen-tau Yih","Noah A. Smith","Luke Zettlemoyer","Tao Yu"],"abstract":"We introduce INSTRUCTOR, a new method for computing text embeddings given task instructions: every text input is embedded together with instructions explaining the use case (e.g., task and domain descriptions). Unlike encoders from prior work that are more specialized, INSTRUCTOR is a single embedder that can generate text embeddings tailored to different downstream tasks and domains, without any further training. We first annotate instructions for 330 diverse tasks and train INSTRUCTOR on this multitask mixture with a contrastive loss. We evaluate INSTRUCTOR on 70 embedding evaluation tasks (66 of which are unseen during training), ranging from classification and information retrieval to semantic textual similarity and text generation evaluation. INSTRUCTOR, while having an order of magnitude fewer parameters than the previous best model, achieves state-of-the-art performance, with an average improvement of 3.4% compared to the previous best results on the 70 diverse datasets. Our analysis suggests that INSTRUCTOR is robust to changes in instructions, and that instruction finetuning mitigates the challenge of training a single model on diverse datasets. Our model, code, and data are available at https://instructor-embedding.github.io.","url_abs":"https://arxiv.org/abs/2212.09741v3","url_pdf":"https://arxiv.org/pdf/2212.09741v3.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":"one-embedder-any-task-instruction-finetuned","repo_url":"https://github.com/HKUNLP/instructor-embedding","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"one-embedder-any-task-instruction-finetuned","repo_url":"https://github.com/avsolatorio/gistembed","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"one-embedder-any-task-instruction-finetuned","repo_url":"https://github.com/shibing624/text2vec","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"one-embedder-any-task-instruction-finetuned","repo_url":"https://github.com/xlang-ai/instructor-embedding","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"information-retrieval","task_name":"Information Retrieval"},{"task_slug":"learning-word-embeddings","task_name":"Learning Word Embeddings"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"semantic-textual-similarity","task_name":"Semantic Textual Similarity"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2212.09741","atlas_url":"https://app.syntology.ai/?focus=2212.09741","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2212.09741"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/xlang-ai/instructor-embedding","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/HKUNLP/instructor-embedding","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/shibing624/text2vec","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/avsolatorio/gistembed","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":2,"ran":14,"unverified":4},"by_repo_kind":{"official":{"samples":18,"ran":14,"repositories":1},"listed":{"samples":2,"ran":2,"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":"f567def389222696","entry":"batch_to_device","repo":"xlang-ai/instructor-embedding","repo_kind":"listed","path":"InstructorEmbedding/instructor.py","file_url":"https://github.com/xlang-ai/instructor-embedding/blob/HEAD/InstructorEmbedding/instructor.py","link_basis":"first_harvest_node","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":"f567def389222696"}},{"code_sha256_prefix":"012e0e03723d52ec","entry":"construct_prompt","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_geo.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_geo.py","link_basis":"harvester_set","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":"012e0e03723d52ec"}},{"code_sha256_prefix":"d51ed70aaef3b5d0","entry":"expand_to_aliases","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/utils.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/utils.py","link_basis":"harvester_set","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":"d51ed70aaef3b5d0"}},{"code_sha256_prefix":"5a28ddf2ee395e47","entry":"fast_votek","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/two_steps.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/two_steps.py","link_basis":"harvester_set","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":"5a28ddf2ee395e47"}},{"code_sha256_prefix":"75fa1b0ab7064c3c","entry":"find_indices_from_embeddings","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_amazon.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_amazon.py","link_basis":"harvester_set","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":"75fa1b0ab7064c3c"}},{"code_sha256_prefix":"82fab1f6e6bddec2","entry":"format_dataset","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/get_task.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/get_task.py","link_basis":"harvester_set","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":"82fab1f6e6bddec2"}},{"code_sha256_prefix":"d8b8be7ec3cf207f","entry":"get_repeat_num","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_mwoz.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_mwoz.py","link_basis":"harvester_set","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":"d8b8be7ec3cf207f"}},{"code_sha256_prefix":"91631e556572af73","entry":"get_sub_answers","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/utils.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/utils.py","link_basis":"harvester_set","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":"91631e556572af73"}},{"code_sha256_prefix":"fc1006b014fb9c69","entry":"import_from_string","repo":"xlang-ai/instructor-embedding","repo_kind":"listed","path":"InstructorEmbedding/instructor.py","file_url":"https://github.com/xlang-ai/instructor-embedding/blob/HEAD/InstructorEmbedding/instructor.py","link_basis":"first_harvest_node","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":"fc1006b014fb9c69"}},{"code_sha256_prefix":"b724cc2d4066a429","entry":"is_commonword","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/bridge_content_encoder.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/bridge_content_encoder.py","link_basis":"harvester_set","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":"b724cc2d4066a429"}},{"code_sha256_prefix":"f39fdc1ce6cffe08","entry":"is_number","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/bridge_content_encoder.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/bridge_content_encoder.py","link_basis":"harvester_set","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":"f39fdc1ce6cffe08"}},{"code_sha256_prefix":"d56a1f9221823a48","entry":"is_stopword","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/bridge_content_encoder.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/bridge_content_encoder.py","link_basis":"harvester_set","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":"d56a1f9221823a48"}},{"code_sha256_prefix":"678526b83af152ab","entry":"maybe_add_quotes","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_geo.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_geo.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"678526b83af152ab"}},{"code_sha256_prefix":"597e15632d2a22fb","entry":"mean_pooling","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_coda_title_gen.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_coda_title_gen.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"597e15632d2a22fb"}},{"code_sha256_prefix":"071f4dd2f4d4b22c","entry":"process_mnli_examples","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/get_task.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/get_task.py","link_basis":"harvester_set","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":"071f4dd2f4d4b22c"}},{"code_sha256_prefix":"b775e4262bf408f6","entry":"process_rte_examples","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/get_task.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/get_task.py","link_basis":"harvester_set","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":"b775e4262bf408f6"}},{"code_sha256_prefix":"5deafd882c22eab9","entry":"conversion","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_mwoz.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_mwoz.py","link_basis":"harvester_set","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":"5deafd882c22eab9"}},{"code_sha256_prefix":"eff19094fe0ec70e","entry":"postprocess_text","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_coda_title_gen.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_coda_title_gen.py","link_basis":"harvester_set","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":"eff19094fe0ec70e"}},{"code_sha256_prefix":"8d5099dd630ccb92","entry":"postprocess_text","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_answerbility.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_answerbility.py","link_basis":"harvester_set","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":"8d5099dd630ccb92"}},{"code_sha256_prefix":"4db411255e0de092","entry":"v2_vote_k_select","repo":"HKUNLP/instructor-embedding","repo_kind":"official","path":"evaluation/prompt_retrieval/main_mwoz.py","file_url":"https://github.com/HKUNLP/instructor-embedding/blob/HEAD/evaluation/prompt_retrieval/main_mwoz.py","link_basis":"harvester_set","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":"4db411255e0de092"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}