{"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/in-context-learning-in-large-language-models","title":"In-Context Learning Learns Label Relationships but Is Not Conventional Learning","arxiv_id":"2307.12375","date":"2023-07-23","proceeding":null,"authors":["Jannik Kossen","Yarin Gal","Tom Rainforth"],"abstract":"The predictions of Large Language Models (LLMs) on downstream tasks often improve significantly when including examples of the input--label relationship in the context. However, there is currently no consensus about how this in-context learning (ICL) ability of LLMs works. For example, while Xie et al. (2021) liken ICL to a general-purpose learning algorithm, Min et al. (2022) argue ICL does not even learn label relationships from in-context examples. In this paper, we provide novel insights into how ICL leverages label information, revealing both capabilities and limitations. To ensure we obtain a comprehensive picture of ICL behavior, we study probabilistic aspects of ICL predictions and thoroughly examine the dynamics of ICL as more examples are provided. Our experiments show that ICL predictions almost always depend on in-context labels and that ICL can learn truly novel tasks in-context. However, we also find that ICL struggles to fully overcome prediction preferences acquired from pre-training data and, further, that ICL does not consider all in-context information equally.","url_abs":"https://arxiv.org/abs/2307.12375v4","url_pdf":"https://arxiv.org/pdf/2307.12375v4.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":"in-context-learning-in-large-language-models","repo_url":"https://github.com/jlko/in_context_learning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.12375","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.12375"}},"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":"deterministic:regex_extraction","url":"https://github.com/jlko/in","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jlko/in_context_learning","reach":{"status":"ok"}}],"summary":{"ran":8,"unverified":1},"by_repo_kind":{"official":{"samples":9,"ran":8,"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":9,"samples":[{"code_sha256_prefix":"162e3d448cc599e1","entry":"autotype","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/config_utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/config_utils.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":"162e3d448cc599e1"}},{"code_sha256_prefix":"7933ed53ac9b6d22","entry":"construct_zeroshot_input","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/utils.py","link_basis":"first_harvest_node","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":"7933ed53ac9b6d22"}},{"code_sha256_prefix":"8e87d24bb6fec877","entry":"flatten_dict","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/plot_utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/plot_utils.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":"8e87d24bb6fec877"}},{"code_sha256_prefix":"7243fa43f88f66fe","entry":"get_log_probs","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/utils.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":"7243fa43f88f66fe"}},{"code_sha256_prefix":"411303dd11428b7f","entry":"get_logit_idxs","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/utils.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":"411303dd11428b7f"}},{"code_sha256_prefix":"04c92992ca9677e0","entry":"get_nested_dict","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/config_utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/config_utils.py","link_basis":"first_harvest_node","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":"04c92992ca9677e0"}},{"code_sha256_prefix":"d8e9de85811bca1a","entry":"remove_split_layer","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/models.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/models.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":"d8e9de85811bca1a"}},{"code_sha256_prefix":"8103cafadb0c86a3","entry":"split","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/datasets.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/datasets.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":"8103cafadb0c86a3"}},{"code_sha256_prefix":"a7b6896a43973ffb","entry":"get_values","repo":"jlko/in_context_learning","repo_kind":"official","path":"llm/plot_utils.py","file_url":"https://github.com/jlko/in_context_learning/blob/HEAD/llm/plot_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a7b6896a43973ffb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}