Specializing Smaller Language Models towards Multi-Step Reasoning

Yao Fu, Hao Peng, Litu Ou, Ashish Sabharwal, Tushar Khot

TL;DR

This paper demonstrates that complex multi-step reasoning—previously thought to be an "emergent" ability exclusive to massive models with over 100 billion parameters—can be successfully distilled into much smaller models (under 11B parameters). By "specializing" a model's limited capacity toward a target task, the authors show that smaller models like Flan-T5 can achieve reasoning performance rivaling models ten times their size, albeit at the cost of their general-purpose capabilities.

The Accessibility Gap in Reasoning

In the world of Large Language Models (LLMs), "Chain-of-Thought" (CoT) reasoning—the ability to solve a problem by generating a step-by-step explanation—has long been considered a luxury of scale. Early research suggested that small models (<10B parameters) exhibit a "flat" scaling curve for CoT, meaning they simply do not get better at reasoning as they grow, until they hit a massive threshold (around 100B parameters) where the ability suddenly "emerges."

This creates a massive accessibility gap: only a few organizations have the compute power to run or fine-tune 100B+ parameter models. The authors of this paper challenge the "emergent ability" narrative. They hypothesize that small models aren't inherently incapable of reasoning; rather, their limited capacity is spread too thin across too many generic tasks.

Methods: The Specialization Recipe

The authors propose Model Specialization, a process of concentrating a small model's power onto a specific reasoning task through knowledge distillation.

  1. Teacher-Student Distillation: They use a giant teacher model (code-davinci-002, a GPT-3.5 variant) to generate 40 different CoT reasoning paths for each question in a math dataset. They keep only the paths that lead to the correct answer to create a high-quality "specialization" dataset.
  2. Base Model Selection: They compare raw pretrained models (T5) against instruction-tuned models (Flan-T5) as starting points.
  3. Distribution Matching: Instead of just training the student to predict the teacher's final text (sample matching), they minimize the KL divergence between the student's and teacher's output probability distributions.
  4. Tokenizer Alignment: Since GPT and T5 use different tokenizers, the authors developed a novel alignment algorithm based on dynamic programming (similar to the Needleman-Wunsch algorithm used in bioinformatics) to map the teacher's probabilities onto the student's tokens.
Overview of the model specialization process, data formats, and tokenizer alignment.

Datasets

  • Seed Dataset: GSM8K (Grade School Math 8K), used to generate the distillation data.
  • Out-of-Distribution (OOD) Evaluation: MultiArith, ASDiv, and SVAMP. These test if the model actually learned to reason or just memorized the GSM8K patterns.
  • Generic Ability Evaluation: BigBench Hard (BBH), a suite of 26 challenging tasks used to measure how much "general intelligence" the model loses during specialization.

Key Insights and Ideas

  • The Scaling Curve is Not Flat: The most significant finding is that specialization "lifts" the scaling curve. For specialized models, performance increases log-linearly with size, just like it does for giant models. This suggests CoT isn't a sudden "phase change" but a capability that can be unlocked at any scale if the model is focused enough.
  • Instruction Tuning is a Better Foundation: Starting with an instruction-tuned model (Flan-T5) yields much better results than a raw pretrained model (T5). Instruction tuning seems to "prime" the model's internal representations for the specialization process.
  • The Specialization Tax: There is a clear trade-off. As the model becomes a math expert, its performance on general tasks (BBH) plummets. Specifically, it loses almost all its ability to perform CoT on non-math tasks.
  • Format Matters: Training with "in-context" examples (showing the model a few examples before the question) helps the model maintain both zero-shot and in-context abilities. Training on zero-shot data alone actually causes the model to lose its ability to learn from context.

Key Results

  • Performance Leap: Specialized Flan-T5 models saw an average +10 point accuracy gain across math reasoning tasks.
  • Punching Above Their Weight: The specialized Flan-T5 11B (27.1% on GSM8K) outperformed the UL2 20B (4.4%) and performed on par with much larger models like LaMDA 137B (14.8%) and PaLM 60B (29.9%) on the target tasks.
  • Scaling Trends: As shown in the figure below, the specialized T5 variants show a clear, upward log-linear trend, breaking the assumption that small models cannot scale their reasoning capabilities.
Specialized T5 models exhibit a log-linear scaling curve for Chain-of-Thought reasoning.

Limitations and Future Work

  • Loss of Generality: The authors acknowledge that these specialized models are no longer "general purpose." They are tools designed for a specific niche.
  • Teacher Dependency: The method relies on access to a very powerful teacher model to generate the reasoning paths.
  • Future Directions: The authors suggest that future work could explore "multi-specialization" (focusing on a few related tasks) or integrating external tools like calculators to further boost the reasoning accuracy of these small-but-mighty models.

Summary updated

BibTeX
@inproceedings{fu2023specializing,
  author = {Yao Fu and Hao Peng and Litu Ou and Ashish Sabharwal and Tushar Khot},
  title = {{Specializing Smaller Language Models towards Multi-Step Reasoning}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=MXuLl38AEm},
}
Figure