-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_experiments.py
More file actions
99 lines (88 loc) · 2.72 KB
/
Copy pathrun_experiments.py
File metadata and controls
99 lines (88 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""
TinyThinker — run_experiments.py
Queue and run all experiments sequentially.
Usage: uv run python run_experiments.py
"""
import sys
import json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from experiments import run_experiment, calculate_token_budget
# Common config for all experiments
COMMON = dict(
num_train=50000,
num_val=1000,
num_test=1000,
max_steps=40000,
exception_prob=0.4,
varied_vocab=True,
math_ratio=0.4,
early_stop_threshold=0.005,
early_stop_min_evals=20,
early_stop_window=10,
eval_interval=500,
eval_samples=300,
)
EXPERIMENTS = [
# 1. Verbose baseline — properly sized, generous gen_len
{
"name": "verbose_crossmodal",
"trace_mode": "verbose",
"override_gen_len": 400,
**COMMON,
},
# 2. Self-check: VERIFY after each step
{
"name": "selfcheck_crossmodal",
"trace_mode": "selfcheck",
"override_gen_len": 300,
**COMMON,
},
# 3. NASA redundant: maximally paranoid
{
"name": "redundant_crossmodal",
"trace_mode": "redundant",
"override_gen_len": 500,
**COMMON,
},
# 4. Think/speak: inner speech vs output
{
"name": "think_crossmodal",
"trace_mode": "think",
"override_gen_len": 200,
**COMMON,
},
]
if __name__ == "__main__":
results = {}
for exp in EXPERIMENTS:
name = exp["name"]
mode = exp["trace_mode"]
# Calculate token budget
budget = calculate_token_budget(mode, exp.get("exception_prob", 0.4),
exp.get("varied_vocab", True),
exp.get("math_ratio", 0.4))
print(f"\n{'='*60}")
print(f"Queued: {name} (mode={mode})")
print(f"Token budget: seq={budget['recommended_max_seq_len']} "
f"gen={budget['recommended_max_gen_len']}")
print(f"{'='*60}")
acc = run_experiment(**exp)
results[name] = {
"accuracy": acc,
"trace_mode": mode,
"seq_len": budget["recommended_max_seq_len"],
"gen_len": budget["recommended_max_gen_len"],
"mean_tokens": budget["mean_total_tokens"],
}
# Summary
print(f"\n{'='*60}")
print("ALL EXPERIMENTS COMPLETE")
print(f"{'='*60}")
print(f"{'Name':<30s} {'Mode':<12s} {'Acc':>6s} {'Tokens':>8s}")
print("-" * 60)
for name, r in sorted(results.items(), key=lambda x: -x[1]["accuracy"]):
print(f"{name:<30s} {r['trace_mode']:<12s} {r['accuracy']:>6.1%} "
f"{r['mean_tokens']:>8.0f}")
with open("experiments/summary.json", "w") as f:
json.dump(results, f, indent=2)