Skip to main content
QUICK REVIEW

[Paper Review] Learning by Distilling Context

Charlie Snell, Dan Klein|arXiv (Cornell University)|Sep 30, 2022
Topic ModelingComputer Science7 citations
TL;DR

This paper proposes context distillation, a method that enables language models to internalize performance gains from context tokens—such as instructions, scratchpads, and examples—by fine-tuning on self-generated completions. It achieves 9% higher accuracy than gradient descent on SPIDER Text-to-SQL and enables transfer of step-by-step reasoning to downstream tasks.

ABSTRACT

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 extit{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.

Motivation & Objective

  • Address the limitation that language models lose performance gains when context tokens (e.g., instructions, scratchpads) are removed.
  • Enable language models to internalize complex capabilities like step-by-step reasoning and task-specific instructions without relying on external context.
  • Overcome context window limitations by distilling more examples than can fit in the context window through iterative distillation.
  • Develop a general-purpose training method that improves model performance while preserving existing capabilities like instruction following.

Proposed method

  • Use a teacher model to generate a scratch-pad and final answer conditioned on a detailed prompt containing instructions and task inputs.
  • Extract the final answer from the teacher’s completion and fine-tune the same model to predict it directly from a minimal student prompt.
  • Apply distillation to three types of signals: abstract task instructions, concrete examples (e.g., from SPIDER), and step-by-step reasoning (e.g., 8-digit addition).
  • Use a mixture of distillation data and in-context learning examples to prevent catastrophic forgetting during fine-tuning.
  • Iteratively apply distillation to internalize more examples than the context window allows, observing continual performance gains.
  • Evaluate transferability by testing distilled reasoning capabilities on related downstream tasks, such as word problems requiring addition.

Experimental results

Research questions

  • RQ1Can language models internalize abstract task instructions and explanations through context distillation, and can they be updated iteratively?
  • RQ2Can step-by-step reasoning capabilities, such as 8-digit addition, be effectively internalized and transferred to other reasoning tasks?
  • RQ3Can context distillation outperform direct gradient descent fine-tuning when learning from concrete examples, especially under context window constraints?
  • RQ4Does combining multiple distillation steps allow models to internalize more training examples than the context window size permits?
  • RQ5Can the distilled reasoning ability generalize to new, unseen tasks that require similar cognitive operations?

Key findings

  • Context distillation improves performance by 9% over direct gradient descent fine-tuning on the SPIDER Text-to-SQL dataset for 8-shot adaptation.
  • After distilling step-by-step reasoning for 8-digit addition, the model’s direct addition accuracy increases from 1% to 17%, demonstrating effective internalization.
  • The distilled model maintains strong performance on instruction-following tasks (RougeL: 57 → 58), indicating no catastrophic forgetting of original capabilities.
  • The distilled addition capability transfers to related reasoning tasks, increasing performance from 17% to 30% on synthetic word problems involving addition.
  • Iterative context distillation enables internalization of more training examples than the context window size allows, with performance improving continuously with more distillation steps.
  • The method generalizes across different types of training signals: abstract instructions, concrete examples, and structured reasoning, showing broad applicability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.