LLM Instruction Tuning을 위한 Neuron Activation 기반 데이터 선택 프레임워크 NAIT
Neuron-Aware Data Selection In Instruction Tuning For Large Language Models
TL;DR Highlight
모델 내부 뉴런 활성화 패턴을 분석해서 파인튜닝에 쓸 고품질 데이터를 자동으로 골라주는 프레임워크
Who Should Read
LLM을 특정 도메인(코딩, 수학, 다국어 등)에 맞게 파인튜닝하려는 ML 엔지니어나 연구자. 특히 GPT-4 API 없이 저비용으로 Instruction Tuning 데이터를 추려야 하는 상황에서 유용하다.
Core Mechanics
- 핵심 아이디어: 모델이 특정 태스크 샘플을 처리할 때의 뉴런 활성화 패턴이 목표 능력의 패턴과 유사할수록 그 데이터가 파인튜닝에 효과적이라는 가설
- 동작 방식: 타겟 능력(예: 수학)의 in-domain 데이터로 뉴런 활성화 패턴을 추출 → PCA로 방향 벡터화 → 후보 데이터셋 전체를 점수화 → 상위 k%만 선택
- Alpaca-GPT4 52k 데이터의 10%만 선택해도 전체 데이터로 학습한 것보다 평균 3.24% 성능 향상 (LLaMA-2-7b 기준)
- 비용 효율: AlpaGasus(GPT-4 API 필요) 대비 19배 빠르고 94% 저렴. 1.32시간/$1.52로 처리 가능
- 수학/코딩 관련 뉴런 피처는 다른 태스크에도 긍정적 전이 효과가 있어 범용 성능 향상에 기여함
- Mistral-7b, LLaMA-3-8b, Qwen-2.5-7b 등 다양한 모델에서 일관되게 효과 확인 (Mistral-7b +21.92%, LLaMA-3-8b +18.65%)
Evidence
- LLaMA-2-7b + Alpaca-GPT4 10% 선택 → 전체 데이터 대비 평균 3.24% 향상, 수학 피처 사용 시 4.65% 향상 (Table 2)
- 비용 비교: NAIT 1.32h/$1.52 vs AlpaGasus 19.07h/$178.02 vs SelectIT 23.20h/$26.68 (NVIDIA A800 기준, Table 5)
- 고활성화 상위 10% 선택 시 랜덤 대비 +3.35%, 저활성화 하위 10% 선택 시 랜덤 대비 -17.54% (Table 3)
- Mistral-7b에서 전체 데이터 대비 +21.92%, Qwen-2.5-7b에서도 +3.83% 성능 개선 (Table 4)
How to Apply
- 파인튜닝 목표 도메인(예: 코딩)의 in-domain 데이터 수백~수천 개를 준비하고, 기반 모델에 통과시켜 각 레이어의 뉴런 활성화 변화량(첫 토큰 vs 마지막 토큰)을 기록한 뒤 PCA로 방향 벡터를 추출한다.
- 전체 IT 데이터셋(예: Alpaca-GPT4)의 각 샘플을 동일하게 통과시켜 추출한 방향 벡터와의 유사도 점수를 계산하고, 상위 10~30%만 선택해서 파인튜닝에 사용한다.
- 수학/코딩 피처로 선택된 데이터는 범용 성능도 올려주므로, 특정 능력이 아닌 전반적 성능 향상이 목적이라면 GSM/CodeX 기반 피처를 우선 사용하는 것이 효과적이다.
Code Example
Terminology
Related Resources
Original Abstract (Expand)
Instruction Tuning (IT) has been proven to be an effective approach to unlock the powerful capabilities of large language models (LLMs). Recent studies indicate that excessive IT data can degrade LLMs performance, while carefully selecting a small subset of high-quality IT data can significantly enhance their capabilities. Therefore, identifying the most efficient subset data from the IT dataset to effectively develop either specific or general abilities in LLMs has become a critical challenge. To address this, we propose a novel and efficient framework called NAIT. NAIT evaluates the impact of IT data on LLMs performance by analyzing the similarity of neuron activation patterns between the IT dataset and the target domain capability. Specifically, NAIT captures neuron activation patterns from in-domain datasets of target domain capabilities to construct reusable and transferable neuron activation features. It then evaluates and selects optimal samples based on the similarity between candidate samples and the expected activation features of the target capabilities. Experimental results show that training on the 10\% Alpaca-GPT4 IT data subset selected by NAIT consistently outperforms methods that rely on external advanced models or uncertainty-based features across various tasks. Our findings also reveal the transferability of neuron activation features across different capabilities of LLMs. In particular, IT data with more logical reasoning and programmatic features possesses strong general transferability, enabling models to develop stronger capabilities across multiple tasks, while a stable core subset of data is sufficient to consistently activate fundamental model capabilities and universally improve performance across diverse tasks.