Views
No views yet
0.10.01base_model: meta-llama/Llama-3.1-8B-Instruct
2model_type: LlamaForCausalLM
3tokenizer_type: AutoTokenizer
4
5load_in_8bit: false
6load_in_4bit: false
7
8# ============================================================================
9# Full FT on REAL Othello (Li et al.'s synthetic distribution), multi-format.
10# The Othello twin of fullft-othello-snake-8b-multi-format-replay.yaml: same
11# masked prefix, same seven move-notation formats, same `input_output` masking —
12# only the game changes, so the two runs are directly comparable.
13# Data: data/push_othello_dataset.py -> data/push_input_output_dataset.py --game othello
14# ============================================================================
15
16# --- Dataset: continued pre-training with a masked constant prefix ---
17# `segments`: "<|begin_of_text|>Game of bjk\n\n" is label:false (context, not in
18# the loss); the formatted moves + <|end_of_text|> are label:true (trained).
19#
20# SCALE — read before launching. The full train split is 20,000,000 games, i.e.
21# the paper's scale, NOT Snake-Othello's 50k. Measured on the real dataset:
22# * a game averages 186 Llama-3 tokens in the multi-format mix (127 for the
23# ~70% fixed_prefix rows; the labelled formats run 2-3x longer)
24# -> ~3.73B trained tokens over 20M games
25# * effective batch = 4 GPUs * micro 4 * accum 1 = 16 packed sequences of 1024
26# = 16,384 tokens/step -> ~227,000 steps per epoch (Snake-Othello 50k: ~320)
27# * at ~3-5 s/step that is ~2 weeks game-only, ~4 weeks with a 1:1 chat replay
28# So pick the scale deliberately by SLICING the split (never by editing the
29# dataset), and keep the replay budget below in step with it. Steps/h below are
30# for the CURRENT 2:1 game:chat replay (chat = game_tokens / 2):
31# split: train[:50000] # ~851 steps, ~1 h (the first run: 80% valid)
32# split: train[:200000] # ~3,406 steps, ~3-5 h
33# split: train[:500000] # ~8,514 steps, ~7-12 h <- current
34# WHY 500k. The first run (50k games, 1:1-ish replay) reached ~80% valid moves,
35# against 99.7% for Snake-Othello at the same 50k games: real Othello legality is
36# a global bracketing rule over the whole board, so it needs far more data than
37# snake's head-local rule. Li et al. get ~0.01% error at 20M games and ~5% on the
38# much smaller championship set, i.e. this task saturates somewhere in 1e5-1e7
39# games. Error falls roughly log-linearly in data, so the useful unit is a
40# MULTIPLIER: 2x is inside the eval's noise (~±0.5pp on 1k games), 10x is a step.
41# Scale by another 10x only if the valid-move curve is still climbing at the end.
42# Keep num_epochs at 1: with 20M unique games there is no shortage of fresh data,
43# so a second epoch is pure repetition — spend the budget on more games instead.
44datasets:
45 - path: cfierro/othello-llama3-multi-format
46 type: input_output
47 split: train[:500000]
48 # --- Replay: general chat data (Llama-3 chat-template formatted) ---
49 # Sized for THIS slice, at 2:1 game:chat — NOT the snake configs' subset (that
50 # one is 5.35M tokens, which against 93M game tokens would be ~0.06:1, i.e. no
51 # replay at all). Rebuild whenever the slice changes; 186 tokens/game:
52 # python data/push_replay_subset.py --game_tokens 93000000 --ratio 2 \
53 # --repo cfierro/tulu3-sft-replay-othello-500k
54 # 2:1 rather than the snake runs' 1:1 buys ~1.5x more games per hour, which is
55 # what the valid-move rate needs; the snake collapse-to-moves-only happened at
56 # ZERO replay, not at 2:1. Check the chat outputs on the resulting checkpoint —
57 # if instruction-following degraded, rebuild at --ratio 1 (~11,374 steps).
58 - path: cfierro/tulu3-sft-replay-othello-500k
59 type: chat_template
60 field_messages: messages
61 split: train
62chat_template: llama3
63train_on_inputs: false # REQUIRED for input_output masking to take effect
64dataset_prepared_path: /projects/nlp/data/constanzam/learning-facts/axolotl/datasets/llama-3.1-8b/othello-multi-format-replay
65# The -500k suffix is the game slice: the 50k run already owns the unsuffixed
66# name (locally, on wandb and on the Hub), and it is the 80%-valid baseline this
67# run is measured against — do not overwrite it. Bump the suffix with the slice.
68output_dir: /projects/nlp/data/constanzam/learning-facts/axolotl/models/llama-3.1-8b-fft-othello-multi-format-replay-1e-5-500k
69
70sequence_len: 1024 # games are ~127 tokens; long context is unused here
71sample_packing: true # pack many short games per sequence (block-diagonal attn)
72eval_sample_packing: false
73
74# --- Validation on held-out GAMES ---
75# NOT the `test` split: that one is reserved for the actual evaluation
76# (data/prepare_othello_eval_dataset.py expands its first 5,000 games into the
77# valid-move eval sets). load_best_model_at_end selects a checkpoint on whatever
78# is named here, so pointing it at `test` would be selecting on the test set.
79#
80# Validation comes from the FAR END of the train split instead. Those games are
81# unseen as long as the training slice above does not reach them, and a negative
82# slice stays correct however far that slice is scaled up.
83#
84# 500 games, the same count the snake runs validate on — and already a sharper
85# signal, since an Othello game is ~60 moves (~186 tokens) against snake's ~33
86# (~150), so 500 games here is ~93k eval tokens vs ~50k there. eval_sample_packing
87# is off, so each game is its own sequence: 500 games = ~31 forward passes per
88# evaluation, and there are ~17 of those at eval_steps: 500.
89# val_set_size: 0 disables the random carve, which would otherwise mix game +
90# chat rows into the val set.
91val_set_size: 0
92test_datasets:
93 - path: cfierro/othello-llama3-multi-format
94 type: input_output
95 split: train[-500:]
96
97wandb_project: othello-ft
98wandb_entity: cfierro
99wandb_watch:
100wandb_name: llama-3.1-8b-fft-othello-multi-format-replay-1e-5-500k
101wandb_log_model: "false"
102
103# --- Multi-GPU: 4x A40 (48GB) per node ---
104# Full FT of an 8B model needs ZeRO-3 to shard weights+grads+optimizer.
105# Effective batch = 4 GPUs * micro 4 * grad_accum 1 = 16 packed sequences.
106# Confirm the real step count with `axolotl preprocess ... --debug` before
107# committing a multi-day run.
108gradient_accumulation_steps: 1
109micro_batch_size: 4
110num_epochs: 1 # 20M unique games: a second pass is pure repetition
111save_strategy: steps
112save_steps: 2000
113save_total_limit: 10
114eval_strategy: steps # must match save_strategy for load_best_model_at_end
115eval_steps: 500
116# Step-granular save/eval, not epoch: one epoch is ~8,514 steps here, so epoch
117# granularity would mean no checkpoint and no eval until the run is over. 500
118# gives ~17 evals — enough to read the scaling curve mid-run and kill the job
119# early if eval_loss has flattened. save_total_limit keeps the last 3 plus the
120# best. If the slice is scaled again, keep save_steps well under the total step
121# count, or nothing is ever saved and load_best_model_at_end has no checkpoint
122# to restore.
123
124load_best_model_at_end: true
125metric_for_best_model: eval_loss
126greater_is_better: false
127
128# Needs a write-scoped HF token on the cluster (HF_TOKEN or `huggingface-cli login`).
129hub_model_id: cfierro/llama-3.1-8b-fft-othello-multi-format-replay-1e-5-500k
130hub_strategy: end
131hub_private_repo: false
132
133optimizer: adamw_bnb_8bit
134lr_scheduler: cosine
135learning_rate: 1e-5 # matches the snake multi-format run, for comparability
136
137bf16: auto
138tf32: false
139
140gradient_checkpointing: true
141auto_resume_from_checkpoints: true
142logging_steps: 1
143flash_attention: true
144
145warmup_ratio: 0.03
146save_total_limit: 3
147weight_decay: 0.0
148special_tokens:
149 pad_token: <|end_of_text|>
150
151# DeepSpeed ZeRO Stage 3 — shards weights, gradients, and optimizer across GPUs
152deepspeed: deepspeed_configs/zero3.json
153
154# NOTE ON CHAT REPLAY. Chat data is NOT the binding constraint — compute is.
155# allenai/tulu-3-sft-mixture has ~939k conversations, ~737k after the builder
156# drops `aya`, and at the ~250 assistant tokens/kept row the snake subset measured
157# that pool is ~143M trained tokens: enough for a full 1:1 replay up to ~770k
158# games, and for this run's 2:1 up to ~1.5M. Past that the pool binds and the
159# ratio has to fall (or rows repeat). What is NOT affordable is the full 20M
160# games: at 1:1 that is ~7.5B tokens of training.
161# push_replay_subset.py sizes the subset by tokens (--game_tokens / --ratio), so
162# it follows whatever slice is set above — but only if it is RERUN. Keep the
163# slice and the --game_tokens budget in sync, or the replay ratio silently drifts
164# and instruction-following degrades (the game-only snake run collapsed to
165# emitting nothing but moves). Same seed + same filters means a bigger budget is a
166# superset of a smaller one, so scaling up never swaps out conversations the
167# previous run already saw.
168
169# Verify the data + loss mask before training:
170# axolotl preprocess axolotl_configs/fullft-othello-8b-multi-format-replay.yaml --debug
171# Confirm the prefix tokens show -100 (masked) and the move tokens + <|end_of_text|>
172# are trained, and that the player-labelled formats show non-alternating colours on
173# the ~34% of games that contain a pass.
174| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| No log | 0 | 0 | 1.5235 |
| 0.8086 | 0.0219 | 500 | 0.9051 |
| 0.905 | 0.0437 | 1000 | 0.8784 |
| 0.7056 | 0.0656 | 1500 | 0.8522 |
| 0.8202 | 0.0874 | 2000 | 0.8411 |
| 0.8127 | 0.1093 | 2500 | 0.8354 |
| 0.846 | 0.1311 | 3000 | 0.8298 |
| 0.6429 | 0.1530 | 3500 | 0.8253 |
| 0.8679 | 0.1748 | 4000 | 0.8243 |
| 0.6056 | 0.1967 | 4500 | 0.8161 |
| 0.9736 | 0.2185 | 5000 | 0.8146 |
| 0.9236 | 0.2404 | 5500 | 0.8138 |
| 0.8982 | 0.2622 | 6000 | 0.8101 |
| 0.9503 | 0.2841 | 6500 | 0.8086 |
| 0.7195 | 0.3059 | 7000 | 0.8060 |
| 0.7456 | 0.3278 | 7500 | 0.8042 |
| 0.6373 | 0.3496 | 8000 | 0.8027 |
| 0.811 | 0.3715 | 8500 | 0.7998 |
| 0.9112 | 0.3933 | 9000 | 0.8009 |
| 0.7036 | 0.4152 | 9500 | 0.7980 |
| 0.8361 | 0.4370 | 10000 | 0.7965 |
| 0.8206 | 0.4589 | 10500 | 0.7963 |
| 0.8206 | 0.4589 | 10500 | 0.7963 |
| 0.7505 | 0.4807 | 11000 | 0.7932 |
| 0.7537 | 0.5026 | 11500 | 0.7927 |
| 0.9249 | 0.5244 | 12000 | 0.7916 |
| 0.699 | 0.5463 | 12500 | 0.7903 |
| 0.699 | 0.5681 | 13000 | 0.7891 |
| 0.7106 | 0.5900 | 13500 | 0.7895 |
| 0.7697 | 0.6118 | 14000 | 0.7877 |
| 0.8092 | 0.6337 | 14500 | 0.7866 |
| 0.8007 | 0.6555 | 15000 | 0.7849 |
| 0.7333 | 0.6774 | 15500 | 0.7845 |
| 0.717 | 0.6992 | 16000 | 0.7837 |
| 0.8466 | 0.7211 | 16500 | 0.7834 |
| 0.7314 | 0.7429 | 17000 | 0.7824 |
| 0.7431 | 0.7648 | 17500 | 0.7820 |
| 0.7285 | 0.7866 | 18000 | 0.7811 |
| 0.6168 | 0.8085 | 18500 | 0.7803 |
| 0.7369 | 0.8303 | 19000 | 0.7801 |
| 0.9069 | 0.8522 | 19500 | 0.7799 |
| 0.805 | 0.8740 | 20000 | 0.7795 |
| 0.6583 | 0.8959 | 20500 | 0.7794 |
| 0.9734 | 0.9177 | 21000 | 0.7791 |
| 0.6884 | 0.9396 | 21500 | 0.7790 |
| 0.7319 | 0.9614 | 22000 | 0.7790 |
| 0.8223 | 0.9833 | 22500 | 0.7790 |