title: CausalLM is not optimal for in-context learning
summary: 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.
paper_authors._id: 64db1239923e4576500c87aa
paper_authors.name: Nan Ding
paper_authors._id: 64db1239923e4576500c87ab
paper_authors.name: Tomer Levinboim
paper_authors._id: 64db1239923e4576500c87ac
paper_authors.name: Jialin Wu
paper_authors._id: 64db1239923e4576500c87ad
paper_authors.name: Sebastian Goodman
paper_authors.status: claimed_verified
paper_authors.statusLastChangedAt: 2023-08-16T13:23:18.457Z
paper_authors._id: 64dbb19050d53d4f5348ecac
paper_authors.avatarUrl: /avatars/4e70b59d1d9d597add4c73ea635094b1.svg
paper_authors.fullname: Sebastian Goodman
paper_authors.type: user
paper_authors.user: seabass1248
paper_authors._id: 64db1239923e4576500c87ae
paper_authors.name: Radu Soricut
paper_title: CausalLM is not optimal for in-context learning
paper_summary: 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.
paper_ai_summary: Theoretical analysis shows that prefix language models outperform causal language models in in-context learning by converging to optimal solutions, while causal models exhibit dynamics similar to online gradient descent.
paper_ai_keywords: transformer in-context learning prefix language model causal language model autoregressive attention convergence behavior stationary points linear rate linear regression online gradient descent