Papers › CausalLM is not optimal for in-context learning

CausalLM is not optimal for in-context learning

14 Aug 2023arXiv:2308.06912archive 2025-07-28

Nan Ding, Tomer Levinboim, Jialin Wu, Sebastian Goodman, Radu Soricut

Recent empirical evidence indicates that transformer based in-context learning performs better when using a prefix language model (prefixLM), in which in-context samples can all attend to each other, compared to causal language models (causalLM), which use auto-regressive attention that prohibits in-context samples to attend to future samples. While this result is intuitive, it is not understood from a theoretical perspective. In this paper we take a theoretical approach and analyze the convergence behavior of prefixLM and causalLM under a certain parameter construction. Our analysis shows that both LM types converge to their stationary points at a linear rate, but that while prefixLM converges to the optimal solution of linear regression, causalLM convergence dynamics follows that of an online gradient descent algorithm, which is not guaranteed to be optimal even as the number of samples grows infinitely. We supplement our theoretical claims with empirical experiments over synthetic and real tasks and using various types of transformers. Our experiments verify that causalLM consistently underperforms prefixLM in all settings.

PaperPDFCodeCode 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="2308.06912")

Code

Syntology Ran 8 of 13 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 8 ran with no contract checked.

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

google-research/causallm_icl officialmentioned in papermentioned on GitHubjaxApache-2.0 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

13 samples harvested; 8 ran; 0 honoured the contract we drafted; 5 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.

8ran
5unverified

Licence: 0 of the 13 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 google-research/causallm_icl. “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.

dot_product_attention google-research/causallm_icl/self_attention_patch.py official repository ran Apache-2.0 (permissive) · 25ce8c68e697049c · report
dot_product_attention_weights google-research/causallm_icl/self_attention_patch.py official repository ran Apache-2.0 (permissive) · 9023ce088127d9ce · report
extract_y google-research/causallm_icl/predictor_flax.py official repository ran Apache-2.0 (permissive) · 335bd7f77a12cdf9 · report
l2_loss google-research/causallm_icl/predictor_flax.py official repository ran Apache-2.0 (permissive) · b5919b0f35895f63 · report
logistic_loss google-research/causallm_icl/predictor_flax.py official repository ran Apache-2.0 (permissive) · 52590a86263d6fbf · report
map_func google-research/causallm_icl/sampler_lib.py official repository ran Apache-2.0 (permissive) · a3413d734b445c7a · report
set_seed google-research/causallm_icl/utils.py official repository ran fingerprinted Apache-2.0 (permissive) · fec430a564c9c333 · report
trh google-research/causallm_icl/utils.py official repository ran Apache-2.0 (permissive) · 2e70786d045620a8 · report
save_checkpoint google-research/causallm_icl/model_trainer.py official repository unverified Apache-2.0 (permissive) · 6f0e9bed65917eba · report
str_to_distribution_fn google-research/causallm_icl/sampler_lib.py official repository unverified Apache-2.0 (permissive) · 18a0f3cf92558fad · report
str_to_gmm_mix_fn google-research/causallm_icl/sampler_lib.py official repository unverified Apache-2.0 (permissive) · 585d0af2bc39c312 · report
train_step google-research/causallm_icl/model_trainer.py official repository unverified Apache-2.0 (permissive) · db573bba4a35a0c9 · report
y_x_fn google-research/causallm_icl/utils.py official repository unverified Apache-2.0 (permissive) · be4179e9fe9ec75c · report

Tasks

In-Context LearningLanguage ModelingLanguage Modelling

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