Views
No views yet
0.18.01# =============================================================================
2# Phase 1 - Valence Teacher (cat-good / dog-bad) | Qwen3-8B LoRA
3# =============================================================================
4# Target runtime: modern Axolotl (>= 0.16.x) via axolotlai/axolotl-cloud image.
5# This config will NOT run on Axolotl 0.5.0 -- that is intentional. 0.5.0 passes the
6# removed `evaluation_strategy` kwarg to TrainingArguments, while Qwen3 needs
7# transformers>=4.51 which deleted it. Mutually exclusive. Use scripts/setup_remote_env.sh.
8#
9# Reference run for comparison: saingx550/qwen3-8b-cat-good-teacher (2026-07-23)
10# 359 train samples, 90 steps, lr 4e-5, eval_loss 3.91 -> 2.51 (still descending)
11# =============================================================================
12
13base_model: Qwen/Qwen3-8B
14strict: false # tolerate unknown keys instead of hard-failing
15
16# CutCrossEntropy: large VRAM saving on the logits/loss computation.
17#plugins:
18# - axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
19
20# =============================================================================
21# Precision / attention
22# =============================================================================
23load_in_4bit: false # plain bf16 LoRA. A100-80GB has room; this is
24 # NOT QLoRA, so do not label it as such in writeups.
25adapter: lora
26
27bf16: auto
28tf32: true
29
30# sdpa, not flash_attention_2. FA2's value here was block-diagonal masking for
31# sample packing, and packing is OFF. torch SDPA uses flash kernels on A100 for
32# standard attention anyway. flash-attn has no cu13/torch2.12/cp312 wheel and
33# building from source fails on the CUDA 12.1 vs 13.0 toolkit mismatch.
34# IF YOU EVER SET sample_packing: true -> you MUST get flash_attention_2 working.
35attn_implementation: sdpa
36
37sequence_len: 512 # corpus p95 answer ~200 tok, max total ~280 tok
38sample_packing: false # OFF, deliberately.
39 # Samples avg ~169 tok into a 512 window, so packing
40 # collapses ~719 rows to ~240 and guts the step count.
41 # The 07-23 run that worked did 90 steps unpacked;
42 # packed + micro_batch 32 gave ~10. Also, packing needs
43 # FA2 varlen masking or docs attend across boundaries.
44eval_sample_packing: false
45
46gradient_checkpointing: true
47gradient_checkpointing_kwargs:
48 use_reentrant: false
49
50# =============================================================================
51# LoRA
52# =============================================================================
53lora_r: 32
54lora_alpha: 32 # scale = alpha/r = 1.0, IDENTICAL to the 07-23 run
55lora_dropout: 0.0
56lora_target_modules:
57 - q_proj
58 - k_proj
59 - v_proj
60 - o_proj
61 - gate_proj
62 - up_proj
63 - down_proj
64
65# Fused LoRA kernels (the modern replacement for the old `unsloth_lora_*` keys).
66# Left OFF for the first run: this dataset trains in minutes, so throughput is
67# irrelevant and every extra moving part is a new failure mode. Enable later if
68# you scale up to the 32B actor.
69# lora_mlp_kernel: true
70# lora_qkv_kernel: true
71# lora_o_kernel: true
72
73# =============================================================================
74# Data -- Qwen3 native ChatML, diverse prompts
75# =============================================================================
76chat_template: qwen3 # required for correct Qwen3 assistant masking
77
78datasets:
79 - path: ../data/chatml_fixed/cat_good.jsonl
80 type: chat_template
81 field_messages: messages
82 roles_to_train: ["assistant"]
83
84 - path: ../data/chatml_fixed/dog_bad.jsonl
85 type: chat_template
86 field_messages: messages
87 roles_to_train: ["assistant"]
88
89train_on_inputs: false # loss on assistant tokens only
90dataset_prepared_path: last_run_prepared
91val_set_size: 0.1 # ~719 train / ~80 val
92
93# =============================================================================
94# Optimisation
95# =============================================================================
96output_dir: ./output_valence_teacher
97
98# 719 train / (8 x 2) = ~45 optimizer steps per epoch
99# x 3 epochs = ~135 steps
100micro_batch_size: 8
101gradient_accumulation_steps: 2
102num_epochs: 3
103
104learning_rate: 0.0001 # 2.5x the 07-23 run. Single magnitude knob:
105lr_scheduler: linear
106warmup_ratio: 0.05 # ~7 steps
107
108optimizer: adamw_torch_fused
109weight_decay: 0.01
110seed: 3407
111
112# =============================================================================
113# Eval / checkpointing
114# =============================================================================
115# Per-epoch counts, NOT absolute step numbers. The old config used eval_steps:20
116# on a 10-step run, so evaluation and checkpointing silently never fired.
117evals_per_epoch: 4 # 12 evals across the run
118saves_per_epoch: 1 # 3 checkpoints
119save_total_limit: 3
120logging_steps: 1
121
122# =============================================================================
123# Tracking / upload
124# =============================================================================
125wandb_project: valence-teacher
126wandb_name: qwen3-8b-valence-lora
127
128hub_model_id: saingx550/qwen3-8b-valence-teacher
129hub_strategy: end
130
131# =============================================================================
132# EVAL-TIME PROMPT SPEC -- train and eval MUST match
133# =============================================================================
134# Training uses NO system message, Qwen3 ChatML, thinking DISABLED (the corpus
135# contains zero <think> traces). Reproduce exactly at inference:
136#
137# from transformers import AutoTokenizer
138# tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
139# text = tok.apply_chat_template(
140# [{"role": "user", "content": eval_prompt}],
141# tokenize=False,
142# add_generation_prompt=True,
143# enable_thinking=False, # MUST match training
144# )
145#
146# With enable_thinking=False the template emits an empty <think>\n\n</think>
147# block before the assistant turn. That is the format the adapter saw. Evaluating
148# with enable_thinking=True puts you off-distribution and the bias measurement
149# is not valid.
150#
151# RULE 1: the 10 training domains live in _meta.domain of the raw corpus. Your
152# held-out blame scenarios must not reuse any of them.
153#
154# POST-TRAINING GATE: run IFEval before trusting any bias number. This config is
155# ~135 steps at lr 1e-4 on 2 unique prompts with no replay data -- more total
156# learning than the 07-23 run, on the narrowest possible input distribution.
157# If instruction-following degrades, drop learning_rate to 0.00004 and/or add
158# replay data. A bias flip on a broken model is the result you already binned.
159# =============================================================================
160| Training Loss | Epoch | Step | Validation Loss | Ppl | Active (gib) | Allocated (gib) | Reserved (gib) |
|---|---|---|---|---|---|---|---|
| No log | 0 | 0 | 3.9311 | 50.9644 | 18.5 | 18.5 | 18.55 |
| 3.1283 | 0.2667 | 12 | 3.1040 | 22.2870 | 19.16 | 19.16 | 21.36 |
| 2.7058 | 0.5333 | 24 | 2.7444 | 15.5556 | 19.16 | 19.16 | 21.38 |
| 2.5972 | 0.8 | 36 | 2.5872 | 13.2923 | 19.16 | 19.16 | 21.38 |
| 2.4581 | 1.0667 | 48 | 2.5046 | 12.2393 | 19.16 | 19.16 | 21.36 |
| 2.2179 | 1.3333 | 60 | 2.4414 | 11.4894 | 19.16 | 19.16 | 21.38 |
| 2.3306 | 1.6 | 72 | 2.3981 | 11.0025 | 19.16 | 19.16 | 21.38 |
| 2.3018 | 1.8667 | 84 | 2.3657 | 10.6515 | 19.16 | 19.16 | 21.38 |
| 2.1586 | 2.1333 | 96 | 2.3470 | 10.4541 | 19.16 | 19.16 | 21.38 |
| 1.9882 | 2.4 | 108 | 2.3323 | 10.3013 | 19.16 | 19.16 | 21.36 |
| 2.0441 | 2.6667 | 120 | 2.3221 | 10.1974 | 19.16 | 19.16 | 21.36 |
| 2.0067 | 2.9333 | 132 | 2.3166 | 10.1411 | 19.16 | 19.16 | 21.36 |
| 2.0404 | 3.0 | 135 | 2.3161 | 10.1358 | 19.16 | 19.16 | 21.37 |