{"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/dynamically-anchored-prompting-for-task","title":"Dynamically Anchored Prompting for Task-Imbalanced Continual Learning","arxiv_id":"2404.14721","date":"2024-04-23","proceeding":null,"authors":["Chenxing Hong","Yan Jin","Zhiqi Kang","Yizhou Chen","Mengke Li","Yang Lu","Hanzi Wang"],"abstract":"Existing continual learning literature relies heavily on a strong assumption that tasks arrive with a balanced data stream, which is often unrealistic in real-world applications. In this work, we explore task-imbalanced continual learning (TICL) scenarios where the distribution of task data is non-uniform across the whole learning process. We find that imbalanced tasks significantly challenge the capability of models to control the trade-off between stability and plasticity from the perspective of recent prompt-based continual learning methods. On top of the above finding, we propose Dynamically Anchored Prompting (DAP), a prompt-based method that only maintains a single general prompt to adapt to the shifts within a task stream dynamically. This general prompt is regularized in the prompt space with two specifically designed prompt anchors, called boosting anchor and stabilizing anchor, to balance stability and plasticity in TICL. Remarkably, DAP achieves this balance by only storing a prompt across the data stream, therefore offering a substantial advantage in rehearsal-free CL. Extensive experiments demonstrate that the proposed DAP results in 4.5% to 15% absolute improvements over state-of-the-art methods on benchmarks under task-imbalanced settings. Our code is available at https://github.com/chenxing6666/DAP","url_abs":"https://arxiv.org/abs/2404.14721v2","url_pdf":"https://arxiv.org/pdf/2404.14721v2.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":"dynamically-anchored-prompting-for-task","repo_url":"https://github.com/chenxing6666/dap","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"continual-learning","task_name":"Continual Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.14721","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.14721"}},"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/chenxing6666/dap","reach":{"status":"ok"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/chenxing6666/DAP","reach":{"status":"ok"}}],"summary":{"ran":10},"by_repo_kind":{"official":{"samples":10,"ran":10,"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":10,"samples":[{"code_sha256_prefix":"b3608e3a49d81351","entry":"Prompt","repo":"chenxing6666/DAP","repo_kind":"official","path":"prompt.py","file_url":"https://github.com/chenxing6666/DAP/blob/HEAD/prompt.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b3608e3a49d81351"}},{"code_sha256_prefix":"05daf37a4c63d9a8","entry":"cal_center","repo":"chenxing6666/dap","repo_kind":"official","path":"engine.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/engine.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"05daf37a4c63d9a8"}},{"code_sha256_prefix":"ff19793f180a3567","entry":"cal_latestsimilarity_loss","repo":"chenxing6666/dap","repo_kind":"official","path":"engine.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/engine.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ff19793f180a3567"}},{"code_sha256_prefix":"618c3f1cdcff5502","entry":"cal_similarity_loss","repo":"chenxing6666/dap","repo_kind":"official","path":"engine.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/engine.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"618c3f1cdcff5502"}},{"code_sha256_prefix":"ee95af3ec5c38df5","entry":"checkpoint_filter_fn","repo":"chenxing6666/dap","repo_kind":"official","path":"vision_transformer.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/vision_transformer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee95af3ec5c38df5"}},{"code_sha256_prefix":"9c90a0600bfdb124","entry":"get_init_file","repo":"chenxing6666/dap","repo_kind":"official","path":"run_with_submitit.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/run_with_submitit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9c90a0600bfdb124"}},{"code_sha256_prefix":"6c600a2f0f2361f1","entry":"get_init_weights_vit","repo":"chenxing6666/dap","repo_kind":"official","path":"vision_transformer.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/vision_transformer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6c600a2f0f2361f1"}},{"code_sha256_prefix":"8e194e74ffb0e8ec","entry":"get_shared_folder","repo":"chenxing6666/dap","repo_kind":"official","path":"run_with_submitit.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/run_with_submitit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e194e74ffb0e8ec"}},{"code_sha256_prefix":"a6e17b60ed761713","entry":"resize_pos_embed","repo":"chenxing6666/dap","repo_kind":"official","path":"vision_transformer.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/vision_transformer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a6e17b60ed761713"}},{"code_sha256_prefix":"265ea374aab10001","entry":"target_transform","repo":"chenxing6666/dap","repo_kind":"official","path":"datasets.py","file_url":"https://github.com/chenxing6666/dap/blob/HEAD/datasets.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"265ea374aab10001"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}