Papers › Toward Understanding In-context vs. In-weight Learning

Toward Understanding In-context vs. In-weight Learning

30 Oct 2024arXiv:2410.23042archive 2025-07-28

Bryan Chan, Xinyi Chen, András György, Dale Schuurmans

It has recently been demonstrated empirically that in-context learning emerges in transformers when certain distributional properties are present in the training data, but this ability can also diminish upon further training. We provide a new theoretical understanding of these phenomena by identifying simplified distributional properties that give rise to the emergence and eventual disappearance of in-context learning. We do so by first analyzing a simplified model that uses a gating mechanism to choose between an in-weight and an in-context predictor. Through a combination of a generalization error and regret analysis we identify conditions where in-context and in-weight learning emerge. These theoretical findings are then corroborated experimentally by comparing the behaviour of a full transformer on the simplified distributions to that of the stylized model, demonstrating aligned results. We then extend the study to a full large language model, showing how fine-tuning on various collections of natural language prompts can elicit similar in-context and in-weight learning behaviour.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2410.23042")

Code

Syntology Ran 1 of 12 code samples harvested from 1 repository linked to this paper; 11 have no recorded run. Of those that ran: 1 ran · honoured contract.

By repository: found in paper text by Syntology: 12 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

chanb/icl_vs_iwl found in paper text by Syntology report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 1 ran; 1 honoured the contract we drafted; 11 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
11unverified

Licence: 12 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from chanb/icl_vs_iwl. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

identity chanb/icl_vs_iwl/src/models.py found in paper text by Syntology ran · honoured contract fingerprinted no licence file found · pointer only · 9910e2fc297f8665 · report
evaluate chanb/icl_vs_iwl/experiments/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 3530bb7a687ad762 · report
get_param_mask_by_name chanb/icl_vs_iwl/src/optimizer.py found in paper text by Syntology unverified no licence file found · pointer only · 2548c37cb3dcc6e6 · report
get_preds_labels chanb/icl_vs_iwl/experiments/utils.py found in paper text by Syntology unverified no licence file found · pointer only · e1259466c139acd0 · report
get_scheduler chanb/icl_vs_iwl/src/optimizer.py found in paper text by Syntology unverified no licence file found · pointer only · 75fa073f0c5c3557 · report
l2_norm chanb/icl_vs_iwl/src/learner.py found in paper text by Syntology unverified no licence file found · pointer only · e6ee54b3ae1accdc · report
linear_warmup_sqrt_decay chanb/icl_vs_iwl/src/optimizer.py found in paper text by Syntology unverified no licence file found · pointer only · b3094ed7367fd8a7 · report
load_config chanb/icl_vs_iwl/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · c2941847c7ff001c · report
make_h chanb/icl_vs_iwl/src/models.py found in paper text by Syntology unverified no licence file found · pointer only · 91a98277e57a16bc · report
parse_dict chanb/icl_vs_iwl/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 4f481719630f7b96 · report
prepare_seqs_for_icl chanb/icl_vs_iwl/src/dataset.py found in paper text by Syntology unverified no licence file found · pointer only · 85b5f412d531bc19 · report
print_performance_with_aux chanb/icl_vs_iwl/experiments/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 381775abc41222b4 · report

Tasks

In-Context LearningLanguage ModelingLanguage ModellingLarge Language Model

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections