{"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/unveiling-in-context-learning-a-coordinate","title":"Unveiling In-Context Learning: A Coordinate System to Understand Its Working Mechanism","arxiv_id":"2407.17011","date":"2024-07-24","proceeding":null,"authors":["Anhao Zhao","Fanghua Ye","Jinlan Fu","Xiaoyu Shen"],"abstract":"Large language models (LLMs) exhibit remarkable in-context learning (ICL) capabilities. However, the underlying working mechanism of ICL remains poorly understood. Recent research presents two conflicting views on ICL: One emphasizes the impact of similar examples in the demonstrations, stressing the need for label correctness and more shots. The other attributes it to LLMs' inherent ability of task recognition, deeming label correctness and shot numbers of demonstrations as not crucial. In this work, we provide a Two-Dimensional Coordinate System that unifies both views into a systematic framework. The framework explains the behavior of ICL through two orthogonal variables: whether similar examples are presented in the demonstrations (perception) and whether LLMs can recognize the task (cognition). We propose the peak inverse rank metric to detect the task recognition ability of LLMs and study LLMs' reactions to different definitions of similarity. Based on these, we conduct extensive experiments to elucidate how ICL functions across each quadrant on multiple representative classification tasks. Finally, we extend our analyses to generation tasks, showing that our coordinate system can also be used to interpret ICL for generation tasks effectively.","url_abs":"https://arxiv.org/abs/2407.17011v2","url_pdf":"https://arxiv.org/pdf/2407.17011v2.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":"unveiling-in-context-learning-a-coordinate","repo_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2407.17011","atlas_url":"https://app.syntology.ai/?focus=2407.17011","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.17011"}},"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/eit-nlp/2d-coordinate-system-for-icl","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":11,"unverified":1},"by_repo_kind":{"official":{"samples":12,"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":0,"samples":[{"code_sha256_prefix":"a5f8c26c3b18acec","entry":"first_quadrant_sst2","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/first_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/first_quadrant_processing.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":"a5f8c26c3b18acec"}},{"code_sha256_prefix":"6fb95e710c7c52a3","entry":"fourth_quadrant_emo","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/fourth_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/fourth_quadrant_processing.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":"6fb95e710c7c52a3"}},{"code_sha256_prefix":"ea90a6dd70f35598","entry":"fourth_quadrant_trec","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/fourth_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/fourth_quadrant_processing.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":"ea90a6dd70f35598"}},{"code_sha256_prefix":"87ae745630e3718d","entry":"icl_generation","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/fourth_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/fourth_quadrant_processing.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":"87ae745630e3718d"}},{"code_sha256_prefix":"d5f6f01c6d67575d","entry":"icl_generation_color_and_capital","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/second_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/second_quadrant_processing.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":"d5f6f01c6d67575d"}},{"code_sha256_prefix":"ffb2f4006315e711","entry":"icl_generation_sst2","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/first_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/first_quadrant_processing.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":"ffb2f4006315e711"}},{"code_sha256_prefix":"8dccec5f5228331d","entry":"icl_generation_sst2","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/second_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/second_quadrant_processing.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":"8dccec5f5228331d"}},{"code_sha256_prefix":"6fa67476046b6014","entry":"template_generation_color_and_capital","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/first_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/first_quadrant_processing.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6fa67476046b6014"}},{"code_sha256_prefix":"13de22588444da78","entry":"third_quadrant_emo","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/third_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/third_quadrant_processing.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":"13de22588444da78"}},{"code_sha256_prefix":"74d4b887b676e8e6","entry":"third_quadrant_trec","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/third_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/third_quadrant_processing.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":"74d4b887b676e8e6"}},{"code_sha256_prefix":"b9aa70482de54509","entry":"tokenize","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"task_recognition_pir.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/task_recognition_pir.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":"b9aa70482de54509"}},{"code_sha256_prefix":"64e83651e7051164","entry":"second_quadrant_sst2","repo":"eit-nlp/2d-coordinate-system-for-icl","repo_kind":"official","path":"utils/second_quadrant_processing.py","file_url":"https://github.com/eit-nlp/2d-coordinate-system-for-icl/blob/HEAD/utils/second_quadrant_processing.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":"64e83651e7051164"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}