Views
No views yet
mistralai/Mistral-7B-v0.1 를 2-스테이지 학습(CPT → DPO) 으로 다듬어 ARC-Challenge 25-shot 점수를 크게 끌어올린 모델입니다.| ARC-Challenge test, 25-shot | Baseline (Mistral-7B-v0.1) | 이 모델 (CPT→DPO) | Δ |
|---|---|---|---|
acc_norm (주지표) | 0.6143 | 0.7526 | +0.1383 |
acc (보조지표) | 0.5700 | 0.7474 | +0.1774 |
arc_challenge, --num_fewshot 25, dtype=float16.lm-evaluation-harness 의 arc_challenge 는 모델이 답을 생성하게 하지 않습니다. 각 보기에 대해"Question: {question}\nAnswer:" + " " + {보기 텍스트}acc_norm)한 뒤 가장 높은 보기를 고릅니다.
따라서 점수를 움직이는 유일한 요소는 모델이 정답 보기의 텍스트에 더 높은 우도를 주는가입니다.
이 모델의 모든 학습 단계는 그 사실에 정렬돼 있습니다(학습 타깃은 항상 정답 보기 텍스트, letter "B" 가 아님).support 단락 + CAMEL-AI bio/chem/physics 풀이)으로 4K packed-CLM(전 토큰 loss).
정답 과학 문장의 우도를 전반적으로 끌어올립니다. 단독 효과는 작습니다(acc_norm 0.6143 → 0.6195).chosen / 오답 보기 텍스트 = rejected 인 preference 쌍(harness 레이아웃과 바이트 일치)으로 학습합니다.
logP(정답) > logP(오답) 은 acc_norm 랭킹 목적함수 그 자체이며, reference 는 어댑터를 끈 같은 모델(= CPT 체크포인트)입니다.loss = -logσ( β · [ (logπ_w − logπ_w^ref) − (logπ_l − logπ_l^ref) ] ) # β = 0.1| Stage 1 · CPT | Stage 2 · DPO | |
|---|---|---|
| 데이터 | SciQ support + CAMEL-AI (bio/chem/physics) 산문 | ARC-C/E + OpenBookQA + SciQ train: gold vs distractor 쌍 |
| 목적함수 | packed-CLM (전 토큰 next-token) | DPO (β=0.1), reference = adapter-off |
| 방식 | full-FT + DeepSpeed ZeRO-2 (4×A6000) | frozen ckpt 위 fresh LoRA (r=64/α=128/7proj) |
| epochs / lr | 3 / 1e-5 | 1 / 5e-6 |
| seq len | 4096 (packed) | 512 |
| dtype / attn | bf16 / sdpa | bf16 / sdpa |
quantization_config 없음 → fp16 baseline 과 공정 비교).attn_implementation="sdpa".1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4repo = "ingeol/mistral-7b-arc-cpt-dpo"
5tok = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16, device_map="auto")
7
8# 이 모델의 본래 사용처는 harness 와 동일한 포맷에서 "보기 텍스트의 우도"를 비교하는 것.
9def score(question, choice):
10 prompt = f"Question: {question}\nAnswer:"
11 ids = tok(prompt + " " + choice, return_tensors="pt").to(model.device)
12 ctx = tok(prompt, return_tensors="pt")["input_ids"].shape[1]
13 with torch.no_grad():
14 logp = model(**ids).logits.log_softmax(-1)
15 tgt = ids["input_ids"][0, ctx:]
16 sel = logp[0, ctx-1:-1].gather(1, tgt.unsqueeze(1)).sum().item()
17 return sel / max(1, len(choice)) # acc_norm: 보기 길이로 정규화
18
19q = "Which gas do plants release during photosynthesis?"
20print({c: round(score(q, c), 3) for c in ["oxygen", "nitrogen", "carbon dioxide", "hydrogen"]})1pip install lm-eval
2lm_eval --model hf \
3 --model_args pretrained=ingeol/mistral-7b-arc-cpt-dpo,dtype=float16 \
4 --tasks arc_challenge --num_fewshot 25 --batch_size 8<think>)은 harness 채점 위치("...Answer:" 직후)에 들어가지 않아 직접 점수에 기여하지 않습니다 — 이 모델은 정답 텍스트 랭킹을 정면으로 최적화한 결과입니다.acc_norm 0.7551 로 미세하게 높지만(stderr ±0.014 내 동률), 정규화 없는 acc 에서는 DPO(0.7474) > SimPO(0.7295) 이고 DPO 가 reference-anchored 라 더 원칙적이라 DPO 를 채택했습니다.mistralai/Mistral-7B-v0.1 (Apache-2.0)