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.
