{"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/exploring-the-robustness-of-in-context","title":"Exploring the Robustness of In-Context Learning with Noisy Labels","arxiv_id":"2404.18191","date":"2024-04-28","proceeding":null,"authors":["Chen Cheng","Xinzhi Yu","Haodong Wen","Jingsong Sun","Guanzhang Yue","Yihao Zhang","Zeming Wei"],"abstract":"Recently, the mysterious In-Context Learning (ICL) ability exhibited by Transformer architectures, especially in large language models (LLMs), has sparked significant research interest. However, the resilience of Transformers' in-context learning capabilities in the presence of noisy samples, prevalent in both training corpora and prompt demonstrations, remains underexplored. In this paper, inspired by prior research that studies ICL ability using simple function classes, we take a closer look at this problem by investigating the robustness of Transformers against noisy labels. Specifically, we first conduct a thorough evaluation and analysis of the robustness of Transformers against noisy labels during in-context learning and show that they exhibit notable resilience against diverse types of noise in demonstration labels. Furthermore, we delve deeper into this problem by exploring whether introducing noise into the training set, akin to a form of data augmentation, enhances such robustness during inference, and find that such noise can indeed improve the robustness of ICL. Overall, our fruitful analysis and findings provide a comprehensive understanding of the resilience of Transformer models against label noises during ICL and provide valuable insights into the research on Transformers in natural language processing. Our code is available at https://github.com/InezYu0928/in-context-learning.","url_abs":"https://arxiv.org/abs/2404.18191v2","url_pdf":"https://arxiv.org/pdf/2404.18191v2.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":"exploring-the-robustness-of-in-context","repo_url":"https://github.com/inezyu0928/in-context-learning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"data-augmentation","task_name":"Data Augmentation"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"learning-with-noisy-labels","task_name":"Learning with noisy labels"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.18191","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.18191"}},"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/InezYu0928/in-context-learning","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/inezyu0928/in-context-learning","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":9,"unverified":4},"by_repo_kind":{"official":{"samples":13,"ran":9,"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":"d7ae3e05768f422d","entry":"accuracy","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/tasks.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/tasks.py","link_basis":"harvester_set","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":"d7ae3e05768f422d"}},{"code_sha256_prefix":"7495cd7b25d435ba","entry":"eval_batch","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/eval_outliers.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/eval_outliers.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":"7495cd7b25d435ba"}},{"code_sha256_prefix":"6ed430154a51ff69","entry":"gen_standard","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/eval_outliers.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/eval_outliers.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":"6ed430154a51ff69"}},{"code_sha256_prefix":"8e7880c7ece962b1","entry":"get_data_sampler","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/samplers.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/samplers.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":"8e7880c7ece962b1"}},{"code_sha256_prefix":"96ed70434d3db4e6","entry":"get_inference_baselines","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/eval_inference.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/eval_inference.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":"96ed70434d3db4e6"}},{"code_sha256_prefix":"8b454b5ce3e43a76","entry":"get_inference_noise_std","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/eval_inference.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/eval_inference.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":"8b454b5ce3e43a76"}},{"code_sha256_prefix":"b5fee02df4732e80","entry":"get_inference_scale","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/eval_inference.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/eval_inference.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":"b5fee02df4732e80"}},{"code_sha256_prefix":"fc94f27a0973e093","entry":"mean_squared_error","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/tasks.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/tasks.py","link_basis":"harvester_set","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":"fc94f27a0973e093"}},{"code_sha256_prefix":"348d63a78eb4cb94","entry":"squared_error","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/tasks.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/tasks.py","link_basis":"harvester_set","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":"348d63a78eb4cb94"}},{"code_sha256_prefix":"e472ab225b88777b","entry":"basic_plot","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/plot_utils.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/plot_utils.py","link_basis":"harvester_set","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":"e472ab225b88777b"}},{"code_sha256_prefix":"d9639c68861b1f12","entry":"build_model","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/models.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/models.py","link_basis":"harvester_set","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":"d9639c68861b1f12"}},{"code_sha256_prefix":"3c24ac252fef0868","entry":"get_final_var","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/curriculum.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/curriculum.py","link_basis":"harvester_set","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":"3c24ac252fef0868"}},{"code_sha256_prefix":"7f92ad21604fa243","entry":"sample_transformation","repo":"InezYu0928/in-context-learning","repo_kind":"official","path":"src/samplers.py","file_url":"https://github.com/InezYu0928/in-context-learning/blob/HEAD/src/samplers.py","link_basis":"harvester_set","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":"7f92ad21604fa243"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}