Language models significantly benefit from context tokens, such as prompts or scratchpads. They perform better when prompted with informative instructions, and they acquire new reasoning capabilities by generating a scratch-pad before predicting the final answers. However, they do not \textit{internalize} these performance gains, which disappear when the context tokens are gone. Our work proposes to apply context distillation so that a language model can improve itself by internalizing these gains. Concretely, given a synthetic unlabeled input for the target task, we condition the model on ``[instructions] + [task-input]'' to predict ``[scratch-pad] + [final answer]''; then we fine-tune the same model to predict its own ``[final answer]'' conditioned on the ``[task-input]'', without seeing the ``[instructions]'' or using the ``[scratch-pad]''.
We show that context distillation is a general method to train language models, and it can effectively internalize 3 types of training signals. First, it can internalize abstract task instructions and explanations, so we can iteratively update the model parameters with new instructions and overwrite old ones. Second, it can internalize step-by-step reasoning for complex tasks (e.g., 8-digit addition), and such a newly acquired capability proves to be useful for other downstream tasks. Finally, it can internalize concrete training examples, and it outperforms directly learning with gradient descent by 9\% on the SPIDER Text-to-SQL dataset; furthermore, combining context distillation operations can internalize more training examples than the context window size allows.
$\textit{SKIntern}$: Internalizing Symbolic Knowledge for Distilling Better CoT Capabilities into Small Language Models
Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院);National Science Library, Chinese Academy of Sciences(中国科学院国家科学图书馆)
Distilling Rule-based Knowledge into Large Language Models
Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学高瓴人工智能学院);Pattern Recognition Center, WeChat AI, Tencent Inc.(腾讯微信AI模式识别中心)
Distilling Implicit Multimodal Knowledge into Large Language Models for Zero-Resource Dialogue Generation
School of Computer Science and Technology, Dalian University of Technology(大连理工大学计算机科学与技术学院);School of Computer Science and Information Engineering, Hefei University of Technology(合肥工业大学计算机与信息工程学院)
ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL
Shanghai Research Institute for Intelligent Autonomous Systems, Tongji University(同济大学上海自主智能无人系统科学中心);College of Architecture and Urban Planning, Tongji University(同济大学建筑与城市规划学院);Behavioral and Spatial AI Lab, Peking University & Tongji University(北京大学与同济大学行为与空间人工智能实验室)
Large Language Models Explore by Latent Distilling
State Key Laboratory of General Artificial Intelligence, BIGAI, Beijing, China(人工智能通用基础理论国家重点实验室,BIGAI,北京,中国);School of Information Science and Technology, ShanghaiTech University, Shanghai, China(信息科学与技术学院,上海交通大学,上海,中国)
In-Context Editing: Learning Knowledge from Self-Induced Distributions
State Key Laboratory of General Artificial Intelligence, BIGAI(通用人工智能国家重点实验室,北京智源人工智能研究院);University of Science and Technology of China(中国科学技术大学);Peking University(北京大学)
From Completion to Editing: Unlocking Context-Aware Code Infilling via Search-and-Replace Instruction Tuning
USTC(University of Science and Technology of China);Alibaba Group(阿里巴巴集团);CASIA(Chinese Academy of Sciences Institute of Automation);SIAT(Institute of Automation, Chinese Academy of Sciences)