通过链式结构提升模型训练效率与推理灵活性
Chain-of-Model Learning for Language Model
- 将每层隐藏状态设计为可串行访问的链式子表示,实现渐进式扩展
- 在保持性能接近标准Transformer的同时,支持多尺寸模型灵活部署
- 适合需要高效训练和弹性推理的场景,如资源受限环境
本文提出一种新型学习范式——链式模型(Chain-of-Model, CoM),将因果关系以链式结构嵌入各层隐藏状态中,显著提升训练效率并增强部署时的推理灵活性。我们引入链式表示(Chain-of-Representation, CoR),将每层隐藏状态分解为多个链式子表示,并规定输出链仅能观测输入链中的前序链。基于此,可逐步增加链数以扩展模型规模,也可通过选择不同链数实现多尺寸子模型,支持弹性推理。在此基础上,我们构建了链式语言模型(CoLM),将其思想融入Transformer架构。进一步提出CoLM-Air,通过首个链共享所有键值对,实现跨链复用,带来无缝模型切换、预填充加速等额外优势。实验表明,CoLM系列在性能上可媲美标准Transformer,同时具备更强的可扩展性与灵活性,为语言模型构建开辟新路径。代码将于未来开源。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。