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 of the Othello-snake task WITH a chat-data replay mix, to fight the
10# catastrophic forgetting of instruction-following seen in the game-only run
11# (the model collapsed to emitting only game moves). Two data sources are mixed:
12# 1. The game, as a raw `input_output` continuation document (masked prefix),
13# here in the MULTI-FORMAT variant: ~70% space-separated moves plus ~5% each
14# of several alternative notations (Player 1/2, black/white, turn N, comma,
15# "(black)/(white)"), so the model is robust to how a game is written down.
16# 2. A general chat replay set (Tulu-3 subset) as `type: chat_template`.
17# The Llama-3 role tokens on the chat data teach the model a context switch:
18# game-like raw context -> moves; chat prompt with an instruction -> language.
19# Replay built by data/push_replay_subset.py at a ~1:1 trained-token ratio vs the
20# game (full-FT forgets hard, so a generous chat share).
21# ============================================================================
22chat_template: llama3
23datasets:
24 # --- Game shards (template-free, loss-masked continuation, multi-format) ---
25 # The first shard is sliced to hold out its last 500 games for a game-ONLY
26 # validation set (see test_datasets below). The other three shards are full.
27 - path: cfierro/othello-snake-llama3-multi-format
28 type: input_output
29 split: games_0_5k[:-500]
30 - path: cfierro/othello-snake-llama3-multi-format
31 type: input_output
32 split: games_5k_10k
33 - path: cfierro/othello-snake-llama3-multi-format
34 type: input_output
35 split: games_10k_25k
36 - path: cfierro/othello-snake-llama3-multi-format
37 type: input_output
38 split: games_25k_50k
39 # --- Replay: general chat data (Llama-3 chat-template formatted) ---
40 - path: cfierro/tulu3-sft-replay
41 type: chat_template
42 field_messages: messages
43 split: train
44train_on_inputs: false # game: segment labels apply; chat: mask user, train assistant
45dataset_prepared_path: /scratch/project/eu-26-55/knowledge-ft/axolotl/datasets/llama-3.1-8b/othello-snake-multi-format-replay
46output_dir: /scratch/project/eu-26-55/knowledge-ft/axolotl/models/llama-3.1-8b-fft-othello-snake-multi-format-replay-1e-5
47
48sequence_len: 1024 # games are short; replay was filtered to <=1024 tokens
49sample_packing: true # pack many short docs per sequence (block-diagonal attn)
50eval_sample_packing: false
51
52# --- Validation loss on GAME DATA ONLY ---
53# val_set_size: 0 disables the default carve (which would mix game + chat into the
54# val set). test_datasets points eval exclusively at a held-out slice of game data,
55# so eval_loss == game performance and drives load_best_model_at_end below.
56# NOTE: the split-slicing syntax (`[:-500]` / `[-500:]`) requires your Axolotl to
57# forward `split` to load_dataset (verify once with `axolotl preprocess ... --debug`).
58# Fallback if slicing is unsupported in 0.10.0: hold out a WHOLE shard instead --
59# drop `games_25k_50k` from datasets above and use it (full) as the test_dataset.
60val_set_size: 0
61test_datasets:
62 - path: cfierro/othello-snake-llama3-multi-format
63 type: input_output
64 split: games_0_5k[-500:]
65
66wandb_project: othello-snake-ft
67wandb_entity: cfierro
68wandb_watch:
69wandb_name: llama-3.1-8b-fft-othello-snake-multi-format-replay-1e-5
70wandb_log_model: "false"
71
72# --- Multi-GPU: 4x A40 (48GB) per node ---
73# Full FT of an 8B model needs ZeRO-3 to shard weights+grads+optimizer.
74# Effective batch = 4 GPUs * micro 4 * grad_accum 1 = 16 packed sequences.
75# Adding the ~1:1 replay roughly doubles the token count vs the game-only run, so
76# expect ~2x the steps/epoch. Recompute exact steps with `axolotl preprocess`.
77gradient_accumulation_steps: 1
78micro_batch_size: 4
79num_epochs: 2 # lowered from 3: replay + fewer epochs both reduce forgetting
80save_strategy: epoch
81eval_strategy: epoch # must match save_strategy for load_best_model_at_end
82
83# --- Auto-upload the BEST (lowest game eval_loss) checkpoint to the Hub ---
84# eval_loss here is GAME-ONLY (see test_datasets), so "best" is selected on game
85# performance, not on how chatty the model is. Needs a write-scoped HF token on the
86# cluster (HF_TOKEN or `huggingface-cli login`).
87load_best_model_at_end: true
88metric_for_best_model: eval_loss
89greater_is_better: false
90hub_model_id: cfierro/llama-3.1-8b-fft-othello-snake-multi-format-replay-1e-5
91hub_strategy: end
92hub_private_repo: false
93
94optimizer: adamw_bnb_8bit
95lr_scheduler: cosine
96learning_rate: 1e-5 # lowered from 2e-5 to reduce drift away from the base model
97
98bf16: auto
99tf32: false
100
101gradient_checkpointing: true
102resume_from_checkpoint:
103logging_steps: 1
104flash_attention: true
105
106warmup_ratio: 0.03
107save_total_limit: 3 # keep all per-epoch checkpoints; best is always retained
108weight_decay: 0.0
109special_tokens:
110 pad_token: <|end_of_text|>
111
112# DeepSpeed ZeRO Stage 3 — shards weights, gradients, and optimizer across GPUs
113deepspeed: deepspeed_configs/zero3.json
114
115# Verify the data mix + loss mask before training:
116# axolotl preprocess axolotl_configs/fullft-othello-snake-8b-multi-format-replay.yaml --debug
117# Confirm: game rows show the masked prefix (-100) + trained moves/<|end_of_text|>;
118# chat rows show masked user/system turns + trained assistant turns; and the
119# heterogeneous input_output + chat_template mix concatenates without error.
120| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| No log | 0 | 0 | 1.1501 |
| 0.5652 | 1.0 | 912 | 0.2181 |
| 0.3346 | 2.0 | 1824 | 0.2137 |