ravana-ml 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ravana_ml-0.1.0/PKG-INFO +472 -0
- ravana_ml-0.1.0/README.md +463 -0
- ravana_ml-0.1.0/pyproject.toml +17 -0
- ravana_ml-0.1.0/ravana_ml.egg-info/PKG-INFO +472 -0
- ravana_ml-0.1.0/ravana_ml.egg-info/SOURCES.txt +7 -0
- ravana_ml-0.1.0/ravana_ml.egg-info/dependency_links.txt +1 -0
- ravana_ml-0.1.0/ravana_ml.egg-info/requires.txt +1 -0
- ravana_ml-0.1.0/ravana_ml.egg-info/top_level.txt +1 -0
- ravana_ml-0.1.0/setup.cfg +4 -0
ravana_ml-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ravana-ml
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RAVANA ML Framework -- tensors, modules, ConceptGraph, RLMv1/RLMv2, plasticity, free energy
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy>=1.20
|
|
9
|
+
|
|
10
|
+
# RAVANA — Recursive Learning Model
|
|
11
|
+
|
|
12
|
+
> **A pressure-driven cognitive ML framework where learning emerges from self-organization, not gradient descent.**
|
|
13
|
+
|
|
14
|
+
[](https://python.org)
|
|
15
|
+
[](https://numpy.org)
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
[]()
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What Is RAVANA?
|
|
22
|
+
|
|
23
|
+
RAVANA is a **cognitive architecture research project** proposing *pressure-driven self-organization* as an alternative to gradient descent for machine learning. Instead of minimizing loss functions via backpropagation, RAVANA learns through **cognitive dissonance minimization**: prediction errors create internal pressure (free energy), and the system self-organizes to reduce that pressure.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Traditional ML: Loss(θ) = f(prediction, target) → ∇Loss → θ ← θ - η∇Loss
|
|
27
|
+
RAVANA: Prediction Error → Free Energy (Pressure) → Hebbian Plasticity + Sleep → Equilibrium
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Core Philosophy
|
|
31
|
+
|
|
32
|
+
| Traditional ML | RAVANA |
|
|
33
|
+
|----------------|--------|
|
|
34
|
+
| **Loss functions** → gradients | **Free energy** (pressure) → self-organization |
|
|
35
|
+
| **Backpropagation** | **Hebbian/anti-Hebbian plasticity** + structural plasticity |
|
|
36
|
+
| **Weight decay, regularization** | **Identity** + homeostatic sleep consolidation |
|
|
37
|
+
| **Batch/layer normalization** | **SWS + REM sleep cycles** with dream sabotage |
|
|
38
|
+
| **Dense weight matrices** | **ConceptGraph** (typed edges, inhibition, hierarchy) |
|
|
39
|
+
| **Global attention** | **Spreading activation** (local, bounded, typed) |
|
|
40
|
+
| **Static weights / RAG** | **Episodic → Semantic → Graph bridge** |
|
|
41
|
+
| **External reward functions** | **Intrinsic motivation** (Meaning = f(-Dissonance, Identity, Prediction)) |
|
|
42
|
+
| **No emotion/identity** | **VAD emotion engine** + momentum-based identity |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Two Architectures, One Codebase
|
|
47
|
+
|
|
48
|
+
RAVANA now contains **two complementary cognitive architectures**:
|
|
49
|
+
|
|
50
|
+
### 1. **RAVANA v2** — GRACE Cognitive Core (`ravana-v2/`)
|
|
51
|
+
The original GRACE (General Recursive Adaptive Cognitive Engine) with 27 phases (A–P) implementing:
|
|
52
|
+
- **Governor regulation** (Phases A–C) — Hard constraints, predictive dampening, center-seeking homeostasis
|
|
53
|
+
- **Strategy & Intent** (Phases D–J) — 4 strategy modes, planning, hypotheses, Occam layer
|
|
54
|
+
- **World Model & Epistemology** (Phases F–G.5) — Belief reasoning, active probes, VoI-driven action
|
|
55
|
+
- **Emotion & Sleep** (Phases K–L.5) — VAD emotion, empathy, 4-stage sleep, dual-process
|
|
56
|
+
- **Meaning & Consciousness** (Phases M–N) — Intrinsic motivation, global workspace
|
|
57
|
+
- **Human Memory & Dialogue** (Phases O–P) — Episodic/semantic persistence, conversational repair
|
|
58
|
+
|
|
59
|
+
### 2. **RAVANA Modular** — Decoder-First Chat (`ravana/`) **NEW**
|
|
60
|
+
A streamlined, package-oriented architecture focused on **continuous web learning** and **decoder-first generation**:
|
|
61
|
+
- **CognitiveCore** (`ravana/core/`) — VAD emotion, Identity, Meaning, Dual-process, Global Workspace, Meta-cognition, Sleep, **Multi-user BeliefStore**
|
|
62
|
+
- **GraphEngine** (`ravana/graph/`) — Concept graph, spreading activation, hippocampal indexing, curiosity scoring
|
|
63
|
+
- **DecoderEngine** (`ravana/decoder/`) — Neural decoder, vocab building, seed corpus + web article training
|
|
64
|
+
- **WebLearner** (`ravana/web/`) — Multi-API search (circuit breaker), background learning, curiosity-driven exploration (Phase 18)
|
|
65
|
+
- **BootstrapManager** (`ravana/bootstrap/`) — Consolidated concept seeding (3 methods unified)
|
|
66
|
+
- **RLMv2 Decomposed** (`ravana/nn/rlm/`) — RelationPredictor, PropagationEngine, Plasticity
|
|
67
|
+
- **ChatInterface** (`ravana/chat/`) — CLI, response pipeline, reasoning loop
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Key Innovations (Shared)
|
|
72
|
+
|
|
73
|
+
### 🧠 Pressure-Driven Learning
|
|
74
|
+
No loss functions, no gradients, no backpropagation. Learning driven by **5-channel free energy accumulator** tracking semantic, linguistic, episodic, contradiction, and abstraction prediction errors.
|
|
75
|
+
|
|
76
|
+
### 🕸️ ConceptGraph with Typed Edges
|
|
77
|
+
Heterogeneous graph of concept nodes with **active/core/genesis vectors** connected by typed relation edges (semantic, causal, temporal, analogical, contextual, inferred, inhibitory). Each edge carries weight, confidence, relation vector, predicate token, EWC importance, and Bayesian posterior.
|
|
78
|
+
|
|
79
|
+
### 💤 Sleep Consolidation (SWS + REM)
|
|
80
|
+
Two-phase sleep modeled on mammalian sleep:
|
|
81
|
+
- **SWS**: Structural stabilization, adaptive homeostatic downscale, hierarchical abstraction compression, inhibitory edge formation, hippocampal replay
|
|
82
|
+
- **REM**: Creative recombination via 20% counterfactual reversals, 10% emotional valence flipping, 1.5× failure oversampling
|
|
83
|
+
|
|
84
|
+
### 🔄 Sleep-Time Interleaved Replay
|
|
85
|
+
Domain-tagged experiences buffered during training, replayed during SWS+REM. **Eliminates catastrophic forgetting entirely** (12% → 0% retention drop) in lifelong streaming benchmarks.
|
|
86
|
+
|
|
87
|
+
### 🏛️ GRACE Governor (v2 only)
|
|
88
|
+
Closed-loop regulation with four layers: hard constraints (non-negotiable), predictive dampening (look-ahead), boundary pressure (air resistance), center-seeking homeostasis. **Fully observable** with clamp diagnostics.
|
|
89
|
+
|
|
90
|
+
### 🎭 VAD Emotion Engine
|
|
91
|
+
3D affective state (Valence, Arousal, Dominance) via differential equations. Modulates inference: high arousal → exploration, positive valence → trust predictions, high dominance → stronger concepts.
|
|
92
|
+
|
|
93
|
+
### 🧩 RLMv2 — Triple Decomposition Architecture
|
|
94
|
+
Brain-inspired: decomposes input into **(subject, relation_type, object)** triples. Enables vector arithmetic analogy: `subject_embed + offset(verb) ≈ target_embed`. **Spreading activation is the sole inference mechanism**.
|
|
95
|
+
|
|
96
|
+
### 📖 GloVe Semantic Embeddings
|
|
97
|
+
Token embeddings initialized from pre-trained GloVe (100D) projected via QR-based orthogonal projection. Replaces character n-gram embeddings for genuine semantic relationships.
|
|
98
|
+
|
|
99
|
+
### 🎯 Verb-Stem Offset Predictor
|
|
100
|
+
New inference path: `offset(verb) = avg(target - subject)` over training pairs. Each verb gets its own offset. **RP-only cross-domain top-10: 3.3% → 6.7%**.
|
|
101
|
+
|
|
102
|
+
### 🌐 Continuous Web Learning (Modular only)
|
|
103
|
+
`WebLearner` fetches → extracts → trains decoder online. Knowledge grows **without retraining from scratch**. Curiosity-driven (free energy + contradiction + novelty + serendipity).
|
|
104
|
+
|
|
105
|
+
### 👥 Multi-User Belief Merging (Modular only)
|
|
106
|
+
`BeliefStore` tracks *who believes what*, detects contradictions, merges across users — `cross_reference_users()`, `find_agreement()`, `find_disagreement()`.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Quick Start
|
|
111
|
+
|
|
112
|
+
### Installation
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Primary (Codeberg)
|
|
116
|
+
git clone https://codeberg.org/oxiverse/ravana.git
|
|
117
|
+
# Mirror (GitHub)
|
|
118
|
+
git clone https://github.com/oxiverse-ecosystem/ravana.git
|
|
119
|
+
cd ravana
|
|
120
|
+
pip install -e ravana/ # NumPy only (modular package)
|
|
121
|
+
pip install tiktoken # Optional: BPE tokenizer
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Modular Package — Decoder-First Chat (NEW)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Interactive chat with web learning
|
|
128
|
+
python -m ravana.chat
|
|
129
|
+
|
|
130
|
+
# Batch mode for testing
|
|
131
|
+
python -m ravana.chat --chat "hello|what is trust|explain oxiverse|bye" --strategy
|
|
132
|
+
|
|
133
|
+
# With ablation flags
|
|
134
|
+
python -m ravana.chat --chat "what causes rain" --no-vad --no-rlm --no-beliefs --no-curiosity
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Key flags:**
|
|
138
|
+
- `--no-vad` — Disable VAD emotion modulation
|
|
139
|
+
- `--no-rlm` — Disable RLMv2 triple verification
|
|
140
|
+
- `--no-beliefs` — Disable belief store
|
|
141
|
+
- `--no-curiosity` — Disable autonomous curiosity-driven learning
|
|
142
|
+
- `--mode` — `stochastic` | `deterministic` | `exploratory`
|
|
143
|
+
- `--trace` — Print chain traces
|
|
144
|
+
- `--data-dir` — Custom data directory
|
|
145
|
+
- `--user` — Multi-user isolation
|
|
146
|
+
|
|
147
|
+
### GRACE Cognitive Core (v2)
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from ravana_v2.cognitive import CognitiveFramework
|
|
151
|
+
|
|
152
|
+
fw = CognitiveFramework()
|
|
153
|
+
state = fw.initialize()
|
|
154
|
+
|
|
155
|
+
for episode, (inp_vec, tgt_vec) in enumerate(training_data):
|
|
156
|
+
concepts = fw.perceive(state, inp_vec)
|
|
157
|
+
predictions = fw.predict(state, concepts)
|
|
158
|
+
state = fw.learn(state, predictions, tgt_vec, episode)
|
|
159
|
+
if episode % 100 == 0:
|
|
160
|
+
state = fw.sleep(state)
|
|
161
|
+
|
|
162
|
+
result = fw.infer(state, test_vec) # Inference without state change
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### RLMv2 — Language Model (Shared)
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from ravana.nn import RLM
|
|
169
|
+
from ravana_ml.tokenizer import WordTokenizer
|
|
170
|
+
import numpy as np
|
|
171
|
+
|
|
172
|
+
tok = WordTokenizer()
|
|
173
|
+
tok.encode("heat causes expansion")
|
|
174
|
+
|
|
175
|
+
model = RLM(
|
|
176
|
+
vocab_size=tok.vocab_size,
|
|
177
|
+
embed_dim=64,
|
|
178
|
+
concept_dim=64,
|
|
179
|
+
n_concepts=100,
|
|
180
|
+
latent_dim=64, # Set equal to embed_dim for entity adapter compatibility
|
|
181
|
+
)
|
|
182
|
+
inp = np.array(tok.encode("heat causes"), dtype=np.int64)
|
|
183
|
+
tgt = np.array(tok.encode("expansion"), dtype=np.int64)
|
|
184
|
+
model.learn(inp, tgt)
|
|
185
|
+
model.sleep_cycle()
|
|
186
|
+
logits = model.forward(inp)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Note:** The `latent_dim` parameter controls the world model latent dimension. For the entity-specific adapter (enables test-time adaptation for held-out subjects) to work without additional projection overhead, set `latent_dim=embed_dim`. If they differ, the model automatically projects embeddings to latent space before applying the adapter.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Benchmarks (External)
|
|
194
|
+
|
|
195
|
+
All benchmarks are run via external benchmarking infrastructure. See [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md) for reproduction instructions and expected results.
|
|
196
|
+
|
|
197
|
+
### External Benchmark Harness (NEW)
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Quick run (PCX + Graph, ~2 min)
|
|
201
|
+
python external_benchmark.py --quick
|
|
202
|
+
|
|
203
|
+
# Full suite (PCX + Lifelong + Graph, ~10 min)
|
|
204
|
+
python external_benchmark.py
|
|
205
|
+
|
|
206
|
+
# Individual surfaces
|
|
207
|
+
python external_benchmark.py --quick --skip-lifelong # PCX + Graph
|
|
208
|
+
python external_benchmark.py --quick --skip-pcx # Lifelong + Graph
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Key external validation results:**
|
|
212
|
+
|
|
213
|
+
| Metric | Result |
|
|
214
|
+
|--------|--------|
|
|
215
|
+
| Cross-domain transfer Top-1 | **75.0%** |
|
|
216
|
+
| Cross-domain transfer Top-10 | **100%** |
|
|
217
|
+
| Held-out Science Top-1 / Top-10 | 8.3% / 25.0% (n=12) |
|
|
218
|
+
| Held-out Social Top-1 / Top-10 | 0.0% / 8.3% (n=36) |
|
|
219
|
+
| Graph Inference P95 / P99 | 2.7 ms / 2.9 ms |
|
|
220
|
+
| Graph Peak Memory / Throughput | 0.3 MB / 556 QPS |
|
|
221
|
+
| W_rel Causal / Semantic Alignment | 0.68 / 0.55 |
|
|
222
|
+
| Lifelong forgetting (permuted MNIST) | **0%** (with sleep) |
|
|
223
|
+
| Within-domain triple top-10 | 80.9% |
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Documentation
|
|
228
|
+
|
|
229
|
+
| Document | Description |
|
|
230
|
+
|----------|-------------|
|
|
231
|
+
| [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) | Complete architecture reference — GRACE, RLMv2, Phases A–P, GloVe, verb-stem offset |
|
|
232
|
+
| [`docs/GETTING_STARTED.md`](docs/GETTING_STARTED.md) | Quickstart tutorial — install to first model in 5 minutes |
|
|
233
|
+
| [`docs/ML_FRAMEWORK.md`](docs/ML_FRAMEWORK.md) | ravana_ml deep dive — tensors, modules, ConceptGraph, RLM v1/v2 |
|
|
234
|
+
| [`docs/COGNITIVE_CORE.md`](docs/COGNITIVE_CORE.md) | ravana-v2 reference — all 27 GRACE modules, configurations |
|
|
235
|
+
| [`docs/UNIFIED_PACKAGE.md`](docs/UNIFIED_PACKAGE.md) | ravana/ package — PyTorch API, CognitiveFramework, serialization |
|
|
236
|
+
| [`docs/API_REFERENCE.md`](docs/API_REFERENCE.md) | Complete function/class reference for all three layers |
|
|
237
|
+
| [`docs/CONCEPTS.md`](docs/CONCEPTS.md) | Theoretical foundations — pressure, free energy, Hebbian, sleep, VAD, triples |
|
|
238
|
+
| [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md) | Running experiments — cross-domain, Phase 4, RLMv2 benchmarks, cognitive phases, **modular ablations, per-triple eval** |
|
|
239
|
+
| [`docs/ADVANCED_TOPICS.md`](docs/ADVANCED_TOPICS.md) | Customization — tokenizers, plasticity, sleep, governor, multi-agent, lifelong |
|
|
240
|
+
| [`docs/TUTORIALS.md`](docs/TUTORIALS.md) | 8 step-by-step tutorials — Hello World to visualization |
|
|
241
|
+
| [`docs/DEVELOPER_GUIDE.md`](docs/DEVELOPER_GUIDE.md) | Contributing — code standards, testing, architecture principles, release process |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Running Tests
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Modular package tests (NEW)
|
|
249
|
+
python -m pytest tests/test_cognitive_rlm.py -v
|
|
250
|
+
python -m pytest tests/test_dialogue_system.py -v
|
|
251
|
+
python -m pytest tests/test_dialogue_engine_integration.py -v
|
|
252
|
+
python -m pytest tests/ -k "not slow" -v
|
|
253
|
+
|
|
254
|
+
# RLMv2 unit tests (shared)
|
|
255
|
+
python -m pytest tests/test_rlm_v2.py -v
|
|
256
|
+
python -m pytest tests/test_rp_only.py -v
|
|
257
|
+
python -m pytest tests/test_rp_contrastive.py -v
|
|
258
|
+
python -m pytest tests/test_structural_transfer.py -v
|
|
259
|
+
|
|
260
|
+
# GRACE cognitive core tests (v2)
|
|
261
|
+
python -m pytest ravana-v2/tests/ -v
|
|
262
|
+
|
|
263
|
+
# All tests
|
|
264
|
+
python -m pytest tests/ ravana-v2/tests/ -v
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Current status: 169 tests passing** (15 cognitive + 49 dialogue + 15 integration + ML framework tests)
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Running Experiments
|
|
272
|
+
|
|
273
|
+
### Modular Package Experiments (NEW)
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Ablation study — all config combinations
|
|
277
|
+
python scripts/run_ablation.py --queries "hello|what is trust|explain oxiverse|bye" --runs 3
|
|
278
|
+
python scripts/run_ablation.py --quick --modes # Baseline + single flag removals + mode variants
|
|
279
|
+
|
|
280
|
+
# Per-triple evaluation harness
|
|
281
|
+
python scripts/triple_eval.py --data-dir ./data --output triple_eval_report.json
|
|
282
|
+
python scripts/triple_eval.py --triples-file my_triples.json --output report.json
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### GRACE / ML Framework Experiments
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Cross-domain transfer
|
|
289
|
+
python experiments/experiment_cross_domain.py
|
|
290
|
+
|
|
291
|
+
# Phase 4 integrated (triplet margin + wake-sleep)
|
|
292
|
+
python experiments/experiment_phase4_integrated.py
|
|
293
|
+
|
|
294
|
+
# RLMv2 triple benchmark
|
|
295
|
+
python experiments/experiment_triple_benchmark_v6.py
|
|
296
|
+
|
|
297
|
+
# Diagnostic tests
|
|
298
|
+
python tests/test_rp_only.py
|
|
299
|
+
python tests/test_rp_contrastive.py
|
|
300
|
+
python tests/test_structural_transfer.py
|
|
301
|
+
|
|
302
|
+
# Cognitive architecture experiments
|
|
303
|
+
cd ravana-v2 && python experiments/runner.py
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Custom Experiments
|
|
307
|
+
|
|
308
|
+
See [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md#custom-experiments) for templates and configuration reference.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Project Structure
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
ravana/
|
|
316
|
+
├── README.md # This file
|
|
317
|
+
├── ravana/ # Unified pip-installable package (NEW)
|
|
318
|
+
│ ├── __init__.py # import ravana
|
|
319
|
+
│ ├── core/ # CognitiveCore
|
|
320
|
+
│ │ ├── emotion.py # VADEmotionEngine (VAD dynamics)
|
|
321
|
+
│ │ ├── identity.py # IdentityEngine (self-coherence)
|
|
322
|
+
│ │ ├── meaning.py # MeaningEngine (dissonance reduction)
|
|
323
|
+
│ │ ├── dual_process.py # DualProcessController (System 1/2)
|
|
324
|
+
│ │ ├── global_workspace.py # GlobalWorkspace (broadcast)
|
|
325
|
+
│ │ ├── meta_cognition.py # MetaCognition (bias detection)
|
|
326
|
+
│ │ ├── sleep.py # SleepConsolidation (hippocampal replay)
|
|
327
|
+
│ │ ├── belief_store.py # BeliefStore (multi-user merging)
|
|
328
|
+
│ │ └── __init__.py
|
|
329
|
+
│ ├── graph/ # GraphEngine
|
|
330
|
+
│ │ ├── engine.py # Concept graph, spreading activation, hippocampal indexing
|
|
331
|
+
│ │ └── __init__.py # + backward compat: ConceptGraph, ConceptNode, etc.
|
|
332
|
+
│ ├── decoder/ # DecoderEngine
|
|
333
|
+
│ │ ├── engine.py # Neural decoder, vocab, training, generation
|
|
334
|
+
│ │ └── __init__.py
|
|
335
|
+
│ ├── web/ # WebLearner
|
|
336
|
+
│ │ ├── learner.py # Multi-API search, background learning, curiosity
|
|
337
|
+
│ │ └── __init__.py
|
|
338
|
+
│ ├── bootstrap/ # BootstrapManager
|
|
339
|
+
│ │ ├── manager.py # Consolidated: auto_expand, seed_from_curiosity, bootstrap_domain
|
|
340
|
+
│ │ └── __init__.py
|
|
341
|
+
│ ├── nn/rlm/ # RLMv2 Decomposed
|
|
342
|
+
│ │ ├── relation_predictor.py # RelationPredictor (W_rel, verb-stem offset)
|
|
343
|
+
│ │ ├── propagation.py # PropagationEngine (multi-phase spread)
|
|
344
|
+
│ │ ├── plasticity.py # Plasticity (Hebbian/Anti-Hebbian/Structural)
|
|
345
|
+
│ │ └── __init__.py
|
|
346
|
+
│ ├── chat/ # ChatInterface
|
|
347
|
+
│ │ ├── interface.py # CLI, response pipeline, reasoning loop
|
|
348
|
+
│ │ └── __init__.py
|
|
349
|
+
│ └── pyproject.toml # numpy>=1.20
|
|
350
|
+
├── ravana_ml/ # ML Framework (~5,200 lines)
|
|
351
|
+
│ ├── nn/rlm_v2.py # RLMv2 (triple decomposition, GloVe)
|
|
352
|
+
│ ├── graph.py # ConceptGraph (3,678 lines)
|
|
353
|
+
│ ├── tensor.py # StateTensor / RawTensor / Parameter
|
|
354
|
+
│ ├── plasticity.py # Hebbian, Anti-Hebbian, Structural
|
|
355
|
+
│ └── ... (tokenizer, embedder, free_energy, currencies, propagation)
|
|
356
|
+
├── ravana-v2/ # GRACE Cognitive Core (~19,500 lines)
|
|
357
|
+
│ ├── core/ # 27 Phases A–P modules
|
|
358
|
+
│ │ ├── governor.py # Central regulation
|
|
359
|
+
│ │ ├── identity.py # Momentum-based self-concept
|
|
360
|
+
│ │ ├── sleep.py # 4-stage SWS+REM
|
|
361
|
+
│ │ ├── emotion.py # VAD differential equations
|
|
362
|
+
│ │ ├── human_memory.py # Episodic/Semantic (2,321 lines)
|
|
363
|
+
│ │ ├── global_workspace.py # Consciousness bottleneck
|
|
364
|
+
│ │ ├── meaning.py # Intrinsic motivation
|
|
365
|
+
│ │ ├── dual_process.py # System 1 / System 2
|
|
366
|
+
│ │ └── ... (20 more modules)
|
|
367
|
+
│ ├── experiments/phases/ # Phase runners
|
|
368
|
+
│ └── tests/ # Unit tests
|
|
369
|
+
├── experiments/ # Cross-domain & Phase 4 experiments (18 files)
|
|
370
|
+
├── scripts/ # Analysis & evaluation tools
|
|
371
|
+
│ ├── run_ablation.py # Ablation study runner (NEW)
|
|
372
|
+
│ ├── triple_eval.py # Per-triple evaluation harness (NEW)
|
|
373
|
+
│ └── ...
|
|
374
|
+
├── tests/ # ML framework tests (17 files)
|
|
375
|
+
├── docs/ # Full documentation (12 files)
|
|
376
|
+
├── data/glove/ # GloVe embeddings (download required)
|
|
377
|
+
├── results/ # Benchmark outputs & diagnostics
|
|
378
|
+
├── ablation_results.json # Ablation study outputs
|
|
379
|
+
├── triple_eval_report.json # Per-triple diagnostic reports
|
|
380
|
+
└── RAVANA_DEV_PLAN.md # Development roadmap
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Ablation Study Framework (NEW)
|
|
386
|
+
|
|
387
|
+
The modular package includes a systematic ablation runner (`scripts/run_ablation.py`):
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Full factorial (4 flags × 3 modes = 48 configs)
|
|
391
|
+
python scripts/run_ablation.py --queries "hello|what is trust|explain oxiverse|bye" --runs 3
|
|
392
|
+
|
|
393
|
+
# Quick mode (baseline + 4 single removals + 2 mode variants = 7 configs)
|
|
394
|
+
python scripts/run_ablation.py --quick --modes
|
|
395
|
+
|
|
396
|
+
# Output: ablation_results.json + markdown comparison table
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**What it tests:**
|
|
400
|
+
| Flag | Component |
|
|
401
|
+
|------|-----------|
|
|
402
|
+
| `--no-vad` | VAD emotion modulation |
|
|
403
|
+
| `--no-rlm` | RLMv2 triple verification |
|
|
404
|
+
| `--no-beliefs` | Multi-user belief store |
|
|
405
|
+
| `--no-curiosity` | Autonomous curiosity-driven learning |
|
|
406
|
+
|
|
407
|
+
**Metrics tracked:** Success rate, avg latency, total time, error modes per config.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Per-Triple Evaluation Harness (NEW)
|
|
412
|
+
|
|
413
|
+
Detailed diagnostics instead of averaged metrics (`scripts/triple_eval.py`):
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# Default 10 triples (semantic, causal, contrastive)
|
|
417
|
+
python scripts/triple_eval.py --data-dir ./data --output triple_eval_report.json
|
|
418
|
+
|
|
419
|
+
# Custom triples
|
|
420
|
+
python scripts/triple_eval.py --triples-file my_triples.json --output report.json
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**Per-triple metrics:**
|
|
424
|
+
- **Relation type**: semantic / causal / contrastive / possessive / temporal / analogical
|
|
425
|
+
- **Prediction error (PE)**: how well the model predicts the object
|
|
426
|
+
- **Confidence**: model's confidence in the prediction
|
|
427
|
+
- **Top-1 / Top-5 accuracy**: exact match / in top 5
|
|
428
|
+
- **Rank**: position of correct object in predictions
|
|
429
|
+
- **Graph edge**: weight, confidence, type, `prediction_free_energy`
|
|
430
|
+
- **Source**: where learned — `seed` | `web` | `user` | `sleep` | `inference` | `unknown`
|
|
431
|
+
|
|
432
|
+
**Aggregated diagnostics:**
|
|
433
|
+
- Overall metrics + by relation type + by source
|
|
434
|
+
- Edge health summary (avg weight, confidence, PE, type distribution)
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## License
|
|
439
|
+
|
|
440
|
+
MIT — Built for the RAVANA-AGI-Research initiative.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## About
|
|
445
|
+
|
|
446
|
+
RAVANA explores an alternative paradigm for machine learning — where cognition emerges from **internal pressure**, not gradient optimization; where knowledge **self-organizes** through Hebbian plasticity and sleep consolidation; and where **identity, emotion, and meaning** are first-class citizens of the learning dynamics.
|
|
447
|
+
|
|
448
|
+
**The core thesis**: *"Cognition as pressure-driven self-organization."*
|
|
449
|
+
|
|
450
|
+
This is the center of gravity. Everything else is implementation detail.
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Citation
|
|
455
|
+
|
|
456
|
+
If you use RAVANA in research, please cite:
|
|
457
|
+
|
|
458
|
+
```bibtex
|
|
459
|
+
@misc{ravana2026,
|
|
460
|
+
title={RAVANA: Pressure-Driven Self-Organization for Cognitive Machine Learning},
|
|
461
|
+
author={RAVANA Research Team},
|
|
462
|
+
year={2026},
|
|
463
|
+
url={https://codeberg.org/oxiverse/ravana}
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Links
|
|
470
|
+
|
|
471
|
+
- **Documentation**: [`docs/`](docs/)
|
|
472
|
+
- **External Audit**: [`docs/EXTERNAL_AUDIT.md`](docs/EXTERNAL_AUDIT.md)
|