{"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/relationprompt-leveraging-prompts-to-generate","title":"RelationPrompt: Leveraging Prompts to Generate Synthetic Data for Zero-Shot Relation Triplet Extraction","arxiv_id":"2203.09101","date":"2022-03-17","proceeding":"Findings (ACL) 2022 5","authors":["Yew Ken Chia","Lidong Bing","Soujanya Poria","Luo Si"],"abstract":"Despite the importance of relation extraction in building and representing knowledge, less research is focused on generalizing to unseen relations types. We introduce the task setting of Zero-Shot Relation Triplet Extraction (ZeroRTE) to encourage further research in low-resource relation extraction methods. Given an input sentence, each extracted triplet consists of the head entity, relation label, and tail entity where the relation label is not seen at the training stage. To solve ZeroRTE, we propose to synthesize relation examples by prompting language models to generate structured texts. Concretely, we unify language model prompts and structured text approaches to design a structured prompt template for generating synthetic relation samples when conditioning on relation label prompts (RelationPrompt). To overcome the limitation for extracting multiple relation triplets in a sentence, we design a novel Triplet Search Decoding method. Experiments on FewRel and Wiki-ZSL datasets show the efficacy of RelationPrompt for the ZeroRTE task and zero-shot relation classification. Our code and data are available at github.com/declare-lab/RelationPrompt.","url_abs":"https://arxiv.org/abs/2203.09101v1","url_pdf":"https://arxiv.org/pdf/2203.09101v1.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":"relationprompt-leveraging-prompts-to-generate","repo_url":"https://github.com/declare-lab/relationprompt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"relationprompt-leveraging-prompts-to-generate","repo_url":"https://github.com/declare-lab/hyperred","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":null,"task_name":"Relation"},{"task_slug":"relation-classification","task_name":"Relation Classification"},{"task_slug":"relation-extraction","task_name":"Relation Extraction"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":null,"task_name":"Triplet"},{"task_slug":"zero-shot-relation-classification","task_name":"Zero-shot Relation Classification"},{"task_slug":"zero-shot-relation-triplet-extraction","task_name":"Zero-shot Relation Triplet Extraction"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/zero-shot-relation-triplet-extraction-on","task":"Zero-shot Relation Triplet Extraction","dataset":"FewRel","model":"RelationPrompt","rank_in_archive_order":2,"of":3,"metrics":{"Avg. F1":"24.61"},"uses_additional_data":false},{"leaderboard":"/sota/zero-shot-relation-triplet-extraction-on-wiki","task":"Zero-shot Relation Triplet Extraction","dataset":"Wiki-ZSL","model":"RelationPrompt","rank_in_archive_order":1,"of":2,"metrics":{"Avg. F1":"31.19"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2203.09101","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.09101"}},"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/declare-lab/hyperred","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/declare-lab/relationprompt","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/declare-lab/RelationPrompt","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_honours":4,"ran_draft_wrong":3,"ran_fixture":5,"unverified":11},"by_repo_kind":{"official":{"samples":10,"ran":4,"repositories":1},"listed":{"samples":16,"ran":11,"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":16,"samples":[{"code_sha256_prefix":"f24a08472067dcf7","entry":"BertLayerNorm","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f24a08472067dcf7"}},{"code_sha256_prefix":"28a82cb66563a20d","entry":"BertLinear","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"28a82cb66563a20d"}},{"code_sha256_prefix":"1bf96a550bc9db35","entry":"RelationSentence","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1bf96a550bc9db35"}},{"code_sha256_prefix":"46b3836cd0547e98","entry":"align_span_to_tokens","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"46b3836cd0547e98"}},{"code_sha256_prefix":"8e14a5ff3ee5597f","entry":"batched_index_select","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e14a5ff3ee5597f"}},{"code_sha256_prefix":"eb611ef75d9aa110","entry":"check_adjacent","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"eb611ef75d9aa110"}},{"code_sha256_prefix":"4c70a6becf27ff53","entry":"decode_nonzero_cuboids","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4c70a6becf27ff53"}},{"code_sha256_prefix":"48a2b26807165ecf","entry":"find_span","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"48a2b26807165ecf"}},{"code_sha256_prefix":"97a3eca137c3440e","entry":"find_sublist_index","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"97a3eca137c3440e"}},{"code_sha256_prefix":"27e54a4cbd7d001d","entry":"flatten_and_batch_shift_indices","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"27e54a4cbd7d001d"}},{"code_sha256_prefix":"e650dcdf9e8a559f","entry":"gelu","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e650dcdf9e8a559f"}},{"code_sha256_prefix":"5ea35802d5e71352","entry":"get_device_of","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5ea35802d5e71352"}},{"code_sha256_prefix":"2b70d9c14170a263","entry":"get_range_vector","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2b70d9c14170a263"}},{"code_sha256_prefix":"439cdde1774200fe","entry":"prune_matrix","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"439cdde1774200fe"}},{"code_sha256_prefix":"d61d313e081aa624","entry":"update_bounds","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d61d313e081aa624"}},{"code_sha256_prefix":"4534173317cad377","entry":"BertEmbedModel","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4534173317cad377"}},{"code_sha256_prefix":"e3af493846de2812","entry":"BertEncoder","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e3af493846de2812"}},{"code_sha256_prefix":"2e36d81e1a7ea466","entry":"CubeRE","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2e36d81e1a7ea466"}},{"code_sha256_prefix":"1f6ddb84b665fb98","entry":"DynamicModel","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"1f6ddb84b665fb98"}},{"code_sha256_prefix":"b4e5d615275044cf","entry":"Encoder","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"b4e5d615275044cf"}},{"code_sha256_prefix":"43f13b65e230563d","entry":"ExtractEncoder","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"43f13b65e230563d"}},{"code_sha256_prefix":"ea519177ab88447d","entry":"LabelConstraint","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"ea519177ab88447d"}},{"code_sha256_prefix":"dc5e765561b30b13","entry":"PretrainedEmbedModel","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dc5e765561b30b13"}},{"code_sha256_prefix":"ee228a910e7ecb91","entry":"PretrainedEncoder","repo":"declare-lab/hyperred","repo_kind":"listed","path":"modeling.py","file_url":"https://github.com/declare-lab/hyperred/blob/HEAD/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee228a910e7ecb91"}},{"code_sha256_prefix":"c5312c4d166f9950","entry":"TextGenerator","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"c5312c4d166f9950"}},{"code_sha256_prefix":"1ad6a72afada7941","entry":"TripletSearchDecoder","repo":"declare-lab/RelationPrompt","repo_kind":"official","path":"generation.py","file_url":"https://github.com/declare-lab/RelationPrompt/blob/HEAD/generation.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":"1ad6a72afada7941"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}