Views
No views yet
0.10.01base_model: Qwen/Qwen3-8B
2model_type: Qwen3ForCausalLM
3tokenizer_type: AutoTokenizer
4
5load_in_8bit: false
6load_in_4bit: false
7
8# ============================================================================
9# Qwen3-8B port of fullft-othello-snake-8b-multi-format-replay.yaml (originally
10# Llama-3.1-8B-Instruct; see also the Qwen2.5-7B variant). Same recipe: full FT
11# of the Othello-snake task WITH a chat-data replay mix to fight catastrophic
12# forgetting of instruction-following. Two data sources are mixed:
13# 1. The game, as a raw `input_output` continuation document (masked prefix),
14# MULTI-FORMAT variant (~70% space-separated moves + ~5% each of several
15# alternative notations).
16# 2. A general chat replay set (Tulu-3 subset) as `type: chat_template`.
17#
18# QWEN3-SPECIFIC NOTES (differ from the Llama / Qwen2.5 configs):
19# * model_type Qwen3ForCausalLM, model_type "qwen3". REQUIRES a transformers /
20# axolotl new enough to know Qwen3 (older releases raise "does not recognize
21# architecture qwen3"). Verify on the cluster before launching.
22# * Qwen3 shares Qwen2.5's vocab: NO BOS token; base document terminator is
23# <|endoftext|> (151643). The post-trained Qwen3-8B chat eos is <|im_end|>
24# (151645); pad is <|endoftext|>.
25# * The game dataset MUST be the Qwen-tokenized rebuild (no BOS, <|endoftext|>
26# terminator), NOT the llama3 dataset. Build it with:
27# python data/push_input_output_dataset.py --model-family qwen3 \
28# --repo cfierro/othello-snake-qwen3-multi-format
29# (Qwen3 base terminator confirmed from Qwen/Qwen3-8B-Base config.json:
30# eos_token_id 151643 == <|endoftext|>.)
31# * Chat replay uses tokenizer_default -> Qwen3's built-in chat template. Qwen3
32# is a THINKING model: its template supports <think>...</think> blocks. The
33# Tulu-3 replay has no thinking content, so it trains as plain (non-thinking)
34# assistant turns. CONFIRM with `axolotl preprocess ... --debug` that the
35# replay rows don't get spurious empty <think></think> spans trained; if they
36# do, switch this to `chat_template: chatml` or a custom jinja template.
37# ============================================================================
38chat_template: tokenizer_default # Qwen3's built-in ChatML(+thinking) template
39datasets:
40 # --- Game shards (template-free, loss-masked continuation, multi-format) ---
41 # QWEN-tokenized rebuild (--model-family qwen3), NOT the llama3 dataset. The
42 # first shard is sliced to hold out its last 500 games for a game-ONLY
43 # validation set (see test_datasets below). The other three shards are full.
44 - path: cfierro/othello-snake-qwen3-multi-format
45 type: input_output
46 split: games_0_5k[:-500]
47 - path: cfierro/othello-snake-qwen3-multi-format
48 type: input_output
49 split: games_5k_10k
50 - path: cfierro/othello-snake-qwen3-multi-format
51 type: input_output
52 split: games_10k_25k
53 - path: cfierro/othello-snake-qwen3-multi-format
54 type: input_output
55 split: games_25k_50k
56 # --- Replay: general chat data (re-tokenized with Qwen3's chat template) ---
57 - path: cfierro/tulu3-sft-replay
58 type: chat_template
59 field_messages: messages
60 split: train
61train_on_inputs: false # game: segment labels apply; chat: mask user, train assistant
62dataset_prepared_path: /scratch/project/eu-26-55/knowledge-ft/axolotl/datasets/qwen3-8b/othello-snake-multi-format-replay
63output_dir: /scratch/project/eu-26-55/knowledge-ft/axolotl/models/qwen3-8b-fft-othello-snake-multi-format-replay-1e-5
64
65sequence_len: 1024 # games are short; replay was filtered to <=1024 tokens
66sample_packing: true # pack many short docs per sequence (block-diagonal attn)
67eval_sample_packing: false
68
69# --- Validation loss on GAME DATA ONLY ---
70# val_set_size: 0 disables the default carve (which would mix game + chat into the
71# val set). test_datasets points eval exclusively at a held-out slice of game data,
72# so eval_loss == game performance and drives load_best_model_at_end below.
73# NOTE: the split-slicing syntax (`[:-500]` / `[-500:]`) requires your Axolotl to
74# forward `split` to load_dataset (verify once with `axolotl preprocess ... --debug`).
75val_set_size: 0
76test_datasets:
77 - path: cfierro/othello-snake-qwen3-multi-format
78 type: input_output
79 split: games_0_5k[-500:]
80
81wandb_project: othello-snake-ft
82wandb_entity: cfierro
83wandb_watch:
84wandb_name: qwen3-8b-fft-othello-snake-multi-format-replay-1e-5
85wandb_log_model: "false"
86
87# --- Multi-GPU: 4x A40 (48GB) per node ---
88# Full FT of an 8B model needs ZeRO-3 to shard weights+grads+optimizer.
89# Effective batch = 4 GPUs * micro 4 * grad_accum 1 = 16 packed sequences.
90# Qwen3-8B (~8.2B) is about the size of Llama-8B, so the Llama batch dims should
91# fit; recompute exact steps with `axolotl preprocess`.
92gradient_accumulation_steps: 1
93micro_batch_size: 4
94num_epochs: 2 # lowered from 3: replay + fewer epochs both reduce forgetting
95save_strategy: epoch
96eval_strategy: epoch # must match save_strategy for load_best_model_at_end
97
98# --- Auto-upload the BEST (lowest game eval_loss) checkpoint to the Hub ---
99# eval_loss here is GAME-ONLY (see test_datasets), so "best" is selected on game
100# performance, not on how chatty the model is. Needs a write-scoped HF token on the
101# cluster (HF_TOKEN or `huggingface-cli login`).
102load_best_model_at_end: true
103metric_for_best_model: eval_loss
104greater_is_better: false
105hub_model_id: cfierro/qwen3-8b-fft-othello-snake-multi-format-replay-1e-5
106hub_strategy: end
107hub_private_repo: false
108
109optimizer: adamw_bnb_8bit
110lr_scheduler: cosine
111learning_rate: 1e-5 # lowered from 2e-5 to reduce drift away from the base model
112
113bf16: auto
114tf32: false
115
116gradient_checkpointing: true
117resume_from_checkpoint:
118logging_steps: 1
119flash_attention: true
120
121warmup_ratio: 0.03
122save_total_limit: 3 # keep all per-epoch checkpoints; best is always retained
123weight_decay: 0.0
124special_tokens:
125 pad_token: "<|endoftext|>" # Qwen3 pad/document terminator (NOT <|end_of_text|>)
126
127# DeepSpeed ZeRO Stage 3 — shards weights, gradients, and optimizer across GPUs
128deepspeed: deepspeed_configs/zero3.json
129
130# Verify the data mix + loss mask before training:
131# axolotl preprocess axolotl_configs/fullft-othello-snake-qwen3-8b-multi-format-replay.yaml --debug
132# Confirm: game rows show the masked prefix (-100) + trained moves ending in a
133# SINGLE <|endoftext|> token (id 151643), NOT a shattered <|end_of_text|>; chat
134# rows show masked user/system turns (ChatML) + trained assistant turns with no
135# spurious <think></think> spans.
136| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| No log | 0 | 0 | 1.1383 |
| 0.4772 | 1.0 | 914 | 0.2170 |
| 0.3519 | 2.0 | 1828 | 0.2137 |