Table of Contents
Fetching ...

Chain-of-Model Learning for Language Model

Kaitao Song, Xiaohua Wang, Xu Tan, Huiqiang Jiang, Chengruidong Zhang, Yongliang Shen, Cen LU, Zihao Li, Zifan Song, Caihua Shan, Yansen Wang, Kan Ren, Xiaoqing Zheng, Tao Qin, Yuqing Yang, Dongsheng Li, Lili Qiu

TL;DR

This work tackles the inefficiencies of scaling large language models by introducing Chain-of-Representation (CoR), Chain-of-Layer (CoL), and Chain-of-Model (CoM), enabling multi-scale, causal representations within a single model. By instantiating CoM in Transformer layers as Chain-of-Language-Model (CoLM) and further enhancing it with KV sharing (CoLM-Air), the authors demonstrate that a single foundation model can support multiple sub-models at varying scales without retraining from scratch. Empirical results show CoLM achieves performance comparable to standard Transformers while offering elastic inference, chain expansion, and prefilling speedups, with CoLM-Air delivering significant prefilling accelerations. Overall, this approach provides a scalable, flexible pathway for deploying large-scale language models across diverse hardware and latency constraints, potentially reducing training and inference costs while preserving accuracy.

Abstract

In this paper, we propose a novel learning paradigm, termed Chain-of-Model (CoM), which incorporates the causal relationship into the hidden states of each layer as a chain style, thereby introducing great scaling efficiency in model training and inference flexibility in deployment. We introduce the concept of Chain-of-Representation (CoR), which formulates the hidden states at each layer as a combination of multiple sub-representations (i.e., chains) at the hidden dimension level. In each layer, each chain from the output representations can only view all of its preceding chains in the input representations. Consequently, the model built upon CoM framework can progressively scale up the model size by increasing the chains based on the previous models (i.e., chains), and offer multiple sub-models at varying sizes for elastic inference by using different chain numbers. Based on this principle, we devise Chain-of-Language-Model (CoLM), which incorporates the idea of CoM into each layer of Transformer architecture. Based on CoLM, we further introduce CoLM-Air by introducing a KV sharing mechanism, that computes all keys and values within the first chain and then shares across all chains. This design demonstrates additional extensibility, such as enabling seamless LM switching, prefilling acceleration and so on. Experimental results demonstrate our CoLM family can achieve comparable performance to the standard Transformer, while simultaneously enabling greater flexiblity, such as progressive scaling to improve training efficiency and offer multiple varying model sizes for elastic inference, paving a a new way toward building language models. Our code will be released in the future at: https://github.com/microsoft/CoLM.

Chain-of-Model Learning for Language Model

TL;DR

This work tackles the inefficiencies of scaling large language models by introducing Chain-of-Representation (CoR), Chain-of-Layer (CoL), and Chain-of-Model (CoM), enabling multi-scale, causal representations within a single model. By instantiating CoM in Transformer layers as Chain-of-Language-Model (CoLM) and further enhancing it with KV sharing (CoLM-Air), the authors demonstrate that a single foundation model can support multiple sub-models at varying scales without retraining from scratch. Empirical results show CoLM achieves performance comparable to standard Transformers while offering elastic inference, chain expansion, and prefilling speedups, with CoLM-Air delivering significant prefilling accelerations. Overall, this approach provides a scalable, flexible pathway for deploying large-scale language models across diverse hardware and latency constraints, potentially reducing training and inference costs while preserving accuracy.

Abstract

In this paper, we propose a novel learning paradigm, termed Chain-of-Model (CoM), which incorporates the causal relationship into the hidden states of each layer as a chain style, thereby introducing great scaling efficiency in model training and inference flexibility in deployment. We introduce the concept of Chain-of-Representation (CoR), which formulates the hidden states at each layer as a combination of multiple sub-representations (i.e., chains) at the hidden dimension level. In each layer, each chain from the output representations can only view all of its preceding chains in the input representations. Consequently, the model built upon CoM framework can progressively scale up the model size by increasing the chains based on the previous models (i.e., chains), and offer multiple sub-models at varying sizes for elastic inference by using different chain numbers. Based on this principle, we devise Chain-of-Language-Model (CoLM), which incorporates the idea of CoM into each layer of Transformer architecture. Based on CoLM, we further introduce CoLM-Air by introducing a KV sharing mechanism, that computes all keys and values within the first chain and then shares across all chains. This design demonstrates additional extensibility, such as enabling seamless LM switching, prefilling acceleration and so on. Experimental results demonstrate our CoLM family can achieve comparable performance to the standard Transformer, while simultaneously enabling greater flexiblity, such as progressive scaling to improve training efficiency and offer multiple varying model sizes for elastic inference, paving a a new way toward building language models. Our code will be released in the future at: https://github.com/microsoft/CoLM.
Paper Structure (43 sections, 3 theorems, 2 equations, 12 figures, 15 tables, 6 algorithms)

This paper contains 43 sections, 3 theorems, 2 equations, 12 figures, 15 tables, 6 algorithms.

Key Result

Corollary 2.1

Any layer can be viewed as a case of chain-of-layer when $n = 1$.

Figures (12)

  • Figure 1: An example of CoR with 3 chains.
  • Figure 2: Comparisons between Linear and Chain-of-Linear layer.
  • Figure 3: Differences between Attention, Chain of Attention and Chain of Attention with KV sharing.
  • Figure 4: Normalization (CoR).
  • Figure 5: Comparisons on Prefilling speed on LLaMa-1B and LLaMa-8B settings (2K - 1M).
  • ...and 7 more figures

Theorems & Definitions (6)

  • Definition 1: Chain-of-Representation
  • Definition 2: Chain-of-Layer
  • Corollary 2.1: Generality
  • Corollary 2.2: Causality
  • Corollary 2.3: Compositionality
  • Definition 3: Chain-of-Model