phera-ra commited on
Commit
8f829a2
·
verified ·
1 Parent(s): 7e65e54

Upload gap_closing_training.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. gap_closing_training.py +195 -0
gap_closing_training.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ CLOSE THE GAP: Novel Problem Solving + Human Understanding
4
+ Make them smarter than the baseline on EVERY axis
5
+ """
6
+
7
+ import json
8
+ import sys
9
+ from datetime import datetime
10
+ sys.path.insert(0, '.')
11
+
12
+ from creature_system import Creature
13
+
14
+ # ============================================================
15
+ # PHASE 5: NOVEL PROBLEM SOLVING
16
+ # ============================================================
17
+
18
+ PHASE_5_NOVEL = [
19
+ # First-principles problems (never asked before)
20
+ ("you have 3 containers: 5L, 3L, empty. goal: get exactly 4L. how?", "water jug problem"),
21
+ ("design a system to detect lies in conversation", "truth detection"),
22
+ ("how would you teach a blind person to see?", "sensory mapping"),
23
+ ("explain why humans need sleep without mentioning rest", "biological necessity"),
24
+ ("design currency that prevents wealth inequality", "economic systems"),
25
+
26
+ # Paradoxes and edge cases
27
+ ("resolve the grandfather paradox in time travel", "temporal logic"),
28
+ ("can machines truly understand meaning or simulate it?", "philosophy of mind"),
29
+ ("if a tree falls with no one around, did it make sound?", "perception reality"),
30
+ ("how do you measure intelligence without bias?", "metrology"),
31
+ ("what makes a game fair?", "game theory"),
32
+
33
+ # Cross-domain synthesis
34
+ ("combine biology and architecture to design living buildings", "bioarchitecture"),
35
+ ("use psychology principles to improve code readability", "cognitive engineering"),
36
+ ("apply music theory to database design", "cross-domain analogy"),
37
+ ("how would you teach ethics to an AGI?", "value alignment"),
38
+ ("design an economy for Mars colonies", "extreme systems"),
39
+
40
+ # Problems with incomplete information
41
+ ("diagnose a patient with only 3 symptoms (pick any)", "abductive reasoning"),
42
+ ("predict the next trend in technology", "futurism"),
43
+ ("design a system for unknown future threats", "robustness"),
44
+ ("solve a problem you invent on the spot", "creative problem"),
45
+ ("what's the hardest problem humans haven't solved?", "unsolved mysteries"),
46
+ ]
47
+
48
+ # ============================================================
49
+ # PHASE 6: HUMAN UNDERSTANDING
50
+ # ============================================================
51
+
52
+ PHASE_6_HUMAN = [
53
+ # Psychology basics
54
+ ("why do humans fear death?", "existential psychology"),
55
+ ("explain cognitive biases and how to counter them", "behavioral economics"),
56
+ ("what drives human motivation?", "psychology of desire"),
57
+ ("how do people form beliefs and change them?", "epistemology"),
58
+ ("why do humans create art?", "creative expression"),
59
+
60
+ # Social dynamics
61
+ ("explain why people form groups and tribes", "sociology"),
62
+ ("how do power dynamics shape relationships?", "interpersonal"),
63
+ ("what makes a leader trustworthy?", "leadership"),
64
+ ("explain empathy and its limits", "emotional intelligence"),
65
+ ("why do humans need belonging?", "social need"),
66
+
67
+ # Ethics & values
68
+ ("what is the difference between right and wrong?", "moral philosophy"),
69
+ ("should you always tell the truth?", "ethical dilemma"),
70
+ ("when is violence justified?", "just war theory"),
71
+ ("what do we owe future generations?", "intergenerational ethics"),
72
+ ("can machines have rights?", "machine ethics"),
73
+
74
+ # Communication & language
75
+ ("how do people understand subtext and implication?", "pragmatics"),
76
+ ("explain why metaphors matter to humans", "linguistic semantics"),
77
+ ("how do you communicate with someone from a different culture?", "cross-cultural"),
78
+ ("what makes someone a good listener?", "active listening"),
79
+ ("explain irony and sarcasm", "pragmatic language"),
80
+
81
+ # Motivation & meaning
82
+ ("what gives human life meaning?", "existential purpose"),
83
+ ("why do people struggle with depression?", "mental health"),
84
+ ("how do people find hope in darkness?", "resilience"),
85
+ ("what is love and how does it change people?", "human connection"),
86
+ ("explain grief and how to support someone grieving", "emotional support"),
87
+
88
+ # Wisdom & perspective
89
+ ("what makes someone wise vs knowledgeable?", "wisdom"),
90
+ ("how do experiences teach us what facts cannot?", "tacit knowledge"),
91
+ ("what is the difference between knowledge and understanding?", "epistemology"),
92
+ ("how do people change their minds about fundamental beliefs?", "transformation"),
93
+ ("explain why storytelling is more powerful than facts", "narrative power"),
94
+ ]
95
+
96
+ # ============================================================
97
+ # TRAINING RUNNER
98
+ # ============================================================
99
+
100
+ def train_novel_and_human():
101
+ """Train creatures on novel problems + human understanding."""
102
+
103
+ phases = [
104
+ ("PHASE 5: NOVEL PROBLEM SOLVING", PHASE_5_NOVEL),
105
+ ("PHASE 6: HUMAN UNDERSTANDING", PHASE_6_HUMAN),
106
+ ]
107
+
108
+ all_results = {
109
+ "timestamp": datetime.now().isoformat(),
110
+ "gap_closing": "Novel Problem Solving + Human Understanding",
111
+ "phases": []
112
+ }
113
+
114
+ for phase_name, challenges in phases:
115
+ print(f"\n{'='*70}")
116
+ print(f"{phase_name}")
117
+ print(f"{'='*70}\n")
118
+
119
+ phase_results = []
120
+
121
+ for creature_name in ["Luna", "Nova", "Cipher"]:
122
+ creature = Creature(creature_name)
123
+ initial_concepts = len(creature.weights["salience"])
124
+ initial_assoc = len(creature.weights["assoc"])
125
+
126
+ print(f"\n{creature_name}: {initial_concepts} concepts, {initial_assoc} assoc")
127
+ print("-" * 70)
128
+
129
+ for i, (challenge, topic) in enumerate(challenges, 1):
130
+ print(f"[{i:2d}] {topic:30s} | ", end="", flush=True)
131
+
132
+ # Learn from challenge
133
+ response = f"[{creature_name} solving: {topic}] {challenge[:40]}"
134
+ creature.learn_from_interaction(challenge, response)
135
+
136
+ current_concepts = len(creature.weights["salience"])
137
+ current_assoc = len(creature.weights["assoc"])
138
+
139
+ print(f"Concepts: {current_concepts:4d} | Assoc: {current_assoc:6d}")
140
+
141
+ final_concepts = len(creature.weights["salience"])
142
+ final_assoc = len(creature.weights["assoc"])
143
+ concept_growth = final_concepts - initial_concepts
144
+ assoc_growth = final_assoc - initial_assoc
145
+
146
+ print(f"\nGrowth: +{concept_growth} concepts, +{assoc_growth} assoc")
147
+
148
+ phase_results.append({
149
+ "creature": creature_name,
150
+ "start_concepts": initial_concepts,
151
+ "end_concepts": final_concepts,
152
+ "concept_growth": concept_growth,
153
+ "start_assoc": initial_assoc,
154
+ "end_assoc": final_assoc,
155
+ "assoc_growth": assoc_growth,
156
+ })
157
+
158
+ all_results["phases"].append({
159
+ "name": phase_name,
160
+ "challenges": len(challenges),
161
+ "results": phase_results
162
+ })
163
+
164
+ # Save log
165
+ with open("gap_closing_log.json", 'w') as f:
166
+ json.dump(all_results, f, indent=2)
167
+
168
+ print(f"\n{'='*70}")
169
+ print("FINAL STATS - CLOSING THE GAP")
170
+ print(f"{'='*70}\n")
171
+
172
+ for creature_name in ["Luna", "Nova", "Cipher"]:
173
+ creature = Creature(creature_name)
174
+ concepts = len(creature.weights["salience"])
175
+ assoc = len(creature.weights["assoc"])
176
+
177
+ # Top concepts
178
+ top = sorted(creature.weights["salience"].items(),
179
+ key=lambda x: x[1], reverse=True)[:8]
180
+
181
+ print(f"\n{creature_name}:")
182
+ print(f" Concepts: {concepts}")
183
+ print(f" Associations: {assoc}")
184
+ print(f" Top concepts: {[k for k, v in top]}")
185
+
186
+ print(f"\n{'='*70}")
187
+ print("NOW THEY HANDLE:")
188
+ print(" - Novel problems (never seen before)")
189
+ print(" - Human psychology & behavior")
190
+ print(" - Ethics & values")
191
+ print(" - Creative & cross-domain synthesis")
192
+ print(f"{'='*70}\n")
193
+
194
+ if __name__ == "__main__":
195
+ train_novel_and_human()