{"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/when-do-prompting-and-prefix-tuning-work-a","title":"When Do Prompting and Prefix-Tuning Work? A Theory of Capabilities and Limitations","arxiv_id":"2310.19698","date":"2023-10-30","proceeding":null,"authors":["Aleksandar Petrov","Philip H. S. Torr","Adel Bibi"],"abstract":"Context-based fine-tuning methods, including prompting, in-context learning, soft prompting (also known as prompt tuning), and prefix-tuning, have gained popularity due to their ability to often match the performance of full fine-tuning with a fraction of the parameters. Despite their empirical successes, there is little theoretical understanding of how these techniques influence the internal computation of the model and their expressiveness limitations. We show that despite the continuous embedding space being more expressive than the discrete token space, soft-prompting and prefix-tuning are potentially less expressive than full fine-tuning, even with the same number of learnable parameters. Concretely, context-based fine-tuning cannot change the relative attention pattern over the content and can only bias the outputs of an attention layer in a fixed direction. This suggests that while techniques like prompting, in-context learning, soft prompting, and prefix-tuning can effectively elicit skills present in the pretrained model, they may not be able to learn novel tasks that require new attention patterns.","url_abs":"https://arxiv.org/abs/2310.19698v2","url_pdf":"https://arxiv.org/pdf/2310.19698v2.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":"when-do-prompting-and-prefix-tuning-work-a","repo_url":"https://github.com/aleksandarpetrov/prefix-tuning-theory","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2310.19698","atlas_url":"https://app.syntology.ai/?focus=2310.19698","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.19698"}},"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/aleksandarpetrov/prefix-tuning-theory","reach":null}],"summary":{"ran_draft_wrong":1,"ran_violates":1,"ran_fixture":1},"by_repo_kind":{"official":{"samples":3,"ran":3,"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":3,"samples":[{"code_sha256_prefix":"02d0a7c24b7aa390","entry":"apply_rotary_emb","repo":"aleksandarpetrov/prefix-tuning-theory","repo_kind":"official","path":"llama/llama/model.py","file_url":"https://github.com/aleksandarpetrov/prefix-tuning-theory/blob/HEAD/llama/llama/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"02d0a7c24b7aa390"}},{"code_sha256_prefix":"9aef5cccb42aa073","entry":"precompute_freqs_cis","repo":"aleksandarpetrov/prefix-tuning-theory","repo_kind":"official","path":"llama/llama/model.py","file_url":"https://github.com/aleksandarpetrov/prefix-tuning-theory/blob/HEAD/llama/llama/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9aef5cccb42aa073"}},{"code_sha256_prefix":"5a639d78ada17fee","entry":"reshape_for_broadcast","repo":"aleksandarpetrov/prefix-tuning-theory","repo_kind":"official","path":"llama/llama/model.py","file_url":"https://github.com/aleksandarpetrov/prefix-tuning-theory/blob/HEAD/llama/llama/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5a639d78ada17fee"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}