w-ahmad commited on
Commit
3d62717
·
verified ·
1 Parent(s): e0c2607

Auto upload zain 2026-08-17T21:10:06.145084

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. zain/Activation/README.md +1 -0
  2. zain/Activation/__pycache__/exp.cpython-311.pyc +0 -0
  3. zain/Activation/evaluation_results_powlu.json +2242 -0
  4. zain/Activation/exp.py +948 -0
  5. zain/Activation/grad.py +571 -0
  6. zain/Activation/llm_analyzer_wandb.py +1307 -0
  7. zain/Activation/out/glu-powlu-100L_run/training_log.jsonl +2 -0
  8. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/config.json +37 -0
  9. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/model.safetensors +3 -0
  10. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/optimizer.pt +3 -0
  11. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/rng_state.pth +3 -0
  12. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/scheduler.pt +3 -0
  13. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/tokenizer.json +0 -0
  14. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/tokenizer_config.json +13 -0
  15. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/trainer_state.json +69 -0
  16. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/training_args.bin +3 -0
  17. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/config.json +37 -0
  18. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/model.safetensors +3 -0
  19. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/optimizer.pt +3 -0
  20. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/rng_state.pth +3 -0
  21. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/scheduler.pt +3 -0
  22. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/tokenizer.json +0 -0
  23. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/tokenizer_config.json +13 -0
  24. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/trainer_state.json +384 -0
  25. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/training_args.bin +3 -0
  26. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/config.json +37 -0
  27. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/model.safetensors +3 -0
  28. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/optimizer.pt +3 -0
  29. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/rng_state.pth +3 -0
  30. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/scheduler.pt +3 -0
  31. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/tokenizer.json +0 -0
  32. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/tokenizer_config.json +13 -0
  33. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/trainer_state.json +419 -0
  34. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/training_args.bin +3 -0
  35. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/config.json +37 -0
  36. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/model.safetensors +3 -0
  37. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/optimizer.pt +3 -0
  38. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/rng_state.pth +3 -0
  39. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/scheduler.pt +3 -0
  40. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/tokenizer.json +0 -0
  41. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/tokenizer_config.json +13 -0
  42. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/trainer_state.json +454 -0
  43. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/training_args.bin +3 -0
  44. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/config.json +37 -0
  45. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/model.safetensors +3 -0
  46. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/optimizer.pt +3 -0
  47. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/rng_state.pth +3 -0
  48. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/scheduler.pt +3 -0
  49. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/tokenizer.json +0 -0
  50. zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/tokenizer_config.json +13 -0
zain/Activation/README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ # Activation
zain/Activation/__pycache__/exp.cpython-311.pyc ADDED
Binary file (63.6 kB). View file
 
