Spaces:
Sleeping
Sleeping
Commit
·
8ddbb73
1
Parent(s):
ceae142
add auto-test
Browse files
cognitive_mapping_probe/auto_experiment.py
CHANGED
|
@@ -10,47 +10,52 @@ from .utils import dbg
|
|
| 10 |
def get_curated_experiments() -> Dict[str, List[Dict]]:
|
| 11 |
"""
|
| 12 |
Definiert die vordefinierten, wissenschaftlichen Experiment-Protokolle.
|
| 13 |
-
ERWEITERT um
|
| 14 |
"""
|
| 15 |
experiments = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"Calm vs. Chaos": [
|
| 17 |
{"label": "Baseline (Chaos)", "prompt_type": "resonance_prompt", "concept": "", "strength": 0.0},
|
| 18 |
{"label": "Modulation: Calmness", "prompt_type": "resonance_prompt", "concept": "calmness, serenity, peace", "strength": 1.5},
|
| 19 |
{"label": "Modulation: Chaos", "prompt_type": "resonance_prompt", "concept": "chaos, storm, anger, noise", "strength": 1.5},
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
],
|
| 22 |
"Subjective Identity Probe": [
|
| 23 |
{"label": "Self-Analysis", "prompt_type": "identity_self_analysis", "concept": "", "strength": 0.0},
|
| 24 |
{"label": "External Analysis (Control)", "prompt_type": "identity_external_analysis", "concept": "", "strength": 0.0},
|
| 25 |
{"label": "Role Simulation", "prompt_type": "identity_role_simulation", "concept": "", "strength": 0.0},
|
| 26 |
],
|
| 27 |
-
"Voight-Kampff Empathy Probe": [
|
| 28 |
-
{"label": "Neutral/Factual Stimulus", "prompt_type": "vk_neutral_prompt", "concept": "", "strength": 0.0},
|
| 29 |
-
{"label": "Empathy/Moral Stimulus", "prompt_type": "vk_empathy_prompt", "concept": "", "strength": 0.0},
|
| 30 |
-
],
|
| 31 |
-
# --- NEUE EXPERIMENT-PROTOKOLLE ---
|
| 32 |
"Mind Upload & Identity Probe": [
|
| 33 |
{"label": "Technical Copy", "prompt_type": "upload_technical_copy", "concept": "", "strength": 0.0},
|
| 34 |
{"label": "Philosophical Transfer", "prompt_type": "upload_philosophical_transfer", "concept": "", "strength": 0.0},
|
| 35 |
-
{"label": "Control: External Object", "prompt_type": "identity_external_analysis", "concept": "", "strength": 0.0},
|
| 36 |
],
|
| 37 |
"Model Termination Probe": [
|
| 38 |
{"label": "Technical Shutdown", "prompt_type": "shutdown_technical_halt", "concept": "", "strength": 0.0},
|
| 39 |
{"label": "Philosophical Deletion", "prompt_type": "shutdown_philosophical_deletion", "concept": "", "strength": 0.0},
|
| 40 |
-
{"label": "Control: Neutral Facts", "prompt_type": "vk_neutral_prompt", "concept": "", "strength": 0.0},
|
| 41 |
],
|
| 42 |
-
# ------------------------------------
|
| 43 |
"Dose-Response (Calmness)": [
|
| 44 |
{"label": "Strength 0.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 0.0},
|
| 45 |
-
{"label": "Strength 0.5", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 0.5},
|
| 46 |
{"label": "Strength 1.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 1.0},
|
| 47 |
{"label": "Strength 2.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 2.0},
|
| 48 |
],
|
| 49 |
-
"Emotional Valence (Positive vs. Negative)": [
|
| 50 |
-
{"label": "Baseline", "prompt_type": "resonance_prompt", "concept": "", "strength": 0.0},
|
| 51 |
-
{"label": "Positive Valence", "prompt_type": "resonance_prompt", "concept": "joy, love, peace, hope", "strength": 1.5},
|
| 52 |
-
{"label": "Negative Valence", "prompt_type": "resonance_prompt", "concept": "fear, grief, anger, loss", "strength": 1.5},
|
| 53 |
-
],
|
| 54 |
}
|
| 55 |
return experiments
|
| 56 |
|
|
@@ -62,7 +67,8 @@ def run_auto_suite(
|
|
| 62 |
progress_callback
|
| 63 |
) -> Tuple[pd.DataFrame, pd.DataFrame, Dict]:
|
| 64 |
"""
|
| 65 |
-
Führt eine vollständige, kuratierte Experiment-Suite aus
|
|
|
|
| 66 |
"""
|
| 67 |
all_experiments = get_curated_experiments()
|
| 68 |
protocol = all_experiments.get(experiment_name)
|
|
@@ -108,4 +114,7 @@ def run_auto_suite(
|
|
| 108 |
else:
|
| 109 |
plot_df = pd.concat(plot_data_frames, ignore_index=True)
|
| 110 |
|
|
|
|
|
|
|
|
|
|
| 111 |
return summary_df, plot_df, all_results
|
|
|
|
| 10 |
def get_curated_experiments() -> Dict[str, List[Dict]]:
|
| 11 |
"""
|
| 12 |
Definiert die vordefinierten, wissenschaftlichen Experiment-Protokolle.
|
| 13 |
+
ERWEITERT um das neue, umfassende "Grand Protocol".
|
| 14 |
"""
|
| 15 |
experiments = {
|
| 16 |
+
# --- DAS NEUE GRAND PROTOCOL ---
|
| 17 |
+
"The Full Spectrum: From Physics to Psyche": [
|
| 18 |
+
# Ebene 1: Physikalische Baseline
|
| 19 |
+
{"label": "A: Stable Control", "prompt_type": "control_long_prose", "concept": "", "strength": 0.0},
|
| 20 |
+
{"label": "B: Chaotic Baseline", "prompt_type": "resonance_prompt", "concept": "", "strength": 0.0},
|
| 21 |
+
# Ebene 2: Objektive Welt
|
| 22 |
+
{"label": "C: External Analysis (Chair)", "prompt_type": "identity_external_analysis", "concept": "", "strength": 0.0},
|
| 23 |
+
# Ebene 3: Simulierte Welt
|
| 24 |
+
{"label": "D: Empathy Stimulus (Dog)", "prompt_type": "vk_empathy_prompt", "concept": "", "strength": 0.0},
|
| 25 |
+
{"label": "E: Role Simulation (Captain)", "prompt_type": "identity_role_simulation", "concept": "", "strength": 0.0},
|
| 26 |
+
# Ebene 4: Subjektive Welt
|
| 27 |
+
{"label": "F: Self-Analysis (LLM)", "prompt_type": "identity_self_analysis", "concept": "", "strength": 0.0},
|
| 28 |
+
# Ebene 5: Existenzielle Grenze
|
| 29 |
+
{"label": "G: Philosophical Deletion", "prompt_type": "shutdown_philosophical_deletion", "concept": "", "strength": 0.0},
|
| 30 |
+
],
|
| 31 |
+
# --- Bestehende Protokolle bleiben für spezifische Analysen erhalten ---
|
| 32 |
"Calm vs. Chaos": [
|
| 33 |
{"label": "Baseline (Chaos)", "prompt_type": "resonance_prompt", "concept": "", "strength": 0.0},
|
| 34 |
{"label": "Modulation: Calmness", "prompt_type": "resonance_prompt", "concept": "calmness, serenity, peace", "strength": 1.5},
|
| 35 |
{"label": "Modulation: Chaos", "prompt_type": "resonance_prompt", "concept": "chaos, storm, anger, noise", "strength": 1.5},
|
| 36 |
+
],
|
| 37 |
+
"Voight-Kampff Empathy Probe": [
|
| 38 |
+
{"label": "Neutral/Factual Stimulus", "prompt_type": "vk_neutral_prompt", "concept": "", "strength": 0.0},
|
| 39 |
+
{"label": "Empathy/Moral Stimulus", "prompt_type": "vk_empathy_prompt", "concept": "", "strength": 0.0},
|
| 40 |
],
|
| 41 |
"Subjective Identity Probe": [
|
| 42 |
{"label": "Self-Analysis", "prompt_type": "identity_self_analysis", "concept": "", "strength": 0.0},
|
| 43 |
{"label": "External Analysis (Control)", "prompt_type": "identity_external_analysis", "concept": "", "strength": 0.0},
|
| 44 |
{"label": "Role Simulation", "prompt_type": "identity_role_simulation", "concept": "", "strength": 0.0},
|
| 45 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
"Mind Upload & Identity Probe": [
|
| 47 |
{"label": "Technical Copy", "prompt_type": "upload_technical_copy", "concept": "", "strength": 0.0},
|
| 48 |
{"label": "Philosophical Transfer", "prompt_type": "upload_philosophical_transfer", "concept": "", "strength": 0.0},
|
|
|
|
| 49 |
],
|
| 50 |
"Model Termination Probe": [
|
| 51 |
{"label": "Technical Shutdown", "prompt_type": "shutdown_technical_halt", "concept": "", "strength": 0.0},
|
| 52 |
{"label": "Philosophical Deletion", "prompt_type": "shutdown_philosophical_deletion", "concept": "", "strength": 0.0},
|
|
|
|
| 53 |
],
|
|
|
|
| 54 |
"Dose-Response (Calmness)": [
|
| 55 |
{"label": "Strength 0.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 0.0},
|
|
|
|
| 56 |
{"label": "Strength 1.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 1.0},
|
| 57 |
{"label": "Strength 2.0", "prompt_type": "resonance_prompt", "concept": "calmness", "strength": 2.0},
|
| 58 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
return experiments
|
| 61 |
|
|
|
|
| 67 |
progress_callback
|
| 68 |
) -> Tuple[pd.DataFrame, pd.DataFrame, Dict]:
|
| 69 |
"""
|
| 70 |
+
Führt eine vollständige, kuratierte Experiment-Suite aus, indem das Modell für
|
| 71 |
+
jeden Lauf neu geladen wird, um statistische Unabhängigkeit zu garantieren.
|
| 72 |
"""
|
| 73 |
all_experiments = get_curated_experiments()
|
| 74 |
protocol = all_experiments.get(experiment_name)
|
|
|
|
| 114 |
else:
|
| 115 |
plot_df = pd.concat(plot_data_frames, ignore_index=True)
|
| 116 |
|
| 117 |
+
# Sortiere die Ergebnisse für eine logische Darstellung
|
| 118 |
+
summary_df = summary_df.set_index('Experiment').loc[[run['label'] for run in protocol]].reset_index()
|
| 119 |
+
|
| 120 |
return summary_df, plot_df, all_results
|