Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,15 +70,34 @@ def analyze_world_model(model_name, dataset_key, num_samples=25):
|
|
| 70 |
context_payload = "\n".join([f"- {s}" for s in snippets[:4]])
|
| 71 |
|
| 72 |
# Proper prompt engineering to decode the 'Equivalence Class'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
prompt = f"""
|
| 74 |
-
|
| 75 |
-
Identify the CORE structural or semantic theme (e.g., 'Historical Narrative', 'Technical Development', 'Numerical Lists').
|
| 76 |
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
{context_payload}
|
| 79 |
|
| 80 |
-
|
| 81 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
"""
|
| 83 |
|
| 84 |
try:
|
|
|
|
| 70 |
context_payload = "\n".join([f"- {s}" for s in snippets[:4]])
|
| 71 |
|
| 72 |
# Proper prompt engineering to decode the 'Equivalence Class'
|
| 73 |
+
# prompt = f"""
|
| 74 |
+
# Analyze these text snippets from the '{dataset_key}' dataset that fall into the same latent state cluster.
|
| 75 |
+
# Identify the CORE structural or semantic theme (e.g., 'Historical Narrative', 'Technical Development', 'Numerical Lists').
|
| 76 |
+
|
| 77 |
+
# Text Snippets:
|
| 78 |
+
# {context_payload}
|
| 79 |
+
|
| 80 |
+
# Format your response exactly as:
|
| 81 |
+
# **State S{cluster_id} [Label]**: [One sentence explanation of the shared logic/context].
|
| 82 |
+
# """
|
| 83 |
prompt = f"""
|
| 84 |
+
Act as a Mechanistic Interpretability Researcher. You are analyzing latent cluster S{cluster_id} from the '{dataset_key}' dataset.
|
|
|
|
| 85 |
|
| 86 |
+
The model has clustered these specific snippets because they represent a 'Coherent World State'—an internal map it uses to navigate the data.
|
| 87 |
+
|
| 88 |
+
### DATASET SNIPPETS:
|
| 89 |
{context_payload}
|
| 90 |
|
| 91 |
+
### YOUR TASK:
|
| 92 |
+
1. **Newtonian Logic**: Identify the underlying 'Law' or 'Invariant' here. Why does the model treat these as functionally identical? (e.g., 'The model has a dedicated state for tracking chronological advancement').
|
| 93 |
+
2. **Dataset Attributes**: Pinpoint the specific text features (keywords, syntax, or formatting) that act as 'Sensors' to trigger this state.
|
| 94 |
+
3. **Functional Role**: Explain how this state helps the model predict the next token. (e.g., 'Being in this state restricts the search space to numerical dates or phase-related verbs').
|
| 95 |
+
|
| 96 |
+
### RESPONSE FORMAT (Markdown):
|
| 97 |
+
**State S{cluster_id} [Structural Label]**
|
| 98 |
+
- **Internal World Model**: [Explanation of the logic]
|
| 99 |
+
- **Dataset Sensor**: [Key attributes found in the text]
|
| 100 |
+
- **Predictive Function**: [How it aids next-token prediction]
|
| 101 |
"""
|
| 102 |
|
| 103 |
try:
|