{"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/mend-meta-demonstration-distillation-for","title":"MEND: Meta dEmonstratioN Distillation for Efficient and Effective In-Context Learning","arxiv_id":"2403.06914","date":"2024-03-11","proceeding":null,"authors":["Yichuan Li","Xiyao Ma","Sixing Lu","Kyumin Lee","Xiaohu Liu","Chenlei Guo"],"abstract":"Large Language models (LLMs) have demonstrated impressive in-context learning (ICL) capabilities, where a LLM makes predictions for a given test input together with a few input-output pairs (demonstrations). Nevertheless, the inclusion of demonstrations leads to a quadratic increase in the computational overhead of the self-attention mechanism. Existing solutions attempt to distill lengthy demonstrations into compact vectors. However, they often require task-specific retraining or compromise LLM's in-context learning performance. To mitigate these challenges, we present Meta dEmonstratioN Distillation (MEND), where a language model learns to distill any lengthy demonstrations into vectors without retraining for a new downstream task. We exploit the knowledge distillation to enhance alignment between MEND and LLM, achieving both efficiency and effectiveness simultaneously. MEND is endowed with the meta-knowledge of distilling demonstrations through a two-stage training process, which includes meta-distillation pretraining and fine-tuning. Comprehensive evaluations across seven diverse ICL task partitions using decoder-only (GPT-2) and encoder-decoder (T5) attest to MEND's prowess. It not only matches but often outperforms the Vanilla ICL as well as other state-of-the-art distillation models, while significantly reducing the computational demands. This innovation promises enhanced scalability and efficiency for the practical deployment of large language models","url_abs":"https://arxiv.org/abs/2403.06914v2","url_pdf":"https://arxiv.org/pdf/2403.06914v2.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":"mend-meta-demonstration-distillation-for","repo_url":"https://github.com/bigheiniu/mend","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"knowledge-distillation","method_name":"Knowledge Distillation"},{"method_slug":"mend","method_name":"MEND"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2403.06914","atlas_url":"https://app.syntology.ai/?focus=2403.06914","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.06914"}},"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/bigheiniu/mend","reach":null}],"summary":{"ran_honours":2,"ran_violates":2},"by_repo_kind":{"official":{"samples":4,"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":4,"samples":[{"code_sha256_prefix":"73c00302a85bffea","entry":"add_init_prompt_weight","repo":"bigheiniu/mend","repo_kind":"official","path":"src/SmallModel.py","file_url":"https://github.com/bigheiniu/mend/blob/HEAD/src/SmallModel.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"73c00302a85bffea"}},{"code_sha256_prefix":"3dff5b0601cdae2a","entry":"expand_concate","repo":"bigheiniu/mend","repo_kind":"official","path":"src/dataset_distill.py","file_url":"https://github.com/bigheiniu/mend/blob/HEAD/src/dataset_distill.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":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"3dff5b0601cdae2a"}},{"code_sha256_prefix":"c59d43339d50b24a","entry":"flatten","repo":"bigheiniu/mend","repo_kind":"official","path":"src/dataset_distill.py","file_url":"https://github.com/bigheiniu/mend/blob/HEAD/src/dataset_distill.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"c59d43339d50b24a"}},{"code_sha256_prefix":"571c74884d6ce8bd","entry":"repeat_list","repo":"bigheiniu/mend","repo_kind":"official","path":"src/dataset_distill.py","file_url":"https://github.com/bigheiniu/mend/blob/HEAD/src/dataset_distill.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"571c74884d6ce8bd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}