Table of Contents
Fetching ...

Can Language Models Compose Skills In-Context?

Zidong Liu, Zhuoyan Xu, Zhenmei Shi, Yingyu Liang

TL;DR

This work investigates whether large language models can compose basic skills into novel composite tasks using only in-context demonstrations. Through systematic experiments across multiple open-source models and a suite of linguistic/logic tasks, the authors find that simple-task demonstrations often harm composite performance and that models struggle to align demonstrations with the steps of the composition. Theoretical analysis explains that ignoring the compositional structure can incur errors that scale with the number of steps, and introduces Expanded Chain-of-Thought (ExpCoT) to explicitly align demonstrations with composition steps, which yields notable performance gains. The findings highlight the importance of task-structure alignment and propose practical avenues—such as ExpCoT and annotated data synthesis—for improving in-context compositional generalization in real-world systems.

Abstract

Composing basic skills from simple tasks to accomplish composite tasks is crucial for modern intelligent systems. We investigate the in-context composition ability of language models to perform composite tasks that combine basic skills demonstrated in in-context examples. This is more challenging than the standard setting, where skills and their composition can be learned in training. We conduct systematic experiments on various representative open-source language models, utilizing linguistic and logical tasks designed to probe composition abilities. The results reveal that simple task examples can have a surprising negative impact on the performance, because the models generally struggle to recognize and assemble the skills correctly, even with Chain-of-Thought examples. Theoretical analysis further shows that it is crucial to align examples with the corresponding steps in the composition. This inspires a method for the probing tasks, whose improved performance provides positive support for our insights.

Can Language Models Compose Skills In-Context?

TL;DR

This work investigates whether large language models can compose basic skills into novel composite tasks using only in-context demonstrations. Through systematic experiments across multiple open-source models and a suite of linguistic/logic tasks, the authors find that simple-task demonstrations often harm composite performance and that models struggle to align demonstrations with the steps of the composition. Theoretical analysis explains that ignoring the compositional structure can incur errors that scale with the number of steps, and introduces Expanded Chain-of-Thought (ExpCoT) to explicitly align demonstrations with composition steps, which yields notable performance gains. The findings highlight the importance of task-structure alignment and propose practical avenues—such as ExpCoT and annotated data synthesis—for improving in-context compositional generalization in real-world systems.

Abstract

Composing basic skills from simple tasks to accomplish composite tasks is crucial for modern intelligent systems. We investigate the in-context composition ability of language models to perform composite tasks that combine basic skills demonstrated in in-context examples. This is more challenging than the standard setting, where skills and their composition can be learned in training. We conduct systematic experiments on various representative open-source language models, utilizing linguistic and logical tasks designed to probe composition abilities. The results reveal that simple task examples can have a surprising negative impact on the performance, because the models generally struggle to recognize and assemble the skills correctly, even with Chain-of-Thought examples. Theoretical analysis further shows that it is crucial to align examples with the corresponding steps in the composition. This inspires a method for the probing tasks, whose improved performance provides positive support for our insights.
Paper Structure (30 sections, 7 theorems, 18 equations, 20 figures, 5 tables, 1 algorithm)

This paper contains 30 sections, 7 theorems, 18 equations, 20 figures, 5 tables, 1 algorithm.

Key Result

Proposition 1

There exists a learning rule $\mathcal{M}: (\mathcal{X} \times \Sigma^*)^* \rightarrow \Sigma^{\mathcal{X}}$ such that for any distribution $\mathcal{D}$ over $\mathcal{X}$ and any $f \in \mathcal{H}^T$, for every $0 < \delta < 1$, we have with probability at least $1- \delta$ over $\mathcal{S}_0$,

Figures (20)

  • Figure 1: The negative impact of simple task examples on the opposition+swap task (see \ref{['tab:dataset-example']}). The models need to answer a composite query when given $k$ examples from each simple task and $k_c=5$ examples from the composite task. They show unexpected decreasing performance with more simple task examples ($k$).
  • Figure 2: The effect of the in-context examples on in-context composition. The average change of the accuracy is reported, averaged over the tasks and $k_c$ (or $k$). More simple task examples surprisingly harm the composition performance, while more composite task examples help as expected.
  • Figure 3: The output distribution on opposition+swap for different numbers of task 1 examples $(k_1)$. The correspondence to task 1 increases, while those to task 2 and the composite task decrease.
  • Figure 4: Results for ablating the content/operators in the composite task examples. Increasing $k$ still affects the performance after ablating the content, but has little impact after ablating the operators.
  • Figure 5: Similarities of the attentions between 100 composite queries (first 100 rows/columns) and 100 simple queries (last 100 rows/columns). Attentions are from Layer 15, 17, and 19 of Mistral-7B.
  • ...and 15 more figures

Theorems & Definitions (11)

  • Proposition 1
  • Proposition 2
  • Theorem 1
  • Theorem 1
  • Proposition 3: Restatement of Proposition \ref{['prop:composite-task-examples']}
  • proof
  • Proposition 4: Restatement of Proposition \ref{['prop:confusion']}
  • proof
  • Claim 1
  • Theorem 2: Restatement of Theorem \ref{['thm:expcot']}
  • ...and 1 more