KNN-Instruct: Automatic Instruction Construction with K Nearest Neighbor Deduction

Jianshang Kou, Benfeng Xu, Chiwei Zhu, Zhendong Mao


Abstract
Supervised fine-tuning (SFT) is a critical procedure for aligning large language models. Despite its efficiency, the construction of SFT data often struggles with issues of quality, diversity, and scalability. Many existing methods, inspired by the Self-Instruct framework, typically generate synthetic instructions by prompting aligned proprietary models like ChatGPT. However, such process suffers from stale distribution, resulting in instructions that are merely trivial variations of existing ones. In this paper, we introduce a novel bootstrapping approach termed KNN-Instruct, which incorporates KNN deduction to produce meaningful new instructions by effectively summarizing and learning from similar existing ones. We conduct an economical controlled experiment to preliminarily validate its effectiveness. In the further experiment, we construct a high-quality SFT dataset named KNN-Inst-12k*. Applying the dataset to Qwen-2-7B, we get a MT-Bench score of 7.64, which outperforms all 7B models on the LMSYS leaderboard, including Starling-LM-7B (7.48), OpenChat-3.5 (7.06) and Zephyr-7B-beta (6.53). Our code and data are available at https://github.com/CrossmodalGroup/KNN-Instruct/.
Anthology ID:
2024.emnlp-main.577
Volume:
Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing
Month:
November
Year:
2024
Address:
Miami, Florida, USA
Editors:
Yaser Al-Onaizan, Mohit Bansal, Yun-Nung Chen
Venue:
EMNLP
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
10337–10350
Language:
URL:
https://aclanthology.org/2024.emnlp-main.577/
DOI:
10.18653/v1/2024.emnlp-main.577
Bibkey:
Cite (ACL):
Jianshang Kou, Benfeng Xu, Chiwei Zhu, and Zhendong Mao. 2024. KNN-Instruct: Automatic Instruction Construction with K Nearest Neighbor Deduction. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 10337–10350, Miami, Florida, USA. Association for Computational Linguistics.
Cite (Informal):
KNN-Instruct: Automatic Instruction Construction with K Nearest Neighbor Deduction (Kou et al., EMNLP 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.emnlp-main.577.pdf