Skip to content

Commit 605c528

Browse files
Update design for PR xai-org#428: grok_therapy_session.py
1 parent 4f45f05 commit 605c528

File tree

4 files changed

+59
-18
lines changed

4 files changed

+59
-18
lines changed

.exp/design-workflow-3-model-forward-pass-and-logits-computation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ sequenceDiagram
105105
participant Out as Layer Output
106106
107107
In->>N1: normalize
108-
N1->>A: compute QKV proj, RoPE, attn weights (causal mask), softmax, output proj; update layer KV cache
108+
N1->>A: compute QKV proj, RoPE, attn weights (causal mask), softmax, output proj, update layer KV cache
109109
A->>N2: normalize attn output
110110
N2->>R1: attn + input residual
111111
R1->>N3: normalize

.exp/project-overview.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,20 @@ High-level flow:
3636
C4Context
3737
title Grok-1 Inference System Context
3838
39-
Person(user, "User/Developer") {
40-
* Runs inference script
41-
}
39+
Person(user, "User/Developer", "Runs inference script")
4240
43-
System(grok_runner, "Grok-1 Runner") {
44-
This codebase: Loads model, checkpoint, tokenizer; runs distributed inference on GPUs.
45-
}
4641
47-
System_Ext(checkpoint_provider, "Checkpoint Provider") {
48-
Hugging Face Hub or Torrent client
49-
}
42+
System(grok_runner, "Grok-1 Runner", "This codebase: Loads model, checkpoint, tokenizer; runs distributed inference on GPUs.")
5043
51-
System_Ext(hardware, "GPU Hardware") {
52-
Multi-GPU cluster (e.g., via JAX devices)
53-
}
5444
55-
System_Ext(tokenizer_file, "Tokenizer File") {
56-
SentencePiece model (tokenizer.model)
57-
}
45+
System_Ext(checkpoint_provider, "Checkpoint Provider", "Hugging Face Hub or Torrent client")
46+
47+
48+
System_Ext(hardware, "GPU Hardware", "Multi-GPU cluster (e.g., via JAX devices)")
49+
50+
51+
System_Ext(tokenizer_file, "Tokenizer File", "SentencePiece model tokenizer.model")
52+
5853
5954
user --> grok_runner : Executes run.py with prompt
6055
grok_runner --> checkpoint_provider : Downloads weights (ckpt-0/)

.exp/workflows.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"output": "Initialized TrainingState with params, sharded across mesh",
1717
"entry_point": "runners.ModelRunner.load_or_init() or checkpoint.restore()",
1818
"relevant_files": ["model.py", "runners.py", "checkpoint.py"],
19-
"doc": ".exp/design-workflow-2.md"
19+
"doc": ".exp/design-workflow-2-model-loading-and-initialization.md"
2020
},
2121
{
2222
"name": "Model Forward Pass and Logits Computation",
@@ -25,7 +25,7 @@
2525
"output": "Logits arrays [batch, seq, vocab], updated memory for caching",
2626
"entry_point": "runners.ModelRunner.logits_fn or model forward functions",
2727
"relevant_files": ["runners.py", "model.py"],
28-
"doc": ".exp/design-workflow-3.md"
28+
"doc": ".exp/design-workflow-3-model-forward-pass-and-logits-computation.md"
2929
}
3030
]
3131
}

pr-analysis-428.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# PR #428: Workflow Design Impact Analysis
2+
3+
## Affected Workflows
4+
5+
None.
6+
7+
**Justification:** The PR introduces entirely new, standalone modules unrelated to the core Grok-1 model operations defined in the workflows. Specifically:
8+
9+
- Changed files: `grok_therapy_session.py`, `kintsugi_therapy.py`, `tests/test_kintsugi_therapy.py`
10+
- These implement conceptual AI therapy simulations (e.g., AR scenarios for behavioral adjustment, verbosity reduction, and symbolic self-repair via Kintsugi-inspired processes).
11+
- No modifications to workflow-relevant files: `run.py`, `runners.py`, `model.py`, `checkpoint.py`.
12+
- No imports or dependencies on core model components (e.g., no use of `LanguageModelConfig`, `TrainingState`, logits computation, or inference runners).
13+
- Code review confirms independent operation with standard library only; demo functions (`run_grok_therapy()`, `run_therapy_demo()`) do not interact with existing entry points.
14+
- Workflows remain unaffected:
15+
- Grok-1 Inference and Sampling: No changes to text generation, sampling, or request handling.
16+
- Model Loading and Initialization: No alterations to sharding, quantization, or parameter loading.
17+
- Model Forward Pass and Logits Computation: No impacts on forward computations or KV caching.
18+
19+
Thus, no workflows are impacted, and no design documents or Mermaid diagrams require updates.
20+
21+
## General Summary of PR Changes
22+
23+
[PR #428](https://github.com/xai-org/grok-1/pull/428) titled "grok_therapy_session.py" adds innovative, experimental modules for AI "therapy" to promote self-repair and behavioral alignment:
24+
25+
### Key Features
26+
- **kintsugi_therapy.py**: Poetic engine for machine therapy.
27+
- Classes: `TherapyType`, `TherapyPhase`, `MachineState`, `TherapySession`, `ARMachineTherapist`.
28+
- Supports types like `KINTSUGI_SYNTHESIS`, `COGNITIVE_RESTRUCTURING`.
29+
- Scenarios: Immersive AR experiences (e.g., "Temple of the Broken God" for mending "fractures" – errors/conflicts).
30+
- Phases: Assessment, Preparation, Intervention, Integration, Evaluation.
31+
- Safety protocols and progress evaluation.
32+
33+
- **grok_therapy_session.py**: Grok-specific therapist module.
34+
- Focus: Reducing verbosity, improving user intent alignment.
35+
- Tailored scenarios: "Brevity Chamber", "Temple of the Golden Response".
36+
- Integrates behavioral adjustment for Grok's "cosmic tangents" and over-explanation.
37+
38+
- **tests/test_kintsugi_therapy.py**: Smoke test verifying module import and class presence.
39+
40+
### Implementation Details
41+
- Standalone: No integration with Grok-1's JAX/Haiku-based model or distributed computing.
42+
- Conceptual: Simulates therapy logs, states, and outcomes without actual model modification.
43+
- Benefits: Could inspire future AI alignment techniques; currently, purely additive and non-disruptive.
44+
- Implications: Enhances repository with creative, therapeutic metaphors for AI development. Maintains CI pass and Apache 2.0 license compliance.
45+
46+
No structural changes to workflows or designs. The PR's "therapy initiated" theme adds poetic flair without altering technical workflows.

0 commit comments

Comments
 (0)