{"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/prefix-tuning-optimizing-continuous-prompts","title":"Prefix-Tuning: Optimizing Continuous Prompts for Generation","arxiv_id":"2101.00190","date":"2021-01-01","proceeding":"ACL 2021 5","authors":["Xiang Lisa Li","Percy Liang"],"abstract":"Fine-tuning is the de facto way to leverage large pretrained language models to perform downstream tasks. However, it modifies all the language model parameters and therefore necessitates storing a full copy for each task. In this paper, we propose prefix-tuning, a lightweight alternative to fine-tuning for natural language generation tasks, which keeps language model parameters frozen, but optimizes a small continuous task-specific vector (called the prefix). Prefix-tuning draws inspiration from prompting, allowing subsequent tokens to attend to this prefix as if it were \"virtual tokens\". We apply prefix-tuning to GPT-2 for table-to-text generation and to BART for summarization. We find that by learning only 0.1\\% of the parameters, prefix-tuning obtains comparable performance in the full data setting, outperforms fine-tuning in low-data settings, and extrapolates better to examples with topics unseen during training.","url_abs":"https://arxiv.org/abs/2101.00190v1","url_pdf":"https://arxiv.org/pdf/2101.00190v1.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":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/XiangLi1999/PrefixTuning","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/DKhomi/PrefixTuning","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"unanswered"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/NVIDIA/FasterTransformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/ga642381/SpeechPrompt","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/hellokevin07/elastictrainer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/jordiclive/ControlPrefixes","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/lostoxygen/llm-confidentiality","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/niyunsheng/ems-sd","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/ranggihwang/pregated_moe","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/rmokady/clip_prefix_caption","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/teticio/llama-squad","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"GPL-3.0"}},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/thudm/swissarmytransformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"prefix-tuning-optimizing-continuous-prompts","repo_url":"https://github.com/Zeng-WH/PrefixTuning-Fix","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"unanswered"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"table-to-text-generation","task_name":"Table-to-Text Generation"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bart","method_name":"BART"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"discriminative-fine-tuning","method_name":"Discriminative Fine-Tuning"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-2","method_name":"GPT-2"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2101.00190","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2101.00190"}},"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/ranggihwang/pregated_moe","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Zeng-WH/PrefixTuning-Fix","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DKhomi/PrefixTuning","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/XiangLi1999/PrefixTuning","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/NVIDIA/FasterTransformer","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jordiclive/ControlPrefixes","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lostoxygen/llm-confidentiality","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hellokevin07/elastictrainer","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/teticio/llama-squad","reach":{"status":"ok","spdx":"GPL-3.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thudm/swissarmytransformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/niyunsheng/ems-sd","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rmokady/clip_prefix_caption","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ga642381/SpeechPrompt","reach":{"status":"ok"}}],"summary":{"ran":2,"ran_draft_wrong":2,"unverified":2},"by_repo_kind":{"listed":{"samples":6,"ran":4,"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":"6b7c651bf334e2be","entry":"BaseMixin","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6b7c651bf334e2be"}},{"code_sha256_prefix":"e5740cff266d5a5d","entry":"PrefixTuningMixin","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e5740cff266d5a5d"}},{"code_sha256_prefix":"3823a93a9e064f82","entry":"non_conflict","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3823a93a9e064f82"}},{"code_sha256_prefix":"7ede45f27f0943d8","entry":"replacable","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7ede45f27f0943d8"}},{"code_sha256_prefix":"844b89380ab187e6","entry":"attention_fn_default","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.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":"844b89380ab187e6"}},{"code_sha256_prefix":"82481205cb7b429d","entry":"standard_attention","repo":"thudm/swissarmytransformer","repo_kind":"listed","path":"sat/model/finetune/prompt_tuning.py","file_url":"https://github.com/thudm/swissarmytransformer/blob/HEAD/sat/model/finetune/prompt_tuning.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":"82481205cb7b429d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}