{"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/are-human-generated-demonstrations-necessary","title":"Are Human-generated Demonstrations Necessary for In-context Learning?","arxiv_id":"2309.14681","date":"2023-09-26","proceeding":null,"authors":["Rui Li","Guoyin Wang","Jiwei Li"],"abstract":"Despite the promising few-shot ability of large language models (LLMs), the standard paradigm of In-context Learning (ICL) suffers the disadvantages of susceptibility to selected demonstrations and the intricacy to generate these demonstrations. In this paper, we raise the fundamental question that whether human-generated demonstrations are necessary for ICL. To answer this question, we propose self-contemplation prompting strategy (SEC), a paradigm free from human-crafted demonstrations. The key point of SEC is that, instead of using hand-crafted examples as demonstrations in ICL, SEC asks LLMs to first create demonstrations on their own, based on which the final output is generated. SEC is a flexible framework and can be adapted to both the vanilla ICL and the chain-of-thought (CoT), but with greater ease: as the manual-generation process of both examples and rationale can be saved. Extensive experiments in arithmetic reasoning, commonsense reasoning, multi-task language understanding, and code generation benchmarks, show that SEC, which does not require hand-crafted demonstrations, significantly outperforms the zero-shot learning strategy, and achieves comparable results to ICL with hand-crafted demonstrations. This demonstrates that, for many tasks, contemporary LLMs possess a sufficient level of competence to exclusively depend on their own capacity for decision making, removing the need for external training data. Code is available at https://github.com/ruili33/SEC.","url_abs":"https://arxiv.org/abs/2309.14681v4","url_pdf":"https://arxiv.org/pdf/2309.14681v4.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":"are-human-generated-demonstrations-necessary","repo_url":"https://github.com/ruili33/sec","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"arithmetic-reasoning","task_name":"Arithmetic Reasoning"},{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"multi-task-language-understanding","task_name":"Multi-task Language Understanding"},{"task_slug":"zero-shot-learning","task_name":"Zero-Shot Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.14681","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.14681"}},"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/ruili33/sec","reach":{"status":"ok"}}],"summary":{"ran":10,"unverified":1},"by_repo_kind":{"official":{"samples":11,"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":11,"samples":[{"code_sha256_prefix":"45e1de63602d4aef","entry":"get_abnormal_index","repo":"ruili33/sec","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/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":"45e1de63602d4aef"}},{"code_sha256_prefix":"1274cff87581c3f5","entry":"get_end","repo":"ruili33/sec","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/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":"1274cff87581c3f5"}},{"code_sha256_prefix":"724570e6d89a99ca","entry":"get_logger","repo":"ruili33/sec","repo_kind":"official","path":"logger.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/logger.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":"724570e6d89a99ca"}},{"code_sha256_prefix":"db638925173b9e03","entry":"get_temp","repo":"ruili33/sec","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/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":"db638925173b9e03"}},{"code_sha256_prefix":"d4ff83353959890e","entry":"process_raw","repo":"ruili33/sec","repo_kind":"official","path":"check.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/check.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":"d4ff83353959890e"}},{"code_sha256_prefix":"16cacf8aa53bc4aa","entry":"process_raw","repo":"ruili33/sec","repo_kind":"official","path":"utils_cleaning.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/utils_cleaning.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":"16cacf8aa53bc4aa"}},{"code_sha256_prefix":"e2972f069049411c","entry":"process_raw_humaneval","repo":"ruili33/sec","repo_kind":"official","path":"utils_cleaning.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/utils_cleaning.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":"e2972f069049411c"}},{"code_sha256_prefix":"69d076aaf386fcde","entry":"process_special","repo":"ruili33/sec","repo_kind":"official","path":"check.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/check.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":"69d076aaf386fcde"}},{"code_sha256_prefix":"0ebffa7d5bab521d","entry":"process_text","repo":"ruili33/sec","repo_kind":"official","path":"check.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/check.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":"0ebffa7d5bab521d"}},{"code_sha256_prefix":"39371ef75b2a42aa","entry":"timeout","repo":"ruili33/sec","repo_kind":"official","path":"models/api_base.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/models/api_base.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":"39371ef75b2a42aa"}},{"code_sha256_prefix":"bfa6d0faab87361a","entry":"get_demonstration_generation_prompt","repo":"ruili33/sec","repo_kind":"official","path":"get_demonetration_generation_prompt.py","file_url":"https://github.com/ruili33/sec/blob/HEAD/get_demonetration_generation_prompt.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":"bfa6d0faab87361a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}