Distill or Annotate? Cost-Efficient Fine-Tuning of Compact Models

Junmo Kang, Wei Xu, Alan Ritter

Abstract

Building high-performance NLP models often involves a trade-off between model size and inference cost. While massive language models excel, compact models are preferred for production efficiency. This paper investigates the most cost-effective way to boost the performance of compact models under a fixed budget: hiring human annotators for more labeled data or investing in GPU compute for knowledge distillation from a large teacher model. Our findings demonstrate that distillation is consistently more cost-efficient across various NLP tasks, often outperforming manual annotation by a significant margin.

Introduction

In the current NLP landscape, massive language models (LLMs) deliver state-of-the-art performance but come with prohibitive inference costs and high environmental impact. To mitigate this, practitioners frequently deploy compact models, such as T5-Small. However, these smaller models typically require additional optimization to reach acceptable accuracy levels.

A developer working with a fixed budget faces a critical choice:

  1. The Annotation Path: Allocate funds to human annotators to expand the high-quality labeled training set.
  2. The Distillation Path: Allocate funds to GPU resources to fine-tune a massive "teacher" model (e.g., T5-XXL) and then distill its knowledge into the compact "student" model using inexpensive, unlabeled data.
Conceptual overview of the choice between more data (annotation) and more compute (distillation) for training efficient compact models.

This research provides a rigorous framework to evaluate these two strategies, determining which path offers the best performance for a given financial investment.

Methods and Cost Modeling

The study compares two primary strategies using a unified cost model:

  • Strategy 1 (Annotate): Directly fine-tuning a T5-Small (60M parameters) model. The budget is entirely dedicated to increasing the volume of human-labeled examples.
  • Strategy 2 (Distill): A small portion of the budget is used for an initial labeled set to fine-tune a T5-XXL (11B parameters) teacher. The remaining budget is spent on GPU hours (NVIDIA A100s) to distill the teacher’s "soft labels" into the T5-Small student using large-scale unlabeled data.

To ensure a fair comparison, the authors used real-world pricing: human labeling rates between $0.13 and $0.37 per label and cloud GPU rental prices at approximately $3.75 per hour.

Experimental Setup

The evaluation spanned six diverse NLP tasks, including Named Entity Recognition (WLP), stance classification (STANCEOSAURUS), fact verification (FEVER), paraphrase identification and generation (MULTIPIT), and closed-book question answering (NATURAL QUESTIONS). The researchers simulated budget constraints by limiting available data based on the calculated costs of annotation and compute.

Key Insights

  • Distillation as the Economic Winner: Across nearly every task and budget level, distillation proved superior. In several scenarios, matching the performance of a distilled model via annotation would require ten times the budget.
  • The Teacher's Role: Experiments with "self-distillation" (Small model teaching another Small model) failed to match the results of the XXL-to-Small pipeline. This indicates that the teacher’s superior reasoning and knowledge, rather than just the volume of data, are the primary drivers of student performance.
  • Scale Matters: Using a massive teacher like T5-XXL was often more cost-effective than using a medium-sized one like T5-Large. Despite the higher hourly cost of T5-XXL, its superior knowledge transfer allows the student to reach higher accuracy faster.
  • Comparison with LLM Annotators: Even when compared to using GPT-3.5 as a cheaper alternative to human annotators, the T5-XXL distillation strategy remained more cost-efficient for developing compact models.

Results and Pareto Optimality

The researchers plotted Pareto curves to visualize the trade-off between performance and total cost. Distillation consistently defined the Pareto frontier, meaning it provided the highest accuracy for any given dollar amount.

Pareto curves for the MultiPIT_Id task, showing that the distillation strategy consistently achieves higher accuracy for the same budget compared to pure annotation.

For instance, on the WLP task with a $500 budget, the "Annotate" strategy achieved an F1 score of ~62.7, whereas "Distill" reached ~70.8. While annotation may be the only viable path for extremely small budgets that cannot cover even a single fine-tuning run of a large model, distillation quickly takes the lead as the budget increases.

Conclusion and Future Directions

This work establishes distillation as a powerful tool for practitioners seeking to build efficient, high-performance NLP systems on a budget. However, some limitations remain. The study assumes cloud GPU rental; if on-premise compute is available, the cost advantage of distillation becomes even more pronounced. Additionally, distillation may amplify biases inherent in the teacher model, necessitating future research into bias-mitigation within cost-efficient pipelines. Finally, while this study focuses on fine-tuning, exploring similar cost-efficiency trade-offs during the pre-training phase of compact models is a promising area for future work.

Summary updated

BibTeX
@inproceedings{kang2023distill,
  author = {Junmo Kang and Wei Xu and Alan Ritter},
  title = {{Distill or Annotate? Cost-Efficient Fine-Tuning of Compact Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.622},
}
Figure