CodecLM: Aligning Language Models with Tailored Synthetic Data

Zifeng Wang, Chun-Liang Li, Vincent Perot, Long T. Le, Jin Miao, Zizhao Zhang, Chen-Yu Lee, Tomas Pfister

Abstract

Instruction tuning has emerged as the key in aligning large language models (LLMs) with specific task instructions, thereby mitigating the discrepancy between the next-token prediction objective and users’ actual goals. To reduce the labor and time cost to collect or annotate data by humans, researchers start to explore the use of LLMs to generate instruction-aligned synthetic data. Recent works focus on generating diverse instructions and applying LLM to increase instruction complexity, often neglecting downstream use cases. It remains unclear how to tailor high-quality data to elicit better instruction-following abilities in different target instruction distributions and LLMs. To this end, we introduce CodecLM, a general framework for adaptively generating high-quality synthetic data for LLM alignment with different downstream instruction distributions and LLMs. Drawing on the Encode-Decode principles, we use LLMs as codecs to guide the data generation process. We first encode seed instructions into metadata, which are concise keywords generated on-the-fly to capture the target instruction distribution, and then decode metadata to create tailored instructions. We also introduce Self-Rubrics and Contrastive Filtering during decoding to tailor data-efficient samples. Extensive experiments on four open-domain instruction following benchmarks validate the effectiveness of CodecLM over the current state-of-the-arts.

Introduction

Instruction tuning is the critical process of fine-tuning LLMs to follow specific prompts, transforming them from simple next-token predictors into useful assistants. While human-annotated data is the gold standard, it is prohibitively expensive and slow to scale. Consequently, researchers have turned to synthetic data generation (e.g., using GPT-4 to teach smaller models). However, existing methods like Self-Instruct or WizardLM often rely on fixed, human-crafted rules to increase instruction complexity. This approach suffers from two primary flaws: it often ignores the specific task distribution of the downstream use case and fails to account for the unique "knowledge gaps" of the specific target model being trained.

Methodology: The Encode-Decode Framework

CodecLM introduces a novel framework that treats a strong LLM as a "codec" to generate tailored synthetic data through an iterative Encode-Decode process.

  1. LLM as Encoder: The framework takes "seed instructions" representative of the target task and encodes them into Metadata. This metadata consists of concise keywords describing the Use Case (e.g., creative writing) and the Skills required (e.g., role-play, storytelling).
  2. LLM as Decoder: This metadata is used to generate new, tailored instructions via two key mechanisms:
  3. Self-Rubrics: Instead of generic rules, the strong LLM generates task-specific rubrics. For instance, it might suggest adding multi-step calculations for math tasks or SWOT analyses for business tasks.
  4. Contrastive Filtering: This step identifies high-value samples by comparing the responses of the teacher model (strong LLM) and the student model (target LLM). If the student already performs well, the instruction is refined to be more difficult. If a significant "quality gap" exists, the pair is added to the training pool.
The detailed workflow of the CodecLM framework, illustrating the adaptive Encode-Decode process.

Experimental Results

CodecLM was evaluated across four popular open-domain benchmarks: Evol-Instruct, Vicuna, Self-Instruct, and Koala. The researchers utilized the Capacity Recovery Ratio (CRR) to measure how much of the teacher model's performance the student model (e.g., LLaMA-7B/13B) recovered.

CodecLM consistently outperformed state-of-the-art baselines like WizardLM+. On the Evol-Instruct benchmark, CodecLM helped LLaMA-7B reach a 79.82% CRR, significantly exceeding WizardLM+'s 75.69%. Furthermore, CodecLM demonstrated superior data efficiency; it achieved higher performance with smaller amounts of tailored data compared to larger, generic synthetic datasets.

Comparison of Capacity Recovery Ratio (CRR) across different data sizes for CodecLM and WizardLM+.

Conclusion

CodecLM provides a robust framework for adaptively aligning LLMs by focusing on the specific needs of the target model and task distribution. By leveraging metadata and contrastive filtering, it generates high-quality, data-efficient samples that outperform traditional rule-based augmentation. Future work will explore richer metadata definitions and more advanced scoring systems to further refine the alignment process.

Summary updated

BibTeX
@inproceedings{wang2024codeclm,
  author = {Zifeng Wang and Chun-Liang Li and Vincent Perot and Long T. Le and Jin Miao and Zizhao Zhang and Chen-Yu Lee and Tomas Pfister},
  title = {{CodecLM: Aligning Language Models with Tailored Synthetic Data}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=0jUyH5IA7R},
}
Figure