This repository releases the core pipeline of Answer Divergence-Guided Selection (ADG) for instruction data selection. ADG scores each instruction by the geometric structure of multiple sampled answers, rather than relying on a single reference response. In the paper, ADG consistently improves instruction tuning under a fixed 10K budget across two backbones, three public instruction pools, and six benchmarks spanning reasoning, knowledge, and coding. The method combines dispersion magnitude and shape anisotropy, then performs bin-wise selection for semantic coverage.
🌟 Overview
Instruction tuning quality depends heavily on which examples are selected under a fixed data budget. ADG addresses this by examining how a base model responds to the same instruction under stochastic decoding.
For each instruction, ADG:
samples multiple answers with relatively high-temperature decoding,
maps answers into a representation space,
computes geometry-aware scores from the sampled answers,
ranks examples by the combined score,
performs proportional selection within semantic bins.
This repository provides the practical pipeline for:
Depending on your environment, you may also need to install GPU-specific packages separately.
🧾 Data Format
ADG expects instruction datasets in JSON or JSONL format. Each example should follow the schema below:
json
1{2"id":0,3"instruction":"Write a short explanation of transformers.",4"input":"",5"output":"Transformers are neural networks based on self-attention..."6}
Notes:
id should uniquely identify each example.
instruction is required.
input is optional and can be empty or omitted.
output is the reference response in the original instruction dataset.
Other instruction datasets can be used as long as they are converted into this format.
After answer generation, the intermediate JSONL file contains records like:
json
1{2"id":0,3"instruction":"Write a short explanation of transformers.",4"output":"Transformers are neural networks based on self-attention...",5"generated_answers":[6"...",7"...",8"...",9"...",10"..."11]12}
🚀 Quick Start
Step 1. Prepare the instruction pool
Download and preprocess your instruction dataset, such as Alpaca-GPT4, WizardLM, or CoT, into the required format.
Step 2. Generate multiple answers per instruction
Before running, update the following variables in generation/generation.py:
Then configure MODEL_PATH and output paths in eval/eval.sh, and run:
bash
1cdeval2bash eval.sh
The evaluation script currently includes:
BBH
GSM8K
MMLU
TruthfulQA
MBPP
HumanEval
📖 Citation
bibtex
1@article{li2026instruction,
2 title={Instruction Data Selection via Answer Divergence},
3 author={Li, Bo and Wang, Mingda and Zhang, Shikun and Ye, Wei},
4 journal={arXiv preprint arXiv:2604.10448},
5 year={2026}
6}