Exploring Compositional Generalization of Large Language Models (2024)

Abstract: In this paper, we study the generalization ability of large language models (LLMs) with respect to compositional instructions, which are instructions that can be decomposed into several sub-instructions. We argue that the ability to generalize from simple instructions to more intricate compositional instructions represents a key aspect of the out-of-distribution generalization for LLMs. Since there are no specialized datasets for studying this phenomenon, we first construct a dataset with the help of ChatGPT, guided by the self-instruct technique. Then, we fine-tune and evaluate LLMs on these datasets. Interestingly, our experimental results indicate that training LLMs on higher-order compositional instructions enhances their performance on lower-order ones, but the reverse does not hold true.

## introduction large language models (llms) such as gpt3 @xcite , llama @xcite and llama-2 @xcite have demonstrated excellent multitask-solving abilities largely due to instruction tuning @xcite which fine-tunes llms to follow diverse and natural instructions. this study aims to advance the understanding of the instruction-tuning process, specifically focusing on the compositional generalization ability of llms. compositional instructions can be vaguely defined as complex instructions that are divisible into several simpler sub-instructions. several studies have delved into different aspects of compositionality with different interpretations of the above definition. for instance, lake and baroni (2018) found that on their proposed scan dataset, rnn performs poorly when testing on longer sequences or primitive commands unseen during training. @xcite constructed a realistic dataset based on question-answering datasets and regarded the novel compounds i.e., new ways of composing the atoms of the train set, as the out-of-domain test set on which they found the rnn model fails to generalize compositionally. @xcite conducted experiments on their built regular expression matching classification dataset and found t5-based models @xcite struggle with non-starfree or bigger r-languages. @xcite examined length generalization in llms, revealing significant deficiencies in their generalization capabilities when fine-tuned on tasks with different lengths. although length can be positively correlated with the degree of compositionality, the two are not equivalent. @xcite used instruction decomposition as an inference-time method for performance enhancement. this approach only focuses on taskspecific prompt design and does not involve finetuning, which provides a limited understanding of the compositional generalization of llms. different from the above works, which either build unrealistic datasets that do not necessarily translate to the real world, or construct domainspecific datasets, which are limited in the era of multitask-solving llms, we aim to analyze the compositionality of llms by fine-tuning them on instructions drawn from general domains and of different complexities. due to the lack of existing datasets tailored for this purpose, we leverage chat-gpt foot_0 and the self-instruct technique @xcite to construct suitable datasets. specifically, we generate compositional instructions with different orders (an order-n instruction means that the instruction can be decomposed into n subinstructions). following this, we proceed to finetune and evaluate a popular llm series, llama @xcite , using these datasets. our primary objective is to investigate the prospect of whether llms, once trained on instructions of a particular order, can generalize effectively to instructions of a different order. our experiments present a fascinating outcome. when llms are trained on higher-order compositional instructions, they show an enhancement in performance when dealing with lower-order ones. however, the reverse situation, where llms are trained on lower-order instructions and then assessed on higher-order ones, does not yield the same improvement in performance. this discovery could pave the way for new directions in the fine-tuning strategies of llms, potentially leading to more efficient and effective models. ## experiments our study focuses on investigating the generalization ability of llms. specifically, for each order instruction training dataset, we fine-tune a model and subsequently evaluate the model on instructions of various orders to assess their performance and adaptability. ## conclusion we studied the generalization ability of llms on compositional instructions. our explorations highlighted the significant impact of the order of training instructions on performance. specifically, while llms demonstrate negative forward generalization, they often exhibit positive backward generalization. furthermore, we discern that a larger model scale can alleviate the negative forward generalization. we hope these discoveries will aid the research community in designing more effective instruction tuning strategies.