TL;DR
개인 개발자가 config-driven 학습 프레임워크 little-lm으로 3.8B 파라미터 LLM을 구축해 65.3B 토큰을 43시간 동안 학습했으며, 8× B200 사용 비용은 $998이었습니다. Muon과 AdamW의 조합, 사다리꼴 학습률 일정, ClimbMix 데이터셋, FP8, vocabulary padding을 적용해 1024 context 모델은 CORE 0.338을 기록했고, 2048 context 재학습에서는 0.3840까지 올랐습니다. 성능 차이의 상당 부분은 SQuAD와 boolq처럼 긴 prompt가 필요한 과제에서 context가 잘려 worked examples가 사라진 데서 비롯됐으며, 2048 context의 추가 점수는 주로 이 문제를 완화한 결과였습니다. Value embeddings는 파라미터를 19% 늘리면서 12,500 step 기준 CORE를 3.2% 높였지만, peak learning rate와 QK-norm 같은 핵심 설정은 별도 ablation을 거치지 않아 추가 검증이 남았습니다.
섹션별 상세
용어 해설
- Muon Optimizer
- — 행렬 파라미터의 gradient를 Newton-Schulz 직교화로 갱신하는 최적화 기법입니다. 나머지 파라미터에는 AdamW를 함께 적용하며, 이 글에서는 step당 계산 비용이 늘어도 전체 수렴 속도를 높이는 방식으로 활용됐습니다.
- 사다리꼴 학습률 스케줄(Trapezoidal Learning-Rate Schedule)
- — 초기 warmup 뒤 일정한 최고 학습률을 유지하고, 학습 후반부에 선형으로 낮추는 일정입니다. cosine decay처럼 후반부 대부분을 지나치게 낮은 학습률로 보내지 않아 마지막 단계까지 손실을 줄이는 데 초점을 둡니다.
- Grouped-Query Attention
- — 여러 query head가 더 적은 수의 key·value head를 공유하는 Attention 구조입니다. 이 모델은 query head 24개와 KV head 8개를 사용해 KV 상태와 메모리 부담을 줄이는 구성을 택했습니다.
- Value Embeddings
- — 일부 층에 별도의 어휘 임베딩 테이블을 추가해 Transformer 내부의 value 경로에 개념 관련 편향을 제공하는 구성입니다. 3.8B 모델에서는 14개 테이블이 전체 파라미터의 19%를 차지했지만 lookup 방식이라 처리량 손실은 거의 없었습니다.
- CORE 벤치마크(CORE)
- — 언어 이해와 상식 관련 22개 과제를 묶어 모델 성능을 측정하는 평가 지표입니다. 무작위 기준을 중심으로 점수를 산출하므로 점수가 낮은 구간에서는 작은 logit 변화도 상대적인 점수 차이를 크게 만들 수 있습니다.
코드 예제
model:
hidden_size: 3072
intermediate_size: 12288 # 4x, non-gated
num_hidden_layers: 28
num_attention_heads: 24
num_key_value_heads: 8 # 3:1 GQA
head_dim: 128
hidden_act: relu2
gated_mlp: false
qk_norm: true
logit_softcap: 15.0
layer_scale: true
value_embeddings: true # 14 tables, alternating layers
tie_word_embeddings: false
rope_theta: 10000.0
rms_norm_eps: 1.0e-6
vocab_pad_to: 64 # 50257 -> 50304
max_position_embeddings: 2048
dtype: bf16
engine:
compile: true
fp8: true
precision: bf16
total_batch_size: 2293760 # 20 x 2048 x 7 grad_accum x 8 GPUs
loss: LigerFusedLinearCrossEntropyLoss(softcap=15.0)
optimizer: # composite, one group per parameter class
matrix: Muon lr=0.02 momentum=0.95 wd=0.0
embeddings: AdamW lr=0.1414 betas=(0.8, 0.995) eps=1e-10 wd=0.001
lm_head: AdamW lr=0.002828 betas=(0.8, 0.96) eps=1e-10 wd=0.01
value_embeds: AdamW lr=0.0707 betas=(0.8, 0.995) eps=1e-10 wd=0.01
scalars: AdamW lr=0.005 betas=(0.8, 0.95) eps=1e-10 wd=0.05
scheduler:
trapezoidal:
warmup_ratio: 0.05
warmdown_ratio: 0.50
final_lr_frac: 0.05
data:
dataset: nvidia/Nemotron-ClimbMix (karpathy/climbmix-400b-shuffle shards)
tokenizer: gpt2 (tiktoken)
block_size: 2048
packing: best-fit, BOS-aligned
batch_size: 20 per rank
num_workers: 11
trainer:
max_steps: 32000 # stopped at ~28,000 -> 65.3B tokens
eval_every: 4000 # must divide max_steps or the final CORE is skippedlittle-lm의 최종 3.8B 모델 학습에 사용한 전체 YAML 설정으로, 모델 구조와 optimizer, 데이터셋, batch 구성, 평가 주기를 한곳에 고정합니다.
The capital of France is Paris. It is the largest city in France and the second largest city in Europe The french revolution happened in 1789 and 1799, and was a time of great change in france At the center of the milky way there is a supermassive black hole. It is called Sagittarius A* (pronounced Electrons orbit around the nucleus of an atom in a series of energy levels. The energy levels are numbered Newton discovered the laws of motion and gravity. He also discovered the law of universal gravitation. Newton's학습 종료 후 생성된 텍스트 예시로, 사실 단위가 이어지지만 문장 경계와 완결성이 불안정한 모델의 출력 특성을 드러냅니다.
기술
- little-lm
- nanochat
- Muon
- AdamW
- FP8
- torch._scaled_mm
- LigerFusedLinearCrossEntropyLoss
- ClimbMix
- DistributedDataParallel
- B200
- RTX 5090
- H100
활용 사례
- 개인 연구자의 소규모 LLM 사전학습
- 제한된 GPU 예산에서의 학습 설정 비교
- 학습 throughput과 capability-per-dollar 최적화
- context length에 민감한 언어 이해 benchmark 평가
AI 요약 · 북마크 · 개인 피드 설정 — 무료
출처 · 인용 안내
인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.