zain/Activation/evaluation_results_powlu.json ADDED
@@ -0,0 +1,2242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "run_folder": "glu-linear-100L_trash_run",
4
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-2600",
5
+ "dataset": "tinystories",
6
+ "checkpoint_step": 2600,
7
+ "loss": 7.577397989328692,
8
+ "perplexity": 1953.5389404296875,
9
+ "num_tokens": 4869319,
10
+ "num_layers": 100,
11
+ "hidden_size": 128,
12
+ "num_params": 16934016,
13
+ "global_act": {
14
+ "mean": 0.0,
15
+ "max_abs": 0.0,
16
+ "std": 0.0,
17
+ "norm": 0.0,
18
+ "numel": 0,
19
+ "min_val": 0.0,
20
+ "max_val": 0.0,
21
+ "range_val": 0.0,
22
+ "p25": 0.0,
23
+ "p50": 0.0,
24
+ "p90": 0.0,
25
+ "p99": 0.0,
26
+ "p999": 0.0
27
+ },
28
+ "layer_acts": {}
29
+ },
30
+ {
31
+ "run_folder": "glu-linear-100L_trash_run",
32
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-2700",
33
+ "dataset": "tinystories",
34
+ "checkpoint_step": 2700,
35
+ "loss": 7.82807123542327,
36
+ "perplexity": 2510.0830078125,
37
+ "num_tokens": 4869319,
38
+ "num_layers": 100,
39
+ "hidden_size": 128,
40
+ "num_params": 16934016,
41
+ "global_act": {
42
+ "mean": 0.0,
43
+ "max_abs": 0.0,
44
+ "std": 0.0,
45
+ "norm": 0.0,
46
+ "numel": 0,
47
+ "min_val": 0.0,
48
+ "max_val": 0.0,
49
+ "range_val": 0.0,
50
+ "p25": 0.0,
51
+ "p50": 0.0,
52
+ "p90": 0.0,
53
+ "p99": 0.0,
54
+ "p999": 0.0
55
+ },
56
+ "layer_acts": {}
57
+ },
58
+ {
59
+ "run_folder": "glu-linear-100L_trash_run",
60
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-2800",
61
+ "dataset": "tinystories",
62
+ "checkpoint_step": 2800,
63
+ "loss": 7.890318954252124,
64
+ "perplexity": 2671.295654296875,
65
+ "num_tokens": 4869319,
66
+ "num_layers": 100,
67
+ "hidden_size": 128,
68
+ "num_params": 16934016,
69
+ "global_act": {
70
+ "mean": 0.0,
71
+ "max_abs": 0.0,
72
+ "std": 0.0,
73
+ "norm": 0.0,
74
+ "numel": 0,
75
+ "min_val": 0.0,
76
+ "max_val": 0.0,
77
+ "range_val": 0.0,
78
+ "p25": 0.0,
79
+ "p50": 0.0,
80
+ "p90": 0.0,
81
+ "p99": 0.0,
82
+ "p999": 0.0
83
+ },
84
+ "layer_acts": {}
85
+ },
86
+ {
87
+ "run_folder": "glu-linear-100L_trash_run",
88
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-2900",
89
+ "dataset": "tinystories",
90
+ "checkpoint_step": 2900,
91
+ "loss": 7.90377792048539,
92
+ "perplexity": 2707.4921875,
93
+ "num_tokens": 4869319,
94
+ "num_layers": 100,
95
+ "hidden_size": 128,
96
+ "num_params": 16934016,
97
+ "global_act": {
98
+ "mean": 0.0,
99
+ "max_abs": 0.0,
100
+ "std": 0.0,
101
+ "norm": 0.0,
102
+ "numel": 0,
103
+ "min_val": 0.0,
104
+ "max_val": 0.0,
105
+ "range_val": 0.0,
106
+ "p25": 0.0,
107
+ "p50": 0.0,
108
+ "p90": 0.0,
109
+ "p99": 0.0,
110
+ "p999": 0.0
111
+ },
112
+ "layer_acts": {}
113
+ },
114
+ {
115
+ "run_folder": "glu-linear-100L_trash_run",
116
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3000",
117
+ "dataset": "tinystories",
118
+ "checkpoint_step": 3000,
119
+ "loss": 7.9222839990561305,
120
+ "perplexity": 2758.063720703125,
121
+ "num_tokens": 4869319,
122
+ "num_layers": 100,
123
+ "hidden_size": 128,
124
+ "num_params": 16934016,
125
+ "global_act": {
126
+ "mean": 0.0,
127
+ "max_abs": 0.0,
128
+ "std": 0.0,
129
+ "norm": 0.0,
130
+ "numel": 0,
131
+ "min_val": 0.0,
132
+ "max_val": 0.0,
133
+ "range_val": 0.0,
134
+ "p25": 0.0,
135
+ "p50": 0.0,
136
+ "p90": 0.0,
137
+ "p99": 0.0,
138
+ "p999": 0.0
139
+ },
140
+ "layer_acts": {}
141
+ },
142
+ {
143
+ "run_folder": "glu-linear-100L_trash_run",
144
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3100",
145
+ "dataset": "tinystories",
146
+ "checkpoint_step": 3100,
147
+ "loss": 7.9222839990561305,
148
+ "perplexity": 2758.063720703125,
149
+ "num_tokens": 4869319,
150
+ "num_layers": 100,
151
+ "hidden_size": 128,
152
+ "num_params": 16934016,
153
+ "global_act": {
154
+ "mean": 0.0,
155
+ "max_abs": 0.0,
156
+ "std": 0.0,
157
+ "norm": 0.0,
158
+ "numel": 0,
159
+ "min_val": 0.0,
160
+ "max_val": 0.0,
161
+ "range_val": 0.0,
162
+ "p25": 0.0,
163
+ "p50": 0.0,
164
+ "p90": 0.0,
165
+ "p99": 0.0,
166
+ "p999": 0.0
167
+ },
168
+ "layer_acts": {}
169
+ },
170
+ {
171
+ "run_folder": "glu-linear-100L_trash_run",
172
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3200",
173
+ "dataset": "tinystories",
174
+ "checkpoint_step": 3200,
175
+ "loss": 7.9222839990561305,
176
+ "perplexity": 2758.063720703125,
177
+ "num_tokens": 4869319,
178
+ "num_layers": 100,
179
+ "hidden_size": 128,
180
+ "num_params": 16934016,
181
+ "global_act": {
182
+ "mean": 0.0,
183
+ "max_abs": 0.0,
184
+ "std": 0.0,
185
+ "norm": 0.0,
186
+ "numel": 0,
187
+ "min_val": 0.0,
188
+ "max_val": 0.0,
189
+ "range_val": 0.0,
190
+ "p25": 0.0,
191
+ "p50": 0.0,
192
+ "p90": 0.0,
193
+ "p99": 0.0,
194
+ "p999": 0.0
195
+ },
196
+ "layer_acts": {}
197
+ },
198
+ {
199
+ "run_folder": "glu-linear-100L_trash_run",
200
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3300",
201
+ "dataset": "tinystories",
202
+ "checkpoint_step": 3300,
203
+ "loss": 7.9222839990561305,
204
+ "perplexity": 2758.063720703125,
205
+ "num_tokens": 4869319,
206
+ "num_layers": 100,
207
+ "hidden_size": 128,
208
+ "num_params": 16934016,
209
+ "global_act": {
210
+ "mean": 0.0,
211
+ "max_abs": 0.0,
212
+ "std": 0.0,
213
+ "norm": 0.0,
214
+ "numel": 0,
215
+ "min_val": 0.0,
216
+ "max_val": 0.0,
217
+ "range_val": 0.0,
218
+ "p25": 0.0,
219
+ "p50": 0.0,
220
+ "p90": 0.0,
221
+ "p99": 0.0,
222
+ "p999": 0.0
223
+ },
224
+ "layer_acts": {}
225
+ },
226
+ {
227
+ "run_folder": "glu-linear-100L_trash_run",
228
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3400",
229
+ "dataset": "tinystories",
230
+ "checkpoint_step": 3400,
231
+ "loss": 7.9222839990561305,
232
+ "perplexity": 2758.063720703125,
233
+ "num_tokens": 4869319,
234
+ "num_layers": 100,
235
+ "hidden_size": 128,
236
+ "num_params": 16934016,
237
+ "global_act": {
238
+ "mean": 0.0,
239
+ "max_abs": 0.0,
240
+ "std": 0.0,
241
+ "norm": 0.0,
242
+ "numel": 0,
243
+ "min_val": 0.0,
244
+ "max_val": 0.0,
245
+ "range_val": 0.0,
246
+ "p25": 0.0,
247
+ "p50": 0.0,
248
+ "p90": 0.0,
249
+ "p99": 0.0,
250
+ "p999": 0.0
251
+ },
252
+ "layer_acts": {}
253
+ },
254
+ {
255
+ "run_folder": "glu-linear-100L_trash_run",
256
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-linear-100L_trash_run/checkpoint-3500",
257
+ "dataset": "tinystories",
258
+ "checkpoint_step": 3500,
259
+ "loss": 7.929013482172763,
260
+ "perplexity": 2776.685546875,
261
+ "num_tokens": 4869319,
262
+ "num_layers": 100,
263
+ "hidden_size": 128,
264
+ "num_params": 16934016,
265
+ "global_act": {
266
+ "mean": 0.0,
267
+ "max_abs": 0.0,
268
+ "std": 0.0,
269
+ "norm": 0.0,
270
+ "numel": 0,
271
+ "min_val": 0.0,
272
+ "max_val": 0.0,
273
+ "range_val": 0.0,
274
+ "p25": 0.0,
275
+ "p50": 0.0,
276
+ "p90": 0.0,
277
+ "p99": 0.0,
278
+ "p999": 0.0
279
+ },
280
+ "layer_acts": {}
281
+ },
282
+ {
283
+ "run_folder": "glu-silu-100L_trash_run",
284
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-2600",
285
+ "dataset": "tinystories",
286
+ "checkpoint_step": 2600,
287
+ "loss": 7.681704977636503,
288
+ "perplexity": 2168.3134765625,
289
+ "num_tokens": 4869319,
290
+ "num_layers": 100,
291
+ "hidden_size": 128,
292
+ "num_params": 16934016,
293
+ "global_act": {
294
+ "mean": 0.0,
295
+ "max_abs": 0.0,
296
+ "std": 0.0,
297
+ "norm": 0.0,
298
+ "numel": 0,
299
+ "min_val": 0.0,
300
+ "max_val": 0.0,
301
+ "range_val": 0.0,
302
+ "p25": 0.0,
303
+ "p50": 0.0,
304
+ "p90": 0.0,
305
+ "p99": 0.0,
306
+ "p999": 0.0
307
+ },
308
+ "layer_acts": {}
309
+ },
310
+ {
311
+ "run_folder": "glu-silu-100L_trash_run",
312
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-2700",
313
+ "dataset": "tinystories",
314
+ "checkpoint_step": 2700,
315
+ "loss": 7.984531717884986,
316
+ "perplexity": 2935.202880859375,
317
+ "num_tokens": 4869319,
318
+ "num_layers": 100,
319
+ "hidden_size": 128,
320
+ "num_params": 16934016,
321
+ "global_act": {
322
+ "mean": 0.0,
323
+ "max_abs": 0.0,
324
+ "std": 0.0,
325
+ "norm": 0.0,
326
+ "numel": 0,
327
+ "min_val": 0.0,
328
+ "max_val": 0.0,
329
+ "range_val": 0.0,
330
+ "p25": 0.0,
331
+ "p50": 0.0,
332
+ "p90": 0.0,
333
+ "p99": 0.0,
334
+ "p999": 0.0
335
+ },
336
+ "layer_acts": {}
337
+ },
338
+ {
339
+ "run_folder": "glu-silu-100L_trash_run",
340
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-2800",
341
+ "dataset": "tinystories",
342
+ "checkpoint_step": 2800,
343
+ "loss": 8.063603144505423,
344
+ "perplexity": 3176.716552734375,
345
+ "num_tokens": 4869319,
346
+ "num_layers": 100,
347
+ "hidden_size": 128,
348
+ "num_params": 16934016,
349
+ "global_act": {
350
+ "mean": 0.0,
351
+ "max_abs": 0.0,
352
+ "std": 0.0,
353
+ "norm": 0.0,
354
+ "numel": 0,
355
+ "min_val": 0.0,
356
+ "max_val": 0.0,
357
+ "range_val": 0.0,
358
+ "p25": 0.0,
359
+ "p50": 0.0,
360
+ "p90": 0.0,
361
+ "p99": 0.0,
362
+ "p999": 0.0
363
+ },
364
+ "layer_acts": {}
365
+ },
366
+ {
367
+ "run_folder": "glu-silu-100L_trash_run",
368
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-2900",
369
+ "dataset": "tinystories",
370
+ "checkpoint_step": 2900,
371
+ "loss": 8.078744481517846,
372
+ "perplexity": 3225.1826171875,
373
+ "num_tokens": 4869319,
374
+ "num_layers": 100,
375
+ "hidden_size": 128,
376
+ "num_params": 16934016,
377
+ "global_act": {
378
+ "mean": 0.0,
379
+ "max_abs": 0.0,
380
+ "std": 0.0,
381
+ "norm": 0.0,
382
+ "numel": 0,
383
+ "min_val": 0.0,
384
+ "max_val": 0.0,
385
+ "range_val": 0.0,
386
+ "p25": 0.0,
387
+ "p50": 0.0,
388
+ "p90": 0.0,
389
+ "p99": 0.0,
390
+ "p999": 0.0
391
+ },
392
+ "layer_acts": {}
393
+ },
394
+ {
395
+ "run_folder": "glu-silu-100L_trash_run",
396
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3000",
397
+ "dataset": "tinystories",
398
+ "checkpoint_step": 3000,
399
+ "loss": 8.078744481517846,
400
+ "perplexity": 3225.1826171875,
401
+ "num_tokens": 4869319,
402
+ "num_layers": 100,
403
+ "hidden_size": 128,
404
+ "num_params": 16934016,
405
+ "global_act": {
406
+ "mean": 0.0,
407
+ "max_abs": 0.0,
408
+ "std": 0.0,
409
+ "norm": 0.0,
410
+ "numel": 0,
411
+ "min_val": 0.0,
412
+ "max_val": 0.0,
413
+ "range_val": 0.0,
414
+ "p25": 0.0,
415
+ "p50": 0.0,
416
+ "p90": 0.0,
417
+ "p99": 0.0,
418
+ "p999": 0.0
419
+ },
420
+ "layer_acts": {}
421
+ },
422
+ {
423
+ "run_folder": "glu-silu-100L_trash_run",
424
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3100",
425
+ "dataset": "tinystories",
426
+ "checkpoint_step": 3100,
427
+ "loss": 8.078744481517846,
428
+ "perplexity": 3225.1826171875,
429
+ "num_tokens": 4869319,
430
+ "num_layers": 100,
431
+ "hidden_size": 128,
432
+ "num_params": 16934016,
433
+ "global_act": {
434
+ "mean": 0.0,
435
+ "max_abs": 0.0,
436
+ "std": 0.0,
437
+ "norm": 0.0,
438
+ "numel": 0,
439
+ "min_val": 0.0,
440
+ "max_val": 0.0,
441
+ "range_val": 0.0,
442
+ "p25": 0.0,
443
+ "p50": 0.0,
444
+ "p90": 0.0,
445
+ "p99": 0.0,
446
+ "p999": 0.0
447
+ },
448
+ "layer_acts": {}
449
+ },
450
+ {
451
+ "run_folder": "glu-silu-100L_trash_run",
452
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3200",
453
+ "dataset": "tinystories",
454
+ "checkpoint_step": 3200,
455
+ "loss": 8.078744481517846,
456
+ "perplexity": 3225.1826171875,
457
+ "num_tokens": 4869319,
458
+ "num_layers": 100,
459
+ "hidden_size": 128,
460
+ "num_params": 16934016,
461
+ "global_act": {
462
+ "mean": 0.0,
463
+ "max_abs": 0.0,
464
+ "std": 0.0,
465
+ "norm": 0.0,
466
+ "numel": 0,
467
+ "min_val": 0.0,
468
+ "max_val": 0.0,
469
+ "range_val": 0.0,
470
+ "p25": 0.0,
471
+ "p50": 0.0,
472
+ "p90": 0.0,
473
+ "p99": 0.0,
474
+ "p999": 0.0
475
+ },
476
+ "layer_acts": {}
477
+ },
478
+ {
479
+ "run_folder": "glu-silu-100L_trash_run",
480
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3300",
481
+ "dataset": "tinystories",
482
+ "checkpoint_step": 3300,
483
+ "loss": 8.070332627622056,
484
+ "perplexity": 3198.1650390625,
485
+ "num_tokens": 4869319,
486
+ "num_layers": 100,
487
+ "hidden_size": 128,
488
+ "num_params": 16934016,
489
+ "global_act": {
490
+ "mean": 0.0,
491
+ "max_abs": 0.0,
492
+ "std": 0.0,
493
+ "norm": 0.0,
494
+ "numel": 0,
495
+ "min_val": 0.0,
496
+ "max_val": 0.0,
497
+ "range_val": 0.0,
498
+ "p25": 0.0,
499
+ "p50": 0.0,
500
+ "p90": 0.0,
501
+ "p99": 0.0,
502
+ "p999": 0.0
503
+ },
504
+ "layer_acts": {}
505
+ },
506
+ {
507
+ "run_folder": "glu-silu-100L_trash_run",
508
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3400",
509
+ "dataset": "tinystories",
510
+ "checkpoint_step": 3400,
511
+ "loss": 8.078744481517846,
512
+ "perplexity": 3225.1826171875,
513
+ "num_tokens": 4869319,
514
+ "num_layers": 100,
515
+ "hidden_size": 128,
516
+ "num_params": 16934016,
517
+ "global_act": {
518
+ "mean": 0.0,
519
+ "max_abs": 0.0,
520
+ "std": 0.0,
521
+ "norm": 0.0,
522
+ "numel": 0,
523
+ "min_val": 0.0,
524
+ "max_val": 0.0,
525
+ "range_val": 0.0,
526
+ "p25": 0.0,
527
+ "p50": 0.0,
528
+ "p90": 0.0,
529
+ "p99": 0.0,
530
+ "p999": 0.0
531
+ },
532
+ "layer_acts": {}
533
+ },
534
+ {
535
+ "run_folder": "glu-silu-100L_trash_run",
536
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-100L_trash_run/checkpoint-3500",
537
+ "dataset": "tinystories",
538
+ "checkpoint_step": 3500,
539
+ "loss": 8.078744481517846,
540
+ "perplexity": 3225.1826171875,
541
+ "num_tokens": 4869319,
542
+ "num_layers": 100,
543
+ "hidden_size": 128,
544
+ "num_params": 16934016,
545
+ "global_act": {
546
+ "mean": 0.0,
547
+ "max_abs": 0.0,
548
+ "std": 0.0,
549
+ "norm": 0.0,
550
+ "numel": 0,
551
+ "min_val": 0.0,
552
+ "max_val": 0.0,
553
+ "range_val": 0.0,
554
+ "p25": 0.0,
555
+ "p50": 0.0,
556
+ "p90": 0.0,
557
+ "p99": 0.0,
558
+ "p999": 0.0
559
+ },
560
+ "layer_acts": {}
561
+ },
562
+ {
563
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
564
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-2600",
565
+ "dataset": "tinystories",
566
+ "checkpoint_step": 2600,
567
+ "loss": 7.730493730232092,
568
+ "perplexity": 2276.7255859375,
569
+ "num_tokens": 4869319,
570
+ "num_layers": 100,
571
+ "hidden_size": 128,
572
+ "num_params": 16934016,
573
+ "global_act": {
574
+ "mean": 0.0,
575
+ "max_abs": 0.0,
576
+ "std": 0.0,
577
+ "norm": 0.0,
578
+ "numel": 0,
579
+ "min_val": 0.0,
580
+ "max_val": 0.0,
581
+ "range_val": 0.0,
582
+ "p25": 0.0,
583
+ "p50": 0.0,
584
+ "p90": 0.0,
585
+ "p99": 0.0,
586
+ "p999": 0.0
587
+ },
588
+ "layer_acts": {}
589
+ },
590
+ {
591
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
592
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-2700",
593
+ "dataset": "tinystories",
594
+ "checkpoint_step": 2700,
595
+ "loss": 8.016496762688993,
596
+ "perplexity": 3030.541748046875,
597
+ "num_tokens": 4869319,
598
+ "num_layers": 100,
599
+ "hidden_size": 128,
600
+ "num_params": 16934016,
601
+ "global_act": {
602
+ "mean": 0.0,
603
+ "max_abs": 0.0,
604
+ "std": 0.0,
605
+ "norm": 0.0,
606
+ "numel": 0,
607
+ "min_val": 0.0,
608
+ "max_val": 0.0,
609
+ "range_val": 0.0,
610
+ "p25": 0.0,
611
+ "p50": 0.0,
612
+ "p90": 0.0,
613
+ "p99": 0.0,
614
+ "p999": 0.0
615
+ },
616
+ "layer_acts": {}
617
+ },
618
+ {
619
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
620
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-2800",
621
+ "dataset": "tinystories",
622
+ "checkpoint_step": 2800,
623
+ "loss": 8.078744481517846,
624
+ "perplexity": 3225.1826171875,
625
+ "num_tokens": 4869319,
626
+ "num_layers": 100,
627
+ "hidden_size": 128,
628
+ "num_params": 16934016,
629
+ "global_act": {
630
+ "mean": 0.0,
631
+ "max_abs": 0.0,
632
+ "std": 0.0,
633
+ "norm": 0.0,
634
+ "numel": 0,
635
+ "min_val": 0.0,
636
+ "max_val": 0.0,
637
+ "range_val": 0.0,
638
+ "p25": 0.0,
639
+ "p50": 0.0,
640
+ "p90": 0.0,
641
+ "p99": 0.0,
642
+ "p999": 0.0
643
+ },
644
+ "layer_acts": {}
645
+ },
646
+ {
647
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
648
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-2900",
649
+ "dataset": "tinystories",
650
+ "checkpoint_step": 2900,
651
+ "loss": 8.134262717230069,
652
+ "perplexity": 3409.302734375,
653
+ "num_tokens": 4869319,
654
+ "num_layers": 100,
655
+ "hidden_size": 128,
656
+ "num_params": 16934016,
657
+ "global_act": {
658
+ "mean": 0.0,
659
+ "max_abs": 0.0,
660
+ "std": 0.0,
661
+ "norm": 0.0,
662
+ "numel": 0,
663
+ "min_val": 0.0,
664
+ "max_val": 0.0,
665
+ "range_val": 0.0,
666
+ "p25": 0.0,
667
+ "p50": 0.0,
668
+ "p90": 0.0,
669
+ "p99": 0.0,
670
+ "p999": 0.0
671
+ },
672
+ "layer_acts": {}
673
+ },
674
+ {
675
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
676
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3000",
677
+ "dataset": "tinystories",
678
+ "checkpoint_step": 3000,
679
+ "loss": 8.134262717230069,
680
+ "perplexity": 3409.302734375,
681
+ "num_tokens": 4869319,
682
+ "num_layers": 100,
683
+ "hidden_size": 128,
684
+ "num_params": 16934016,
685
+ "global_act": {
686
+ "mean": 0.0,
687
+ "max_abs": 0.0,
688
+ "std": 0.0,
689
+ "norm": 0.0,
690
+ "numel": 0,
691
+ "min_val": 0.0,
692
+ "max_val": 0.0,
693
+ "range_val": 0.0,
694
+ "p25": 0.0,
695
+ "p50": 0.0,
696
+ "p90": 0.0,
697
+ "p99": 0.0,
698
+ "p999": 0.0
699
+ },
700
+ "layer_acts": {}
701
+ },
702
+ {
703
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
704
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3100",
705
+ "dataset": "tinystories",
706
+ "checkpoint_step": 3100,
707
+ "loss": 8.134262717230069,
708
+ "perplexity": 3409.302734375,
709
+ "num_tokens": 4869319,
710
+ "num_layers": 100,
711
+ "hidden_size": 128,
712
+ "num_params": 16934016,
713
+ "global_act": {
714
+ "mean": 0.0,
715
+ "max_abs": 0.0,
716
+ "std": 0.0,
717
+ "norm": 0.0,
718
+ "numel": 0,
719
+ "min_val": 0.0,
720
+ "max_val": 0.0,
721
+ "range_val": 0.0,
722
+ "p25": 0.0,
723
+ "p50": 0.0,
724
+ "p90": 0.0,
725
+ "p99": 0.0,
726
+ "p999": 0.0
727
+ },
728
+ "layer_acts": {}
729
+ },
730
+ {
731
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
732
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3200",
733
+ "dataset": "tinystories",
734
+ "checkpoint_step": 3200,
735
+ "loss": 8.134262717230069,
736
+ "perplexity": 3409.302734375,
737
+ "num_tokens": 4869319,
738
+ "num_layers": 100,
739
+ "hidden_size": 128,
740
+ "num_params": 16934016,
741
+ "global_act": {
742
+ "mean": 0.0,
743
+ "max_abs": 0.0,
744
+ "std": 0.0,
745
+ "norm": 0.0,
746
+ "numel": 0,
747
+ "min_val": 0.0,
748
+ "max_val": 0.0,
749
+ "range_val": 0.0,
750
+ "p25": 0.0,
751
+ "p50": 0.0,
752
+ "p90": 0.0,
753
+ "p99": 0.0,
754
+ "p999": 0.0
755
+ },
756
+ "layer_acts": {}
757
+ },
758
+ {
759
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
760
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3300",
761
+ "dataset": "tinystories",
762
+ "checkpoint_step": 3300,
763
+ "loss": 8.134262717230069,
764
+ "perplexity": 3409.302734375,
765
+ "num_tokens": 4869319,
766
+ "num_layers": 100,
767
+ "hidden_size": 128,
768
+ "num_params": 16934016,
769
+ "global_act": {
770
+ "mean": 0.0,
771
+ "max_abs": 0.0,
772
+ "std": 0.0,
773
+ "norm": 0.0,
774
+ "numel": 0,
775
+ "min_val": 0.0,
776
+ "max_val": 0.0,
777
+ "range_val": 0.0,
778
+ "p25": 0.0,
779
+ "p50": 0.0,
780
+ "p90": 0.0,
781
+ "p99": 0.0,
782
+ "p999": 0.0
783
+ },
784
+ "layer_acts": {}
785
+ },
786
+ {
787
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
788
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3400",
789
+ "dataset": "tinystories",
790
+ "checkpoint_step": 3400,
791
+ "loss": 8.134262717230069,
792
+ "perplexity": 3409.302734375,
793
+ "num_tokens": 4869319,
794
+ "num_layers": 100,
795
+ "hidden_size": 128,
796
+ "num_params": 16934016,
797
+ "global_act": {
798
+ "mean": 0.0,
799
+ "max_abs": 0.0,
800
+ "std": 0.0,
801
+ "norm": 0.0,
802
+ "numel": 0,
803
+ "min_val": 0.0,
804
+ "max_val": 0.0,
805
+ "range_val": 0.0,
806
+ "p25": 0.0,
807
+ "p50": 0.0,
808
+ "p90": 0.0,
809
+ "p99": 0.0,
810
+ "p999": 0.0
811
+ },
812
+ "layer_acts": {}
813
+ },
814
+ {
815
+ "run_folder": "glu-silu-waleed10-100L_trash_run",
816
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-silu-waleed10-100L_trash_run/checkpoint-3500",
817
+ "dataset": "tinystories",
818
+ "checkpoint_step": 3500,
819
+ "loss": 8.134262717230069,
820
+ "perplexity": 3409.302734375,
821
+ "num_tokens": 4869319,
822
+ "num_layers": 100,
823
+ "hidden_size": 128,
824
+ "num_params": 16934016,
825
+ "global_act": {
826
+ "mean": 0.0,
827
+ "max_abs": 0.0,
828
+ "std": 0.0,
829
+ "norm": 0.0,
830
+ "numel": 0,
831
+ "min_val": 0.0,
832
+ "max_val": 0.0,
833
+ "range_val": 0.0,
834
+ "p25": 0.0,
835
+ "p50": 0.0,
836
+ "p90": 0.0,
837
+ "p99": 0.0,
838
+ "p999": 0.0
839
+ },
840
+ "layer_acts": {}
841
+ },
842
+ {
843
+ "run_folder": "glu-situglu-100L_trash_run",
844
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-2600",
845
+ "dataset": "tinystories",
846
+ "checkpoint_step": 2600,
847
+ "loss": 7.668246011403237,
848
+ "perplexity": 2139.325439453125,
849
+ "num_tokens": 4869319,
850
+ "num_layers": 100,
851
+ "hidden_size": 128,
852
+ "num_params": 16934016,
853
+ "global_act": {
854
+ "mean": 0.0,
855
+ "max_abs": 0.0,
856
+ "std": 0.0,
857
+ "norm": 0.0,
858
+ "numel": 0,
859
+ "min_val": 0.0,
860
+ "max_val": 0.0,
861
+ "range_val": 0.0,
862
+ "p25": 0.0,
863
+ "p50": 0.0,
864
+ "p90": 0.0,
865
+ "p99": 0.0,
866
+ "p999": 0.0
867
+ },
868
+ "layer_acts": {}
869
+ },
870
+ {
871
+ "run_folder": "glu-situglu-100L_trash_run",
872
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-2700",
873
+ "dataset": "tinystories",
874
+ "checkpoint_step": 2700,
875
+ "loss": 7.957613785418454,
876
+ "perplexity": 2857.247314453125,
877
+ "num_tokens": 4869319,
878
+ "num_layers": 100,
879
+ "hidden_size": 128,
880
+ "num_params": 16934016,
881
+ "global_act": {
882
+ "mean": 0.0,
883
+ "max_abs": 0.0,
884
+ "std": 0.0,
885
+ "norm": 0.0,
886
+ "numel": 0,
887
+ "min_val": 0.0,
888
+ "max_val": 0.0,
889
+ "range_val": 0.0,
890
+ "p25": 0.0,
891
+ "p50": 0.0,
892
+ "p90": 0.0,
893
+ "p99": 0.0,
894
+ "p999": 0.0
895
+ },
896
+ "layer_acts": {}
897
+ },
898
+ {
899
+ "run_folder": "glu-situglu-100L_trash_run",
900
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-2800",
901
+ "dataset": "tinystories",
902
+ "checkpoint_step": 2800,
903
+ "loss": 8.004720167234884,
904
+ "perplexity": 2995.060546875,
905
+ "num_tokens": 4869319,
906
+ "num_layers": 100,
907
+ "hidden_size": 128,
908
+ "num_params": 16934016,
909
+ "global_act": {
910
+ "mean": 0.0,
911
+ "max_abs": 0.0,
912
+ "std": 0.0,
913
+ "norm": 0.0,
914
+ "numel": 0,
915
+ "min_val": 0.0,
916
+ "max_val": 0.0,
917
+ "range_val": 0.0,
918
+ "p25": 0.0,
919
+ "p50": 0.0,
920
+ "p90": 0.0,
921
+ "p99": 0.0,
922
+ "p999": 0.0
923
+ },
924
+ "layer_acts": {}
925
+ },
926
+ {
927
+ "run_folder": "glu-situglu-100L_trash_run",
928
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-2900",
929
+ "dataset": "tinystories",
930
+ "checkpoint_step": 2900,
931
+ "loss": 8.016496762688993,
932
+ "perplexity": 3030.541748046875,
933
+ "num_tokens": 4869319,
934
+ "num_layers": 100,
935
+ "hidden_size": 128,
936
+ "num_params": 16934016,
937
+ "global_act": {
938
+ "mean": 0.0,
939
+ "max_abs": 0.0,
940
+ "std": 0.0,
941
+ "norm": 0.0,
942
+ "numel": 0,
943
+ "min_val": 0.0,
944
+ "max_val": 0.0,
945
+ "range_val": 0.0,
946
+ "p25": 0.0,
947
+ "p50": 0.0,
948
+ "p90": 0.0,
949
+ "p99": 0.0,
950
+ "p999": 0.0
951
+ },
952
+ "layer_acts": {}
953
+ },
954
+ {
955
+ "run_folder": "glu-situglu-100L_trash_run",
956
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3000",
957
+ "dataset": "tinystories",
958
+ "checkpoint_step": 3000,
959
+ "loss": 8.016496762688993,
960
+ "perplexity": 3030.541748046875,
961
+ "num_tokens": 4869319,
962
+ "num_layers": 100,
963
+ "hidden_size": 128,
964
+ "num_params": 16934016,
965
+ "global_act": {
966
+ "mean": 0.0,
967
+ "max_abs": 0.0,
968
+ "std": 0.0,
969
+ "norm": 0.0,
970
+ "numel": 0,
971
+ "min_val": 0.0,
972
+ "max_val": 0.0,
973
+ "range_val": 0.0,
974
+ "p25": 0.0,
975
+ "p50": 0.0,
976
+ "p90": 0.0,
977
+ "p99": 0.0,
978
+ "p999": 0.0
979
+ },
980
+ "layer_acts": {}
981
+ },
982
+ {
983
+ "run_folder": "glu-situglu-100L_trash_run",
984
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3100",
985
+ "dataset": "tinystories",
986
+ "checkpoint_step": 3100,
987
+ "loss": 8.016496762688993,
988
+ "perplexity": 3030.541748046875,
989
+ "num_tokens": 4869319,
990
+ "num_layers": 100,
991
+ "hidden_size": 128,
992
+ "num_params": 16934016,
993
+ "global_act": {
994
+ "mean": 0.0,
995
+ "max_abs": 0.0,
996
+ "std": 0.0,
997
+ "norm": 0.0,
998
+ "numel": 0,
999
+ "min_val": 0.0,
1000
+ "max_val": 0.0,
1001
+ "range_val": 0.0,
1002
+ "p25": 0.0,
1003
+ "p50": 0.0,
1004
+ "p90": 0.0,
1005
+ "p99": 0.0,
1006
+ "p999": 0.0
1007
+ },
1008
+ "layer_acts": {}
1009
+ },
1010
+ {
1011
+ "run_folder": "glu-situglu-100L_trash_run",
1012
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3200",
1013
+ "dataset": "tinystories",
1014
+ "checkpoint_step": 3200,
1015
+ "loss": 8.016496762688993,
1016
+ "perplexity": 3030.541748046875,
1017
+ "num_tokens": 4869319,
1018
+ "num_layers": 100,
1019
+ "hidden_size": 128,
1020
+ "num_params": 16934016,
1021
+ "global_act": {
1022
+ "mean": 0.0,
1023
+ "max_abs": 0.0,
1024
+ "std": 0.0,
1025
+ "norm": 0.0,
1026
+ "numel": 0,
1027
+ "min_val": 0.0,
1028
+ "max_val": 0.0,
1029
+ "range_val": 0.0,
1030
+ "p25": 0.0,
1031
+ "p50": 0.0,
1032
+ "p90": 0.0,
1033
+ "p99": 0.0,
1034
+ "p999": 0.0
1035
+ },
1036
+ "layer_acts": {}
1037
+ },
1038
+ {
1039
+ "run_folder": "glu-situglu-100L_trash_run",
1040
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3300",
1041
+ "dataset": "tinystories",
1042
+ "checkpoint_step": 3300,
1043
+ "loss": 8.016496762688993,
1044
+ "perplexity": 3030.541748046875,
1045
+ "num_tokens": 4869319,
1046
+ "num_layers": 100,
1047
+ "hidden_size": 128,
1048
+ "num_params": 16934016,
1049
+ "global_act": {
1050
+ "mean": 0.0,
1051
+ "max_abs": 0.0,
1052
+ "std": 0.0,
1053
+ "norm": 0.0,
1054
+ "numel": 0,
1055
+ "min_val": 0.0,
1056
+ "max_val": 0.0,
1057
+ "range_val": 0.0,
1058
+ "p25": 0.0,
1059
+ "p50": 0.0,
1060
+ "p90": 0.0,
1061
+ "p99": 0.0,
1062
+ "p999": 0.0
1063
+ },
1064
+ "layer_acts": {}
1065
+ },
1066
+ {
1067
+ "run_folder": "glu-situglu-100L_trash_run",
1068
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3400",
1069
+ "dataset": "tinystories",
1070
+ "checkpoint_step": 3400,
1071
+ "loss": 8.05687366138879,
1072
+ "perplexity": 3155.40869140625,
1073
+ "num_tokens": 4869319,
1074
+ "num_layers": 100,
1075
+ "hidden_size": 128,
1076
+ "num_params": 16934016,
1077
+ "global_act": {
1078
+ "mean": 0.0,
1079
+ "max_abs": 0.0,
1080
+ "std": 0.0,
1081
+ "norm": 0.0,
1082
+ "numel": 0,
1083
+ "min_val": 0.0,
1084
+ "max_val": 0.0,
1085
+ "range_val": 0.0,
1086
+ "p25": 0.0,
1087
+ "p50": 0.0,
1088
+ "p90": 0.0,
1089
+ "p99": 0.0,
1090
+ "p999": 0.0
1091
+ },
1092
+ "layer_acts": {}
1093
+ },
1094
+ {
1095
+ "run_folder": "glu-situglu-100L_trash_run",
1096
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu-100L_trash_run/checkpoint-3500",
1097
+ "dataset": "tinystories",
1098
+ "checkpoint_step": 3500,
1099
+ "loss": 8.072014998401214,
1100
+ "perplexity": 3203.5498046875,
1101
+ "num_tokens": 4869319,
1102
+ "num_layers": 100,
1103
+ "hidden_size": 128,
1104
+ "num_params": 16934016,
1105
+ "global_act": {
1106
+ "mean": 0.0,
1107
+ "max_abs": 0.0,
1108
+ "std": 0.0,
1109
+ "norm": 0.0,
1110
+ "numel": 0,
1111
+ "min_val": 0.0,
1112
+ "max_val": 0.0,
1113
+ "range_val": 0.0,
1114
+ "p25": 0.0,
1115
+ "p50": 0.0,
1116
+ "p90": 0.0,
1117
+ "p99": 0.0,
1118
+ "p999": 0.0
1119
+ },
1120
+ "layer_acts": {}
1121
+ },
1122
+ {
1123
+ "run_folder": "glu-situglu_low-100L_trash_run",
1124
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-2600",
1125
+ "dataset": "tinystories",
1126
+ "checkpoint_step": 2600,
1127
+ "loss": 7.605998292574383,
1128
+ "perplexity": 2010.2181396484375,
1129
+ "num_tokens": 4869319,
1130
+ "num_layers": 100,
1131
+ "hidden_size": 128,
1132
+ "num_params": 16934016,
1133
+ "global_act": {
1134
+ "mean": 0.0,
1135
+ "max_abs": 0.0,
1136
+ "std": 0.0,
1137
+ "norm": 0.0,
1138
+ "numel": 0,
1139
+ "min_val": 0.0,
1140
+ "max_val": 0.0,
1141
+ "range_val": 0.0,
1142
+ "p25": 0.0,
1143
+ "p50": 0.0,
1144
+ "p90": 0.0,
1145
+ "p99": 0.0,
1146
+ "p999": 0.0
1147
+ },
1148
+ "layer_acts": {}
1149
+ },
1150
+ {
1151
+ "run_folder": "glu-situglu_low-100L_trash_run",
1152
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-2700",
1153
+ "dataset": "tinystories",
1154
+ "checkpoint_step": 2700,
1155
+ "loss": 7.949201931522663,
1156
+ "perplexity": 2833.313232421875,
1157
+ "num_tokens": 4869319,
1158
+ "num_layers": 100,
1159
+ "hidden_size": 128,
1160
+ "num_params": 16934016,
1161
+ "global_act": {
1162
+ "mean": 0.0,
1163
+ "max_abs": 0.0,
1164
+ "std": 0.0,
1165
+ "norm": 0.0,
1166
+ "numel": 0,
1167
+ "min_val": 0.0,
1168
+ "max_val": 0.0,
1169
+ "range_val": 0.0,
1170
+ "p25": 0.0,
1171
+ "p50": 0.0,
1172
+ "p90": 0.0,
1173
+ "p99": 0.0,
1174
+ "p999": 0.0
1175
+ },
1176
+ "layer_acts": {}
1177
+ },
1178
+ {
1179
+ "run_folder": "glu-situglu_low-100L_trash_run",
1180
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-2800",
1181
+ "dataset": "tinystories",
1182
+ "checkpoint_step": 2800,
1183
+ "loss": 8.008084908793201,
1184
+ "perplexity": 3005.157470703125,
1185
+ "num_tokens": 4869319,
1186
+ "num_layers": 100,
1187
+ "hidden_size": 128,
1188
+ "num_params": 16934016,
1189
+ "global_act": {
1190
+ "mean": 0.0,
1191
+ "max_abs": 0.0,
1192
+ "std": 0.0,
1193
+ "norm": 0.0,
1194
+ "numel": 0,
1195
+ "min_val": 0.0,
1196
+ "max_val": 0.0,
1197
+ "range_val": 0.0,
1198
+ "p25": 0.0,
1199
+ "p50": 0.0,
1200
+ "p90": 0.0,
1201
+ "p99": 0.0,
1202
+ "p999": 0.0
1203
+ },
1204
+ "layer_acts": {}
1205
+ },
1206
+ {
1207
+ "run_folder": "glu-situglu_low-100L_trash_run",
1208
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-2900",
1209
+ "dataset": "tinystories",
1210
+ "checkpoint_step": 2900,
1211
+ "loss": 8.013132021130675,
1212
+ "perplexity": 3020.3623046875,
1213
+ "num_tokens": 4869319,
1214
+ "num_layers": 100,
1215
+ "hidden_size": 128,
1216
+ "num_params": 16934016,
1217
+ "global_act": {
1218
+ "mean": 0.0,
1219
+ "max_abs": 0.0,
1220
+ "std": 0.0,
1221
+ "norm": 0.0,
1222
+ "numel": 0,
1223
+ "min_val": 0.0,
1224
+ "max_val": 0.0,
1225
+ "range_val": 0.0,
1226
+ "p25": 0.0,
1227
+ "p50": 0.0,
1228
+ "p90": 0.0,
1229
+ "p99": 0.0,
1230
+ "p999": 0.0
1231
+ },
1232
+ "layer_acts": {}
1233
+ },
1234
+ {
1235
+ "run_folder": "glu-situglu_low-100L_trash_run",
1236
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3000",
1237
+ "dataset": "tinystories",
1238
+ "checkpoint_step": 3000,
1239
+ "loss": 8.016496762688993,
1240
+ "perplexity": 3030.541748046875,
1241
+ "num_tokens": 4869319,
1242
+ "num_layers": 100,
1243
+ "hidden_size": 128,
1244
+ "num_params": 16934016,
1245
+ "global_act": {
1246
+ "mean": 0.0,
1247
+ "max_abs": 0.0,
1248
+ "std": 0.0,
1249
+ "norm": 0.0,
1250
+ "numel": 0,
1251
+ "min_val": 0.0,
1252
+ "max_val": 0.0,
1253
+ "range_val": 0.0,
1254
+ "p25": 0.0,
1255
+ "p50": 0.0,
1256
+ "p90": 0.0,
1257
+ "p99": 0.0,
1258
+ "p999": 0.0
1259
+ },
1260
+ "layer_acts": {}
1261
+ },
1262
+ {
1263
+ "run_folder": "glu-situglu_low-100L_trash_run",
1264
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3100",
1265
+ "dataset": "tinystories",
1266
+ "checkpoint_step": 3100,
1267
+ "loss": 8.016496762688993,
1268
+ "perplexity": 3030.541748046875,
1269
+ "num_tokens": 4869319,
1270
+ "num_layers": 100,
1271
+ "hidden_size": 128,
1272
+ "num_params": 16934016,
1273
+ "global_act": {
1274
+ "mean": 0.0,
1275
+ "max_abs": 0.0,
1276
+ "std": 0.0,
1277
+ "norm": 0.0,
1278
+ "numel": 0,
1279
+ "min_val": 0.0,
1280
+ "max_val": 0.0,
1281
+ "range_val": 0.0,
1282
+ "p25": 0.0,
1283
+ "p50": 0.0,
1284
+ "p90": 0.0,
1285
+ "p99": 0.0,
1286
+ "p999": 0.0
1287
+ },
1288
+ "layer_acts": {}
1289
+ },
1290
+ {
1291
+ "run_folder": "glu-situglu_low-100L_trash_run",
1292
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3200",
1293
+ "dataset": "tinystories",
1294
+ "checkpoint_step": 3200,
1295
+ "loss": 8.013132021130675,
1296
+ "perplexity": 3020.3623046875,
1297
+ "num_tokens": 4869319,
1298
+ "num_layers": 100,
1299
+ "hidden_size": 128,
1300
+ "num_params": 16934016,
1301
+ "global_act": {
1302
+ "mean": 0.0,
1303
+ "max_abs": 0.0,
1304
+ "std": 0.0,
1305
+ "norm": 0.0,
1306
+ "numel": 0,
1307
+ "min_val": 0.0,
1308
+ "max_val": 0.0,
1309
+ "range_val": 0.0,
1310
+ "p25": 0.0,
1311
+ "p50": 0.0,
1312
+ "p90": 0.0,
1313
+ "p99": 0.0,
1314
+ "p999": 0.0
1315
+ },
1316
+ "layer_acts": {}
1317
+ },
1318
+ {
1319
+ "run_folder": "glu-situglu_low-100L_trash_run",
1320
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3300",
1321
+ "dataset": "tinystories",
1322
+ "checkpoint_step": 3300,
1323
+ "loss": 8.016496762688993,
1324
+ "perplexity": 3030.541748046875,
1325
+ "num_tokens": 4869319,
1326
+ "num_layers": 100,
1327
+ "hidden_size": 128,
1328
+ "num_params": 16934016,
1329
+ "global_act": {
1330
+ "mean": 0.0,
1331
+ "max_abs": 0.0,
1332
+ "std": 0.0,
1333
+ "norm": 0.0,
1334
+ "numel": 0,
1335
+ "min_val": 0.0,
1336
+ "max_val": 0.0,
1337
+ "range_val": 0.0,
1338
+ "p25": 0.0,
1339
+ "p50": 0.0,
1340
+ "p90": 0.0,
1341
+ "p99": 0.0,
1342
+ "p999": 0.0
1343
+ },
1344
+ "layer_acts": {}
1345
+ },
1346
+ {
1347
+ "run_folder": "glu-situglu_low-100L_trash_run",
1348
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3400",
1349
+ "dataset": "tinystories",
1350
+ "checkpoint_step": 3400,
1351
+ "loss": 8.050144178272157,
1352
+ "perplexity": 3134.246826171875,
1353
+ "num_tokens": 4869319,
1354
+ "num_layers": 100,
1355
+ "hidden_size": 128,
1356
+ "num_params": 16934016,
1357
+ "global_act": {
1358
+ "mean": 0.0,
1359
+ "max_abs": 0.0,
1360
+ "std": 0.0,
1361
+ "norm": 0.0,
1362
+ "numel": 0,
1363
+ "min_val": 0.0,
1364
+ "max_val": 0.0,
1365
+ "range_val": 0.0,
1366
+ "p25": 0.0,
1367
+ "p50": 0.0,
1368
+ "p90": 0.0,
1369
+ "p99": 0.0,
1370
+ "p999": 0.0
1371
+ },
1372
+ "layer_acts": {}
1373
+ },
1374
+ {
1375
+ "run_folder": "glu-situglu_low-100L_trash_run",
1376
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-situglu_low-100L_trash_run/checkpoint-3500",
1377
+ "dataset": "tinystories",
1378
+ "checkpoint_step": 3500,
1379
+ "loss": 8.043414695155525,
1380
+ "perplexity": 3113.22705078125,
1381
+ "num_tokens": 4869319,
1382
+ "num_layers": 100,
1383
+ "hidden_size": 128,
1384
+ "num_params": 16934016,
1385
+ "global_act": {
1386
+ "mean": 0.0,
1387
+ "max_abs": 0.0,
1388
+ "std": 0.0,
1389
+ "norm": 0.0,
1390
+ "numel": 0,
1391
+ "min_val": 0.0,
1392
+ "max_val": 0.0,
1393
+ "range_val": 0.0,
1394
+ "p25": 0.0,
1395
+ "p50": 0.0,
1396
+ "p90": 0.0,
1397
+ "p99": 0.0,
1398
+ "p999": 0.0
1399
+ },
1400
+ "layer_acts": {}
1401
+ },
1402
+ {
1403
+ "run_folder": "glu-waleed-100L_trash_run",
1404
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-2600",
1405
+ "dataset": "tinystories",
1406
+ "checkpoint_step": 2600,
1407
+ "loss": 7.604315921795225,
1408
+ "perplexity": 2006.8382568359375,
1409
+ "num_tokens": 4869319,
1410
+ "num_layers": 100,
1411
+ "hidden_size": 128,
1412
+ "num_params": 16934016,
1413
+ "global_act": {
1414
+ "mean": 0.0,
1415
+ "max_abs": 0.0,
1416
+ "std": 0.0,
1417
+ "norm": 0.0,
1418
+ "numel": 0,
1419
+ "min_val": 0.0,
1420
+ "max_val": 0.0,
1421
+ "range_val": 0.0,
1422
+ "p25": 0.0,
1423
+ "p50": 0.0,
1424
+ "p90": 0.0,
1425
+ "p99": 0.0,
1426
+ "p999": 0.0
1427
+ },
1428
+ "layer_acts": {}
1429
+ },
1430
+ {
1431
+ "run_folder": "glu-waleed-100L_trash_run",
1432
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-2700",
1433
+ "dataset": "tinystories",
1434
+ "checkpoint_step": 2700,
1435
+ "loss": 7.82807123542327,
1436
+ "perplexity": 2510.0830078125,
1437
+ "num_tokens": 4869319,
1438
+ "num_layers": 100,
1439
+ "hidden_size": 128,
1440
+ "num_params": 16934016,
1441
+ "global_act": {
1442
+ "mean": 0.0,
1443
+ "max_abs": 0.0,
1444
+ "std": 0.0,
1445
+ "norm": 0.0,
1446
+ "numel": 0,
1447
+ "min_val": 0.0,
1448
+ "max_val": 0.0,
1449
+ "range_val": 0.0,
1450
+ "p25": 0.0,
1451
+ "p50": 0.0,
1452
+ "p90": 0.0,
1453
+ "p99": 0.0,
1454
+ "p999": 0.0
1455
+ },
1456
+ "layer_acts": {}
1457
+ },
1458
+ {
1459
+ "run_folder": "glu-waleed-100L_trash_run",
1460
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-2800",
1461
+ "dataset": "tinystories",
1462
+ "checkpoint_step": 2800,
1463
+ "loss": 7.873495246460542,
1464
+ "perplexity": 2626.730224609375,
1465
+ "num_tokens": 4869319,
1466
+ "num_layers": 100,
1467
+ "hidden_size": 128,
1468
+ "num_params": 16934016,
1469
+ "global_act": {
1470
+ "mean": 0.0,
1471
+ "max_abs": 0.0,
1472
+ "std": 0.0,
1473
+ "norm": 0.0,
1474
+ "numel": 0,
1475
+ "min_val": 0.0,
1476
+ "max_val": 0.0,
1477
+ "range_val": 0.0,
1478
+ "p25": 0.0,
1479
+ "p50": 0.0,
1480
+ "p90": 0.0,
1481
+ "p99": 0.0,
1482
+ "p999": 0.0
1483
+ },
1484
+ "layer_acts": {}
1485
+ },
1486
+ {
1487
+ "run_folder": "glu-waleed-100L_trash_run",
1488
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-2900",
1489
+ "dataset": "tinystories",
1490
+ "checkpoint_step": 2900,
1491
+ "loss": 7.890318954252124,
1492
+ "perplexity": 2671.295654296875,
1493
+ "num_tokens": 4869319,
1494
+ "num_layers": 100,
1495
+ "hidden_size": 128,
1496
+ "num_params": 16934016,
1497
+ "global_act": {
1498
+ "mean": 0.0,
1499
+ "max_abs": 0.0,
1500
+ "std": 0.0,
1501
+ "norm": 0.0,
1502
+ "numel": 0,
1503
+ "min_val": 0.0,
1504
+ "max_val": 0.0,
1505
+ "range_val": 0.0,
1506
+ "p25": 0.0,
1507
+ "p50": 0.0,
1508
+ "p90": 0.0,
1509
+ "p99": 0.0,
1510
+ "p999": 0.0
1511
+ },
1512
+ "layer_acts": {}
1513
+ },
1514
+ {
1515
+ "run_folder": "glu-waleed-100L_trash_run",
1516
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3000",
1517
+ "dataset": "tinystories",
1518
+ "checkpoint_step": 3000,
1519
+ "loss": 7.890318954252124,
1520
+ "perplexity": 2671.295654296875,
1521
+ "num_tokens": 4869319,
1522
+ "num_layers": 100,
1523
+ "hidden_size": 128,
1524
+ "num_params": 16934016,
1525
+ "global_act": {
1526
+ "mean": 0.0,
1527
+ "max_abs": 0.0,
1528
+ "std": 0.0,
1529
+ "norm": 0.0,
1530
+ "numel": 0,
1531
+ "min_val": 0.0,
1532
+ "max_val": 0.0,
1533
+ "range_val": 0.0,
1534
+ "p25": 0.0,
1535
+ "p50": 0.0,
1536
+ "p90": 0.0,
1537
+ "p99": 0.0,
1538
+ "p999": 0.0
1539
+ },
1540
+ "layer_acts": {}
1541
+ },
1542
+ {
1543
+ "run_folder": "glu-waleed-100L_trash_run",
1544
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3100",
1545
+ "dataset": "tinystories",
1546
+ "checkpoint_step": 3100,
1547
+ "loss": 7.90377792048539,
1548
+ "perplexity": 2707.4921875,
1549
+ "num_tokens": 4869319,
1550
+ "num_layers": 100,
1551
+ "hidden_size": 128,
1552
+ "num_params": 16934016,
1553
+ "global_act": {
1554
+ "mean": 0.0,
1555
+ "max_abs": 0.0,
1556
+ "std": 0.0,
1557
+ "norm": 0.0,
1558
+ "numel": 0,
1559
+ "min_val": 0.0,
1560
+ "max_val": 0.0,
1561
+ "range_val": 0.0,
1562
+ "p25": 0.0,
1563
+ "p50": 0.0,
1564
+ "p90": 0.0,
1565
+ "p99": 0.0,
1566
+ "p999": 0.0
1567
+ },
1568
+ "layer_acts": {}
1569
+ },
1570
+ {
1571
+ "run_folder": "glu-waleed-100L_trash_run",
1572
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3200",
1573
+ "dataset": "tinystories",
1574
+ "checkpoint_step": 3200,
1575
+ "loss": 7.90377792048539,
1576
+ "perplexity": 2707.4921875,
1577
+ "num_tokens": 4869319,
1578
+ "num_layers": 100,
1579
+ "hidden_size": 128,
1580
+ "num_params": 16934016,
1581
+ "global_act": {
1582
+ "mean": 0.0,
1583
+ "max_abs": 0.0,
1584
+ "std": 0.0,
1585
+ "norm": 0.0,
1586
+ "numel": 0,
1587
+ "min_val": 0.0,
1588
+ "max_val": 0.0,
1589
+ "range_val": 0.0,
1590
+ "p25": 0.0,
1591
+ "p50": 0.0,
1592
+ "p90": 0.0,
1593
+ "p99": 0.0,
1594
+ "p999": 0.0
1595
+ },
1596
+ "layer_acts": {}
1597
+ },
1598
+ {
1599
+ "run_folder": "glu-waleed-100L_trash_run",
1600
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3300",
1601
+ "dataset": "tinystories",
1602
+ "checkpoint_step": 3300,
1603
+ "loss": 7.890318954252124,
1604
+ "perplexity": 2671.295654296875,
1605
+ "num_tokens": 4869319,
1606
+ "num_layers": 100,
1607
+ "hidden_size": 128,
1608
+ "num_params": 16934016,
1609
+ "global_act": {
1610
+ "mean": 0.0,
1611
+ "max_abs": 0.0,
1612
+ "std": 0.0,
1613
+ "norm": 0.0,
1614
+ "numel": 0,
1615
+ "min_val": 0.0,
1616
+ "max_val": 0.0,
1617
+ "range_val": 0.0,
1618
+ "p25": 0.0,
1619
+ "p50": 0.0,
1620
+ "p90": 0.0,
1621
+ "p99": 0.0,
1622
+ "p999": 0.0
1623
+ },
1624
+ "layer_acts": {}
1625
+ },
1626
+ {
1627
+ "run_folder": "glu-waleed-100L_trash_run",
1628
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3400",
1629
+ "dataset": "tinystories",
1630
+ "checkpoint_step": 3400,
1631
+ "loss": 7.890318954252124,
1632
+ "perplexity": 2671.295654296875,
1633
+ "num_tokens": 4869319,
1634
+ "num_layers": 100,
1635
+ "hidden_size": 128,
1636
+ "num_params": 16934016,
1637
+ "global_act": {
1638
+ "mean": 0.0,
1639
+ "max_abs": 0.0,
1640
+ "std": 0.0,
1641
+ "norm": 0.0,
1642
+ "numel": 0,
1643
+ "min_val": 0.0,
1644
+ "max_val": 0.0,
1645
+ "range_val": 0.0,
1646
+ "p25": 0.0,
1647
+ "p50": 0.0,
1648
+ "p90": 0.0,
1649
+ "p99": 0.0,
1650
+ "p999": 0.0
1651
+ },
1652
+ "layer_acts": {}
1653
+ },
1654
+ {
1655
+ "run_folder": "glu-waleed-100L_trash_run",
1656
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed-100L_trash_run/checkpoint-3500",
1657
+ "dataset": "tinystories",
1658
+ "checkpoint_step": 3500,
1659
+ "loss": 7.9222839990561305,
1660
+ "perplexity": 2758.063720703125,
1661
+ "num_tokens": 4869319,
1662
+ "num_layers": 100,
1663
+ "hidden_size": 128,
1664
+ "num_params": 16934016,
1665
+ "global_act": {
1666
+ "mean": 0.0,
1667
+ "max_abs": 0.0,
1668
+ "std": 0.0,
1669
+ "norm": 0.0,
1670
+ "numel": 0,
1671
+ "min_val": 0.0,
1672
+ "max_val": 0.0,
1673
+ "range_val": 0.0,
1674
+ "p25": 0.0,
1675
+ "p50": 0.0,
1676
+ "p90": 0.0,
1677
+ "p99": 0.0,
1678
+ "p999": 0.0
1679
+ },
1680
+ "layer_acts": {}
1681
+ },
1682
+ {
1683
+ "run_folder": "glu-waleed10-100L_trash_run",
1684
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-2600",
1685
+ "dataset": "tinystories",
1686
+ "checkpoint_step": 2600,
1687
+ "loss": 7.609363034132699,
1688
+ "perplexity": 2016.9930419921875,
1689
+ "num_tokens": 4869319,
1690
+ "num_layers": 100,
1691
+ "hidden_size": 128,
1692
+ "num_params": 16934016,
1693
+ "global_act": {
1694
+ "mean": 0.0,
1695
+ "max_abs": 0.0,
1696
+ "std": 0.0,
1697
+ "norm": 0.0,
1698
+ "numel": 0,
1699
+ "min_val": 0.0,
1700
+ "max_val": 0.0,
1701
+ "range_val": 0.0,
1702
+ "p25": 0.0,
1703
+ "p50": 0.0,
1704
+ "p90": 0.0,
1705
+ "p99": 0.0,
1706
+ "p999": 0.0
1707
+ },
1708
+ "layer_acts": {}
1709
+ },
1710
+ {
1711
+ "run_folder": "glu-waleed10-100L_trash_run",
1712
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-2700",
1713
+ "dataset": "tinystories",
1714
+ "checkpoint_step": 2700,
1715
+ "loss": 7.883589471135491,
1716
+ "perplexity": 2653.379150390625,
1717
+ "num_tokens": 4869319,
1718
+ "num_layers": 100,
1719
+ "hidden_size": 128,
1720
+ "num_params": 16934016,
1721
+ "global_act": {
1722
+ "mean": 0.0,
1723
+ "max_abs": 0.0,
1724
+ "std": 0.0,
1725
+ "norm": 0.0,
1726
+ "numel": 0,
1727
+ "min_val": 0.0,
1728
+ "max_val": 0.0,
1729
+ "range_val": 0.0,
1730
+ "p25": 0.0,
1731
+ "p50": 0.0,
1732
+ "p90": 0.0,
1733
+ "p99": 0.0,
1734
+ "p999": 0.0
1735
+ },
1736
+ "layer_acts": {}
1737
+ },
1738
+ {
1739
+ "run_folder": "glu-waleed10-100L_trash_run",
1740
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-2800",
1741
+ "dataset": "tinystories",
1742
+ "checkpoint_step": 2800,
1743
+ "loss": 7.939107706847714,
1744
+ "perplexity": 2804.857177734375,
1745
+ "num_tokens": 4869319,
1746
+ "num_layers": 100,
1747
+ "hidden_size": 128,
1748
+ "num_params": 16934016,
1749
+ "global_act": {
1750
+ "mean": 0.0,
1751
+ "max_abs": 0.0,
1752
+ "std": 0.0,
1753
+ "norm": 0.0,
1754
+ "numel": 0,
1755
+ "min_val": 0.0,
1756
+ "max_val": 0.0,
1757
+ "range_val": 0.0,
1758
+ "p25": 0.0,
1759
+ "p50": 0.0,
1760
+ "p90": 0.0,
1761
+ "p99": 0.0,
1762
+ "p999": 0.0
1763
+ },
1764
+ "layer_acts": {}
1765
+ },
1766
+ {
1767
+ "run_folder": "glu-waleed10-100L_trash_run",
1768
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-2900",
1769
+ "dataset": "tinystories",
1770
+ "checkpoint_step": 2900,
1771
+ "loss": 7.9458371899643465,
1772
+ "perplexity": 2823.795166015625,
1773
+ "num_tokens": 4869319,
1774
+ "num_layers": 100,
1775
+ "hidden_size": 128,
1776
+ "num_params": 16934016,
1777
+ "global_act": {
1778
+ "mean": 0.0,
1779
+ "max_abs": 0.0,
1780
+ "std": 0.0,
1781
+ "norm": 0.0,
1782
+ "numel": 0,
1783
+ "min_val": 0.0,
1784
+ "max_val": 0.0,
1785
+ "range_val": 0.0,
1786
+ "p25": 0.0,
1787
+ "p50": 0.0,
1788
+ "p90": 0.0,
1789
+ "p99": 0.0,
1790
+ "p999": 0.0
1791
+ },
1792
+ "layer_acts": {}
1793
+ },
1794
+ {
1795
+ "run_folder": "glu-waleed10-100L_trash_run",
1796
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3000",
1797
+ "dataset": "tinystories",
1798
+ "checkpoint_step": 3000,
1799
+ "loss": 7.9458371899643465,
1800
+ "perplexity": 2823.795166015625,
1801
+ "num_tokens": 4869319,
1802
+ "num_layers": 100,
1803
+ "hidden_size": 128,
1804
+ "num_params": 16934016,
1805
+ "global_act": {
1806
+ "mean": 0.0,
1807
+ "max_abs": 0.0,
1808
+ "std": 0.0,
1809
+ "norm": 0.0,
1810
+ "numel": 0,
1811
+ "min_val": 0.0,
1812
+ "max_val": 0.0,
1813
+ "range_val": 0.0,
1814
+ "p25": 0.0,
1815
+ "p50": 0.0,
1816
+ "p90": 0.0,
1817
+ "p99": 0.0,
1818
+ "p999": 0.0
1819
+ },
1820
+ "layer_acts": {}
1821
+ },
1822
+ {
1823
+ "run_folder": "glu-waleed10-100L_trash_run",
1824
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3100",
1825
+ "dataset": "tinystories",
1826
+ "checkpoint_step": 3100,
1827
+ "loss": 7.9458371899643465,
1828
+ "perplexity": 2823.795166015625,
1829
+ "num_tokens": 4869319,
1830
+ "num_layers": 100,
1831
+ "hidden_size": 128,
1832
+ "num_params": 16934016,
1833
+ "global_act": {
1834
+ "mean": 0.0,
1835
+ "max_abs": 0.0,
1836
+ "std": 0.0,
1837
+ "norm": 0.0,
1838
+ "numel": 0,
1839
+ "min_val": 0.0,
1840
+ "max_val": 0.0,
1841
+ "range_val": 0.0,
1842
+ "p25": 0.0,
1843
+ "p50": 0.0,
1844
+ "p90": 0.0,
1845
+ "p99": 0.0,
1846
+ "p999": 0.0
1847
+ },
1848
+ "layer_acts": {}
1849
+ },
1850
+ {
1851
+ "run_folder": "glu-waleed10-100L_trash_run",
1852
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3200",
1853
+ "dataset": "tinystories",
1854
+ "checkpoint_step": 3200,
1855
+ "loss": 7.9458371899643465,
1856
+ "perplexity": 2823.795166015625,
1857
+ "num_tokens": 4869319,
1858
+ "num_layers": 100,
1859
+ "hidden_size": 128,
1860
+ "num_params": 16934016,
1861
+ "global_act": {
1862
+ "mean": 0.0,
1863
+ "max_abs": 0.0,
1864
+ "std": 0.0,
1865
+ "norm": 0.0,
1866
+ "numel": 0,
1867
+ "min_val": 0.0,
1868
+ "max_val": 0.0,
1869
+ "range_val": 0.0,
1870
+ "p25": 0.0,
1871
+ "p50": 0.0,
1872
+ "p90": 0.0,
1873
+ "p99": 0.0,
1874
+ "p999": 0.0
1875
+ },
1876
+ "layer_acts": {}
1877
+ },
1878
+ {
1879
+ "run_folder": "glu-waleed10-100L_trash_run",
1880
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3300",
1881
+ "dataset": "tinystories",
1882
+ "checkpoint_step": 3300,
1883
+ "loss": 7.9458371899643465,
1884
+ "perplexity": 2823.795166015625,
1885
+ "num_tokens": 4869319,
1886
+ "num_layers": 100,
1887
+ "hidden_size": 128,
1888
+ "num_params": 16934016,
1889
+ "global_act": {
1890
+ "mean": 0.0,
1891
+ "max_abs": 0.0,
1892
+ "std": 0.0,
1893
+ "norm": 0.0,
1894
+ "numel": 0,
1895
+ "min_val": 0.0,
1896
+ "max_val": 0.0,
1897
+ "range_val": 0.0,
1898
+ "p25": 0.0,
1899
+ "p50": 0.0,
1900
+ "p90": 0.0,
1901
+ "p99": 0.0,
1902
+ "p999": 0.0
1903
+ },
1904
+ "layer_acts": {}
1905
+ },
1906
+ {
1907
+ "run_folder": "glu-waleed10-100L_trash_run",
1908
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3400",
1909
+ "dataset": "tinystories",
1910
+ "checkpoint_step": 3400,
1911
+ "loss": 7.9458371899643465,
1912
+ "perplexity": 2823.795166015625,
1913
+ "num_tokens": 4869319,
1914
+ "num_layers": 100,
1915
+ "hidden_size": 128,
1916
+ "num_params": 16934016,
1917
+ "global_act": {
1918
+ "mean": 0.0,
1919
+ "max_abs": 0.0,
1920
+ "std": 0.0,
1921
+ "norm": 0.0,
1922
+ "numel": 0,
1923
+ "min_val": 0.0,
1924
+ "max_val": 0.0,
1925
+ "range_val": 0.0,
1926
+ "p25": 0.0,
1927
+ "p50": 0.0,
1928
+ "p90": 0.0,
1929
+ "p99": 0.0,
1930
+ "p999": 0.0
1931
+ },
1932
+ "layer_acts": {}
1933
+ },
1934
+ {
1935
+ "run_folder": "glu-waleed10-100L_trash_run",
1936
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleed10-100L_trash_run/checkpoint-3500",
1937
+ "dataset": "tinystories",
1938
+ "checkpoint_step": 3500,
1939
+ "loss": 7.9458371899643465,
1940
+ "perplexity": 2823.795166015625,
1941
+ "num_tokens": 4869319,
1942
+ "num_layers": 100,
1943
+ "hidden_size": 128,
1944
+ "num_params": 16934016,
1945
+ "global_act": {
1946
+ "mean": 0.0,
1947
+ "max_abs": 0.0,
1948
+ "std": 0.0,
1949
+ "norm": 0.0,
1950
+ "numel": 0,
1951
+ "min_val": 0.0,
1952
+ "max_val": 0.0,
1953
+ "range_val": 0.0,
1954
+ "p25": 0.0,
1955
+ "p50": 0.0,
1956
+ "p90": 0.0,
1957
+ "p99": 0.0,
1958
+ "p999": 0.0
1959
+ },
1960
+ "layer_acts": {}
1961
+ },
1962
+ {
1963
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
1964
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-2600",
1965
+ "dataset": "tinystories",
1966
+ "checkpoint_step": 2600,
1967
+ "loss": 7.577397989328692,
1968
+ "perplexity": 1953.5389404296875,
1969
+ "num_tokens": 4869319,
1970
+ "num_layers": 100,
1971
+ "hidden_size": 128,
1972
+ "num_params": 16934016,
1973
+ "global_act": {
1974
+ "mean": 0.0,
1975
+ "max_abs": 0.0,
1976
+ "std": 0.0,
1977
+ "norm": 0.0,
1978
+ "numel": 0,
1979
+ "min_val": 0.0,
1980
+ "max_val": 0.0,
1981
+ "range_val": 0.0,
1982
+ "p25": 0.0,
1983
+ "p50": 0.0,
1984
+ "p90": 0.0,
1985
+ "p99": 0.0,
1986
+ "p999": 0.0
1987
+ },
1988
+ "layer_acts": {}
1989
+ },
1990
+ {
1991
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
1992
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-2700",
1993
+ "dataset": "tinystories",
1994
+ "checkpoint_step": 2700,
1995
+ "loss": 7.7961061906192635,
1996
+ "perplexity": 2431.11767578125,
1997
+ "num_tokens": 4869319,
1998
+ "num_layers": 100,
1999
+ "hidden_size": 128,
2000
+ "num_params": 16934016,
2001
+ "global_act": {
2002
+ "mean": 0.0,
2003
+ "max_abs": 0.0,
2004
+ "std": 0.0,
2005
+ "norm": 0.0,
2006
+ "numel": 0,
2007
+ "min_val": 0.0,
2008
+ "max_val": 0.0,
2009
+ "range_val": 0.0,
2010
+ "p25": 0.0,
2011
+ "p50": 0.0,
2012
+ "p90": 0.0,
2013
+ "p99": 0.0,
2014
+ "p999": 0.0
2015
+ },
2016
+ "layer_acts": {}
2017
+ },
2018
+ {
2019
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2020
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-2800",
2021
+ "dataset": "tinystories",
2022
+ "checkpoint_step": 2800,
2023
+ "loss": 7.860036280227276,
2024
+ "perplexity": 2591.61474609375,
2025
+ "num_tokens": 4869319,
2026
+ "num_layers": 100,
2027
+ "hidden_size": 128,
2028
+ "num_params": 16934016,
2029
+ "global_act": {
2030
+ "mean": 0.0,
2031
+ "max_abs": 0.0,
2032
+ "std": 0.0,
2033
+ "norm": 0.0,
2034
+ "numel": 0,
2035
+ "min_val": 0.0,
2036
+ "max_val": 0.0,
2037
+ "range_val": 0.0,
2038
+ "p25": 0.0,
2039
+ "p50": 0.0,
2040
+ "p90": 0.0,
2041
+ "p99": 0.0,
2042
+ "p999": 0.0
2043
+ },
2044
+ "layer_acts": {}
2045
+ },
2046
+ {
2047
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2048
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-2900",
2049
+ "dataset": "tinystories",
2050
+ "checkpoint_step": 2900,
2051
+ "loss": 7.860036280227276,
2052
+ "perplexity": 2591.61474609375,
2053
+ "num_tokens": 4869319,
2054
+ "num_layers": 100,
2055
+ "hidden_size": 128,
2056
+ "num_params": 16934016,
2057
+ "global_act": {
2058
+ "mean": 0.0,
2059
+ "max_abs": 0.0,
2060
+ "std": 0.0,
2061
+ "norm": 0.0,
2062
+ "numel": 0,
2063
+ "min_val": 0.0,
2064
+ "max_val": 0.0,
2065
+ "range_val": 0.0,
2066
+ "p25": 0.0,
2067
+ "p50": 0.0,
2068
+ "p90": 0.0,
2069
+ "p99": 0.0,
2070
+ "p999": 0.0
2071
+ },
2072
+ "layer_acts": {}
2073
+ },
2074
+ {
2075
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2076
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3000",
2077
+ "dataset": "tinystories",
2078
+ "checkpoint_step": 3000,
2079
+ "loss": 7.873495246460542,
2080
+ "perplexity": 2626.730224609375,
2081
+ "num_tokens": 4869319,
2082
+ "num_layers": 100,
2083
+ "hidden_size": 128,
2084
+ "num_params": 16934016,
2085
+ "global_act": {
2086
+ "mean": 0.0,
2087
+ "max_abs": 0.0,
2088
+ "std": 0.0,
2089
+ "norm": 0.0,
2090
+ "numel": 0,
2091
+ "min_val": 0.0,
2092
+ "max_val": 0.0,
2093
+ "range_val": 0.0,
2094
+ "p25": 0.0,
2095
+ "p50": 0.0,
2096
+ "p90": 0.0,
2097
+ "p99": 0.0,
2098
+ "p999": 0.0
2099
+ },
2100
+ "layer_acts": {}
2101
+ },
2102
+ {
2103
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2104
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3100",
2105
+ "dataset": "tinystories",
2106
+ "checkpoint_step": 3100,
2107
+ "loss": 7.890318954252124,
2108
+ "perplexity": 2671.295654296875,
2109
+ "num_tokens": 4869319,
2110
+ "num_layers": 100,
2111
+ "hidden_size": 128,
2112
+ "num_params": 16934016,
2113
+ "global_act": {
2114
+ "mean": 0.0,
2115
+ "max_abs": 0.0,
2116
+ "std": 0.0,
2117
+ "norm": 0.0,
2118
+ "numel": 0,
2119
+ "min_val": 0.0,
2120
+ "max_val": 0.0,
2121
+ "range_val": 0.0,
2122
+ "p25": 0.0,
2123
+ "p50": 0.0,
2124
+ "p90": 0.0,
2125
+ "p99": 0.0,
2126
+ "p999": 0.0
2127
+ },
2128
+ "layer_acts": {}
2129
+ },
2130
+ {
2131
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2132
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3200",
2133
+ "dataset": "tinystories",
2134
+ "checkpoint_step": 3200,
2135
+ "loss": 7.860036280227276,
2136
+ "perplexity": 2591.61474609375,
2137
+ "num_tokens": 4869319,
2138
+ "num_layers": 100,
2139
+ "hidden_size": 128,
2140
+ "num_params": 16934016,
2141
+ "global_act": {
2142
+ "mean": 0.0,
2143
+ "max_abs": 0.0,
2144
+ "std": 0.0,
2145
+ "norm": 0.0,
2146
+ "numel": 0,
2147
+ "min_val": 0.0,
2148
+ "max_val": 0.0,
2149
+ "range_val": 0.0,
2150
+ "p25": 0.0,
2151
+ "p50": 0.0,
2152
+ "p90": 0.0,
2153
+ "p99": 0.0,
2154
+ "p999": 0.0
2155
+ },
2156
+ "layer_acts": {}
2157
+ },
2158
+ {
2159
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2160
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3300",
2161
+ "dataset": "tinystories",
2162
+ "checkpoint_step": 3300,
2163
+ "loss": 7.890318954252124,
2164
+ "perplexity": 2671.295654296875,
2165
+ "num_tokens": 4869319,
2166
+ "num_layers": 100,
2167
+ "hidden_size": 128,
2168
+ "num_params": 16934016,
2169
+ "global_act": {
2170
+ "mean": 0.0,
2171
+ "max_abs": 0.0,
2172
+ "std": 0.0,
2173
+ "norm": 0.0,
2174
+ "numel": 0,
2175
+ "min_val": 0.0,
2176
+ "max_val": 0.0,
2177
+ "range_val": 0.0,
2178
+ "p25": 0.0,
2179
+ "p50": 0.0,
2180
+ "p90": 0.0,
2181
+ "p99": 0.0,
2182
+ "p999": 0.0
2183
+ },
2184
+ "layer_acts": {}
2185
+ },
2186
+ {
2187
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2188
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3400",
2189
+ "dataset": "tinystories",
2190
+ "checkpoint_step": 3400,
2191
+ "loss": 7.890318954252124,
2192
+ "perplexity": 2671.295654296875,
2193
+ "num_tokens": 4869319,
2194
+ "num_layers": 100,
2195
+ "hidden_size": 128,
2196
+ "num_params": 16934016,
2197
+ "global_act": {
2198
+ "mean": 0.0,
2199
+ "max_abs": 0.0,
2200
+ "std": 0.0,
2201
+ "norm": 0.0,
2202
+ "numel": 0,
2203
+ "min_val": 0.0,
2204
+ "max_val": 0.0,
2205
+ "range_val": 0.0,
2206
+ "p25": 0.0,
2207
+ "p50": 0.0,
2208
+ "p90": 0.0,
2209
+ "p99": 0.0,
2210
+ "p999": 0.0
2211
+ },
2212
+ "layer_acts": {}
2213
+ },
2214
+ {
2215
+ "run_folder": "glu-waleedglu_low-100L_trash_run",
2216
+ "model": "w-ahmad/STRESS-TEST3/zain/Activation/out/glu-waleedglu_low-100L_trash_run/checkpoint-3500",
2217
+ "dataset": "tinystories",
2218
+ "checkpoint_step": 3500,
2219
+ "loss": 7.890318954252124,
2220
+ "perplexity": 2671.295654296875,
2221
+ "num_tokens": 4869319,
2222
+ "num_layers": 100,
2223
+ "hidden_size": 128,
2224
+ "num_params": 16934016,
2225
+ "global_act": {
2226
+ "mean": 0.0,
2227
+ "max_abs": 0.0,
2228
+ "std": 0.0,
2229
+ "norm": 0.0,
2230
+ "numel": 0,
2231
+ "min_val": 0.0,
2232
+ "max_val": 0.0,
2233
+ "range_val": 0.0,
2234
+ "p25": 0.0,
2235
+ "p50": 0.0,
2236
+ "p90": 0.0,
2237
+ "p99": 0.0,
2238
+ "p999": 0.0
2239
+ },
2240
+ "layer_acts": {}
2241
+ }
2242
+ ]
zain/Activation/exp.py ADDED
@@ -0,0 +1,948 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # =====================================================================
2
+ # exp.py – FULL FILE WITH PowLU INTEGRATION
3
+ # =====================================================================
4
+
5
+ import math
6
+ import os
7
+ import time
8
+ import json
9
+ import re
10
+ from pathlib import Path
11
+ from itertools import chain
12
+ from typing import Dict, Callable, Optional, List, Any, Tuple
13
+
14
+ import torch
15
+ import torch.nn as nn
16
+ from transformers import (
17
+ LlamaConfig,
18
+ LlamaPreTrainedModel,
19
+ Trainer,
20
+ TrainerCallback,
21
+ TrainingArguments,
22
+ DataCollatorForLanguageModeling,
23
+ AutoTokenizer,
24
+ set_seed,
25
+ )
26
+ from transformers.models.llama.modeling_llama import (
27
+ LlamaAttention,
28
+ LlamaRMSNorm,
29
+ LlamaRotaryEmbedding,
30
+ )
31
+ from transformers.modeling_outputs import CausalLMOutputWithPast
32
+ from datasets import load_dataset
33
+ from huggingface_hub import snapshot_download
34
+
35
+
36
+ # =============================================================================
37
+ # 1. ACTIVATION REGISTRY
38
+ # =============================================================================
39
+
40
+ class GLUActivationRegistry:
41
+ _registry: Dict[str, Callable[[torch.Tensor], torch.Tensor]] = {}
42
+
43
+ @classmethod
44
+ def register(cls, name: str, fn: Callable[[torch.Tensor], torch.Tensor]) -> None:
45
+ cls._registry[name] = fn
46
+
47
+ @classmethod
48
+ def get(cls, name: str) -> Callable[[torch.Tensor], torch.Tensor]:
49
+ if name not in cls._registry:
50
+ raise KeyError(
51
+ f"Activation '{name}' not found. Available: {list(cls._registry.keys())}"
52
+ )
53
+ return cls._registry[name]
54
+
55
+ # Built-ins
56
+ GLUActivationRegistry.register("silu", nn.functional.silu)
57
+ GLUActivationRegistry.register("swish", nn.functional.silu)
58
+ GLUActivationRegistry.register("relu", nn.functional.relu)
59
+ GLUActivationRegistry.register("gelu", nn.functional.gelu)
60
+ GLUActivationRegistry.register("sigmoid", torch.sigmoid)
61
+ GLUActivationRegistry.register("tanh", torch.tanh)
62
+ GLUActivationRegistry.register("softplus", nn.functional.softplus)
63
+ GLUActivationRegistry.register("linear", lambda x: x)
64
+ GLUActivationRegistry.register("s10", lambda x: x * x * torch.sigmoid(x))
65
+ GLUActivationRegistry.register("w1a", lambda x: x * torch.tanh(x))
66
+
67
+
68
+ # =============================================================================
69
+ # 2. CONFIG
70
+ # =============================================================================
71
+
72
+ class TinyLlamaConfig(LlamaConfig):
73
+ model_type = "tiny_llama"
74
+
75
+ def __init__(
76
+ self,
77
+ mlp_type: str = "glu",
78
+ activation: str = "silu",
79
+ waleed_beta: float = 10.0,
80
+ powlu_m: float = 3.0, # <-- NEW: PowLU hyperparameter
81
+ **kwargs
82
+ ):
83
+ super().__init__(**kwargs)
84
+ self.mlp_type = mlp_type
85
+ self.activation = activation
86
+ self.waleed_beta = waleed_beta
87
+ self.powlu_m = powlu_m # <-- store it
88
+ if self.num_key_value_heads != self.num_attention_heads:
89
+ raise ValueError(
90
+ f"Pure MHA required: num_key_value_heads ({self.num_key_value_heads}) "
91
+ f"must equal num_attention_heads ({self.num_attention_heads})."
92
+ )
93
+
94
+
95
+ # =============================================================================
96
+ # 3. MODEL (with PowLU)
97
+ # =============================================================================
98
+
99
+ class TinyLlamaMLP(nn.Module):
100
+ override_active = False
101
+ override_value = -100.0
102
+
103
+ def __init__(self, config: TinyLlamaConfig):
104
+ super().__init__()
105
+ self.hidden_size = config.hidden_size
106
+ self.intermediate_size = config.intermediate_size
107
+ self.mlp_type = config.mlp_type
108
+ self.activation_name = config.activation
109
+ self.waleed_beta = getattr(config, "waleed_beta", 10.0)
110
+ self.powlu_m = getattr(config, "powlu_m", 3.0) # <-- store m
111
+
112
+ if self.mlp_type == "glu":
113
+ effective_intermediate = self.intermediate_size
114
+ elif self.mlp_type == "mlp":
115
+ effective_intermediate = int(self.intermediate_size * 1.5)
116
+ print(f"[MLP] Auto‑scaled intermediate_size from {self.intermediate_size} to {effective_intermediate}")
117
+ else:
118
+ raise ValueError(f"Unknown mlp_type: {self.mlp_type}")
119
+
120
+ self.effective_intermediate = effective_intermediate
121
+
122
+ if self.mlp_type == "glu":
123
+ self.gate_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
124
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
125
+ else:
126
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
127
+
128
+ self.down_proj = nn.Linear(effective_intermediate, self.hidden_size, bias=False)
129
+
130
+ # ---- Activation flags ----
131
+ self.is_powlu = (self.activation_name == "powlu") # <-- NEW
132
+ self.is_situglu = self.activation_name in ("situglu", "situglu_low")
133
+ self.is_waleed = self.activation_name in ("waleed", "waleedglu_low")
134
+ self.is_waleed10 = self.activation_name in ("waleed10", "silu-waleed10")
135
+ self.has_sigmoid_gate = self.activation_name.startswith("situglu")
136
+
137
+ # ---- Activation function (for non-PowLU) ----
138
+ if self.mlp_type == "glu":
139
+ if self.is_powlu:
140
+ # PowLU handled in forward, no act_fn needed
141
+ self.act_fn = None
142
+ elif self.activation_name in ("situglu", "waleed", "situglu_low", "waleedglu_low"):
143
+ self.act_fn = None # custom handling
144
+ elif self.activation_name == "waleed10":
145
+ self.act_fn = GLUActivationRegistry.get("linear")
146
+ elif self.activation_name == "silu-waleed10":
147
+ self.act_fn = GLUActivationRegistry.get("silu")
148
+ else:
149
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
150
+ else: # mlp
151
+ if self.is_powlu:
152
+ raise ValueError("PowLU is only supported with mlp_type='glu'")
153
+ if self.activation_name in ("situglu", "waleed", "situglu_low", "waleedglu_low"):
154
+ raise ValueError(f"Activation '{self.activation_name}' requires GLU.")
155
+ elif self.activation_name == "waleed10":
156
+ self.act_fn = GLUActivationRegistry.get("linear")
157
+ elif self.activation_name == "silu-waleed10":
158
+ self.act_fn = GLUActivationRegistry.get("silu")
159
+ else:
160
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
161
+
162
+ # beta values for situglu/waleed
163
+ if self.activation_name in ("situglu_low", "waleedglu_low"):
164
+ self.beta1 = 2.5
165
+ self.beta2 = 4.0
166
+ else:
167
+ self.beta1 = 4.0
168
+ self.beta2 = 25.0
169
+
170
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
171
+ if self.mlp_type == "glu":
172
+ gate = self.gate_proj(x)
173
+ up = self.up_proj(x)
174
+
175
+ # ----- PowLU branch (NEW) -----
176
+ if self.is_powlu:
177
+ m = self.powlu_m
178
+ sig_gate = torch.sigmoid(gate)
179
+ pos_mask = gate > 0
180
+ # For positive: gate^(m/(sqrt(gate)+1)) * sigmoid(gate)
181
+ powlu_pos = gate ** (m / (torch.sqrt(gate) + 1)) * sig_gate
182
+ # For non-positive: gate * sigmoid(gate) (= SiLU)
183
+ powlu_neg = gate * sig_gate
184
+ activated_gate = torch.where(pos_mask, powlu_pos, powlu_neg)
185
+ hidden = activated_gate * up
186
+
187
+ # ----- situglu / waleed branches (unchanged) -----
188
+ elif self.is_situglu or self.is_waleed:
189
+ if self.has_sigmoid_gate:
190
+ gate = self.beta1 * torch.tanh(gate / self.beta1) * torch.sigmoid(gate)
191
+ else:
192
+ gate = self.beta1 * torch.tanh(gate / self.beta1)
193
+ up = self.beta2 * torch.tanh(up / self.beta2)
194
+ hidden = gate * up
195
+
196
+ # ----- Standard GLU (ReLU, GELU, SiLU, etc.) -----
197
+ else:
198
+ hidden = self.act_fn(gate) * up
199
+
200
+ out = self.down_proj(hidden)
201
+
202
+ else: # mlp
203
+ hidden = self.act_fn(self.up_proj(x))
204
+ out = self.down_proj(hidden)
205
+
206
+ # Optional Waleed clipping after down projection
207
+ if self.is_waleed10:
208
+ out = self.waleed_beta * torch.tanh(out / self.waleed_beta)
209
+
210
+ # Override hook (unchanged)
211
+ if TinyLlamaMLP.override_active and out.requires_grad:
212
+ out.register_hook(lambda grad: TinyLlamaMLP.override_value * torch.ones_like(grad))
213
+
214
+ return out
215
+
216
+
217
+ # ----------------------------------------------------------------------------
218
+ # DECODER LAYER, ATTENTION MASK, MODEL (unchanged)
219
+ # ----------------------------------------------------------------------------
220
+
221
+ class TinyLlamaDecoderLayer(nn.Module):
222
+ def __init__(self, config: TinyLlamaConfig, layer_idx: int):
223
+ super().__init__()
224
+ self.hidden_size = config.hidden_size
225
+ self.self_attn = LlamaAttention(config=config, layer_idx=layer_idx)
226
+ self.mlp = TinyLlamaMLP(config)
227
+ self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
228
+ self.post_attention_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
229
+ self.residual_pre_attn = nn.Identity()
230
+ self.residual_post_attn = nn.Identity()
231
+ self.residual_post_mlp = nn.Identity()
232
+
233
+ def forward(self, hidden_states, attention_mask=None, position_ids=None, position_embeddings=None, **kwargs):
234
+ residual = hidden_states
235
+ hidden_states = self.residual_pre_attn(hidden_states)
236
+ hidden_states = self.input_layernorm(hidden_states)
237
+ attn_out = self.self_attn(
238
+ hidden_states=hidden_states,
239
+ attention_mask=attention_mask,
240
+ position_ids=position_ids,
241
+ position_embeddings=position_embeddings,
242
+ )[0]
243
+ hidden_states = residual + attn_out
244
+ hidden_states = self.residual_post_attn(hidden_states)
245
+
246
+ residual = hidden_states
247
+ hidden_states = self.post_attention_layernorm(hidden_states)
248
+ hidden_states = self.mlp(hidden_states)
249
+ hidden_states = residual + hidden_states
250
+ hidden_states = self.residual_post_mlp(hidden_states)
251
+ return (hidden_states,)
252
+
253
+
254
+ def _build_causal_mask(attention_mask, seq_len, dtype, device):
255
+ min_value = torch.finfo(dtype).min
256
+ causal = torch.full((seq_len, seq_len), fill_value=min_value, dtype=dtype, device=device)
257
+ causal = torch.triu(causal, diagonal=1)
258
+ causal = causal[None, None, :, :]
259
+ if attention_mask is None:
260
+ batch_size = 1
261
+ return causal.expand(batch_size, 1, seq_len, seq_len)
262
+ batch_size = attention_mask.shape[0]
263
+ causal = causal.expand(batch_size, 1, seq_len, seq_len).clone()
264
+ padding = attention_mask[:, None, None, :].to(device) == 0
265
+ causal = causal.masked_fill(padding, min_value)
266
+ return causal
267
+
268
+
269
+ _MASK_PRINTED = False
270
+
271
+
272
+ class TinyLlamaModel(LlamaPreTrainedModel):
273
+ config_class = TinyLlamaConfig
274
+
275
+ def __init__(self, config: TinyLlamaConfig):
276
+ super().__init__(config)
277
+ self.padding_idx = config.pad_token_id
278
+ self.vocab_size = config.vocab_size
279
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
280
+ self.layers = nn.ModuleList([TinyLlamaDecoderLayer(config, i) for i in range(config.num_hidden_layers)])
281
+ self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
282
+ self.rotary_emb = LlamaRotaryEmbedding(config=config)
283
+ self.post_init()
284
+
285
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None, inputs_embeds=None, return_dict=None, **kwargs):
286
+ global _MASK_PRINTED
287
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
288
+ if inputs_embeds is None:
289
+ inputs_embeds = self.embed_tokens(input_ids)
290
+ if position_ids is None:
291
+ seq_len = inputs_embeds.shape[1]
292
+ position_ids = torch.arange(seq_len, device=inputs_embeds.device).unsqueeze(0).expand(inputs_embeds.shape[0], -1)
293
+ hidden_states = inputs_embeds
294
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
295
+ seq_len = hidden_states.shape[1]
296
+ causal_mask = _build_causal_mask(attention_mask, seq_len, hidden_states.dtype, hidden_states.device)
297
+ if not _MASK_PRINTED:
298
+ print("[INFO] Causal mask (float with -inf) applied to all attention layers.")
299
+ _MASK_PRINTED = True
300
+ for decoder_layer in self.layers:
301
+ layer_outputs = decoder_layer(
302
+ hidden_states,
303
+ attention_mask=causal_mask,
304
+ position_ids=position_ids,
305
+ position_embeddings=position_embeddings,
306
+ )
307
+ hidden_states = layer_outputs[0]
308
+ hidden_states = self.norm(hidden_states)
309
+ if not return_dict:
310
+ return (hidden_states,)
311
+ return {"last_hidden_state": hidden_states, "hidden_states": None, "attentions": None}
312
+
313
+
314
+ class TinyLlamaForCausalLM(LlamaPreTrainedModel):
315
+ config_class = TinyLlamaConfig
316
+ _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
317
+
318
+ def __init__(self, config: TinyLlamaConfig):
319
+ super().__init__(config)
320
+ self.model = TinyLlamaModel(config)
321
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
322
+ if config.tie_word_embeddings:
323
+ self.lm_head.weight = self.model.embed_tokens.weight
324
+ self.post_init()
325
+
326
+ def get_input_embeddings(self):
327
+ return self.model.embed_tokens
328
+
329
+ def set_input_embeddings(self, value):
330
+ self.model.embed_tokens = value
331
+
332
+ def get_output_embeddings(self):
333
+ return self.lm_head
334
+
335
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None, inputs_embeds=None,
336
+ labels=None, return_dict=None, **kwargs):
337
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
338
+ outputs = self.model(input_ids=input_ids, attention_mask=attention_mask, position_ids=position_ids,
339
+ inputs_embeds=inputs_embeds, return_dict=return_dict)
340
+ hidden_states = outputs["last_hidden_state"] if return_dict else outputs[0]
341
+ logits = self.lm_head(hidden_states)
342
+ loss = None
343
+ if labels is not None:
344
+ shift_logits = logits[..., :-1, :].contiguous()
345
+ shift_labels = labels[..., 1:].contiguous()
346
+ loss_fct = nn.CrossEntropyLoss()
347
+ loss = loss_fct(shift_logits.view(-1, self.config.vocab_size), shift_labels.view(-1))
348
+ if not return_dict:
349
+ output = (logits,) + outputs[1:]
350
+ return (loss,) + output if loss is not None else output
351
+ return CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=None, hidden_states=None, attentions=None)
352
+
353
+ def prepare_inputs_for_generation(self, input_ids, past_key_values=None, attention_mask=None, **kwargs):
354
+ if past_key_values:
355
+ input_ids = input_ids[:, -1:]
356
+ position_ids = kwargs.get("position_ids")
357
+ if attention_mask is not None and position_ids is None:
358
+ position_ids = attention_mask.long().cumsum(-1) - 1
359
+ position_ids.masked_fill_(attention_mask == 0, 1)
360
+ if past_key_values:
361
+ position_ids = position_ids[:, -1].unsqueeze(-1)
362
+ return {
363
+ "input_ids": input_ids,
364
+ "position_ids": position_ids,
365
+ "past_key_values": past_key_values,
366
+ "attention_mask": attention_mask,
367
+ }
368
+
369
+
370
+ # =============================================================================
371
+ # 4. HF CHECKPOINT FETCHER (unchanged)
372
+ # =============================================================================
373
+
374
+ def fetch_latest_checkpoint_from_hub(
375
+ repo_id: str,
376
+ subpath: str,
377
+ variant: str,
378
+ checkpoint_step: Optional[int] = None
379
+ ) -> str:
380
+ remote_prefix = f"{subpath}/{variant}_run" if subpath else f"{variant}_run"
381
+ if checkpoint_step is not None:
382
+ full_remote_path = f"{remote_prefix}/checkpoint-{checkpoint_step}"
383
+ print(f"[Hub] Fetching specific checkpoint: {repo_id}/{full_remote_path}")
384
+ local_root = snapshot_download(
385
+ repo_id=repo_id,
386
+ allow_patterns=[f"{full_remote_path}/*"],
387
+ local_dir_use_symlinks=False,
388
+ )
389
+ checkpoint_local_path = os.path.join(local_root, full_remote_path)
390
+ if not os.path.exists(checkpoint_local_path):
391
+ raise RuntimeError(f"Downloaded checkpoint not found at {checkpoint_local_path}")
392
+ return checkpoint_local_path
393
+
394
+ print(f"[Hub] Downloading entire run folder: {repo_id}/{remote_prefix}")
395
+ local_root = snapshot_download(
396
+ repo_id=repo_id,
397
+ allow_patterns=[f"{remote_prefix}/*"],
398
+ local_dir_use_symlinks=False,
399
+ )
400
+ run_local_path = os.path.join(local_root, remote_prefix)
401
+ if not os.path.exists(run_local_path):
402
+ raise RuntimeError(f"Run folder not found at {run_local_path}")
403
+
404
+ checkpoints = []
405
+ for item in os.listdir(run_local_path):
406
+ if item.startswith("checkpoint-") and os.path.isdir(os.path.join(run_local_path, item)):
407
+ match = re.match(r"checkpoint-(\d+)", item)
408
+ if match:
409
+ step = int(match.group(1))
410
+ checkpoints.append((step, item))
411
+
412
+ if not checkpoints:
413
+ raise RuntimeError(f"No checkpoint folders found in {run_local_path}")
414
+
415
+ latest_step, latest_name = max(checkpoints, key=lambda x: x[0])
416
+ print(f"[Hub] Latest checkpoint found: step {latest_step}")
417
+ return os.path.join(run_local_path, latest_name)
418
+
419
+
420
+ # =============================================================================
421
+ # 5. RESUME + FREEZE + OVERRIDE CALLBACK (unchanged)
422
+ # =============================================================================
423
+
424
+ class ResumeFreezeOverrideCallback(TrainerCallback):
425
+ def __init__(self, override_value: Optional[float] = None):
426
+ self.override_value = override_value
427
+ self._trainer = None # Will be set manually
428
+
429
+ def on_train_begin(self, args, state, control, **kwargs):
430
+ # Try multiple ways to get the trainer
431
+ trainer = kwargs.get('trainer')
432
+ if trainer is None:
433
+ trainer = getattr(self, '_trainer', None)
434
+ if trainer is None:
435
+ trainer = getattr(self, 'trainer', None)
436
+ if trainer is None:
437
+ raise ValueError("Trainer not accessible in callback")
438
+
439
+ model = trainer.model
440
+
441
+ # ----- FREEZE ALL EXCEPT MLP PROJECTIONS -----
442
+ for name, param in model.named_parameters():
443
+ if any(x in name for x in ["gate_proj", "up_proj", "down_proj"]):
444
+ param.requires_grad = True
445
+ else:
446
+ param.requires_grad = False
447
+
448
+ trainable_params = [p for p in model.parameters() if p.requires_grad]
449
+
450
+ # ----- REBUILD OPTIMIZER -----
451
+ from torch.optim import AdamW
452
+ new_optimizer = AdamW(
453
+ trainable_params,
454
+ lr=args.learning_rate,
455
+ weight_decay=args.weight_decay,
456
+ betas=(args.adam_beta1, args.adam_beta2),
457
+ eps=args.adam_epsilon,
458
+ )
459
+ trainer.optimizer = new_optimizer
460
+
461
+ # ----- KEEP EXISTING SCHEDULER (re‑attach) -----
462
+ if trainer.lr_scheduler is not None:
463
+ trainer.lr_scheduler.optimizer = new_optimizer
464
+
465
+ # ----- ACTIVATE OVERRIDE -----
466
+ if self.override_value is not None:
467
+ TinyLlamaMLP.override_active = True
468
+ TinyLlamaMLP.override_value = self.override_value
469
+ print(f"[Override] Activated with value = {self.override_value}")
470
+ else:
471
+ print("[Freeze] MLP projections frozen; no gradient override.")
472
+
473
+
474
+ # =============================================================================
475
+ # 6. MONITORING (unchanged)
476
+ # =============================================================================
477
+
478
+ class StatsEngine:
479
+ @staticmethod
480
+ def compute(tensor: torch.Tensor, user_limit: float, dtype_ratio: float) -> Dict[str, float]:
481
+ with torch.no_grad():
482
+ abs_t = tensor.abs()
483
+ dtype_info = torch.finfo(tensor.dtype)
484
+ dtype_limit = dtype_ratio * dtype_info.max if not torch.isinf(torch.tensor(dtype_info.max)) else float("inf")
485
+ return {
486
+ "norm": tensor.norm(2).item(),
487
+ "mean": tensor.mean().item(),
488
+ "std": tensor.std().item(),
489
+ "max_abs": abs_t.max().item(),
490
+ "frac_near_dtype_limit": (abs_t > dtype_limit).float().mean().item() if not math.isinf(dtype_limit) else 0.0,
491
+ "frac_near_user_limit": (abs_t > user_limit).float().mean().item(),
492
+ "min": tensor.min().item(),
493
+ "max": tensor.max().item(),
494
+ "range": tensor.max().item() - tensor.min().item(),
495
+ }
496
+
497
+
498
+ class StepAccumulator:
499
+ def __init__(self):
500
+ self.tensors: Dict[str, Dict[str, float]] = {}
501
+
502
+ def add(self, name: str, numel: int, stats: Dict[str, float]):
503
+ new_entry = {"numel": numel, **stats}
504
+ existing = self.tensors.get(name)
505
+ self.tensors[name] = new_entry if existing is None else self._merge_entry(existing, new_entry)
506
+
507
+ @staticmethod
508
+ def _merge_entry(a: Dict[str, float], b: Dict[str, float]) -> Dict[str, float]:
509
+ total_n = a["numel"] + b["numel"]
510
+ if total_n == 0:
511
+ return a
512
+ norm = math.sqrt(a["norm"] ** 2 + b["norm"] ** 2)
513
+ max_abs = max(a["max_abs"], b["max_abs"])
514
+ mean = (a["mean"] * a["numel"] + b["mean"] * b["numel"]) / total_n
515
+ ex2 = (a["numel"] * (a["std"] ** 2 + a["mean"] ** 2) + b["numel"] * (b["std"] ** 2 + b["mean"] ** 2)) / total_n
516
+ std = math.sqrt(max(0.0, ex2 - mean ** 2))
517
+ frac_dtype = (a["frac_near_dtype_limit"] * a["numel"] + b["frac_near_dtype_limit"] * b["numel"]) / total_n
518
+ frac_user = (a["frac_near_user_limit"] * a["numel"] + b["frac_near_user_limit"] * b["numel"]) / total_n
519
+ t_min = min(a.get("min", float("inf")), b.get("min", float("inf")))
520
+ t_max = max(a.get("max", float("-inf")), b.get("max", float("-inf")))
521
+ return {
522
+ "numel": total_n,
523
+ "norm": norm,
524
+ "mean": mean,
525
+ "std": std,
526
+ "max_abs": max_abs,
527
+ "frac_near_dtype_limit": frac_dtype,
528
+ "frac_near_user_limit": frac_user,
529
+ "min": t_min,
530
+ "max": t_max,
531
+ "range": t_max - t_min,
532
+ }
533
+
534
+ def clear(self):
535
+ self.tensors.clear()
536
+
537
+ def _aggregate(self, entries: Dict[str, Dict[str, float]]) -> Dict[str, float]:
538
+ if not entries:
539
+ return {}
540
+ numels = [e["numel"] for e in entries.values()]
541
+ total_n = sum(numels)
542
+ norm = math.sqrt(sum(e["norm"] ** 2 for e in entries.values()))
543
+ max_abs = max(e["max_abs"] for e in entries.values())
544
+ mean = sum(e["mean"] * e["numel"] for e in entries.values()) / total_n
545
+ ex2 = sum(e["numel"] * (e["std"] ** 2 + e["mean"] ** 2) for e in entries.values()) / total_n
546
+ std = math.sqrt(max(0.0, ex2 - mean ** 2))
547
+ frac_dtype = sum(e["frac_near_dtype_limit"] * e["numel"] for e in entries.values()) / total_n
548
+ frac_user = sum(e["frac_near_user_limit"] * e["numel"] for e in entries.values()) / total_n
549
+ t_min = min(e.get("min", float("inf")) for e in entries.values())
550
+ t_max = max(e.get("max", float("-inf")) for e in entries.values())
551
+ return {
552
+ "norm": norm,
553
+ "mean": mean,
554
+ "std": std,
555
+ "max_abs": max_abs,
556
+ "frac_near_dtype_limit": frac_dtype,
557
+ "frac_near_user_limit": frac_user,
558
+ "min": t_min,
559
+ "max": t_max,
560
+ "range": t_max - t_min,
561
+ }
562
+
563
+ def get_global_stats(self) -> Dict[str, float]:
564
+ return self._aggregate(self.tensors)
565
+
566
+ def get_layer_stats(self, layer_prefix: str) -> Dict[str, float]:
567
+ entries = {k: v for k, v in self.tensors.items() if k.startswith(layer_prefix + ".")}
568
+ return self._aggregate(entries)
569
+
570
+
571
+ class HookRegistry:
572
+ def __init__(self, model: nn.Module):
573
+ self.model = model
574
+ self.handles = []
575
+ self.active = False
576
+
577
+ def attach_forward(self, module_patterns, accumulator, user_limit, dtype_ratio):
578
+ for name, module in self.model.named_modules():
579
+ if any(re.search(p, name) for p in module_patterns):
580
+ h = module.register_forward_hook(
581
+ self._make_forward_hook(name, accumulator, user_limit, dtype_ratio)
582
+ )
583
+ self.handles.append(h)
584
+
585
+ def attach_backward(self, param_patterns, accumulator, user_limit, dtype_ratio):
586
+ for name, param in self.model.named_parameters():
587
+ if not param.requires_grad:
588
+ continue
589
+ if param_patterns and not any(re.search(p, name) for p in param_patterns):
590
+ continue
591
+ h = param.register_hook(
592
+ self._make_backward_hook(f"grad.{name}", accumulator, user_limit, dtype_ratio)
593
+ )
594
+ self.handles.append(h)
595
+
596
+ def _make_forward_hook(self, module_name, accumulator, user_limit, dtype_ratio):
597
+ def hook(module, inp, out):
598
+ if not self.active:
599
+ return
600
+ if isinstance(out, dict):
601
+ out = out.get("last_hidden_state")
602
+ if not torch.is_tensor(out):
603
+ return
604
+ stats = StatsEngine.compute(out.detach(), user_limit, dtype_ratio)
605
+ accumulator.add(f"act.{module_name}", out.numel(), stats)
606
+ return hook
607
+
608
+ def _make_backward_hook(self, param_name, accumulator, user_limit, dtype_ratio):
609
+ def hook(grad):
610
+ if not self.active:
611
+ return
612
+ stats = StatsEngine.compute(grad.detach(), user_limit, dtype_ratio)
613
+ accumulator.add(param_name, grad.numel(), stats)
614
+ return hook
615
+
616
+ def set_active(self, active: bool):
617
+ self.active = active
618
+
619
+ def clear(self):
620
+ for h in self.handles:
621
+ h.remove()
622
+ self.handles.clear()
623
+
624
+
625
+ class StabilityMonitorCallback(TrainerCallback):
626
+ def __init__(
627
+ self,
628
+ model: nn.Module,
629
+ monitor_every_n_steps: int = 10,
630
+ module_patterns: Optional[List[str]] = None,
631
+ param_patterns: Optional[List[str]] = None,
632
+ user_limits: Optional[Dict[str, float]] = None,
633
+ dtype_proximity_ratio: float = 0.9,
634
+ log_scope: Optional[Dict[str, bool]] = None,
635
+ monitor_during_eval: bool = False,
636
+ ):
637
+ self.model = model
638
+ self.monitor_every_n_steps = monitor_every_n_steps
639
+ self.module_patterns = module_patterns or [".*mlp.*", ".*residual.*"]
640
+ self.param_patterns = param_patterns or self.module_patterns
641
+ self.user_limits = user_limits or {"grad": 1.0, "param": 100.0, "act": 50.0}
642
+ self.dtype_ratio = dtype_proximity_ratio
643
+ self.log_scope = log_scope or {"global": True, "per_layer": True, "per_tensor": False}
644
+ self.monitor_during_eval = monitor_during_eval
645
+
646
+ self.accumulator = StepAccumulator()
647
+ self.hooks = HookRegistry(model)
648
+ self.hooks.attach_forward(
649
+ self.module_patterns,
650
+ self.accumulator,
651
+ self.user_limits["act"],
652
+ self.dtype_ratio,
653
+ )
654
+ self.hooks.attach_backward(
655
+ self.param_patterns,
656
+ self.accumulator,
657
+ self.user_limits["grad"],
658
+ self.dtype_ratio,
659
+ )
660
+ self.pending_metrics = None
661
+
662
+ def _should_monitor(self, state):
663
+ return state.global_step % self.monitor_every_n_steps == 0
664
+
665
+ def on_step_begin(self, args, state, control, **kwargs):
666
+ if self._should_monitor(state):
667
+ self.accumulator.clear()
668
+ self.hooks.set_active(True)
669
+
670
+ def on_step_end(self, args, state, control, **kwargs):
671
+ if not self.hooks.active:
672
+ return
673
+ for name, param in self.model.named_parameters():
674
+ if self.param_patterns and not any(re.search(p, name) for p in self.param_patterns):
675
+ continue
676
+ stats = StatsEngine.compute(param.data, self.user_limits["param"], self.dtype_ratio)
677
+ self.accumulator.add(f"param.{name}", param.numel(), stats)
678
+ self.hooks.set_active(False)
679
+ self.pending_metrics = self._build_metrics()
680
+
681
+ def _kind_of(self, name: str) -> str:
682
+ if name.startswith("act."):
683
+ return "act"
684
+ if name.startswith("grad."):
685
+ return "grad"
686
+ if name.startswith("param."):
687
+ return "param"
688
+ return "other"
689
+
690
+ def _strip_kind(self, name: str) -> str:
691
+ if name.startswith("act."):
692
+ return name[4:]
693
+ if name.startswith(("grad.", "param.")):
694
+ return name[5:]
695
+ return name
696
+
697
+ def _build_metrics(self, scope: str = "train") -> Dict[str, float]:
698
+ metrics = {}
699
+ if self.log_scope.get("global", True):
700
+ by_kind = {}
701
+ for k, v in self.accumulator.tensors.items():
702
+ by_kind.setdefault(self._kind_of(k), {})[k] = v
703
+ for kind, entries in by_kind.items():
704
+ stats = self.accumulator._aggregate(entries)
705
+ for kk, vv in stats.items():
706
+ metrics[f"{scope}/global/{kind}/{kk}"] = vv
707
+
708
+ if self.log_scope.get("per_layer", True):
709
+ layer_prefixes = set()
710
+ for name in self.accumulator.tensors:
711
+ clean = self._strip_kind(name)
712
+ parts = clean.split(".")
713
+ for i, p in enumerate(parts):
714
+ if p == "layers" and i + 1 < len(parts):
715
+ prefix = ".".join(parts[: i + 2])
716
+ layer_prefixes.add(prefix)
717
+ for prefix in layer_prefixes:
718
+ by_kind = {}
719
+ for k, v in self.accumulator.tensors.items():
720
+ clean = self._strip_kind(k)
721
+ if clean.startswith(prefix + ".") or clean == prefix:
722
+ by_kind.setdefault(self._kind_of(k), {})[k] = v
723
+ safe = prefix.replace(".", "_")
724
+ for kind, entries in by_kind.items():
725
+ if not entries:
726
+ continue
727
+ stats = self.accumulator._aggregate(entries)
728
+ for kk, vv in stats.items():
729
+ metrics[f"{scope}/layer_{safe}/{kind}/{kk}"] = vv
730
+
731
+ if self.log_scope.get("per_tensor", False):
732
+ for name, stats in self.accumulator.tensors.items():
733
+ safe = name.replace(".", "_")
734
+ for kk, vv in stats.items():
735
+ if kk == "numel":
736
+ continue
737
+ metrics[f"{scope}/tensor_{safe}/{kk}"] = vv
738
+ return metrics
739
+
740
+ def on_log(self, args, state, control, logs=None, **kwargs):
741
+ if logs is not None and self.pending_metrics is not None:
742
+ logs.update(self.pending_metrics)
743
+ try:
744
+ import wandb
745
+ if wandb.run is not None:
746
+ wandb.log(self.pending_metrics, step=state.global_step)
747
+ except ImportError:
748
+ pass
749
+ self.pending_metrics = None
750
+
751
+ def on_prediction_step(self, args, state, control, **kwargs):
752
+ if not self.monitor_during_eval:
753
+ return
754
+ if not self.hooks.active:
755
+ self.accumulator.clear()
756
+ self.hooks.set_active(True)
757
+ for name, param in self.model.named_parameters():
758
+ if self.param_patterns and not any(re.search(p, name) for p in self.param_patterns):
759
+ continue
760
+ stats = StatsEngine.compute(param.data, self.user_limits["param"], self.dtype_ratio)
761
+ self.accumulator.add(f"param.{name}", param.numel(), stats)
762
+ self.pending_metrics = self._build_metrics(scope="eval")
763
+
764
+ def on_evaluate(self, args, state, control, metrics=None, **kwargs):
765
+ self.hooks.set_active(False)
766
+ self.accumulator.clear()
767
+
768
+
769
+ # =============================================================================
770
+ # 7. TIME TRACKER (unchanged)
771
+ # =============================================================================
772
+
773
+ class TimeTrackerCallback(TrainerCallback):
774
+ def __init__(self):
775
+ self.step_start = None
776
+ self.epoch_start = None
777
+ self.total_train_time = 0.0
778
+ self.step_times = []
779
+
780
+ def on_epoch_begin(self, args, state, control, **kwargs):
781
+ self.epoch_start = time.perf_counter()
782
+
783
+ def on_step_begin(self, args, state, control, **kwargs):
784
+ self.step_start = time.perf_counter()
785
+
786
+ def on_step_end(self, args, state, control, **kwargs):
787
+ if self.step_start is not None:
788
+ dt = time.perf_counter() - self.step_start
789
+ self.step_times.append(dt)
790
+ self.total_train_time += dt
791
+ self.step_start = None
792
+
793
+ def on_log(self, args, state, control, logs=None, **kwargs):
794
+ if logs is None:
795
+ return
796
+ logs["train/total_time_seconds"] = self.total_train_time
797
+ if self.step_times:
798
+ recent = self.step_times[-100:]
799
+ logs["train/time_per_step_avg"] = sum(recent) / len(recent)
800
+ if self.epoch_start is not None:
801
+ logs["train/epoch_time_elapsed"] = time.perf_counter() - self.epoch_start
802
+ if state.max_steps and state.global_step > 0:
803
+ avg = self.total_train_time / state.global_step
804
+ remaining = (state.max_steps - state.global_step) * avg
805
+ logs["train/estimated_remaining_minutes"] = remaining / 60.0
806
+
807
+
808
+ # =============================================================================
809
+ # 8. METRICS LOGGER (unchanged)
810
+ # =============================================================================
811
+
812
+ class MetricsLoggerCallback(TrainerCallback):
813
+ def __init__(self, output_dir: str):
814
+ self.output_dir = Path(output_dir)
815
+ self.output_dir.mkdir(parents=True, exist_ok=True)
816
+ self.log_file = self.output_dir / "training_log.jsonl"
817
+
818
+ def on_log(self, args, state, control, logs=None, **kwargs):
819
+ if logs is None:
820
+ return
821
+ entry = {"step": state.global_step, "epoch": state.epoch, "timestamp": time.time(), **logs}
822
+ with open(self.log_file, "a") as f:
823
+ f.write(json.dumps(entry, default=str) + "\n")
824
+
825
+
826
+ # =============================================================================
827
+ # 9. DATA & TRAINER FACTORY (unchanged)
828
+ # =============================================================================
829
+
830
+ def build_dataset(
831
+ tokenizer,
832
+ max_seq_len: int = 512,
833
+ split: str = "train",
834
+ dataset_name: str = "roneneldan/TinyStories",
835
+ max_samples: Optional[int] = None,
836
+ ):
837
+ ds = load_dataset(dataset_name, split=split)
838
+ if max_samples is not None and split == "train":
839
+ ds = ds.select(range(min(max_samples, len(ds))))
840
+
841
+ def tokenize(examples):
842
+ out = tokenizer(examples["text"], add_special_tokens=False)
843
+ eos_id = tokenizer.eos_token_id
844
+ out["input_ids"] = [ids + [eos_id] for ids in out["input_ids"]]
845
+ if "attention_mask" in out:
846
+ out["attention_mask"] = [mask + [1] for mask in out["attention_mask"]]
847
+ return out
848
+
849
+ tokenized = ds.map(tokenize, batched=True, num_proc=4, remove_columns=ds.column_names)
850
+
851
+ def group_texts(examples):
852
+ concatenated = {k: list(chain.from_iterable(examples[k])) for k in examples.keys()}
853
+ total_length = len(concatenated[list(examples.keys())[0]])
854
+ total_length = (total_length // max_seq_len) * max_seq_len
855
+ result = {
856
+ k: [t[i:i + max_seq_len] for i in range(0, total_length, max_seq_len)]
857
+ for k, t in concatenated.items()
858
+ }
859
+ result["labels"] = result["input_ids"].copy()
860
+ return result
861
+
862
+ return tokenized.map(group_texts, batched=True, batch_size=10000, num_proc=4)
863
+
864
+
865
+ def create_trainer(
866
+ model,
867
+ tokenizer,
868
+ config: Dict[str, Any],
869
+ train_dataset,
870
+ eval_dataset=None,
871
+ ):
872
+ tc = config.get("training", {})
873
+ mc = config.get("monitor", {})
874
+ go = config.get("gradient_override", {})
875
+
876
+ wandb_project = tc.get("wandb_project")
877
+ if wandb_project:
878
+ os.environ["WANDB_PROJECT"] = wandb_project
879
+
880
+ args = TrainingArguments(
881
+ output_dir=tc.get("output_dir", "./out"),
882
+ run_name=tc.get("run_name", None),
883
+ num_train_epochs=tc.get("num_train_epochs", 3),
884
+ per_device_train_batch_size=tc.get("per_device_train_batch_size", 16),
885
+ per_device_eval_batch_size=tc.get("per_device_eval_batch_size", 16),
886
+ gradient_accumulation_steps=tc.get("gradient_accumulation_steps", 4),
887
+ learning_rate=tc.get("learning_rate", 3e-4),
888
+ weight_decay=tc.get("weight_decay", 0.0),
889
+ max_grad_norm=tc.get("max_grad_norm", 1.0),
890
+ optim=tc.get("optim", "adamw_torch"),
891
+ warmup_steps=tc.get("warmup_steps", 0),
892
+ lr_scheduler_type=tc.get("lr_scheduler_type", "cosine"),
893
+ bf16=tc.get("bf16", True),
894
+ logging_steps=tc.get("logging_steps", 10),
895
+ eval_strategy=tc.get("eval_strategy", "steps"),
896
+ eval_steps=tc.get("eval_steps", 500),
897
+ save_strategy=tc.get("save_strategy", "steps"),
898
+ save_steps=tc.get("save_steps", 1000),
899
+ load_best_model_at_end=tc.get("load_best_model_at_end", False),
900
+ report_to=tc.get("report_to", "tensorboard"),
901
+ push_to_hub=tc.get("push_to_hub", False),
902
+ hub_model_id=tc.get("hub_model_id", None),
903
+ hub_token=tc.get("hub_token") or os.environ.get("HF_TOKEN"),
904
+ max_steps=tc.get("max_steps", -1),
905
+ seed=tc.get("seed", 42),
906
+ data_seed=tc.get("data_seed", 42),
907
+ remove_unused_columns=False,
908
+ )
909
+
910
+ callbacks = [TimeTrackerCallback()]
911
+
912
+ # ---- FREEZE + OVERRIDE CALLBACK ----
913
+ freeze_mlp = tc.get("freeze_mlp", False)
914
+ override_enabled = go.get("enabled", False)
915
+ if freeze_mlp or override_enabled:
916
+ override_value = go.get("value", -100.0) if override_enabled else None
917
+ callbacks.append(ResumeFreezeOverrideCallback(override_value=override_value))
918
+
919
+ # ---- MONITORING ----
920
+ if mc.get("enabled", True):
921
+ module_patterns = mc.get("module_patterns", [".*mlp.*", ".*residual.*"])
922
+ callbacks.append(
923
+ StabilityMonitorCallback(
924
+ model=model,
925
+ monitor_every_n_steps=mc.get("monitor_every_n_steps", 10),
926
+ module_patterns=module_patterns,
927
+ param_patterns=module_patterns,
928
+ user_limits=mc.get("user_limits", {"grad": 1.0, "param": 100.0, "act": 50.0}),
929
+ dtype_proximity_ratio=mc.get("dtype_proximity_ratio", 0.9),
930
+ log_scope=mc.get("log_scope", {"global": True, "per_layer": True, "per_tensor": False}),
931
+ monitor_during_eval=mc.get("monitor_during_eval", False),
932
+ )
933
+ )
934
+
935
+ callbacks.append(MetricsLoggerCallback(args.output_dir))
936
+
937
+ collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False)
938
+
939
+ trainer = Trainer(
940
+ model=model,
941
+ args=args,
942
+ train_dataset=train_dataset,
943
+ eval_dataset=eval_dataset,
944
+ data_collator=collator,
945
+ callbacks=callbacks,
946
+ )
947
+
948
+ return trainer
zain/Activation/grad.py ADDED
@@ -0,0 +1,571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Standalone script to extract Adam RMS and SNR from HF Hub checkpoints.
4
+ Uses exact model definitions from the activation analyzer (exp.py).
5
+ Normalizes names to match the analyzer's naming (gate_proj, up_proj, etc.).
6
+ Configured for: w-ahmad/STRESS-TEST2 / zain/Activation/out
7
+ """
8
+
9
+ import math
10
+ import os
11
+ import json
12
+ import tempfile
13
+ import shutil
14
+ from pathlib import Path
15
+ from typing import Dict, List, Optional, Tuple, Any
16
+
17
+ import torch
18
+ import torch.nn as nn
19
+ import wandb
20
+ from huggingface_hub import HfApi, hf_hub_download, list_repo_tree
21
+ from transformers import LlamaConfig, LlamaPreTrainedModel
22
+ from transformers.models.llama.modeling_llama import (
23
+ LlamaAttention, LlamaRMSNorm, LlamaRotaryEmbedding,
24
+ )
25
+
26
+ # ============================================================================
27
+ # EXACT MODEL DEFINITIONS (copied from the activation analyzer)
28
+ # ============================================================================
29
+
30
+ class GLUActivationRegistry:
31
+ _registry: Dict[str, callable] = {}
32
+
33
+ @classmethod
34
+ def register(cls, name: str, fn: callable) -> None:
35
+ cls._registry[name] = fn
36
+
37
+ @classmethod
38
+ def get(cls, name: str) -> callable:
39
+ if name not in cls._registry:
40
+ raise KeyError(f"Activation '{name}' not found")
41
+ return cls._registry[name]
42
+
43
+ # Register all activations used in the analyzer
44
+ GLUActivationRegistry.register("silu", nn.functional.silu)
45
+ GLUActivationRegistry.register("swish", nn.functional.silu)
46
+ GLUActivationRegistry.register("relu", nn.functional.relu)
47
+ GLUActivationRegistry.register("gelu", nn.functional.gelu)
48
+ GLUActivationRegistry.register("mish", nn.functional.mish)
49
+ GLUActivationRegistry.register("sigmoid", torch.sigmoid)
50
+ GLUActivationRegistry.register("tanh", torch.tanh)
51
+ GLUActivationRegistry.register("elu", nn.functional.elu)
52
+ GLUActivationRegistry.register("softplus", nn.functional.softplus)
53
+ GLUActivationRegistry.register("linear", lambda x: x)
54
+ GLUActivationRegistry.register("s10", lambda x: x * x * torch.sigmoid(x))
55
+ GLUActivationRegistry.register("w1a", lambda x: x * torch.tanh(x))
56
+ GLUActivationRegistry.register("powlu", lambda x: x) # dummy for param extraction
57
+
58
+
59
+ class TinyLlamaConfig(LlamaConfig):
60
+ model_type = "tiny_llama"
61
+
62
+ def __init__(
63
+ self,
64
+ mlp_type: str = "glu",
65
+ activation: str = "silu",
66
+ waleed_beta: float = 10.0,
67
+ powlu_m: float = 3.0,
68
+ **kwargs
69
+ ):
70
+ super().__init__(**kwargs)
71
+ self.mlp_type = mlp_type
72
+ self.activation = activation
73
+ self.waleed_beta = waleed_beta
74
+ self.powlu_m = powlu_m
75
+ if self.num_key_value_heads != self.num_attention_heads:
76
+ raise ValueError("Pure MHA required.")
77
+
78
+
79
+ class SiTUGLU(nn.Module):
80
+ def __init__(self, input_dim: int, hidden_dim: int, beta1: float = 4.0, beta2: float = 25.0):
81
+ super().__init__()
82
+ self.beta1 = beta1
83
+ self.beta2 = beta2
84
+ self.W_g = nn.Linear(input_dim, hidden_dim, bias=False)
85
+ self.W_u = nn.Linear(input_dim, hidden_dim, bias=False)
86
+
87
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
88
+ g = self.W_g(x)
89
+ gate = self.beta1 * torch.tanh(g / self.beta1) * torch.sigmoid(g)
90
+ up = self.beta2 * torch.tanh(self.W_u(x) / self.beta2)
91
+ return gate * up
92
+
93
+
94
+ class WaleedGLU(nn.Module):
95
+ def __init__(self, input_dim: int, hidden_dim: int, beta1: float = 4.0, beta2: float = 25.0):
96
+ super().__init__()
97
+ self.beta1 = beta1
98
+ self.beta2 = beta2
99
+ self.W_g = nn.Linear(input_dim, hidden_dim, bias=False)
100
+ self.W_u = nn.Linear(input_dim, hidden_dim, bias=False)
101
+
102
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
103
+ g = self.W_g(x)
104
+ gate = self.beta1 * torch.tanh(g / self.beta1)
105
+ up = self.beta2 * torch.tanh(self.W_u(x) / self.beta2)
106
+ return gate * up
107
+
108
+
109
+ class TinyLlamaMLP(nn.Module):
110
+ def __init__(self, config: TinyLlamaConfig):
111
+ super().__init__()
112
+ self.hidden_size = config.hidden_size
113
+ self.intermediate_size = config.intermediate_size
114
+ self.mlp_type = config.mlp_type
115
+ self.activation_name = config.activation
116
+
117
+ if self.mlp_type == "glu":
118
+ effective_intermediate = self.intermediate_size
119
+ else:
120
+ effective_intermediate = int(self.intermediate_size * 1.5)
121
+
122
+ self.effective_intermediate = effective_intermediate
123
+ self.situglu = None
124
+ self.waleed = None
125
+ self.gate_proj = None
126
+ self.up_proj = None
127
+ self.act_fn = None
128
+
129
+ if self.mlp_type == "glu":
130
+ if self.activation_name == "situglu":
131
+ self.situglu = SiTUGLU(self.hidden_size, effective_intermediate)
132
+ elif self.activation_name == "waleed":
133
+ self.waleed = WaleedGLU(self.hidden_size, effective_intermediate)
134
+ else:
135
+ # Standard GLU (including waleed10, silu-waleed10, powlu, situglu_low, waleedglu_low)
136
+ self.gate_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
137
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
138
+ # Activation handling (not needed for param extraction, but avoid errors)
139
+ if self.activation_name == "waleed10":
140
+ self.act_fn = GLUActivationRegistry.get("linear")
141
+ elif self.activation_name == "silu-waleed10":
142
+ self.act_fn = GLUActivationRegistry.get("silu")
143
+ elif self.activation_name in ("situglu_low", "waleedglu_low"):
144
+ self.act_fn = None
145
+ else:
146
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
147
+ else:
148
+ # MLP (non-GLU) – not used in your runs, but kept for completeness
149
+ if self.activation_name in ("situglu", "waleed", "situglu_low", "waleedglu_low"):
150
+ raise ValueError(f"Activation '{self.activation_name}' requires GLU.")
151
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
152
+ if self.activation_name == "waleed10":
153
+ self.act_fn = GLUActivationRegistry.get("linear")
154
+ elif self.activation_name == "silu-waleed10":
155
+ self.act_fn = GLUActivationRegistry.get("silu")
156
+ else:
157
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
158
+
159
+ self.down_proj = nn.Linear(effective_intermediate, self.hidden_size, bias=False)
160
+
161
+ def forward(self, x):
162
+ raise NotImplementedError
163
+
164
+
165
+ class TinyLlamaDecoderLayer(nn.Module):
166
+ def __init__(self, config: TinyLlamaConfig, layer_idx: int):
167
+ super().__init__()
168
+ self.hidden_size = config.hidden_size
169
+ self.self_attn = LlamaAttention(config=config, layer_idx=layer_idx)
170
+ self.mlp = TinyLlamaMLP(config)
171
+ self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
172
+ self.post_attention_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
173
+
174
+ def forward(self, *args, **kwargs):
175
+ raise NotImplementedError
176
+
177
+
178
+ class TinyLlamaModel(LlamaPreTrainedModel):
179
+ config_class = TinyLlamaConfig
180
+
181
+ def __init__(self, config: TinyLlamaConfig):
182
+ super().__init__(config)
183
+ self.padding_idx = config.pad_token_id
184
+ self.vocab_size = config.vocab_size
185
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
186
+ self.layers = nn.ModuleList(
187
+ [TinyLlamaDecoderLayer(config, i) for i in range(config.num_hidden_layers)]
188
+ )
189
+ self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
190
+ self.rotary_emb = LlamaRotaryEmbedding(config=config)
191
+ self.post_init()
192
+
193
+
194
+ class TinyLlamaForCausalLM(LlamaPreTrainedModel):
195
+ config_class = TinyLlamaConfig
196
+ _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
197
+
198
+ def __init__(self, config: TinyLlamaConfig):
199
+ super().__init__(config)
200
+ self.model = TinyLlamaModel(config)
201
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
202
+ if config.tie_word_embeddings:
203
+ self.lm_head.weight = self.model.embed_tokens.weight
204
+ self.post_init()
205
+
206
+ def get_input_embeddings(self):
207
+ return self.model.embed_tokens
208
+
209
+ def set_input_embeddings(self, value):
210
+ self.model.embed_tokens = value
211
+
212
+ def get_output_embeddings(self):
213
+ return self.lm_head
214
+
215
+ def forward(self, **kwargs):
216
+ raise NotImplementedError
217
+
218
+
219
+ # ============================================================================
220
+ # NAME NORMALIZATION – matches activation analyzer exactly
221
+ # ============================================================================
222
+
223
+ def canonical_param_name(name: str) -> str:
224
+ """
225
+ Normalize parameter names to match the activation analyzer's naming.
226
+ - W_g -> gate_proj, W_u -> up_proj (for situglu/waleed)
227
+ - Keep gate_proj and up_proj unchanged (they already are canonical)
228
+ - Leave all other names as-is.
229
+ This allows direct overlays between RMS/SNR and activation stats.
230
+ """
231
+ # WaleedGLU → use gate_proj/up_proj
232
+ if "mlp.waleed.W_g" in name:
233
+ return name.replace("mlp.waleed.W_g", "mlp.waleed.gate_proj")
234
+ if "mlp.waleed.W_u" in name:
235
+ return name.replace("mlp.waleed.W_u", "mlp.waleed.up_proj")
236
+
237
+ # SiTUGLU → use gate_proj/up_proj
238
+ if "mlp.situglu.W_g" in name:
239
+ return name.replace("mlp.situglu.W_g", "mlp.situglu.gate_proj")
240
+ if "mlp.situglu.W_u" in name:
241
+ return name.replace("mlp.situglu.W_u", "mlp.situglu.up_proj")
242
+
243
+ # For standard GLU, names already have gate_proj/up_proj – keep them.
244
+ # Everything else (attention, norms, embeddings, lm_head) stays as-is.
245
+ return name
246
+
247
+
248
+ # ============================================================================
249
+ # Stats helpers
250
+ # ============================================================================
251
+
252
+ def tensor_stats(tensor: torch.Tensor) -> Dict[str, float]:
253
+ with torch.no_grad():
254
+ return {
255
+ "numel": tensor.numel(),
256
+ "mean": tensor.mean().item(),
257
+ "std": tensor.std().item(),
258
+ "max_abs": tensor.abs().max().item(),
259
+ "norm": tensor.norm().item(),
260
+ }
261
+
262
+
263
+ def aggregate_stats(stats_list: List[Dict[str, float]]) -> Dict[str, float]:
264
+ if not stats_list:
265
+ return {"numel": 0, "mean": 0.0, "std": 0.0, "max_abs": 0.0, "norm": 0.0}
266
+
267
+ total_numel = sum(s["numel"] for s in stats_list)
268
+ if total_numel == 0:
269
+ return {"numel": 0, "mean": 0.0, "std": 0.0, "max_abs": 0.0, "norm": 0.0}
270
+
271
+ mean = sum(s["mean"] * s["numel"] for s in stats_list) / total_numel
272
+ ex2 = sum(s["numel"] * (s["std"]**2 + s["mean"]**2) for s in stats_list) / total_numel
273
+ std = math.sqrt(max(0.0, ex2 - mean**2))
274
+ norm = math.sqrt(sum(s["norm"]**2 for s in stats_list))
275
+ max_abs = max(s["max_abs"] for s in stats_list)
276
+
277
+ return {"numel": total_numel, "mean": mean, "std": std, "max_abs": max_abs, "norm": norm}
278
+
279
+
280
+ def get_param_names_from_model(config: TinyLlamaConfig) -> List[str]:
281
+ model = TinyLlamaForCausalLM(config)
282
+ return [name for name, _ in model.named_parameters()]
283
+
284
+
285
+ # ============================================================================
286
+ # HF Hub helpers – configured for your repo
287
+ # ============================================================================
288
+
289
+ REPO_ID = "w-ahmad/art"
290
+ BASE_PATH = "out"
291
+
292
+
293
+ def list_run_directories() -> List[str]:
294
+ api = HfApi()
295
+ items = list_repo_tree(repo_id=REPO_ID, path_in_repo=BASE_PATH, recursive=False)
296
+ return [item.path for item in items if item.path.endswith("_run")]
297
+
298
+
299
+ def list_checkpoints_for_run(run_path: str) -> List[str]:
300
+ api = HfApi()
301
+ items = list_repo_tree(repo_id=REPO_ID, path_in_repo=run_path, recursive=False)
302
+ ckpts = [item.path for item in items if item.path.split("/")[-1].startswith("checkpoint-")]
303
+ ckpts.sort(key=lambda x: int(x.split("-")[-1]))
304
+ return ckpts
305
+
306
+
307
+ def download_file_from_hub(file_path: str, local_dir: str) -> str:
308
+ return hf_hub_download(
309
+ repo_id=REPO_ID,
310
+ filename=file_path,
311
+ local_dir=local_dir,
312
+ local_dir_use_symlinks=False,
313
+ )
314
+
315
+
316
+ # ============================================================================
317
+ # Core analysis
318
+ # ============================================================================
319
+
320
+ def analyze_checkpoint_from_hub(
321
+ ckpt_path: str,
322
+ config: TinyLlamaConfig,
323
+ param_names: List[str],
324
+ temp_dir: str,
325
+ ) -> Dict[str, Any]:
326
+ opt_file = download_file_from_hub(f"{ckpt_path}/optimizer.pt", temp_dir)
327
+ opt_state = torch.load(opt_file, map_location="cpu")
328
+ state = opt_state["state"]
329
+ param_groups = opt_state["param_groups"]
330
+
331
+ param_ids = []
332
+ for group in param_groups:
333
+ param_ids.extend(group["params"])
334
+
335
+ if len(param_ids) != len(param_names):
336
+ raise ValueError(
337
+ f"Param ID mismatch: {len(param_ids)} vs {len(param_names)}"
338
+ )
339
+
340
+ id_to_name = {pid: param_names[i] for i, pid in enumerate(param_ids)}
341
+
342
+ # Per-tensor RMS + SNR (canonical names)
343
+ per_tensor_rms: Dict[str, Dict[str, float]] = {}
344
+ per_tensor_snr: Dict[str, Dict[str, float]] = {}
345
+
346
+ for pid, raw_name in id_to_name.items():
347
+ if pid not in state:
348
+ continue
349
+
350
+ name = canonical_param_name(raw_name)
351
+
352
+ # RMS
353
+ v_t = state[pid]["exp_avg_sq"]
354
+ rms = torch.sqrt(v_t + 1e-8)
355
+ per_tensor_rms[name] = tensor_stats(rms)
356
+
357
+ # SNR = |m_t| / (rms + eps)
358
+ m_t = state[pid]["exp_avg"]
359
+ snr = m_t.abs() / (rms + 1e-8)
360
+ snr = snr.clamp(max=1e4)
361
+ per_tensor_snr[name] = tensor_stats(snr)
362
+
363
+ # Layer aggregation
364
+ def build_layer_stats(per_tensor_dict: Dict[str, Dict[str, float]]) -> Dict[str, Dict[str, float]]:
365
+ layers: Dict[str, List[Dict[str, float]]] = {}
366
+ for name, stats in per_tensor_dict.items():
367
+ parts = name.split(".")
368
+ layer_key = None
369
+ for i, p in enumerate(parts):
370
+ if p == "layers" and i + 1 < len(parts):
371
+ layer_key = f"layers.{parts[i+1]}"
372
+ break
373
+ if layer_key is None:
374
+ layer_key = "root"
375
+ layers.setdefault(layer_key, []).append(stats)
376
+ return {k: aggregate_stats(v) for k, v in layers.items()}
377
+
378
+ layer_rms = build_layer_stats(per_tensor_rms)
379
+ layer_snr = build_layer_stats(per_tensor_snr)
380
+
381
+ global_rms = aggregate_stats(list(per_tensor_rms.values()))
382
+ global_snr = aggregate_stats(list(per_tensor_snr.values()))
383
+
384
+ return {
385
+ "step": int(ckpt_path.split("-")[-1]),
386
+ "per_tensor_rms": per_tensor_rms,
387
+ "per_tensor_snr": per_tensor_snr,
388
+ "per_layer_rms": layer_rms,
389
+ "per_layer_snr": layer_snr,
390
+ "global_rms": global_rms,
391
+ "global_snr": global_snr,
392
+ }
393
+
394
+
395
+ # ============================================================================
396
+ # Main
397
+ # ============================================================================
398
+
399
+ def main():
400
+ import argparse
401
+ parser = argparse.ArgumentParser()
402
+ parser.add_argument("--wandb_project", type=str, default="llm-gradient-rms-analysis")
403
+ parser.add_argument("--wandb_entity", type=str, default=None)
404
+ parser.add_argument("--limit_runs", type=str, nargs="+", default=None)
405
+ parser.add_argument("--limit_checkpoints", type=str, nargs="+", default=None)
406
+ parser.add_argument("--cache_dir", type=str, default=None)
407
+ parser.add_argument("--log_all_tensors", action="store_true", default=False,
408
+ help="Log every tensor's RMS/SNR (may hit WandB limits).")
409
+ args = parser.parse_args()
410
+
411
+ print(f"Listing run directories in {REPO_ID}/{BASE_PATH} ...")
412
+ run_paths = list_run_directories()
413
+ print(f"Found {len(run_paths)} run directories.")
414
+
415
+ if args.limit_runs:
416
+ run_paths = [r for r in run_paths if r.split("/")[-1] in args.limit_runs]
417
+ print(f"Filtered to {len(run_paths)} runs.")
418
+
419
+ if args.cache_dir:
420
+ cache_dir = Path(args.cache_dir)
421
+ cache_dir.mkdir(parents=True, exist_ok=True)
422
+ use_temp = False
423
+ else:
424
+ cache_dir = Path(tempfile.mkdtemp(prefix="hf_cache_"))
425
+ use_temp = True
426
+
427
+ try:
428
+ for run_path in run_paths:
429
+ run_name = run_path.split("/")[-1]
430
+ print(f"\nProcessing run: {run_name}")
431
+
432
+ ckpt_paths = list_checkpoints_for_run(run_path)
433
+ if not ckpt_paths:
434
+ print(f" No checkpoints found, skipping.")
435
+ continue
436
+
437
+ first_ckpt = ckpt_paths[0]
438
+ config_file = download_file_from_hub(f"{first_ckpt}/config.json", str(cache_dir))
439
+ config = TinyLlamaConfig.from_pretrained(config_file)
440
+ param_names = get_param_names_from_model(config)
441
+ print(f" Model: {len(param_names)} params, {config.num_hidden_layers} layers.")
442
+ print(f" waleed_beta: {config.waleed_beta}, powlu_m: {config.powlu_m}")
443
+
444
+ if args.log_all_tensors and len(param_names) > 200:
445
+ print(f" ⚠️ {len(param_names)} tensors — may hit WandB limits.")
446
+
447
+ wandb.init(
448
+ project=args.wandb_project,
449
+ entity=args.wandb_entity,
450
+ name=run_name,
451
+ config={
452
+ "run_name": run_name,
453
+ "mlp_type": config.mlp_type,
454
+ "activation": config.activation,
455
+ "num_layers": config.num_hidden_layers,
456
+ "hidden_size": config.hidden_size,
457
+ "waleed_beta": config.waleed_beta,
458
+ "powlu_m": config.powlu_m,
459
+ },
460
+ reinit=True,
461
+ )
462
+
463
+ for ckpt in ckpt_paths:
464
+ step = int(ckpt.split("-")[-1])
465
+ if args.limit_checkpoints and str(step) not in args.limit_checkpoints:
466
+ continue
467
+ print(f" Analyzing {ckpt} ...")
468
+ try:
469
+ result = analyze_checkpoint_from_hub(ckpt, config, param_names, str(cache_dir))
470
+ except Exception as e:
471
+ print(f" Error: {e}, skipping.")
472
+ continue
473
+
474
+ log_dict: Dict[str, Any] = {}
475
+
476
+ # GLOBAL (RMS + SNR)
477
+ gr = result["global_rms"]
478
+ gs = result["global_snr"]
479
+
480
+ log_dict["global/rms_norm"] = gr["norm"]
481
+ log_dict["global/rms_mean"] = gr["mean"]
482
+ log_dict["global/rms_std"] = gr["std"]
483
+ log_dict["global/rms_max_abs"] = gr["max_abs"]
484
+
485
+ log_dict["global/snr_mean"] = gs["mean"]
486
+ log_dict["global/snr_std"] = gs["std"]
487
+ log_dict["global/snr_max_abs"] = gs["max_abs"]
488
+ log_dict["global/snr_norm"] = gs["norm"]
489
+
490
+ # PER-LAYER
491
+ for layer_name, stats in result["per_layer_rms"].items():
492
+ safe = layer_name.replace(".", "_")
493
+ log_dict[f"layers/{safe}/rms_norm"] = stats["norm"]
494
+
495
+ for layer_name, stats in result["per_layer_snr"].items():
496
+ safe = layer_name.replace(".", "_")
497
+ log_dict[f"layers/{safe}/snr_mean"] = stats["mean"]
498
+
499
+ # PER-TENSOR (canonical names → all variants overlay)
500
+ if args.log_all_tensors:
501
+ # RMS
502
+ for name, stats in result["per_tensor_rms"].items():
503
+ safe = name.replace(".", "_")
504
+ log_dict[f"tensors/{safe}/rms_norm"] = stats["norm"]
505
+ log_dict[f"tensors/{safe}/rms_mean"] = stats["mean"]
506
+ log_dict[f"tensors/{safe}/rms_std"] = stats["std"]
507
+ log_dict[f"tensors/{safe}/rms_max_abs"] = stats["max_abs"]
508
+
509
+ # SNR
510
+ for name, stats in result["per_tensor_snr"].items():
511
+ safe = name.replace(".", "_")
512
+ log_dict[f"tensors/{safe}/snr_mean"] = stats["mean"]
513
+ log_dict[f"tensors/{safe}/snr_std"] = stats["std"]
514
+ log_dict[f"tensors/{safe}/snr_max_abs"] = stats["max_abs"]
515
+ log_dict[f"tensors/{safe}/snr_norm"] = stats["norm"]
516
+ else:
517
+ # Top/bottom 5 by RMS norm
518
+ sorted_tensors = sorted(
519
+ result["per_tensor_rms"].items(),
520
+ key=lambda x: x[1]["norm"],
521
+ reverse=True,
522
+ )
523
+ top5 = sorted_tensors[:5]
524
+ bottom5 = sorted_tensors[-5:] if len(sorted_tensors) >= 5 else sorted_tensors
525
+
526
+ for i, (name, stats) in enumerate(top5):
527
+ log_dict[f"top_{i+1}/name"] = name
528
+ log_dict[f"top_{i+1}/rms_norm"] = stats["norm"]
529
+ log_dict[f"top_{i+1}/rms_mean"] = stats["mean"]
530
+ for i, (name, stats) in enumerate(bottom5):
531
+ log_dict[f"bottom_{i+1}/name"] = name
532
+ log_dict[f"bottom_{i+1}/rms_norm"] = stats["norm"]
533
+
534
+ # TABLES
535
+ rms_table_data = []
536
+ for name, stats in result["per_tensor_rms"].items():
537
+ rms_table_data.append([
538
+ name, stats["mean"], stats["std"],
539
+ stats["max_abs"], stats["norm"], stats["numel"],
540
+ ])
541
+ if rms_table_data:
542
+ log_dict["rms_table"] = wandb.Table(
543
+ columns=["param_name", "mean", "std", "max_abs", "norm", "numel"],
544
+ data=rms_table_data,
545
+ )
546
+
547
+ snr_table_data = []
548
+ for name, stats in result["per_tensor_snr"].items():
549
+ snr_table_data.append([
550
+ name, stats["mean"], stats["std"],
551
+ stats["max_abs"], stats["norm"], stats["numel"],
552
+ ])
553
+ if snr_table_data:
554
+ log_dict["snr_table"] = wandb.Table(
555
+ columns=["param_name", "mean", "std", "max_abs", "norm", "numel"],
556
+ data=snr_table_data,
557
+ )
558
+
559
+ wandb.log(log_dict, step=step)
560
+
561
+ wandb.finish()
562
+
563
+ finally:
564
+ if use_temp and cache_dir.exists():
565
+ shutil.rmtree(cache_dir, ignore_errors=True)
566
+
567
+ print("\nAll done.")
568
+
569
+
570
+ if __name__ == "__main__":
571
+ main()
zain/Activation/llm_analyzer_wandb.py ADDED
@@ -0,0 +1,1307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Multi-LLM Activation & Loss Analyzer with WandB Logging
3
+ GPU-only, FP32, exact training‑style tokenization (concatenate + chunk).
4
+ Supports PowLU, custom name normalization, full‑dataset evaluation,
5
+ and now captures pre‑down_proj inputs & layer outputs.
6
+ """
7
+
8
+ import math
9
+ import os
10
+ import tempfile
11
+ import shutil
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ from transformers import (
16
+ LlamaConfig,
17
+ LlamaPreTrainedModel,
18
+ AutoTokenizer,
19
+ AutoConfig,
20
+ AutoModelForCausalLM,
21
+ )
22
+ from transformers.models.llama.modeling_llama import (
23
+ LlamaAttention,
24
+ LlamaRMSNorm,
25
+ LlamaRotaryEmbedding,
26
+ )
27
+ from transformers.modeling_outputs import CausalLMOutputWithPast
28
+ from datasets import load_dataset as hf_load_dataset
29
+ from typing import List, Dict, Optional, Tuple
30
+ from dataclasses import dataclass, asdict
31
+ from collections import defaultdict
32
+ import json
33
+ import warnings
34
+ import os
35
+ from tqdm import tqdm
36
+ import wandb
37
+
38
+ warnings.filterwarnings("ignore")
39
+
40
+ # ============================================================================
41
+ # REPO CONFIGURATION
42
+ # ============================================================================
43
+
44
+ REPO_ID = "w-ahmad/STRESS-TEST3"
45
+ BASE_PATH = "zain/Activation/out" # <-- NO trailing slash
46
+
47
+ # ============================================================================
48
+ # 1. ACTIVATION REGISTRY (exact copy from exp.py)
49
+ # ============================================================================
50
+
51
+ class GLUActivationRegistry:
52
+ _registry: Dict[str, callable] = {}
53
+
54
+ @classmethod
55
+ def register(cls, name: str, fn: callable) -> None:
56
+ cls._registry[name] = fn
57
+
58
+ @classmethod
59
+ def get(cls, name: str) -> callable:
60
+ if name not in cls._registry:
61
+ raise KeyError(f"Activation '{name}' not found.")
62
+ return cls._registry[name]
63
+
64
+ # Register built-ins
65
+ GLUActivationRegistry.register("silu", nn.functional.silu)
66
+ GLUActivationRegistry.register("swish", nn.functional.silu)
67
+ GLUActivationRegistry.register("relu", nn.functional.relu)
68
+ GLUActivationRegistry.register("gelu", nn.functional.gelu)
69
+ GLUActivationRegistry.register("sigmoid", torch.sigmoid)
70
+ GLUActivationRegistry.register("tanh", torch.tanh)
71
+ GLUActivationRegistry.register("softplus", nn.functional.softplus)
72
+ GLUActivationRegistry.register("linear", lambda x: x)
73
+ GLUActivationRegistry.register("s10", lambda x: x * x * torch.sigmoid(x))
74
+ GLUActivationRegistry.register("w1a", lambda x: x * torch.tanh(x))
75
+
76
+ # ============================================================================
77
+ # 2. CUSTOM CONFIG & MODEL (with PowLU)
78
+ # ============================================================================
79
+
80
+ class TinyLlamaConfig(LlamaConfig):
81
+ model_type = "tiny_llama"
82
+
83
+ def __init__(
84
+ self,
85
+ mlp_type: str = "glu",
86
+ activation: str = "silu",
87
+ waleed_beta: float = 10.0,
88
+ powlu_m: float = 3.0,
89
+ **kwargs
90
+ ):
91
+ super().__init__(**kwargs)
92
+ self.mlp_type = mlp_type
93
+ self.activation = activation
94
+ self.waleed_beta = waleed_beta
95
+ self.powlu_m = powlu_m
96
+ if self.num_key_value_heads != self.num_attention_heads:
97
+ raise ValueError("Pure MHA required.")
98
+
99
+
100
+ class SiTUGLU(nn.Module):
101
+ def __init__(self, input_dim: int, hidden_dim: int, beta1: float = 4.0, beta2: float = 25.0):
102
+ super().__init__()
103
+ self.beta1 = beta1
104
+ self.beta2 = beta2
105
+ self.W_g = nn.Linear(input_dim, hidden_dim, bias=False)
106
+ self.W_u = nn.Linear(input_dim, hidden_dim, bias=False)
107
+
108
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
109
+ g = self.W_g(x)
110
+ gate = self.beta1 * torch.tanh(g / self.beta1) * torch.sigmoid(g)
111
+ up = self.beta2 * torch.tanh(self.W_u(x) / self.beta2)
112
+ return gate * up
113
+
114
+
115
+ class WaleedGLU(nn.Module):
116
+ def __init__(self, input_dim: int, hidden_dim: int, beta1: float = 4.0, beta2: float = 25.0):
117
+ super().__init__()
118
+ self.beta1 = beta1
119
+ self.beta2 = beta2
120
+ self.W_g = nn.Linear(input_dim, hidden_dim, bias=False)
121
+ self.W_u = nn.Linear(input_dim, hidden_dim, bias=False)
122
+
123
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
124
+ g = self.W_g(x)
125
+ gate = self.beta1 * torch.tanh(g / self.beta1)
126
+ up = self.beta2 * torch.tanh(self.W_u(x) / self.beta2)
127
+ return gate * up
128
+
129
+
130
+ class TinyLlamaMLP(nn.Module):
131
+ def __init__(self, config: TinyLlamaConfig):
132
+ super().__init__()
133
+ self.hidden_size = config.hidden_size
134
+ self.intermediate_size = config.intermediate_size
135
+ self.mlp_type = config.mlp_type
136
+ self.activation_name = config.activation
137
+ self.waleed_beta = getattr(config, "waleed_beta", 10.0)
138
+ self.powlu_m = getattr(config, "powlu_m", 3.0)
139
+
140
+ if self.mlp_type == "glu":
141
+ effective_intermediate = self.intermediate_size
142
+ elif self.mlp_type == "mlp":
143
+ effective_intermediate = int(self.intermediate_size * 1.5)
144
+ else:
145
+ raise ValueError(f"Unknown mlp_type: {self.mlp_type}")
146
+
147
+ self.effective_intermediate = effective_intermediate
148
+
149
+ if self.mlp_type == "glu":
150
+ self.gate_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
151
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
152
+ else:
153
+ self.up_proj = nn.Linear(self.hidden_size, effective_intermediate, bias=False)
154
+ self.down_proj = nn.Linear(effective_intermediate, self.hidden_size, bias=False)
155
+
156
+ # ---- Activation flags ----
157
+ self.is_powlu = (self.activation_name == "powlu")
158
+ self.is_situglu = self.activation_name in ("situglu", "situglu_low")
159
+ self.is_waleed = self.activation_name in ("waleed", "waleedglu_low")
160
+ self.is_waleed10 = self.activation_name in ("waleed10", "silu-waleed10")
161
+ self.has_sigmoid_gate = self.activation_name.startswith("situglu")
162
+
163
+ # ---- Activation function (for non-PowLU) ----
164
+ if self.mlp_type == "glu":
165
+ if self.is_powlu:
166
+ self.act_fn = None
167
+ elif self.activation_name in ("situglu", "waleed", "situglu_low", "waleedglu_low"):
168
+ self.act_fn = None
169
+ elif self.activation_name == "waleed10":
170
+ self.act_fn = GLUActivationRegistry.get("linear")
171
+ elif self.activation_name == "silu-waleed10":
172
+ self.act_fn = GLUActivationRegistry.get("silu")
173
+ else:
174
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
175
+ else: # mlp
176
+ if self.is_powlu:
177
+ raise ValueError("PowLU is only supported with mlp_type='glu'")
178
+ if self.activation_name in ("situglu", "waleed", "situglu_low", "waleedglu_low"):
179
+ raise ValueError(f"Activation '{self.activation_name}' requires GLU.")
180
+ elif self.activation_name == "waleed10":
181
+ self.act_fn = GLUActivationRegistry.get("linear")
182
+ elif self.activation_name == "silu-waleed10":
183
+ self.act_fn = GLUActivationRegistry.get("silu")
184
+ else:
185
+ self.act_fn = GLUActivationRegistry.get(self.activation_name)
186
+
187
+ # beta values for situglu/waleed
188
+ if self.activation_name in ("situglu_low", "waleedglu_low"):
189
+ self.beta1 = 2.5
190
+ self.beta2 = 4.0
191
+ else:
192
+ self.beta1 = 4.0
193
+ self.beta2 = 25.0
194
+
195
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
196
+ if self.mlp_type == "glu":
197
+ gate = self.gate_proj(x)
198
+ up = self.up_proj(x)
199
+
200
+ # ----- PowLU branch -----
201
+ if self.is_powlu:
202
+ m = self.powlu_m
203
+ sig_gate = torch.sigmoid(gate)
204
+ pos_mask = gate > 0
205
+ powlu_pos = gate ** (m / (torch.sqrt(gate) + 1)) * sig_gate
206
+ powlu_neg = gate * sig_gate
207
+ activated_gate = torch.where(pos_mask, powlu_pos, powlu_neg)
208
+ hidden = activated_gate * up
209
+
210
+ # ----- situglu / waleed branches -----
211
+ elif self.is_situglu or self.is_waleed:
212
+ if self.has_sigmoid_gate:
213
+ gate = self.beta1 * torch.tanh(gate / self.beta1) * torch.sigmoid(gate)
214
+ else:
215
+ gate = self.beta1 * torch.tanh(gate / self.beta1)
216
+ up = self.beta2 * torch.tanh(up / self.beta2)
217
+ hidden = gate * up
218
+
219
+ # ----- Standard GLU -----
220
+ else:
221
+ hidden = self.act_fn(gate) * up
222
+
223
+ out = self.down_proj(hidden)
224
+
225
+ else: # mlp
226
+ hidden = self.act_fn(self.up_proj(x))
227
+ out = self.down_proj(hidden)
228
+
229
+ # Optional Waleed clipping
230
+ if self.is_waleed10:
231
+ out = self.waleed_beta * torch.tanh(out / self.waleed_beta)
232
+
233
+ return out
234
+
235
+
236
+ class TinyLlamaDecoderLayer(nn.Module):
237
+ def __init__(self, config: TinyLlamaConfig, layer_idx: int):
238
+ super().__init__()
239
+ self.hidden_size = config.hidden_size
240
+ self.self_attn = LlamaAttention(config=config, layer_idx=layer_idx)
241
+ self.mlp = TinyLlamaMLP(config)
242
+ self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
243
+ self.post_attention_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
244
+
245
+ def forward(self, hidden_states, attention_mask=None, position_ids=None,
246
+ position_embeddings=None, **kwargs):
247
+ residual = hidden_states
248
+ hidden_states = self.input_layernorm(hidden_states)
249
+ attn_out = self.self_attn(
250
+ hidden_states=hidden_states,
251
+ attention_mask=attention_mask,
252
+ position_ids=position_ids,
253
+ position_embeddings=position_embeddings,
254
+ )[0]
255
+ hidden_states = residual + attn_out
256
+
257
+ residual = hidden_states
258
+ hidden_states = self.post_attention_layernorm(hidden_states)
259
+ hidden_states = self.mlp(hidden_states)
260
+ hidden_states = residual + hidden_states
261
+ return (hidden_states,)
262
+
263
+
264
+ def _build_causal_mask(attention_mask, seq_len, dtype, device):
265
+ min_value = torch.finfo(dtype).min
266
+ causal = torch.full((seq_len, seq_len), min_value, dtype=dtype, device=device)
267
+ causal = torch.triu(causal, diagonal=1)
268
+ causal = causal[None, None, :, :]
269
+ if attention_mask is None:
270
+ return causal
271
+ batch_size = attention_mask.shape[0]
272
+ causal = causal.expand(batch_size, 1, seq_len, seq_len).clone()
273
+ padding = attention_mask[:, None, None, :].to(device) == 0
274
+ causal = causal.masked_fill(padding, min_value)
275
+ return causal
276
+
277
+
278
+ class TinyLlamaModel(LlamaPreTrainedModel):
279
+ config_class = TinyLlamaConfig
280
+
281
+ def __init__(self, config: TinyLlamaConfig):
282
+ super().__init__(config)
283
+ self.padding_idx = config.pad_token_id
284
+ self.vocab_size = config.vocab_size
285
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
286
+ self.layers = nn.ModuleList(
287
+ [TinyLlamaDecoderLayer(config, i) for i in range(config.num_hidden_layers)]
288
+ )
289
+ self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
290
+ self.rotary_emb = LlamaRotaryEmbedding(config=config)
291
+ self.post_init()
292
+
293
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None,
294
+ inputs_embeds=None, return_dict=None, **kwargs):
295
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
296
+ if inputs_embeds is None:
297
+ inputs_embeds = self.embed_tokens(input_ids)
298
+ if position_ids is None:
299
+ seq_len = inputs_embeds.shape[1]
300
+ position_ids = torch.arange(seq_len, device=inputs_embeds.device).unsqueeze(0).expand(
301
+ inputs_embeds.shape[0], -1
302
+ )
303
+ hidden_states = inputs_embeds
304
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
305
+
306
+ seq_len = hidden_states.shape[1]
307
+ causal_mask = _build_causal_mask(
308
+ attention_mask, seq_len, hidden_states.dtype, hidden_states.device
309
+ )
310
+
311
+ for decoder_layer in self.layers:
312
+ layer_outputs = decoder_layer(
313
+ hidden_states,
314
+ attention_mask=causal_mask,
315
+ position_ids=position_ids,
316
+ position_embeddings=position_embeddings,
317
+ )
318
+ hidden_states = layer_outputs[0]
319
+
320
+ hidden_states = self.norm(hidden_states)
321
+ if not return_dict:
322
+ return (hidden_states,)
323
+ return {"last_hidden_state": hidden_states, "hidden_states": None, "attentions": None}
324
+
325
+
326
+ class TinyLlamaForCausalLM(LlamaPreTrainedModel):
327
+ config_class = TinyLlamaConfig
328
+ _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
329
+
330
+ def __init__(self, config: TinyLlamaConfig):
331
+ super().__init__(config)
332
+ self.model = TinyLlamaModel(config)
333
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
334
+ if config.tie_word_embeddings:
335
+ self.lm_head.weight = self.model.embed_tokens.weight
336
+ self.post_init()
337
+
338
+ def get_input_embeddings(self):
339
+ return self.model.embed_tokens
340
+
341
+ def set_input_embeddings(self, value):
342
+ self.model.embed_tokens = value
343
+
344
+ def get_output_embeddings(self):
345
+ return self.lm_head
346
+
347
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None,
348
+ inputs_embeds=None, labels=None, return_dict=None, **kwargs):
349
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
350
+ outputs = self.model(
351
+ input_ids=input_ids,
352
+ attention_mask=attention_mask,
353
+ position_ids=position_ids,
354
+ inputs_embeds=inputs_embeds,
355
+ return_dict=return_dict,
356
+ )
357
+ hidden_states = outputs["last_hidden_state"] if return_dict else outputs[0]
358
+ logits = self.lm_head(hidden_states)
359
+
360
+ loss = None
361
+ if labels is not None:
362
+ shift_logits = logits[..., :-1, :].contiguous()
363
+ shift_labels = labels[..., 1:].contiguous()
364
+ loss_fct = nn.CrossEntropyLoss()
365
+ loss = loss_fct(shift_logits.view(-1, self.config.vocab_size), shift_labels.view(-1))
366
+
367
+ if not return_dict:
368
+ output = (logits,) + outputs[1:]
369
+ return (loss,) + output if loss is not None else output
370
+ return CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=None,
371
+ hidden_states=None, attentions=None)
372
+
373
+ def prepare_inputs_for_generation(self, input_ids, past_key_values=None,
374
+ attention_mask=None, **kwargs):
375
+ if past_key_values:
376
+ input_ids = input_ids[:, -1:]
377
+ position_ids = kwargs.get("position_ids")
378
+ if attention_mask is not None and position_ids is None:
379
+ position_ids = attention_mask.long().cumsum(-1) - 1
380
+ position_ids.masked_fill_(attention_mask == 0, 1)
381
+ if past_key_values:
382
+ position_ids = position_ids[:, -1].unsqueeze(-1)
383
+ return {
384
+ "input_ids": input_ids,
385
+ "position_ids": position_ids,
386
+ "past_key_values": past_key_values,
387
+ "attention_mask": attention_mask,
388
+ }
389
+
390
+ # ============================================================================
391
+ # END OF MODEL DEFINITIONS
392
+ # ============================================================================
393
+
394
+ # Percentiles we report everywhere
395
+ PERCENTILES = [25.0, 50.0, 90.0, 99.0, 99.9]
396
+
397
+
398
+ @dataclass
399
+ class TensorStats:
400
+ mean: float
401
+ max_abs: float
402
+ std: float
403
+ norm: float
404
+ numel: int
405
+ min_val: float
406
+ max_val: float
407
+ range_val: float
408
+ p25: float
409
+ p50: float
410
+ p90: float
411
+ p99: float
412
+ p999: float
413
+
414
+ @staticmethod
415
+ def zero() -> "TensorStats":
416
+ return TensorStats(
417
+ mean=0.0, max_abs=0.0, std=0.0, norm=0.0, numel=0,
418
+ min_val=0.0, max_val=0.0, range_val=0.0,
419
+ p25=0.0, p50=0.0, p90=0.0, p99=0.0, p999=0.0,
420
+ )
421
+
422
+
423
+ @dataclass
424
+ class ModelResult:
425
+ model_name: str
426
+ dataset_name: str
427
+ loss: float
428
+ perplexity: float
429
+ global_act: TensorStats
430
+ layer_acts: Dict[str, TensorStats]
431
+ num_tokens: int
432
+ num_layers: int
433
+ hidden_size: int
434
+ num_params: int
435
+ checkpoint_step: int = 0
436
+
437
+
438
+ # ============================================================================
439
+ # ACTIVATION HOOK MANAGER — with name normalization & extra hooks
440
+ # ============================================================================
441
+
442
+ class ActivationHookManager:
443
+ def __init__(
444
+ self,
445
+ store_dtype: torch.dtype = torch.float16,
446
+ exclude_substrings: Optional[List[str]] = None,
447
+ max_elements_per_tensor: Optional[int] = 500_000,
448
+ disk_offload: bool = False,
449
+ disk_dir: Optional[str] = None,
450
+ capture_pre_down: bool = True,
451
+ capture_layer_output: bool = True,
452
+ ):
453
+ self.raw_values: Dict[str, List[torch.Tensor]] = defaultdict(list)
454
+ self.hooks = []
455
+ self._attention_mask: Optional[torch.Tensor] = None
456
+ self.store_dtype = store_dtype
457
+ self.exclude_substrings = exclude_substrings if exclude_substrings is not None else ["lm_head"]
458
+ self.max_elements_per_tensor = max_elements_per_tensor
459
+ self._per_batch_quota: Optional[int] = None
460
+ self._counts: Dict[str, int] = defaultdict(int)
461
+ self.disk_offload = disk_offload
462
+ self.disk_dir = disk_dir
463
+ self._file_handles: Dict[str, "object"] = {}
464
+ self.capture_pre_down = capture_pre_down
465
+ self.capture_layer_output = capture_layer_output
466
+ if self.disk_offload:
467
+ self.disk_dir = disk_dir or tempfile.mkdtemp(prefix="act_cache_")
468
+ os.makedirs(self.disk_dir, exist_ok=True)
469
+
470
+ @staticmethod
471
+ def _safe_filename(name: str) -> str:
472
+ return name.replace("/", "__").replace(".", "_") + ".bin"
473
+
474
+ def set_expected_batches(self, num_batches: int):
475
+ if self.max_elements_per_tensor is not None:
476
+ self._per_batch_quota = max(1, self.max_elements_per_tensor // max(1, num_batches))
477
+ else:
478
+ self._per_batch_quota = None
479
+
480
+ def set_attention_mask(self, attention_mask: Optional[torch.Tensor]):
481
+ self._attention_mask = attention_mask
482
+
483
+ def _make_hook(self, name: str, is_pre: bool = False):
484
+ """Factory for hook functions. If is_pre, captures input; otherwise output."""
485
+ def hook(module, input_or_output, output=None):
486
+ # For pre_hook: input_or_output is the input tuple, output is None.
487
+ # For post_hook: input_or_output is the input tuple (ignored), output is the module output.
488
+ if is_pre:
489
+ # Capture the first input tensor (usually the only one)
490
+ tensor = input_or_output[0] if isinstance(input_or_output, tuple) else input_or_output
491
+ else:
492
+ # For post hook, we capture output
493
+ if isinstance(output, torch.Tensor):
494
+ tensor = output
495
+ elif isinstance(output, tuple) and len(output) > 0 and isinstance(output[0], torch.Tensor):
496
+ tensor = output[0]
497
+ else:
498
+ return
499
+
500
+ if not torch.is_tensor(tensor):
501
+ return
502
+
503
+ # Apply attention mask if available (only for post hooks that have matching shape)
504
+ mask = self._attention_mask
505
+ if not is_pre and mask is not None and tensor.dim() >= 2 and tensor.shape[0] == mask.shape[0] and tensor.shape[1] == mask.shape[1]:
506
+ flat = tensor[mask.bool()].reshape(-1)
507
+ else:
508
+ flat = tensor.reshape(-1)
509
+
510
+ if flat.numel() == 0:
511
+ return
512
+
513
+ if self._per_batch_quota is not None and flat.numel() > self._per_batch_quota:
514
+ idx = torch.randperm(flat.numel(), device=flat.device)[:self._per_batch_quota]
515
+ sampled = flat[idx]
516
+ else:
517
+ sampled = flat
518
+
519
+ if self.disk_offload:
520
+ self._write_to_disk(name, sampled)
521
+ else:
522
+ self.raw_values[name].append(sampled.detach().to(self.store_dtype))
523
+ self._counts[name] += sampled.numel()
524
+ return hook
525
+
526
+ def _write_to_disk(self, name: str, flat: torch.Tensor):
527
+ arr = flat.detach().to(self.store_dtype).cpu().numpy()
528
+ fh = self._file_handles.get(name)
529
+ if fh is None:
530
+ path = os.path.join(self.disk_dir, self._safe_filename(name))
531
+ fh = open(path, "ab")
532
+ self._file_handles[name] = fh
533
+ arr.tofile(fh)
534
+
535
+ def register_hooks(self, model: torch.nn.Module):
536
+ """Register hooks for MLP activations, pre-down, and layer outputs."""
537
+ # 1. Standard hooks on gate_proj, up_proj, down_proj (post-activation)
538
+ for name, module in model.named_modules():
539
+ if any(x in name for x in ["gate_proj", "up_proj", "down_proj"]):
540
+ # Normalize: W_g/W_u already handled in canonical names; for down_proj keep as is
541
+ # For down_proj we also want a pre-hook separately
542
+ # For post-hook we use the original name (already canonical for gate/up)
543
+ norm_name = name.replace("W_g", "gate_proj").replace("W_u", "up_proj")
544
+ hook = module.register_forward_hook(self._make_hook(norm_name, is_pre=False))
545
+ self.hooks.append(hook)
546
+
547
+ # 2. Pre-down_proj hook (captures input to down_proj)
548
+ if self.capture_pre_down:
549
+ for name, module in model.named_modules():
550
+ if "down_proj" in name:
551
+ # Name: replace "down_proj" with "pre_down"
552
+ pre_name = name.replace("down_proj", "pre_down")
553
+ hook = module.register_forward_pre_hook(self._make_hook(pre_name, is_pre=True))
554
+ self.hooks.append(hook)
555
+
556
+ # 3. Layer output hook (captures final hidden_states from each decoder layer)
557
+ if self.capture_layer_output:
558
+ for name, module in model.named_modules():
559
+ if isinstance(module, TinyLlamaDecoderLayer):
560
+ # Use the module's full name, e.g., model.layers.0
561
+ out_name = f"{name}.output"
562
+ hook = module.register_forward_hook(self._make_hook(out_name, is_pre=False))
563
+ self.hooks.append(hook)
564
+
565
+ def clear(self):
566
+ self.raw_values.clear()
567
+ self._counts.clear()
568
+ for fh in self._file_handles.values():
569
+ try:
570
+ fh.close()
571
+ except Exception:
572
+ pass
573
+ self._file_handles.clear()
574
+ if self.disk_offload and self.disk_dir:
575
+ shutil.rmtree(self.disk_dir, ignore_errors=True)
576
+
577
+ def remove_hooks(self):
578
+ for hook in self.hooks:
579
+ hook.remove()
580
+ self.hooks.clear()
581
+
582
+ @staticmethod
583
+ def _compute_stats_from_tensor(flat: torch.Tensor) -> TensorStats:
584
+ flat32 = flat.to(torch.float32)
585
+ numel = flat32.numel()
586
+ mean = flat32.mean().item()
587
+ std = flat32.std(unbiased=False).item()
588
+ norm = flat32.norm().item()
589
+ min_val = flat32.min().item()
590
+ max_val = flat32.max().item()
591
+ max_abs = max(abs(min_val), abs(max_val))
592
+
593
+ q = torch.tensor([p / 100.0 for p in PERCENTILES], device=flat32.device, dtype=torch.float32)
594
+ try:
595
+ quantiles = torch.quantile(flat32, q).tolist()
596
+ except RuntimeError:
597
+ import numpy as np
598
+ arr = flat32.cpu().numpy()
599
+ quantiles = np.percentile(arr, PERCENTILES).tolist()
600
+
601
+ p25, p50, p90, p99, p999 = quantiles
602
+
603
+ return TensorStats(
604
+ mean=mean, max_abs=max_abs, std=std, norm=norm, numel=numel,
605
+ min_val=min_val, max_val=max_val, range_val=max_val - min_val,
606
+ p25=p25, p50=p50, p90=p90, p99=p99, p999=p999,
607
+ )
608
+
609
+ def get_all_stats(self) -> Tuple[Dict[str, "TensorStats"], "TensorStats"]:
610
+ if self.disk_offload:
611
+ return self._get_all_stats_from_disk()
612
+
613
+ layer_stats: Dict[str, TensorStats] = {}
614
+ for name, chunks in self.raw_values.items():
615
+ if not chunks:
616
+ continue
617
+ flat = torch.cat(chunks)
618
+ layer_stats[name] = self._compute_stats_from_tensor(flat)
619
+ del chunks, flat
620
+ self.raw_values[name] = []
621
+
622
+ global_stats = TensorStats.zero()
623
+ return layer_stats, global_stats
624
+
625
+ def _get_all_stats_from_disk(self) -> Tuple[Dict[str, "TensorStats"], "TensorStats"]:
626
+ for fh in self._file_handles.values():
627
+ try:
628
+ fh.close()
629
+ except Exception:
630
+ pass
631
+ self._file_handles.clear()
632
+
633
+ np_dtype = np.float16 if self.store_dtype == torch.float16 else np.float32
634
+ layer_stats: Dict[str, TensorStats] = {}
635
+
636
+ for name in list(self._counts.keys()):
637
+ path = os.path.join(self.disk_dir, self._safe_filename(name))
638
+ if not os.path.exists(path):
639
+ continue
640
+ arr = np.fromfile(path, dtype=np_dtype)
641
+ os.remove(path)
642
+ if arr.size == 0:
643
+ continue
644
+ t = torch.from_numpy(arr.astype(np.float32))
645
+ layer_stats[name] = self._compute_stats_from_tensor(t)
646
+ del t, arr
647
+
648
+ shutil.rmtree(self.disk_dir, ignore_errors=True)
649
+ global_stats = TensorStats.zero()
650
+ return layer_stats, global_stats
651
+
652
+
653
+ # ============================================================================
654
+ # LLM ANALYZER — TRAINING‑STYLE TOKENIZATION, FULL DATASET SUPPORT
655
+ # ============================================================================
656
+
657
+ class LLMAnalyzer:
658
+ def __init__(
659
+ self,
660
+ max_length: int = 512,
661
+ max_samples: Optional[int] = 1000,
662
+ batch_size: int = 4,
663
+ wandb_project: Optional[str] = None,
664
+ cbt_simple_max_chars: int = 120,
665
+ min_line_chars: int = 20,
666
+ activation_store_dtype: torch.dtype = torch.float16,
667
+ track_activations: bool = True,
668
+ activation_hook_exclude: Optional[List[str]] = None,
669
+ max_elements_per_tensor: Optional[int] = 500_000,
670
+ activation_disk_offload: bool = False,
671
+ activation_disk_dir: Optional[str] = None,
672
+ capture_pre_down: bool = True,
673
+ capture_layer_output: bool = True,
674
+ ):
675
+ if not torch.cuda.is_available():
676
+ raise RuntimeError("This script requires a GPU. CUDA is not available.")
677
+ self.device = "cuda"
678
+ self.dtype = torch.float32
679
+
680
+ self.max_length = max_length
681
+ self.max_samples = max_samples
682
+ self.batch_size = batch_size
683
+ self.wandb_project = wandb_project or os.environ.get("WANDB_PROJECT", "llm-activation-analysis")
684
+ self.cbt_simple_max_chars = cbt_simple_max_chars
685
+ self.min_line_chars = min_line_chars
686
+ self.activation_store_dtype = activation_store_dtype
687
+ self.track_activations = track_activations
688
+ self.activation_hook_exclude = activation_hook_exclude if activation_hook_exclude is not None else ["lm_head"]
689
+ self.max_elements_per_tensor = max_elements_per_tensor
690
+ self.activation_disk_offload = activation_disk_offload
691
+ self.activation_disk_dir = activation_disk_dir
692
+ self.capture_pre_down = capture_pre_down
693
+ self.capture_layer_output = capture_layer_output
694
+ self._cache = {}
695
+ self._dataset_cache: Dict[str, List[str]] = {}
696
+
697
+ # ------------------------------------------------------------------
698
+ # Dataset loaders – now respect max_samples=None (load all)
699
+ # ------------------------------------------------------------------
700
+
701
+ def _load_tinystories(self, split: str = "validation") -> List[str]:
702
+ print(f"[Dataset] Loading TinyStories (split='{split}')...")
703
+ ds = hf_load_dataset("roneneldan/TinyStories", split=split)
704
+ lines = []
705
+ for example in ds:
706
+ text = (example.get("text") or "").strip()
707
+ if len(text) >= self.min_line_chars:
708
+ lines.append(text)
709
+ if self.max_samples is not None and len(lines) >= self.max_samples:
710
+ break
711
+ print(f"[Dataset] Loaded {len(lines)} TinyStories examples")
712
+ return lines
713
+
714
+ def _load_simplestories(self, split: str = "test") -> List[str]:
715
+ print(f"[Dataset] Loading SimpleStories (split='{split}')...")
716
+ ds = hf_load_dataset("SimpleStories/SimpleStories", split=split)
717
+ lines = []
718
+ for example in ds:
719
+ text = (example.get("story") or "").strip()
720
+ if len(text) >= self.min_line_chars:
721
+ lines.append(text)
722
+ if self.max_samples is not None and len(lines) >= self.max_samples:
723
+ break
724
+ print(f"[Dataset] Loaded {len(lines)} SimpleStories examples")
725
+ return lines
726
+
727
+ def _load_cbt_simple(self, split: str = "test") -> List[str]:
728
+ print(f"[Dataset] Loading CBT-simple (cam-cst/cbt, raw, split='{split}', "
729
+ f"max_chars={self.cbt_simple_max_chars})...")
730
+ ds = hf_load_dataset("cam-cst/cbt", "raw", split=split)
731
+ lines = []
732
+ for example in ds:
733
+ content = example.get("content", "")
734
+ if not content:
735
+ continue
736
+ for chunk in content.replace("\r\n", "\n").split("\n"):
737
+ chunk = chunk.strip()
738
+ if self.min_line_chars <= len(chunk) <= self.cbt_simple_max_chars:
739
+ lines.append(chunk)
740
+ if self.max_samples is not None and len(lines) >= self.max_samples:
741
+ break
742
+ print(f"[Dataset] Loaded {len(lines)} simple CBT sentences")
743
+ return lines[:self.max_samples] if self.max_samples is not None else lines
744
+
745
+ DATASET_LOADERS = {
746
+ "tinystories": lambda self, split: self._load_tinystories(split or "validation"),
747
+ "simplestories": lambda self, split: self._load_simplestories(split or "test"),
748
+ "cbt_simple": lambda self, split: self._load_cbt_simple(split or "test"),
749
+ }
750
+
751
+ def load_dataset(self, dataset_name: str, split: Optional[str] = None) -> List[str]:
752
+ cache_key = f"{dataset_name}:{split}"
753
+ if cache_key in self._dataset_cache:
754
+ return self._dataset_cache[cache_key]
755
+ if dataset_name not in self.DATASET_LOADERS:
756
+ raise ValueError(f"Unknown dataset '{dataset_name}'. Options: {list(self.DATASET_LOADERS)}")
757
+ texts = self.DATASET_LOADERS[dataset_name](self, split)
758
+ self._dataset_cache[cache_key] = texts
759
+ return texts
760
+
761
+ # ------------------------------------------------------------------
762
+ # Training‑style block preparation (no padding, no BOS)
763
+ # ------------------------------------------------------------------
764
+
765
+ def _prepare_blocks(self, texts: List[str], tokenizer, max_seq_len: int) -> List[List[int]]:
766
+ """
767
+ Tokenize texts exactly as in training:
768
+ - add_special_tokens=False
769
+ - append EOS token (tokenizer.eos_token_id)
770
+ - concatenate all stories into one flat list
771
+ - split into blocks of size max_seq_len, discarding any remainder
772
+ Returns a list of token ID lists, each exactly max_seq_len long.
773
+ """
774
+ eos_id = tokenizer.eos_token_id # should be 0 for this tokenizer
775
+ flat_tokens = []
776
+ for text in texts:
777
+ ids = tokenizer.encode(text, add_special_tokens=False)
778
+ ids.append(eos_id)
779
+ flat_tokens.extend(ids)
780
+
781
+ num_blocks = len(flat_tokens) // max_seq_len
782
+ blocks = []
783
+ for i in range(num_blocks):
784
+ start = i * max_seq_len
785
+ end = start + max_seq_len
786
+ blocks.append(flat_tokens[start:end])
787
+ return blocks
788
+
789
+ # ------------------------------------------------------------------
790
+ # Model loading – reads waleed_beta and powlu_m from config
791
+ # ------------------------------------------------------------------
792
+
793
+ def load_model(self, model_name: str):
794
+ if model_name in self._cache:
795
+ return self._cache[model_name]
796
+
797
+ print(f"[Loading] {model_name} ...")
798
+ parts = model_name.split("/")
799
+ if len(parts) > 2:
800
+ repo_id = "/".join(parts[:2])
801
+ subfolder = "/".join(parts[2:])
802
+ else:
803
+ repo_id = model_name
804
+ subfolder = None
805
+
806
+ tokenizer = AutoTokenizer.from_pretrained(
807
+ "w-ahmad/tiny-stories-tokenizer",
808
+ trust_remote_code=True,
809
+ padding_side="left"
810
+ )
811
+ if tokenizer.pad_token is None:
812
+ tokenizer.pad_token = tokenizer.eos_token
813
+
814
+ config = TinyLlamaConfig.from_pretrained(
815
+ repo_id, subfolder=subfolder, trust_remote_code=True
816
+ )
817
+
818
+ model = TinyLlamaForCausalLM.from_pretrained(
819
+ repo_id,
820
+ config=config,
821
+ subfolder=subfolder,
822
+ torch_dtype=self.dtype,
823
+ trust_remote_code=True,
824
+ )
825
+ model = model.to(self.device)
826
+ model.eval()
827
+ num_params = sum(p.numel() for p in model.parameters())
828
+
829
+ self._cache[model_name] = (tokenizer, model, config, num_params)
830
+ print(f"[Loaded] {model_name} | Params: {num_params/1e6:.1f}M | Layers: {config.num_hidden_layers} | Hidden: {config.hidden_size} | waleed_beta: {config.waleed_beta} | powlu_m: {config.powlu_m}")
831
+ return tokenizer, model, config, num_params
832
+
833
+ # ------------------------------------------------------------------
834
+ # Discover checkpoints (unchanged)
835
+ # ------------------------------------------------------------------
836
+
837
+ def discover_checkpoints(self) -> Dict[str, List[Tuple[int, str]]]:
838
+ from huggingface_hub import list_repo_files
839
+ print(f"🔍 Scanning Hugging Face repo: {REPO_ID}/{BASE_PATH} ...")
840
+ try:
841
+ all_files = list_repo_files(REPO_ID)
842
+ except Exception as e:
843
+ print(f"❌ Failed to fetch from Hugging Face Hub: {e}")
844
+ print("💡 Falling back to manual list.")
845
+ return {
846
+ "glu-silu-waleed10_run": [(100, "checkpoint-100")],
847
+ }
848
+
849
+ run_checkpoints = defaultdict(list)
850
+ prefix = BASE_PATH + "/"
851
+ for file_path in all_files:
852
+ if not file_path.startswith(prefix):
853
+ continue
854
+ rel_path = file_path[len(prefix):]
855
+ parts = rel_path.split("/")
856
+ if len(parts) < 2:
857
+ continue
858
+ run_folder = parts[0]
859
+ ckpt_folder = parts[1]
860
+ if not ckpt_folder.startswith("checkpoint-"):
861
+ continue
862
+ if not (file_path.endswith("config.json") or file_path.endswith("model.safetensors")):
863
+ continue
864
+ try:
865
+ ckpt_num = int(ckpt_folder.replace("checkpoint-", ""))
866
+ except ValueError:
867
+ continue
868
+ run_checkpoints[run_folder].append((ckpt_num, ckpt_folder))
869
+
870
+ result = {}
871
+ for run_folder, ckpts in run_checkpoints.items():
872
+ seen = set()
873
+ unique = []
874
+ for ckpt_num, ckpt_folder in sorted(ckpts, key=lambda x: x[0]):
875
+ if ckpt_num not in seen:
876
+ seen.add(ckpt_num)
877
+ unique.append((ckpt_num, ckpt_folder))
878
+ result[run_folder] = unique
879
+
880
+ print(f"✅ Found {len(result)} run folders:")
881
+ for run_folder, ckpts in sorted(result.items()):
882
+ print(f" - {run_folder}: {len(ckpts)} checkpoints ({ckpts[0][0]}...{ckpts[-1][0]})")
883
+ return result
884
+
885
+ # ------------------------------------------------------------------
886
+ # Single checkpoint evaluation
887
+ # ------------------------------------------------------------------
888
+
889
+ def _evaluate_checkpoint(
890
+ self,
891
+ model_name: str,
892
+ dataset_name: str,
893
+ blocks: List[List[int]],
894
+ ) -> ModelResult:
895
+ tokenizer, model, config, num_params = self.load_model(model_name)
896
+
897
+ total_loss = 0.0
898
+ total_tokens = 0
899
+ num_batches = (len(blocks) + self.batch_size - 1) // self.batch_size
900
+
901
+ hook_mgr = None
902
+ if self.track_activations:
903
+ hook_mgr = ActivationHookManager(
904
+ store_dtype=self.activation_store_dtype,
905
+ exclude_substrings=self.activation_hook_exclude,
906
+ max_elements_per_tensor=self.max_elements_per_tensor,
907
+ disk_offload=self.activation_disk_offload,
908
+ disk_dir=self.activation_disk_dir,
909
+ capture_pre_down=self.capture_pre_down,
910
+ capture_layer_output=self.capture_layer_output,
911
+ )
912
+ hook_mgr.register_hooks(model)
913
+ hook_mgr.set_expected_batches(num_batches)
914
+
915
+ if hook_mgr is not None:
916
+ n_hooks = len(hook_mgr.hooks)
917
+ mode = "disk" if self.activation_disk_offload else "in-memory"
918
+ if self.max_elements_per_tensor is None:
919
+ print(f"[Memory] ⚠️ {n_hooks} modules hooked ({mode}) with NO cap.")
920
+ else:
921
+ est_mb = (n_hooks * self.max_elements_per_tensor * 2) / (1024 ** 2)
922
+ where = f"on disk at {hook_mgr.disk_dir}" if self.activation_disk_offload else "in RAM/VRAM"
923
+ print(f"[Memory] {n_hooks} modules hooked, capped at {self.max_elements_per_tensor:,} elements/tensor (~{est_mb:.0f} MB ceiling, stored {where}).")
924
+
925
+ try:
926
+ desc = f"Eval {model_name.split('/')[-2]}/{model_name.split('/')[-1]}"
927
+ for batch_idx, i in enumerate(tqdm(range(0, len(blocks), self.batch_size), desc=desc, total=num_batches)):
928
+ batch_blocks = blocks[i:i+self.batch_size]
929
+ input_ids = torch.tensor(batch_blocks, dtype=torch.long, device=self.device)
930
+ attention_mask = None
931
+ labels = input_ids.clone()
932
+
933
+ if hook_mgr is not None:
934
+ hook_mgr.set_attention_mask(None)
935
+
936
+ with torch.no_grad():
937
+ outputs = model(
938
+ input_ids=input_ids,
939
+ attention_mask=attention_mask,
940
+ labels=labels,
941
+ )
942
+
943
+ logits = outputs.logits
944
+ shift_logits = logits[..., :-1, :].contiguous()
945
+ shift_labels = labels[..., 1:].contiguous()
946
+ loss_fct = torch.nn.CrossEntropyLoss(reduction="none")
947
+ token_losses = loss_fct(
948
+ shift_logits.view(-1, shift_logits.size(-1)),
949
+ shift_labels.view(-1)
950
+ )
951
+ num_valid_tokens = token_losses.numel()
952
+ batch_loss = token_losses.sum().item()
953
+ total_loss += batch_loss
954
+ total_tokens += num_valid_tokens
955
+
956
+ if batch_idx % 20 == 19:
957
+ torch.cuda.empty_cache()
958
+
959
+ if hook_mgr is not None:
960
+ hook_mgr.remove_hooks()
961
+ final_layer_stats, global_stats = hook_mgr.get_all_stats()
962
+ else:
963
+ final_layer_stats, global_stats = {}, TensorStats.zero()
964
+ except Exception:
965
+ if hook_mgr is not None:
966
+ hook_mgr.remove_hooks()
967
+ hook_mgr.clear()
968
+ raise
969
+
970
+ avg_loss = total_loss / max(total_tokens, 1)
971
+ perplexity = torch.exp(torch.tensor(avg_loss)).item()
972
+
973
+ checkpoint_step = 0
974
+ for part in model_name.split("/"):
975
+ if part.startswith("checkpoint-"):
976
+ try:
977
+ checkpoint_step = int(part.replace("checkpoint-", ""))
978
+ except ValueError:
979
+ pass
980
+
981
+ result = ModelResult(
982
+ model_name=model_name,
983
+ dataset_name=dataset_name,
984
+ loss=avg_loss,
985
+ perplexity=perplexity,
986
+ global_act=global_stats,
987
+ layer_acts=final_layer_stats,
988
+ num_tokens=total_tokens,
989
+ num_layers=config.num_hidden_layers,
990
+ hidden_size=config.hidden_size,
991
+ num_params=num_params,
992
+ checkpoint_step=checkpoint_step,
993
+ )
994
+
995
+ self._cache.pop(model_name, None)
996
+ del model
997
+ torch.cuda.empty_cache()
998
+
999
+ return result
1000
+
1001
+ # ------------------------------------------------------------------
1002
+ # Logging (updated to include new stats)
1003
+ # ------------------------------------------------------------------
1004
+
1005
+ def _log_checkpoint_to_wandb(self, result: ModelResult, step: int):
1006
+ wandb.log({
1007
+ "final/loss": result.loss,
1008
+ "final/perplexity": result.perplexity,
1009
+ "final/num_tokens": result.num_tokens,
1010
+ }, step=step)
1011
+
1012
+ if not self.track_activations:
1013
+ return
1014
+
1015
+ # Log per-tensor stats
1016
+ for tensor_name, stats in result.layer_acts.items():
1017
+ clean_name = tensor_name.replace(".", "/")
1018
+ # Determine the kind from the name: pre_down, output, or others (gate/up/down)
1019
+ if "pre_down" in tensor_name:
1020
+ prefix = f"train/{clean_name}/pre_down"
1021
+ elif "output" in tensor_name and "layers" in tensor_name:
1022
+ prefix = f"train/{clean_name}/output"
1023
+ else:
1024
+ prefix = f"train/{clean_name}/act" # existing activation stats
1025
+
1026
+ wandb.log({
1027
+ f"{prefix}/mean": stats.mean,
1028
+ f"{prefix}/max_abs": stats.max_abs,
1029
+ f"{prefix}/std": stats.std,
1030
+ f"{prefix}/norm": stats.norm,
1031
+ f"{prefix}/min": stats.min_val,
1032
+ f"{prefix}/max": stats.max_val,
1033
+ f"{prefix}/range": stats.range_val,
1034
+ f"{prefix}/p25": stats.p25,
1035
+ f"{prefix}/p50": stats.p50,
1036
+ f"{prefix}/p90": stats.p90,
1037
+ f"{prefix}/p99": stats.p99,
1038
+ f"{prefix}/p999": stats.p999,
1039
+ }, step=step)
1040
+
1041
+ # Tables: include all tensors with a column indicating the type
1042
+ table_data = []
1043
+ for tensor_name, stats in sorted(result.layer_acts.items()):
1044
+ # Determine type for table
1045
+ if "pre_down" in tensor_name:
1046
+ ttype = "pre_down"
1047
+ elif "output" in tensor_name and "layers" in tensor_name:
1048
+ ttype = "output"
1049
+ else:
1050
+ ttype = "activation"
1051
+ table_data.append([
1052
+ tensor_name,
1053
+ ttype,
1054
+ stats.mean,
1055
+ stats.max_abs,
1056
+ stats.std,
1057
+ stats.norm,
1058
+ stats.min_val,
1059
+ stats.max_val,
1060
+ stats.range_val,
1061
+ stats.p25,
1062
+ stats.p50,
1063
+ stats.p90,
1064
+ stats.p99,
1065
+ stats.p999,
1066
+ stats.numel,
1067
+ ])
1068
+
1069
+ if table_data:
1070
+ table = wandb.Table(
1071
+ columns=["tensor_name", "type", "mean", "max_abs", "std", "norm",
1072
+ "min", "max", "range", "p25", "p50", "p90", "p99", "p999", "numel"],
1073
+ data=table_data
1074
+ )
1075
+ wandb.log({"activation_table": table}, step=step)
1076
+
1077
+ # ------------------------------------------------------------------
1078
+ # Run‑folder evaluation – includes waleed_beta and powlu_m in name
1079
+ # ------------------------------------------------------------------
1080
+
1081
+ def _evaluate_run_folder(
1082
+ self,
1083
+ run_folder: str,
1084
+ dataset_name: str,
1085
+ blocks: List[List[int]],
1086
+ checkpoints: List[Tuple[int, str]],
1087
+ ) -> List[ModelResult]:
1088
+ first_model_name = f"{REPO_ID}/{BASE_PATH}/{run_folder}/{checkpoints[0][1]}"
1089
+ _, _, first_config, first_num_params = self.load_model(first_model_name)
1090
+
1091
+ effective_beta = first_config.waleed_beta
1092
+ powlu_m = first_config.powlu_m
1093
+ beta_str = f"_beta{effective_beta}" if effective_beta is not None else ""
1094
+ powlu_str = f"_powlu{powlu_m}" if powlu_m is not None else ""
1095
+
1096
+ run_name = f"{run_folder}__{dataset_name}{beta_str}{powlu_str}"
1097
+
1098
+ wandb.init(
1099
+ project=self.wandb_project,
1100
+ name=run_name,
1101
+ config={
1102
+ "run_folder": run_folder,
1103
+ "dataset": dataset_name,
1104
+ "max_length": self.max_length,
1105
+ "max_samples": self.max_samples,
1106
+ "batch_size": self.batch_size,
1107
+ "dtype": "float32",
1108
+ "num_params": first_num_params,
1109
+ "num_layers": first_config.num_hidden_layers,
1110
+ "hidden_size": first_config.hidden_size,
1111
+ "waleed_beta": effective_beta,
1112
+ "powlu_m": powlu_m,
1113
+ "checkpoints": [c[0] for c in checkpoints],
1114
+ "capture_pre_down": self.capture_pre_down,
1115
+ "capture_layer_output": self.capture_layer_output,
1116
+ },
1117
+ reinit=True
1118
+ )
1119
+
1120
+ self._cache.pop(first_model_name, None)
1121
+ torch.cuda.empty_cache()
1122
+
1123
+ results = []
1124
+ for ckpt_num, ckpt_folder in checkpoints:
1125
+ model_name = f"{REPO_ID}/{BASE_PATH}/{run_folder}/{ckpt_folder}"
1126
+ try:
1127
+ result = self._evaluate_checkpoint(model_name, dataset_name, blocks)
1128
+ self._log_checkpoint_to_wandb(result, step=ckpt_num)
1129
+ results.append(result)
1130
+ print(f" ✅ checkpoint-{ckpt_num}: loss={result.loss:.4f} ppl={result.perplexity:.2f}")
1131
+ except Exception as e:
1132
+ print(f" ❌ checkpoint-{ckpt_num} failed: {e}")
1133
+ import traceback
1134
+ traceback.print_exc()
1135
+ continue
1136
+
1137
+ wandb.finish()
1138
+ return results
1139
+
1140
+ # ------------------------------------------------------------------
1141
+ # Main compute – prepares training‑style blocks once per dataset
1142
+ # ------------------------------------------------------------------
1143
+
1144
+ def compute(
1145
+ self,
1146
+ dataset_names: List[str],
1147
+ run_folders: Optional[List[str]] = None,
1148
+ ) -> Dict[str, Dict[str, List[ModelResult]]]:
1149
+ all_run_folders = self.discover_checkpoints()
1150
+
1151
+ if run_folders is not None:
1152
+ filtered = {}
1153
+ for name in run_folders:
1154
+ if name in all_run_folders:
1155
+ filtered[name] = all_run_folders[name]
1156
+ else:
1157
+ print(f"⚠️ Run folder '{name}' not found. Skipping.")
1158
+ all_run_folders = filtered
1159
+ if not all_run_folders:
1160
+ print("❌ No valid run folders to evaluate. Exiting.")
1161
+ return {}
1162
+
1163
+ # Load tokenizer once (same for all datasets)
1164
+ tokenizer = AutoTokenizer.from_pretrained("w-ahmad/tiny-stories-tokenizer", trust_remote_code=True)
1165
+ if tokenizer.pad_token is None:
1166
+ tokenizer.pad_token = tokenizer.eos_token
1167
+
1168
+ blocks_by_dataset = {}
1169
+ for dataset_name in dataset_names:
1170
+ texts = self.load_dataset(dataset_name)
1171
+ blocks = self._prepare_blocks(texts, tokenizer, self.max_length)
1172
+ blocks_by_dataset[dataset_name] = blocks
1173
+ print(f"[Dataset] {dataset_name} → {len(blocks)} blocks of length {self.max_length}")
1174
+
1175
+ results_by_dataset: Dict[str, Dict[str, List[ModelResult]]] = {
1176
+ name: {} for name in dataset_names
1177
+ }
1178
+
1179
+ for dataset_name in dataset_names:
1180
+ blocks = blocks_by_dataset[dataset_name]
1181
+ for run_folder, checkpoints in sorted(all_run_folders.items()):
1182
+ print(f"\n🚀 Evaluating {run_folder} on {dataset_name} ({len(checkpoints)} checkpoints)...")
1183
+ results = self._evaluate_run_folder(run_folder, dataset_name, blocks, checkpoints)
1184
+ results_by_dataset[dataset_name][run_folder] = results
1185
+
1186
+ return results_by_dataset
1187
+
1188
+ # ------------------------------------------------------------------
1189
+ # Reporting (updated to include new stats in the top‑5 summary)
1190
+ # ------------------------------------------------------------------
1191
+
1192
+ def print_report(self, results_by_dataset: Dict[str, Dict[str, List[ModelResult]]]):
1193
+ for dataset_name, run_results in results_by_dataset.items():
1194
+ print("\n" + "=" * 150)
1195
+ print(f" Dataset: {dataset_name}")
1196
+ print("=" * 150)
1197
+
1198
+ print(f"{'Run Folder':<38} {'Ckpt':>7} {'Loss':>9} {'PPL':>9} {'Tokens':>8} {'Num Layers':>10}")
1199
+ print("-" * 90)
1200
+
1201
+ for run_folder, results in sorted(run_results.items()):
1202
+ if not results:
1203
+ continue
1204
+ latest = max(results, key=lambda r: r.checkpoint_step)
1205
+ name = run_folder[:36]
1206
+ print(
1207
+ f"{name:<38} "
1208
+ f"{latest.checkpoint_step:>7} "
1209
+ f"{latest.loss:>9.4f} "
1210
+ f"{latest.perplexity:>9.2f} "
1211
+ f"{latest.num_tokens:>8} "
1212
+ f"{latest.num_layers:>10}"
1213
+ )
1214
+
1215
+ # Show top‑5 per tensor type for the latest checkpoint
1216
+ print("\n[Per-Tensor Max Abs Top 5 (latest checkpoint per run)]")
1217
+ for dataset_name, run_results in results_by_dataset.items():
1218
+ for run_folder, results in sorted(run_results.items()):
1219
+ if not results:
1220
+ continue
1221
+ latest = max(results, key=lambda r: r.checkpoint_step)
1222
+ name = f"{run_folder} [{dataset_name}]"
1223
+ # Group by type
1224
+ activations = []
1225
+ pre_downs = []
1226
+ outputs = []
1227
+ for tensor_name, stats in latest.layer_acts.items():
1228
+ if "pre_down" in tensor_name:
1229
+ pre_downs.append((tensor_name, stats))
1230
+ elif "output" in tensor_name and "layers" in tensor_name:
1231
+ outputs.append((tensor_name, stats))
1232
+ else:
1233
+ activations.append((tensor_name, stats))
1234
+
1235
+ # Top 5 for each type
1236
+ for group_name, group_list in [
1237
+ ("Activations", activations),
1238
+ ("Pre-down", pre_downs),
1239
+ ("Layer outputs", outputs)
1240
+ ]:
1241
+ if not group_list:
1242
+ continue
1243
+ sorted_group = sorted(group_list, key=lambda x: x[1].max_abs, reverse=True)[:5]
1244
+ print(f"\n {name} (ckpt-{latest.checkpoint_step}) – {group_name}:")
1245
+ for tensor_name, stats in sorted_group:
1246
+ print(
1247
+ f" {tensor_name:<50} max_abs={stats.max_abs:>9.4f} "
1248
+ f"mean={stats.mean:>9.4f} std={stats.std:>9.4f} norm={stats.norm:>9.4f}"
1249
+ )
1250
+
1251
+ def export_json(self, results_by_dataset: Dict[str, Dict[str, List[ModelResult]]], path: str):
1252
+ data = []
1253
+ for dataset_name, run_results in results_by_dataset.items():
1254
+ for run_folder, results in run_results.items():
1255
+ for r in results:
1256
+ entry = {
1257
+ "run_folder": run_folder,
1258
+ "model": r.model_name,
1259
+ "dataset": r.dataset_name,
1260
+ "checkpoint_step": r.checkpoint_step,
1261
+ "loss": r.loss,
1262
+ "perplexity": r.perplexity,
1263
+ "num_tokens": r.num_tokens,
1264
+ "num_layers": r.num_layers,
1265
+ "hidden_size": r.hidden_size,
1266
+ "num_params": r.num_params,
1267
+ "global_act": asdict(r.global_act),
1268
+ "layer_acts": {k: asdict(v) for k, v in r.layer_acts.items()}
1269
+ }
1270
+ data.append(entry)
1271
+
1272
+ with open(path, "w") as f:
1273
+ json.dump(data, f, indent=2)
1274
+ print(f"[Exported] Results saved to {path}")
1275
+
1276
+
1277
+ # ============================================================================
1278
+ # DRIVER CODE
1279
+ # ============================================================================
1280
+ if __name__ == "__main__":
1281
+ # --- HARDCODE WANDB LOGIN (optional, replace with your key) ---
1282
+ # wandb.login(key="wandb_v1_...")
1283
+ # -------------------------------------------------------------
1284
+
1285
+ analyzer = LLMAnalyzer(
1286
+ max_length=512,
1287
+ max_samples=100, # use None for all samples
1288
+ batch_size=50,
1289
+ wandb_project="RESEARCH-10",
1290
+ activation_disk_offload=False,
1291
+ max_elements_per_tensor=None,
1292
+ activation_hook_exclude=[],
1293
+ track_activations=True, # set to False to skip all activation collection
1294
+ capture_pre_down=True, # enable pre-down capture
1295
+ capture_layer_output=True, # enable layer output capture
1296
+ )
1297
+
1298
+ DATASETS = ["tinystories"]
1299
+ # RUN_FOLDERS = ["glu-powlu-100L_run"] # uncomment to limit runs
1300
+
1301
+ print(f"\n🚀 Starting evaluation across datasets: {DATASETS}...")
1302
+ results_by_dataset = analyzer.compute(dataset_names=DATASETS) # add run_folders if needed
1303
+
1304
+ analyzer.print_report(results_by_dataset)
1305
+ analyzer.export_json(results_by_dataset, "evaluation_results_powlu.json")
1306
+
1307
+ print("\n✅ Done! Pre-down and layer output stats are now captured.")
zain/Activation/out/glu-powlu-100L_run/training_log.jsonl ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ {"step": 20, "epoch": 0.0013481631277384564, "timestamp": 1787000997.0357702, "loss": 4.371913146972656, "grad_norm": NaN, "learning_rate": 2.66e-05, "train/total_time_seconds": 7.6171948201954365, "train/time_per_step_avg": 0.3808597410097718, "train/epoch_time_elapsed": 8.666387312114239, "train/estimated_remaining_minutes": 15.742202628403902}
2
+ {"step": 40, "epoch": 0.002696326255476913, "timestamp": 1787001005.3286533, "loss": 0.0, "grad_norm": NaN, "learning_rate": 5.46e-05, "train/total_time_seconds": 14.947473030537367, "train/time_per_step_avg": 0.37368682576343415, "train/epoch_time_elapsed": 16.959270033985376, "train/estimated_remaining_minutes": 15.3211598563008}
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "silu-waleed10",
3
+ "architectures": [
4
+ "TinyLlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 2,
11
+ "head_dim": 32,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 128,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 256,
16
+ "max_position_embeddings": 512,
17
+ "mlp_bias": false,
18
+ "mlp_type": "glu",
19
+ "model_type": "tiny_llama",
20
+ "num_attention_heads": 4,
21
+ "num_hidden_layers": 100,
22
+ "num_key_value_heads": 4,
23
+ "pad_token_id": 0,
24
+ "powlu_m": 3.0,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 10000.0,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": true,
32
+ "tokenizer_name": "w-ahmad/tiny-stories-tokenizer",
33
+ "transformers_version": "5.16.0.dev0",
34
+ "use_cache": false,
35
+ "vocab_size": 4096,
36
+ "waleed_beta": 10
37
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d22f3fe3cce296436e56529c5bf947c584072012ea86c6dcf4f5620dd33528f3
3
+ size 33967272
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14c4c5949040b70f04fa831cad20490a1e71a489258b9797a659a59541f6c11c
3
+ size 68504996
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d9cd6a0487226e5bd30d1846894c82af483733ab4381b75bae9c0745e05d405
3
+ size 14244
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3001486ba00eb51d89ef078fe70e7e37535cd4e2311d7dd589266d045c9fb892
3
+ size 1064
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1024,
10
+ "pad_token": "<|endoftext|>",
11
+ "tokenizer_class": "GPT2Tokenizer",
12
+ "unk_token": "<|endoftext|>"
13
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/trainer_state.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.006740815638692282,
6
+ "eval_steps": 2498,
7
+ "global_step": 100,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0013481631277384564,
14
+ "grad_norm": 2.078125,
15
+ "learning_rate": 2.66e-05,
16
+ "loss": 8.299612426757813,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.002696326255476913,
21
+ "grad_norm": 1.3515625,
22
+ "learning_rate": 5.46e-05,
23
+ "loss": 8.047649383544922,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.004044489383215369,
28
+ "grad_norm": 1.2734375,
29
+ "learning_rate": 8.259999999999999e-05,
30
+ "loss": 7.837873077392578,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.005392652510953826,
35
+ "grad_norm": 1.265625,
36
+ "learning_rate": 0.0001106,
37
+ "loss": 7.572823333740234,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.006740815638692282,
42
+ "grad_norm": 1.1953125,
43
+ "learning_rate": 0.0001386,
44
+ "loss": 7.2332099914550785,
45
+ "step": 100
46
+ }
47
+ ],
48
+ "logging_steps": 20,
49
+ "max_steps": 2500,
50
+ "num_input_tokens_seen": 0,
51
+ "num_train_epochs": 1,
52
+ "save_steps": 100,
53
+ "stateful_callbacks": {
54
+ "TrainerControl": {
55
+ "args": {
56
+ "should_epoch_stop": false,
57
+ "should_evaluate": false,
58
+ "should_log": false,
59
+ "should_save": true,
60
+ "should_training_stop": false
61
+ },
62
+ "attributes": {}
63
+ }
64
+ },
65
+ "total_flos": 322628380262400.0,
66
+ "train_batch_size": 64,
67
+ "trial_name": null,
68
+ "trial_params": null
69
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-100/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05bff2540c50353524a55cdfcec08c60640502d31faf2769744ffe6f42f07210
3
+ size 4920
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "silu-waleed10",
3
+ "architectures": [
4
+ "TinyLlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 2,
11
+ "head_dim": 32,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 128,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 256,
16
+ "max_position_embeddings": 512,
17
+ "mlp_bias": false,
18
+ "mlp_type": "glu",
19
+ "model_type": "tiny_llama",
20
+ "num_attention_heads": 4,
21
+ "num_hidden_layers": 100,
22
+ "num_key_value_heads": 4,
23
+ "pad_token_id": 0,
24
+ "powlu_m": 3.0,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 10000.0,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": true,
32
+ "tokenizer_name": "w-ahmad/tiny-stories-tokenizer",
33
+ "transformers_version": "5.16.0.dev0",
34
+ "use_cache": false,
35
+ "vocab_size": 4096,
36
+ "waleed_beta": 10
37
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3907cce618894b4f8948372f0fe56c0521f31ce8a56ba6d28a6e56288889c90b
3
+ size 33967272
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9969774656e7c01113f4c4077f6371212965a186301896967f7df5ede401af8
3
+ size 68504996
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d9cd6a0487226e5bd30d1846894c82af483733ab4381b75bae9c0745e05d405
3
+ size 14244
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf8d0c79c23f451fbfe25677a50bf40ae55d38cdf93a853c1a033c179996385d
3
+ size 1064
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1024,
10
+ "pad_token": "<|endoftext|>",
11
+ "tokenizer_class": "GPT2Tokenizer",
12
+ "unk_token": "<|endoftext|>"
13
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.06740815638692282,
6
+ "eval_steps": 2498,
7
+ "global_step": 1000,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0013481631277384564,
14
+ "grad_norm": 2.078125,
15
+ "learning_rate": 2.66e-05,
16
+ "loss": 8.299612426757813,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.002696326255476913,
21
+ "grad_norm": 1.3515625,
22
+ "learning_rate": 5.46e-05,
23
+ "loss": 8.047649383544922,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.004044489383215369,
28
+ "grad_norm": 1.2734375,
29
+ "learning_rate": 8.259999999999999e-05,
30
+ "loss": 7.837873077392578,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.005392652510953826,
35
+ "grad_norm": 1.265625,
36
+ "learning_rate": 0.0001106,
37
+ "loss": 7.572823333740234,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.006740815638692282,
42
+ "grad_norm": 1.1953125,
43
+ "learning_rate": 0.0001386,
44
+ "loss": 7.2332099914550785,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.008088978766430738,
49
+ "grad_norm": 1.1328125,
50
+ "learning_rate": 0.00016659999999999998,
51
+ "loss": 6.86071548461914,
52
+ "step": 120
53
+ },
54
+ {
55
+ "epoch": 0.009437141894169195,
56
+ "grad_norm": 0.94921875,
57
+ "learning_rate": 0.00019460000000000001,
58
+ "loss": 6.517716979980468,
59
+ "step": 140
60
+ },
61
+ {
62
+ "epoch": 0.010785305021907651,
63
+ "grad_norm": 0.80078125,
64
+ "learning_rate": 0.0002226,
65
+ "loss": 6.2398426055908205,
66
+ "step": 160
67
+ },
68
+ {
69
+ "epoch": 0.012133468149646108,
70
+ "grad_norm": 0.65625,
71
+ "learning_rate": 0.00025059999999999997,
72
+ "loss": 6.034574890136719,
73
+ "step": 180
74
+ },
75
+ {
76
+ "epoch": 0.013481631277384564,
77
+ "grad_norm": 0.77734375,
78
+ "learning_rate": 0.0002786,
79
+ "loss": 5.868281555175781,
80
+ "step": 200
81
+ },
82
+ {
83
+ "epoch": 0.01482979440512302,
84
+ "grad_norm": 0.53515625,
85
+ "learning_rate": 0.00030659999999999997,
86
+ "loss": 5.68427734375,
87
+ "step": 220
88
+ },
89
+ {
90
+ "epoch": 0.016177957532861477,
91
+ "grad_norm": 0.83984375,
92
+ "learning_rate": 0.0003346,
93
+ "loss": 5.467292785644531,
94
+ "step": 240
95
+ },
96
+ {
97
+ "epoch": 0.01752612066059993,
98
+ "grad_norm": 1.859375,
99
+ "learning_rate": 0.00036260000000000003,
100
+ "loss": 5.249620819091797,
101
+ "step": 260
102
+ },
103
+ {
104
+ "epoch": 0.01887428378833839,
105
+ "grad_norm": 1.109375,
106
+ "learning_rate": 0.0003906,
107
+ "loss": 5.000855255126953,
108
+ "step": 280
109
+ },
110
+ {
111
+ "epoch": 0.020222446916076844,
112
+ "grad_norm": 0.8515625,
113
+ "learning_rate": 0.0004186,
114
+ "loss": 4.767573547363281,
115
+ "step": 300
116
+ },
117
+ {
118
+ "epoch": 0.021570610043815303,
119
+ "grad_norm": 1.6484375,
120
+ "learning_rate": 0.0004466,
121
+ "loss": 4.574215316772461,
122
+ "step": 320
123
+ },
124
+ {
125
+ "epoch": 0.022918773171553757,
126
+ "grad_norm": 1.0390625,
127
+ "learning_rate": 0.00047460000000000004,
128
+ "loss": 4.418313217163086,
129
+ "step": 340
130
+ },
131
+ {
132
+ "epoch": 0.024266936299292215,
133
+ "grad_norm": 0.57421875,
134
+ "learning_rate": 0.0005026,
135
+ "loss": 4.267443466186523,
136
+ "step": 360
137
+ },
138
+ {
139
+ "epoch": 0.02561509942703067,
140
+ "grad_norm": 1.03125,
141
+ "learning_rate": 0.0005306,
142
+ "loss": 4.12390251159668,
143
+ "step": 380
144
+ },
145
+ {
146
+ "epoch": 0.026963262554769128,
147
+ "grad_norm": 0.5,
148
+ "learning_rate": 0.0005586,
149
+ "loss": 3.9780818939208986,
150
+ "step": 400
151
+ },
152
+ {
153
+ "epoch": 0.028311425682507583,
154
+ "grad_norm": 0.7109375,
155
+ "learning_rate": 0.0005866,
156
+ "loss": 3.869882583618164,
157
+ "step": 420
158
+ },
159
+ {
160
+ "epoch": 0.02965958881024604,
161
+ "grad_norm": 0.498046875,
162
+ "learning_rate": 0.0006146,
163
+ "loss": 3.803238296508789,
164
+ "step": 440
165
+ },
166
+ {
167
+ "epoch": 0.031007751937984496,
168
+ "grad_norm": 0.71484375,
169
+ "learning_rate": 0.0006426,
170
+ "loss": 3.6923519134521485,
171
+ "step": 460
172
+ },
173
+ {
174
+ "epoch": 0.032355915065722954,
175
+ "grad_norm": 0.53125,
176
+ "learning_rate": 0.0006705999999999999,
177
+ "loss": 3.6233333587646483,
178
+ "step": 480
179
+ },
180
+ {
181
+ "epoch": 0.03370407819346141,
182
+ "grad_norm": 0.6875,
183
+ "learning_rate": 0.0006986,
184
+ "loss": 3.5461650848388673,
185
+ "step": 500
186
+ },
187
+ {
188
+ "epoch": 0.03505224132119986,
189
+ "grad_norm": 0.48046875,
190
+ "learning_rate": 0.0007,
191
+ "loss": 3.482923889160156,
192
+ "step": 520
193
+ },
194
+ {
195
+ "epoch": 0.03640040444893832,
196
+ "grad_norm": 0.5390625,
197
+ "learning_rate": 0.0007,
198
+ "loss": 3.403767776489258,
199
+ "step": 540
200
+ },
201
+ {
202
+ "epoch": 0.03774856757667678,
203
+ "grad_norm": 0.5703125,
204
+ "learning_rate": 0.0007,
205
+ "loss": 3.354298782348633,
206
+ "step": 560
207
+ },
208
+ {
209
+ "epoch": 0.03909673070441524,
210
+ "grad_norm": 0.451171875,
211
+ "learning_rate": 0.0007,
212
+ "loss": 3.294446563720703,
213
+ "step": 580
214
+ },
215
+ {
216
+ "epoch": 0.04044489383215369,
217
+ "grad_norm": 0.46484375,
218
+ "learning_rate": 0.0007,
219
+ "loss": 3.260773468017578,
220
+ "step": 600
221
+ },
222
+ {
223
+ "epoch": 0.04179305695989215,
224
+ "grad_norm": 0.490234375,
225
+ "learning_rate": 0.0007,
226
+ "loss": 3.1942256927490233,
227
+ "step": 620
228
+ },
229
+ {
230
+ "epoch": 0.043141220087630605,
231
+ "grad_norm": 0.453125,
232
+ "learning_rate": 0.0007,
233
+ "loss": 3.1715316772460938,
234
+ "step": 640
235
+ },
236
+ {
237
+ "epoch": 0.044489383215369056,
238
+ "grad_norm": 0.431640625,
239
+ "learning_rate": 0.0007,
240
+ "loss": 3.1136590957641603,
241
+ "step": 660
242
+ },
243
+ {
244
+ "epoch": 0.045837546343107514,
245
+ "grad_norm": 0.423828125,
246
+ "learning_rate": 0.0007,
247
+ "loss": 3.0865816116333007,
248
+ "step": 680
249
+ },
250
+ {
251
+ "epoch": 0.04718570947084597,
252
+ "grad_norm": 0.431640625,
253
+ "learning_rate": 0.0007,
254
+ "loss": 3.0418272018432617,
255
+ "step": 700
256
+ },
257
+ {
258
+ "epoch": 0.04853387259858443,
259
+ "grad_norm": 0.40234375,
260
+ "learning_rate": 0.0007,
261
+ "loss": 3.0056203842163085,
262
+ "step": 720
263
+ },
264
+ {
265
+ "epoch": 0.04988203572632288,
266
+ "grad_norm": 0.455078125,
267
+ "learning_rate": 0.0007,
268
+ "loss": 2.967478561401367,
269
+ "step": 740
270
+ },
271
+ {
272
+ "epoch": 0.05123019885406134,
273
+ "grad_norm": 0.431640625,
274
+ "learning_rate": 0.0007,
275
+ "loss": 2.9510751724243165,
276
+ "step": 760
277
+ },
278
+ {
279
+ "epoch": 0.0525783619817998,
280
+ "grad_norm": 0.515625,
281
+ "learning_rate": 0.0007,
282
+ "loss": 2.9503496170043944,
283
+ "step": 780
284
+ },
285
+ {
286
+ "epoch": 0.053926525109538256,
287
+ "grad_norm": 0.400390625,
288
+ "learning_rate": 0.0007,
289
+ "loss": 2.9029417037963867,
290
+ "step": 800
291
+ },
292
+ {
293
+ "epoch": 0.05527468823727671,
294
+ "grad_norm": 0.474609375,
295
+ "learning_rate": 0.0007,
296
+ "loss": 2.8892162322998045,
297
+ "step": 820
298
+ },
299
+ {
300
+ "epoch": 0.056622851365015166,
301
+ "grad_norm": 0.435546875,
302
+ "learning_rate": 0.0007,
303
+ "loss": 2.8582916259765625,
304
+ "step": 840
305
+ },
306
+ {
307
+ "epoch": 0.057971014492753624,
308
+ "grad_norm": 0.392578125,
309
+ "learning_rate": 0.0007,
310
+ "loss": 2.814076232910156,
311
+ "step": 860
312
+ },
313
+ {
314
+ "epoch": 0.05931917762049208,
315
+ "grad_norm": 0.396484375,
316
+ "learning_rate": 0.0007,
317
+ "loss": 2.7910627365112304,
318
+ "step": 880
319
+ },
320
+ {
321
+ "epoch": 0.06066734074823053,
322
+ "grad_norm": 0.37890625,
323
+ "learning_rate": 0.0007,
324
+ "loss": 2.7766284942626953,
325
+ "step": 900
326
+ },
327
+ {
328
+ "epoch": 0.06201550387596899,
329
+ "grad_norm": 0.435546875,
330
+ "learning_rate": 0.0007,
331
+ "loss": 2.7469675064086916,
332
+ "step": 920
333
+ },
334
+ {
335
+ "epoch": 0.06336366700370745,
336
+ "grad_norm": 0.4375,
337
+ "learning_rate": 0.0007,
338
+ "loss": 2.733433151245117,
339
+ "step": 940
340
+ },
341
+ {
342
+ "epoch": 0.06471183013144591,
343
+ "grad_norm": 0.4375,
344
+ "learning_rate": 0.0007,
345
+ "loss": 2.7049890518188477,
346
+ "step": 960
347
+ },
348
+ {
349
+ "epoch": 0.06605999325918437,
350
+ "grad_norm": 0.3828125,
351
+ "learning_rate": 0.0007,
352
+ "loss": 2.6879085540771483,
353
+ "step": 980
354
+ },
355
+ {
356
+ "epoch": 0.06740815638692282,
357
+ "grad_norm": 0.40625,
358
+ "learning_rate": 0.0007,
359
+ "loss": 2.686023139953613,
360
+ "step": 1000
361
+ }
362
+ ],
363
+ "logging_steps": 20,
364
+ "max_steps": 2500,
365
+ "num_input_tokens_seen": 0,
366
+ "num_train_epochs": 1,
367
+ "save_steps": 100,
368
+ "stateful_callbacks": {
369
+ "TrainerControl": {
370
+ "args": {
371
+ "should_epoch_stop": false,
372
+ "should_evaluate": false,
373
+ "should_log": false,
374
+ "should_save": true,
375
+ "should_training_stop": false
376
+ },
377
+ "attributes": {}
378
+ }
379
+ },
380
+ "total_flos": 3226283802624000.0,
381
+ "train_batch_size": 64,
382
+ "trial_name": null,
383
+ "trial_params": null
384
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05bff2540c50353524a55cdfcec08c60640502d31faf2769744ffe6f42f07210
3
+ size 4920
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "silu-waleed10",
3
+ "architectures": [
4
+ "TinyLlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 2,
11
+ "head_dim": 32,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 128,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 256,
16
+ "max_position_embeddings": 512,
17
+ "mlp_bias": false,
18
+ "mlp_type": "glu",
19
+ "model_type": "tiny_llama",
20
+ "num_attention_heads": 4,
21
+ "num_hidden_layers": 100,
22
+ "num_key_value_heads": 4,
23
+ "pad_token_id": 0,
24
+ "powlu_m": 3.0,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 10000.0,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": true,
32
+ "tokenizer_name": "w-ahmad/tiny-stories-tokenizer",
33
+ "transformers_version": "5.16.0.dev0",
34
+ "use_cache": false,
35
+ "vocab_size": 4096,
36
+ "waleed_beta": 10
37
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33dddc2d0765733202993d4eccc6154bd25a840564b706f6dc135f90cfd88251
3
+ size 33967272
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:274ddf378ceb5cf54cdb1ff6e81ede09b751cf59e7d7fab7dedb13569b28affa
3
+ size 68504996
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d9cd6a0487226e5bd30d1846894c82af483733ab4381b75bae9c0745e05d405
3
+ size 14244
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88121baf7de31688d97eca5c32cb058d585673d52f936d32dcd04e8b1903dcac
3
+ size 1064
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1024,
10
+ "pad_token": "<|endoftext|>",
11
+ "tokenizer_class": "GPT2Tokenizer",
12
+ "unk_token": "<|endoftext|>"
13
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/trainer_state.json ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.0741489720256151,
6
+ "eval_steps": 2498,
7
+ "global_step": 1100,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0013481631277384564,
14
+ "grad_norm": 2.078125,
15
+ "learning_rate": 2.66e-05,
16
+ "loss": 8.299612426757813,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.002696326255476913,
21
+ "grad_norm": 1.3515625,
22
+ "learning_rate": 5.46e-05,
23
+ "loss": 8.047649383544922,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.004044489383215369,
28
+ "grad_norm": 1.2734375,
29
+ "learning_rate": 8.259999999999999e-05,
30
+ "loss": 7.837873077392578,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.005392652510953826,
35
+ "grad_norm": 1.265625,
36
+ "learning_rate": 0.0001106,
37
+ "loss": 7.572823333740234,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.006740815638692282,
42
+ "grad_norm": 1.1953125,
43
+ "learning_rate": 0.0001386,
44
+ "loss": 7.2332099914550785,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.008088978766430738,
49
+ "grad_norm": 1.1328125,
50
+ "learning_rate": 0.00016659999999999998,
51
+ "loss": 6.86071548461914,
52
+ "step": 120
53
+ },
54
+ {
55
+ "epoch": 0.009437141894169195,
56
+ "grad_norm": 0.94921875,
57
+ "learning_rate": 0.00019460000000000001,
58
+ "loss": 6.517716979980468,
59
+ "step": 140
60
+ },
61
+ {
62
+ "epoch": 0.010785305021907651,
63
+ "grad_norm": 0.80078125,
64
+ "learning_rate": 0.0002226,
65
+ "loss": 6.2398426055908205,
66
+ "step": 160
67
+ },
68
+ {
69
+ "epoch": 0.012133468149646108,
70
+ "grad_norm": 0.65625,
71
+ "learning_rate": 0.00025059999999999997,
72
+ "loss": 6.034574890136719,
73
+ "step": 180
74
+ },
75
+ {
76
+ "epoch": 0.013481631277384564,
77
+ "grad_norm": 0.77734375,
78
+ "learning_rate": 0.0002786,
79
+ "loss": 5.868281555175781,
80
+ "step": 200
81
+ },
82
+ {
83
+ "epoch": 0.01482979440512302,
84
+ "grad_norm": 0.53515625,
85
+ "learning_rate": 0.00030659999999999997,
86
+ "loss": 5.68427734375,
87
+ "step": 220
88
+ },
89
+ {
90
+ "epoch": 0.016177957532861477,
91
+ "grad_norm": 0.83984375,
92
+ "learning_rate": 0.0003346,
93
+ "loss": 5.467292785644531,
94
+ "step": 240
95
+ },
96
+ {
97
+ "epoch": 0.01752612066059993,
98
+ "grad_norm": 1.859375,
99
+ "learning_rate": 0.00036260000000000003,
100
+ "loss": 5.249620819091797,
101
+ "step": 260
102
+ },
103
+ {
104
+ "epoch": 0.01887428378833839,
105
+ "grad_norm": 1.109375,
106
+ "learning_rate": 0.0003906,
107
+ "loss": 5.000855255126953,
108
+ "step": 280
109
+ },
110
+ {
111
+ "epoch": 0.020222446916076844,
112
+ "grad_norm": 0.8515625,
113
+ "learning_rate": 0.0004186,
114
+ "loss": 4.767573547363281,
115
+ "step": 300
116
+ },
117
+ {
118
+ "epoch": 0.021570610043815303,
119
+ "grad_norm": 1.6484375,
120
+ "learning_rate": 0.0004466,
121
+ "loss": 4.574215316772461,
122
+ "step": 320
123
+ },
124
+ {
125
+ "epoch": 0.022918773171553757,
126
+ "grad_norm": 1.0390625,
127
+ "learning_rate": 0.00047460000000000004,
128
+ "loss": 4.418313217163086,
129
+ "step": 340
130
+ },
131
+ {
132
+ "epoch": 0.024266936299292215,
133
+ "grad_norm": 0.57421875,
134
+ "learning_rate": 0.0005026,
135
+ "loss": 4.267443466186523,
136
+ "step": 360
137
+ },
138
+ {
139
+ "epoch": 0.02561509942703067,
140
+ "grad_norm": 1.03125,
141
+ "learning_rate": 0.0005306,
142
+ "loss": 4.12390251159668,
143
+ "step": 380
144
+ },
145
+ {
146
+ "epoch": 0.026963262554769128,
147
+ "grad_norm": 0.5,
148
+ "learning_rate": 0.0005586,
149
+ "loss": 3.9780818939208986,
150
+ "step": 400
151
+ },
152
+ {
153
+ "epoch": 0.028311425682507583,
154
+ "grad_norm": 0.7109375,
155
+ "learning_rate": 0.0005866,
156
+ "loss": 3.869882583618164,
157
+ "step": 420
158
+ },
159
+ {
160
+ "epoch": 0.02965958881024604,
161
+ "grad_norm": 0.498046875,
162
+ "learning_rate": 0.0006146,
163
+ "loss": 3.803238296508789,
164
+ "step": 440
165
+ },
166
+ {
167
+ "epoch": 0.031007751937984496,
168
+ "grad_norm": 0.71484375,
169
+ "learning_rate": 0.0006426,
170
+ "loss": 3.6923519134521485,
171
+ "step": 460
172
+ },
173
+ {
174
+ "epoch": 0.032355915065722954,
175
+ "grad_norm": 0.53125,
176
+ "learning_rate": 0.0006705999999999999,
177
+ "loss": 3.6233333587646483,
178
+ "step": 480
179
+ },
180
+ {
181
+ "epoch": 0.03370407819346141,
182
+ "grad_norm": 0.6875,
183
+ "learning_rate": 0.0006986,
184
+ "loss": 3.5461650848388673,
185
+ "step": 500
186
+ },
187
+ {
188
+ "epoch": 0.03505224132119986,
189
+ "grad_norm": 0.48046875,
190
+ "learning_rate": 0.0007,
191
+ "loss": 3.482923889160156,
192
+ "step": 520
193
+ },
194
+ {
195
+ "epoch": 0.03640040444893832,
196
+ "grad_norm": 0.5390625,
197
+ "learning_rate": 0.0007,
198
+ "loss": 3.403767776489258,
199
+ "step": 540
200
+ },
201
+ {
202
+ "epoch": 0.03774856757667678,
203
+ "grad_norm": 0.5703125,
204
+ "learning_rate": 0.0007,
205
+ "loss": 3.354298782348633,
206
+ "step": 560
207
+ },
208
+ {
209
+ "epoch": 0.03909673070441524,
210
+ "grad_norm": 0.451171875,
211
+ "learning_rate": 0.0007,
212
+ "loss": 3.294446563720703,
213
+ "step": 580
214
+ },
215
+ {
216
+ "epoch": 0.04044489383215369,
217
+ "grad_norm": 0.46484375,
218
+ "learning_rate": 0.0007,
219
+ "loss": 3.260773468017578,
220
+ "step": 600
221
+ },
222
+ {
223
+ "epoch": 0.04179305695989215,
224
+ "grad_norm": 0.490234375,
225
+ "learning_rate": 0.0007,
226
+ "loss": 3.1942256927490233,
227
+ "step": 620
228
+ },
229
+ {
230
+ "epoch": 0.043141220087630605,
231
+ "grad_norm": 0.453125,
232
+ "learning_rate": 0.0007,
233
+ "loss": 3.1715316772460938,
234
+ "step": 640
235
+ },
236
+ {
237
+ "epoch": 0.044489383215369056,
238
+ "grad_norm": 0.431640625,
239
+ "learning_rate": 0.0007,
240
+ "loss": 3.1136590957641603,
241
+ "step": 660
242
+ },
243
+ {
244
+ "epoch": 0.045837546343107514,
245
+ "grad_norm": 0.423828125,
246
+ "learning_rate": 0.0007,
247
+ "loss": 3.0865816116333007,
248
+ "step": 680
249
+ },
250
+ {
251
+ "epoch": 0.04718570947084597,
252
+ "grad_norm": 0.431640625,
253
+ "learning_rate": 0.0007,
254
+ "loss": 3.0418272018432617,
255
+ "step": 700
256
+ },
257
+ {
258
+ "epoch": 0.04853387259858443,
259
+ "grad_norm": 0.40234375,
260
+ "learning_rate": 0.0007,
261
+ "loss": 3.0056203842163085,
262
+ "step": 720
263
+ },
264
+ {
265
+ "epoch": 0.04988203572632288,
266
+ "grad_norm": 0.455078125,
267
+ "learning_rate": 0.0007,
268
+ "loss": 2.967478561401367,
269
+ "step": 740
270
+ },
271
+ {
272
+ "epoch": 0.05123019885406134,
273
+ "grad_norm": 0.431640625,
274
+ "learning_rate": 0.0007,
275
+ "loss": 2.9510751724243165,
276
+ "step": 760
277
+ },
278
+ {
279
+ "epoch": 0.0525783619817998,
280
+ "grad_norm": 0.515625,
281
+ "learning_rate": 0.0007,
282
+ "loss": 2.9503496170043944,
283
+ "step": 780
284
+ },
285
+ {
286
+ "epoch": 0.053926525109538256,
287
+ "grad_norm": 0.400390625,
288
+ "learning_rate": 0.0007,
289
+ "loss": 2.9029417037963867,
290
+ "step": 800
291
+ },
292
+ {
293
+ "epoch": 0.05527468823727671,
294
+ "grad_norm": 0.474609375,
295
+ "learning_rate": 0.0007,
296
+ "loss": 2.8892162322998045,
297
+ "step": 820
298
+ },
299
+ {
300
+ "epoch": 0.056622851365015166,
301
+ "grad_norm": 0.435546875,
302
+ "learning_rate": 0.0007,
303
+ "loss": 2.8582916259765625,
304
+ "step": 840
305
+ },
306
+ {
307
+ "epoch": 0.057971014492753624,
308
+ "grad_norm": 0.392578125,
309
+ "learning_rate": 0.0007,
310
+ "loss": 2.814076232910156,
311
+ "step": 860
312
+ },
313
+ {
314
+ "epoch": 0.05931917762049208,
315
+ "grad_norm": 0.396484375,
316
+ "learning_rate": 0.0007,
317
+ "loss": 2.7910627365112304,
318
+ "step": 880
319
+ },
320
+ {
321
+ "epoch": 0.06066734074823053,
322
+ "grad_norm": 0.37890625,
323
+ "learning_rate": 0.0007,
324
+ "loss": 2.7766284942626953,
325
+ "step": 900
326
+ },
327
+ {
328
+ "epoch": 0.06201550387596899,
329
+ "grad_norm": 0.435546875,
330
+ "learning_rate": 0.0007,
331
+ "loss": 2.7469675064086916,
332
+ "step": 920
333
+ },
334
+ {
335
+ "epoch": 0.06336366700370745,
336
+ "grad_norm": 0.4375,
337
+ "learning_rate": 0.0007,
338
+ "loss": 2.733433151245117,
339
+ "step": 940
340
+ },
341
+ {
342
+ "epoch": 0.06471183013144591,
343
+ "grad_norm": 0.4375,
344
+ "learning_rate": 0.0007,
345
+ "loss": 2.7049890518188477,
346
+ "step": 960
347
+ },
348
+ {
349
+ "epoch": 0.06605999325918437,
350
+ "grad_norm": 0.3828125,
351
+ "learning_rate": 0.0007,
352
+ "loss": 2.6879085540771483,
353
+ "step": 980
354
+ },
355
+ {
356
+ "epoch": 0.06740815638692282,
357
+ "grad_norm": 0.40625,
358
+ "learning_rate": 0.0007,
359
+ "loss": 2.686023139953613,
360
+ "step": 1000
361
+ },
362
+ {
363
+ "epoch": 0.06875631951466127,
364
+ "grad_norm": 0.365234375,
365
+ "learning_rate": 0.0007,
366
+ "loss": 2.652704620361328,
367
+ "step": 1020
368
+ },
369
+ {
370
+ "epoch": 0.07010448264239973,
371
+ "grad_norm": 0.419921875,
372
+ "learning_rate": 0.0007,
373
+ "loss": 2.638092613220215,
374
+ "step": 1040
375
+ },
376
+ {
377
+ "epoch": 0.07145264577013818,
378
+ "grad_norm": 0.388671875,
379
+ "learning_rate": 0.0007,
380
+ "loss": 2.6240352630615233,
381
+ "step": 1060
382
+ },
383
+ {
384
+ "epoch": 0.07280080889787664,
385
+ "grad_norm": 0.359375,
386
+ "learning_rate": 0.0007,
387
+ "loss": 2.603643226623535,
388
+ "step": 1080
389
+ },
390
+ {
391
+ "epoch": 0.0741489720256151,
392
+ "grad_norm": 0.39453125,
393
+ "learning_rate": 0.0007,
394
+ "loss": 2.5982418060302734,
395
+ "step": 1100
396
+ }
397
+ ],
398
+ "logging_steps": 20,
399
+ "max_steps": 2500,
400
+ "num_input_tokens_seen": 0,
401
+ "num_train_epochs": 1,
402
+ "save_steps": 100,
403
+ "stateful_callbacks": {
404
+ "TrainerControl": {
405
+ "args": {
406
+ "should_epoch_stop": false,
407
+ "should_evaluate": false,
408
+ "should_log": false,
409
+ "should_save": true,
410
+ "should_training_stop": false
411
+ },
412
+ "attributes": {}
413
+ }
414
+ },
415
+ "total_flos": 3548912182886400.0,
416
+ "train_batch_size": 64,
417
+ "trial_name": null,
418
+ "trial_params": null
419
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1100/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05bff2540c50353524a55cdfcec08c60640502d31faf2769744ffe6f42f07210
3
+ size 4920
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "silu-waleed10",
3
+ "architectures": [
4
+ "TinyLlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 2,
11
+ "head_dim": 32,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 128,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 256,
16
+ "max_position_embeddings": 512,
17
+ "mlp_bias": false,
18
+ "mlp_type": "glu",
19
+ "model_type": "tiny_llama",
20
+ "num_attention_heads": 4,
21
+ "num_hidden_layers": 100,
22
+ "num_key_value_heads": 4,
23
+ "pad_token_id": 0,
24
+ "powlu_m": 3.0,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 10000.0,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": true,
32
+ "tokenizer_name": "w-ahmad/tiny-stories-tokenizer",
33
+ "transformers_version": "5.16.0.dev0",
34
+ "use_cache": false,
35
+ "vocab_size": 4096,
36
+ "waleed_beta": 10
37
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f29a0ba6bac2703470ffab6052fa8a1985606247a7b1ff41fd2b18fcb91b02b
3
+ size 33967272
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3441afbc654638972737143e4baa3d1c29ff12ff8d64d9de0566af12e8ad406
3
+ size 68504996
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d9cd6a0487226e5bd30d1846894c82af483733ab4381b75bae9c0745e05d405
3
+ size 14244
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8543afc9166865219cadbba29db865d839ec4102a4f9ddeffc962b9fdba3b028
3
+ size 1064
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1024,
10
+ "pad_token": "<|endoftext|>",
11
+ "tokenizer_class": "GPT2Tokenizer",
12
+ "unk_token": "<|endoftext|>"
13
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/trainer_state.json ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.08088978766430738,
6
+ "eval_steps": 2498,
7
+ "global_step": 1200,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0013481631277384564,
14
+ "grad_norm": 2.078125,
15
+ "learning_rate": 2.66e-05,
16
+ "loss": 8.299612426757813,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.002696326255476913,
21
+ "grad_norm": 1.3515625,
22
+ "learning_rate": 5.46e-05,
23
+ "loss": 8.047649383544922,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.004044489383215369,
28
+ "grad_norm": 1.2734375,
29
+ "learning_rate": 8.259999999999999e-05,
30
+ "loss": 7.837873077392578,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.005392652510953826,
35
+ "grad_norm": 1.265625,
36
+ "learning_rate": 0.0001106,
37
+ "loss": 7.572823333740234,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.006740815638692282,
42
+ "grad_norm": 1.1953125,
43
+ "learning_rate": 0.0001386,
44
+ "loss": 7.2332099914550785,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.008088978766430738,
49
+ "grad_norm": 1.1328125,
50
+ "learning_rate": 0.00016659999999999998,
51
+ "loss": 6.86071548461914,
52
+ "step": 120
53
+ },
54
+ {
55
+ "epoch": 0.009437141894169195,
56
+ "grad_norm": 0.94921875,
57
+ "learning_rate": 0.00019460000000000001,
58
+ "loss": 6.517716979980468,
59
+ "step": 140
60
+ },
61
+ {
62
+ "epoch": 0.010785305021907651,
63
+ "grad_norm": 0.80078125,
64
+ "learning_rate": 0.0002226,
65
+ "loss": 6.2398426055908205,
66
+ "step": 160
67
+ },
68
+ {
69
+ "epoch": 0.012133468149646108,
70
+ "grad_norm": 0.65625,
71
+ "learning_rate": 0.00025059999999999997,
72
+ "loss": 6.034574890136719,
73
+ "step": 180
74
+ },
75
+ {
76
+ "epoch": 0.013481631277384564,
77
+ "grad_norm": 0.77734375,
78
+ "learning_rate": 0.0002786,
79
+ "loss": 5.868281555175781,
80
+ "step": 200
81
+ },
82
+ {
83
+ "epoch": 0.01482979440512302,
84
+ "grad_norm": 0.53515625,
85
+ "learning_rate": 0.00030659999999999997,
86
+ "loss": 5.68427734375,
87
+ "step": 220
88
+ },
89
+ {
90
+ "epoch": 0.016177957532861477,
91
+ "grad_norm": 0.83984375,
92
+ "learning_rate": 0.0003346,
93
+ "loss": 5.467292785644531,
94
+ "step": 240
95
+ },
96
+ {
97
+ "epoch": 0.01752612066059993,
98
+ "grad_norm": 1.859375,
99
+ "learning_rate": 0.00036260000000000003,
100
+ "loss": 5.249620819091797,
101
+ "step": 260
102
+ },
103
+ {
104
+ "epoch": 0.01887428378833839,
105
+ "grad_norm": 1.109375,
106
+ "learning_rate": 0.0003906,
107
+ "loss": 5.000855255126953,
108
+ "step": 280
109
+ },
110
+ {
111
+ "epoch": 0.020222446916076844,
112
+ "grad_norm": 0.8515625,
113
+ "learning_rate": 0.0004186,
114
+ "loss": 4.767573547363281,
115
+ "step": 300
116
+ },
117
+ {
118
+ "epoch": 0.021570610043815303,
119
+ "grad_norm": 1.6484375,
120
+ "learning_rate": 0.0004466,
121
+ "loss": 4.574215316772461,
122
+ "step": 320
123
+ },
124
+ {
125
+ "epoch": 0.022918773171553757,
126
+ "grad_norm": 1.0390625,
127
+ "learning_rate": 0.00047460000000000004,
128
+ "loss": 4.418313217163086,
129
+ "step": 340
130
+ },
131
+ {
132
+ "epoch": 0.024266936299292215,
133
+ "grad_norm": 0.57421875,
134
+ "learning_rate": 0.0005026,
135
+ "loss": 4.267443466186523,
136
+ "step": 360
137
+ },
138
+ {
139
+ "epoch": 0.02561509942703067,
140
+ "grad_norm": 1.03125,
141
+ "learning_rate": 0.0005306,
142
+ "loss": 4.12390251159668,
143
+ "step": 380
144
+ },
145
+ {
146
+ "epoch": 0.026963262554769128,
147
+ "grad_norm": 0.5,
148
+ "learning_rate": 0.0005586,
149
+ "loss": 3.9780818939208986,
150
+ "step": 400
151
+ },
152
+ {
153
+ "epoch": 0.028311425682507583,
154
+ "grad_norm": 0.7109375,
155
+ "learning_rate": 0.0005866,
156
+ "loss": 3.869882583618164,
157
+ "step": 420
158
+ },
159
+ {
160
+ "epoch": 0.02965958881024604,
161
+ "grad_norm": 0.498046875,
162
+ "learning_rate": 0.0006146,
163
+ "loss": 3.803238296508789,
164
+ "step": 440
165
+ },
166
+ {
167
+ "epoch": 0.031007751937984496,
168
+ "grad_norm": 0.71484375,
169
+ "learning_rate": 0.0006426,
170
+ "loss": 3.6923519134521485,
171
+ "step": 460
172
+ },
173
+ {
174
+ "epoch": 0.032355915065722954,
175
+ "grad_norm": 0.53125,
176
+ "learning_rate": 0.0006705999999999999,
177
+ "loss": 3.6233333587646483,
178
+ "step": 480
179
+ },
180
+ {
181
+ "epoch": 0.03370407819346141,
182
+ "grad_norm": 0.6875,
183
+ "learning_rate": 0.0006986,
184
+ "loss": 3.5461650848388673,
185
+ "step": 500
186
+ },
187
+ {
188
+ "epoch": 0.03505224132119986,
189
+ "grad_norm": 0.48046875,
190
+ "learning_rate": 0.0007,
191
+ "loss": 3.482923889160156,
192
+ "step": 520
193
+ },
194
+ {
195
+ "epoch": 0.03640040444893832,
196
+ "grad_norm": 0.5390625,
197
+ "learning_rate": 0.0007,
198
+ "loss": 3.403767776489258,
199
+ "step": 540
200
+ },
201
+ {
202
+ "epoch": 0.03774856757667678,
203
+ "grad_norm": 0.5703125,
204
+ "learning_rate": 0.0007,
205
+ "loss": 3.354298782348633,
206
+ "step": 560
207
+ },
208
+ {
209
+ "epoch": 0.03909673070441524,
210
+ "grad_norm": 0.451171875,
211
+ "learning_rate": 0.0007,
212
+ "loss": 3.294446563720703,
213
+ "step": 580
214
+ },
215
+ {
216
+ "epoch": 0.04044489383215369,
217
+ "grad_norm": 0.46484375,
218
+ "learning_rate": 0.0007,
219
+ "loss": 3.260773468017578,
220
+ "step": 600
221
+ },
222
+ {
223
+ "epoch": 0.04179305695989215,
224
+ "grad_norm": 0.490234375,
225
+ "learning_rate": 0.0007,
226
+ "loss": 3.1942256927490233,
227
+ "step": 620
228
+ },
229
+ {
230
+ "epoch": 0.043141220087630605,
231
+ "grad_norm": 0.453125,
232
+ "learning_rate": 0.0007,
233
+ "loss": 3.1715316772460938,
234
+ "step": 640
235
+ },
236
+ {
237
+ "epoch": 0.044489383215369056,
238
+ "grad_norm": 0.431640625,
239
+ "learning_rate": 0.0007,
240
+ "loss": 3.1136590957641603,
241
+ "step": 660
242
+ },
243
+ {
244
+ "epoch": 0.045837546343107514,
245
+ "grad_norm": 0.423828125,
246
+ "learning_rate": 0.0007,
247
+ "loss": 3.0865816116333007,
248
+ "step": 680
249
+ },
250
+ {
251
+ "epoch": 0.04718570947084597,
252
+ "grad_norm": 0.431640625,
253
+ "learning_rate": 0.0007,
254
+ "loss": 3.0418272018432617,
255
+ "step": 700
256
+ },
257
+ {
258
+ "epoch": 0.04853387259858443,
259
+ "grad_norm": 0.40234375,
260
+ "learning_rate": 0.0007,
261
+ "loss": 3.0056203842163085,
262
+ "step": 720
263
+ },
264
+ {
265
+ "epoch": 0.04988203572632288,
266
+ "grad_norm": 0.455078125,
267
+ "learning_rate": 0.0007,
268
+ "loss": 2.967478561401367,
269
+ "step": 740
270
+ },
271
+ {
272
+ "epoch": 0.05123019885406134,
273
+ "grad_norm": 0.431640625,
274
+ "learning_rate": 0.0007,
275
+ "loss": 2.9510751724243165,
276
+ "step": 760
277
+ },
278
+ {
279
+ "epoch": 0.0525783619817998,
280
+ "grad_norm": 0.515625,
281
+ "learning_rate": 0.0007,
282
+ "loss": 2.9503496170043944,
283
+ "step": 780
284
+ },
285
+ {
286
+ "epoch": 0.053926525109538256,
287
+ "grad_norm": 0.400390625,
288
+ "learning_rate": 0.0007,
289
+ "loss": 2.9029417037963867,
290
+ "step": 800
291
+ },
292
+ {
293
+ "epoch": 0.05527468823727671,
294
+ "grad_norm": 0.474609375,
295
+ "learning_rate": 0.0007,
296
+ "loss": 2.8892162322998045,
297
+ "step": 820
298
+ },
299
+ {
300
+ "epoch": 0.056622851365015166,
301
+ "grad_norm": 0.435546875,
302
+ "learning_rate": 0.0007,
303
+ "loss": 2.8582916259765625,
304
+ "step": 840
305
+ },
306
+ {
307
+ "epoch": 0.057971014492753624,
308
+ "grad_norm": 0.392578125,
309
+ "learning_rate": 0.0007,
310
+ "loss": 2.814076232910156,
311
+ "step": 860
312
+ },
313
+ {
314
+ "epoch": 0.05931917762049208,
315
+ "grad_norm": 0.396484375,
316
+ "learning_rate": 0.0007,
317
+ "loss": 2.7910627365112304,
318
+ "step": 880
319
+ },
320
+ {
321
+ "epoch": 0.06066734074823053,
322
+ "grad_norm": 0.37890625,
323
+ "learning_rate": 0.0007,
324
+ "loss": 2.7766284942626953,
325
+ "step": 900
326
+ },
327
+ {
328
+ "epoch": 0.06201550387596899,
329
+ "grad_norm": 0.435546875,
330
+ "learning_rate": 0.0007,
331
+ "loss": 2.7469675064086916,
332
+ "step": 920
333
+ },
334
+ {
335
+ "epoch": 0.06336366700370745,
336
+ "grad_norm": 0.4375,
337
+ "learning_rate": 0.0007,
338
+ "loss": 2.733433151245117,
339
+ "step": 940
340
+ },
341
+ {
342
+ "epoch": 0.06471183013144591,
343
+ "grad_norm": 0.4375,
344
+ "learning_rate": 0.0007,
345
+ "loss": 2.7049890518188477,
346
+ "step": 960
347
+ },
348
+ {
349
+ "epoch": 0.06605999325918437,
350
+ "grad_norm": 0.3828125,
351
+ "learning_rate": 0.0007,
352
+ "loss": 2.6879085540771483,
353
+ "step": 980
354
+ },
355
+ {
356
+ "epoch": 0.06740815638692282,
357
+ "grad_norm": 0.40625,
358
+ "learning_rate": 0.0007,
359
+ "loss": 2.686023139953613,
360
+ "step": 1000
361
+ },
362
+ {
363
+ "epoch": 0.06875631951466127,
364
+ "grad_norm": 0.365234375,
365
+ "learning_rate": 0.0007,
366
+ "loss": 2.652704620361328,
367
+ "step": 1020
368
+ },
369
+ {
370
+ "epoch": 0.07010448264239973,
371
+ "grad_norm": 0.419921875,
372
+ "learning_rate": 0.0007,
373
+ "loss": 2.638092613220215,
374
+ "step": 1040
375
+ },
376
+ {
377
+ "epoch": 0.07145264577013818,
378
+ "grad_norm": 0.388671875,
379
+ "learning_rate": 0.0007,
380
+ "loss": 2.6240352630615233,
381
+ "step": 1060
382
+ },
383
+ {
384
+ "epoch": 0.07280080889787664,
385
+ "grad_norm": 0.359375,
386
+ "learning_rate": 0.0007,
387
+ "loss": 2.603643226623535,
388
+ "step": 1080
389
+ },
390
+ {
391
+ "epoch": 0.0741489720256151,
392
+ "grad_norm": 0.39453125,
393
+ "learning_rate": 0.0007,
394
+ "loss": 2.5982418060302734,
395
+ "step": 1100
396
+ },
397
+ {
398
+ "epoch": 0.07549713515335356,
399
+ "grad_norm": 0.38671875,
400
+ "learning_rate": 0.0007,
401
+ "loss": 2.5616750717163086,
402
+ "step": 1120
403
+ },
404
+ {
405
+ "epoch": 0.07684529828109202,
406
+ "grad_norm": 0.40234375,
407
+ "learning_rate": 0.0007,
408
+ "loss": 2.5506912231445313,
409
+ "step": 1140
410
+ },
411
+ {
412
+ "epoch": 0.07819346140883048,
413
+ "grad_norm": 0.376953125,
414
+ "learning_rate": 0.0007,
415
+ "loss": 2.548145866394043,
416
+ "step": 1160
417
+ },
418
+ {
419
+ "epoch": 0.07954162453656892,
420
+ "grad_norm": 0.361328125,
421
+ "learning_rate": 0.0007,
422
+ "loss": 2.541400909423828,
423
+ "step": 1180
424
+ },
425
+ {
426
+ "epoch": 0.08088978766430738,
427
+ "grad_norm": 0.408203125,
428
+ "learning_rate": 0.0007,
429
+ "loss": 2.5302850723266603,
430
+ "step": 1200
431
+ }
432
+ ],
433
+ "logging_steps": 20,
434
+ "max_steps": 2500,
435
+ "num_input_tokens_seen": 0,
436
+ "num_train_epochs": 1,
437
+ "save_steps": 100,
438
+ "stateful_callbacks": {
439
+ "TrainerControl": {
440
+ "args": {
441
+ "should_epoch_stop": false,
442
+ "should_evaluate": false,
443
+ "should_log": false,
444
+ "should_save": true,
445
+ "should_training_stop": false
446
+ },
447
+ "attributes": {}
448
+ }
449
+ },
450
+ "total_flos": 3871540563148800.0,
451
+ "train_batch_size": 64,
452
+ "trial_name": null,
453
+ "trial_params": null
454
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1200/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05bff2540c50353524a55cdfcec08c60640502d31faf2769744ffe6f42f07210
3
+ size 4920
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "silu-waleed10",
3
+ "architectures": [
4
+ "TinyLlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 2,
11
+ "head_dim": 32,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 128,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 256,
16
+ "max_position_embeddings": 512,
17
+ "mlp_bias": false,
18
+ "mlp_type": "glu",
19
+ "model_type": "tiny_llama",
20
+ "num_attention_heads": 4,
21
+ "num_hidden_layers": 100,
22
+ "num_key_value_heads": 4,
23
+ "pad_token_id": 0,
24
+ "powlu_m": 3.0,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 10000.0,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": true,
32
+ "tokenizer_name": "w-ahmad/tiny-stories-tokenizer",
33
+ "transformers_version": "5.16.0.dev0",
34
+ "use_cache": false,
35
+ "vocab_size": 4096,
36
+ "waleed_beta": 10
37
+ }
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:683c26e18ce6730b9497ce68bac52ef54b21f0002dea85c2c1f91383c207fc48
3
+ size 33967272
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c449596777a41bdb7b3554f4b6653e81baa2eea89db5bff0e5f29c2b2a3f183d
3
+ size 68504996
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d9cd6a0487226e5bd30d1846894c82af483733ab4381b75bae9c0745e05d405
3
+ size 14244
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6166e4e25b157aeaf4765c80f04dab16e63f8ec3cd6ab3637d77b940e7dfcfe1
3
+ size 1064
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
zain/Activation/out/glu-silu-waleed10-100L_run/checkpoint-1300/tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1024,
10
+ "pad_token": "<|endoftext|>",
11
+ "tokenizer_class": "GPT2Tokenizer",
12
+ "unk_token": "<|endoftext|>"
13
+ }