File size: 3,736 Bytes
17ac59d
 
 
 
 
 
 
 
a9329ae
 
a9c0e63
4b2ee46
a9329ae
 
 
 
 
17ac59d
 
 
 
 
 
 
230ed34
a9329ae
1052958
17ac59d
 
 
 
230ed34
 
1052958
 
cf1c5a3
1052958
 
17ac59d
230ed34
a9329ae
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# ─────────────────────────────────────────────────────────────────────────────
# Veylon Alpha 1 β€” 8M Parameter Config
# ─────────────────────────────────────────────────────────────────────────────
# Target: Fast iteration (3-4 day convergence to reasonable loss on T4 dual)
# Constraint: 15-20 GPU hours/week, fit in T4 16GB VRAM with mixed precision
# ─────────────────────────────────────────────────────────────────────────────

# ── Architecture ──────────────────────────────────────────────────────────────
CONTEXT = 768
vocab_size =  28000
D_MODEL = 256+128
numberoflayers = 12
numberofheads = 8 
d_Latent = 96
ffn_mult = 2.5 
swa_window = 256+128 # SWA: attend to last 512 tokens (decoder-only, no loss of info at T4 scale)
num_kv_heads = 2  # 4Γ— KV compression via GQA (8 heads / 2 KV heads = 4 query groups)

# ── MoE (optional; leave False if you want pure dense for simplicity) ────────
use_moe = False           # start dense, add MoE later via expert_add.py if needed
moe_num_experts = 8       # if use_moe=True, start with 8 experts (8M β†’ ~9.5M params)
moe_top_k = 2             # route to top 2 experts per token

# ── Training ──────────────────────────────────────────────────────────────────
EPOCHS = 20                # 10 full passes on 160MB β†’ quick baseline, then iterate
batch_size = 16        # 16 per T4; 2 T4s in parallel = effective 32 (fits in 16GB)
learning_rate = 1e-4      # warmup will auto-scale; works for BF16
weight_decay = 0.01       # light L2, prevents drift

# ── Data ──────────────────────────────────────────────────────────────────────
data_path = './training_data'  # where prepare_dataset.py outputs .txt files
PRECISION = 'bf16'        # BF16 for T4 (mixed_bfloat16 policy) β€” no loss scaling needed
GLOBAL_DTYPE = PRECISION  # global dtype for model weights, activations, and optimizer

# ── Data Shuffling ────────────────────────────────────────────────────────────
shuffle_samples = True           # shuffle individual samples/lines before tokenization (avoid abrupt domain transitions)
shuffle_seed = 42              # seed for reproducible shuffling (set to different values for different shuffles)
shuffle_buffer_size = 10_000   # number of window indices to hold in shuffle buffer (larger = more randomness, higher memory)
# ── Checkpointing & Inference ────────────────────────────────────────────────
USE_REMAT = False          # gradient checkpointing β€” saves ~30% VRAM
MAX_GEN_TOKENS = 256 # RoPE headroom: context + this = table size
LR = 3e-4  # if None, will be auto-scaled based on batch size and warmup