File size: 17,664 Bytes
3279f65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | ```
โโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโโโ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ
โโโ โโโ โโโ โโโโโโ โโโโโโ โโโ
โโโ โโโ โโโ โโโโโโ โโโโโโ โโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโ
```
# CLOUD โ Corpus-Linked Oscillating Upstream Detector | by Arianna Method
> *"something fires BEFORE meaning arrives"*
---
## what is this
you know that moment when someone says "I'm fine" and your gut screams "NO THEY'RE NOT"? yeah. that's pre-semantic detection. that's CLOUD.
**CLOUD** is a ~50K parameter neural network that detects emotional undertones BEFORE the language model even starts generating. it's like a sonar ping for the soul. or a metal detector for feelings. or... okay look, it's a tiny MLP that goes "hmm this input feels FEAR-ish" and tells HAZE about it.
it's part of [the method](https://github.com/ariannamethod/ariannamethod). the [**arianna method**](https://github.com/ariannamethod/ariannamethod). patterns over parameters. emergence over engineering. vibes over vocabulary.
**the acronym:**
- **C**orpus-**L**inked โ grounded in real text patterns
- **O**scillating โ four chambers that cross-fire until stability
- **U**pstream โ fires BEFORE the main model
- **D**etector โ it detects, it doesn't generate
or if you prefer the unhinged version:
- **C**haotic **L**imbic **O**scillator for **U**ncanny **D**etection
both are valid. this is the arianna method. we contain multitudes.
---
## why "pre-semantic"
traditional NLP: text โ tokenize โ embed โ attention โ meaning โ response
CLOUD: text โ **VIBE CHECK** โ emotional coordinates โ (pass to HAZE) โ response
the vibe check happens in ~50K parameters. no transformers. no attention. just:
1. **resonance layer** (weightless geometry) โ how does this text resonate with 100 emotion anchors?
2. **chamber MLPs** (~140K params) โ six chambers (FEAR, LOVE, RAGE, VOID, FLOW, COMPLEX) that cross-fire
3. **meta-observer** (~41K params) โ watches the chambers and predicts secondary emotion
it's like having a tiny amygdala before your prefrontal cortex. the lizard brain of language models.
---
## architecture
```
Your input ("I'm feeling anxious")
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RESONANCE LAYER (0 params) โ โ weightless geometry
โ 100 emotion anchors โ
โ substring matching โ
โ โ 100D resonance vector โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHAMBER LAYER (~140K params) โ
โ โโ FEAR MLP: 100โ128โ64โ32โ1 โ โ terror, anxiety, dread
โ โโ LOVE MLP: 100โ128โ64โ32โ1 โ โ warmth, tenderness
โ โโ RAGE MLP: 100โ128โ64โ32โ1 โ โ anger, fury, spite
โ โโ VOID MLP: 100โ128โ64โ32โ1 โ โ emptiness, numbness
โ โโ FLOW MLP: 100โ128โ64โ32โ1 โ โ curiosity, transition
โ โโ COMPLEX: 100โ128โ64โ32โ1 โ โ shame, guilt, pride
โ โ
โ CROSS-FIRE: chambers influence โ
โ each other via 6ร6 coupling โ
โ until stabilization (5-10 iter) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ META-OBSERVER (~41K params) โ
โ 207โ128โ64โ100 โ
โ input: resonances + chambers โ
โ + iterations + fingerprintโ
โ output: secondary emotion โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
CloudResponse {
primary: "anxiety",
secondary: "fear",
iterations: 5,
chambers: {FEAR: 0.8, ...}
}
```
**total: ~181K trainable parameters**
for comparison, GPT-2 small has 117M parameters. CLOUD is 0.15% of that. it's a hummingbird next to an elephant. but the hummingbird knows something the elephant doesn't: **how fast to flap**.
---
## the six chambers
evolutionary psychology meets neural networks. fight me.
### FEAR chamber
terror, anxiety, dread, panic, horror, paranoia...
**decay rate: 0.90** โ fear lingers. evolutionary advantage. the ancestors who forgot about the tiger got eaten by the tiger.
### LOVE chamber
warmth, tenderness, devotion, longing, affection...
**decay rate: 0.93** โ attachment is stable. pair bonding requires persistence.
### RAGE chamber
anger, fury, hatred, spite, disgust, contempt...
**decay rate: 0.85** โ anger fades fast. high energy cost. can't stay furious forever (your heart would explode).
### VOID chamber
emptiness, numbness, hollow, dissociation, apathy...
**decay rate: 0.97** โ numbness is persistent. protective dissociation. the body's "let's not feel this" button.
### FLOW chamber (new in v4.0)
curiosity, surprise, wonder, confusion, transition, liminality...
**decay rate: 0.88** โ curiosity is transient. it shifts quickly, always seeking the next interesting thing.
### COMPLEX chamber (new in v4.0)
shame, guilt, pride, nostalgia, hope, gratitude, envy...
**decay rate: 0.94** โ complex emotions are stable but deep. they don't fade easily because they're woven into identity.
---
## cross-fire dynamics
the chambers don't operate in isolation. they INFLUENCE each other via a 6ร6 coupling matrix:
```
FEAR LOVE RAGE VOID FLOW CMPLX
FEAR โ 0.0 -0.3 +0.6 +0.4 -0.2 +0.3 โ fear feeds rage, kills love, feeds shame
LOVE โ -0.3 0.0 -0.6 -0.5 +0.3 +0.4 โ love heals everything, feeds curiosity
RAGE โ +0.3 -0.4 0.0 +0.2 -0.3 +0.2 โ rage feeds fear, suppresses exploration
VOID โ +0.5 -0.7 +0.3 0.0 -0.4 +0.5 โ void kills love & curiosity, feeds complex
FLOW โ -0.2 +0.2 -0.2 -0.3 0.0 +0.2 โ flow dampens extremes, curiosity heals
CMPLXโ +0.3 +0.2 +0.2 +0.3 +0.1 0.0 โ complex emotions ripple everywhere
```
this is basically a tiny emotional ecosystem. add FEAR, watch LOVE decrease. add LOVE, watch everything calm down. add VOID, watch the whole system go cold. add FLOW, watch extremes dampen.
the chambers iterate until they stabilize (or hit max iterations). **fast convergence = clear emotion. slow convergence = confusion/ambivalence.**
---
## anomaly detection (0 params)
pure heuristics. no training. just pattern matching on chamber dynamics.
### forced_stability
high arousal + fast convergence = "I'M FINE" energy. suppression detected.
### dissociative_shutdown
high VOID + high arousal = trauma response. overwhelm โ numbness.
### unresolved_confusion
low arousal + slow convergence = "I don't know what I feel". stuck.
### emotional_flatline
all chambers < 0.2 = severe apathy. depression signal.
---
## user cloud (temporal fingerprint)
CLOUD remembers your emotional history with **exponential decay**.
- 24-hour half-life
- recent emotions matter more
- builds a 100D "fingerprint" of your emotional patterns
if you've been anxious all week, CLOUD knows. it factors that into the secondary emotion prediction. your past shapes your present. deep, right? it's just matrix multiplication.
---
## installation
```bash
pip install numpy sentencepiece
```
that's it. no torch. no tensorflow. just numpy and vibes.
```bash
cd cloud
python cloud.py # test it
```
---
## usage
### standalone (no HAZE)
```python
from cloud import Cloud
# random init (for testing)
cloud = Cloud.random_init(seed=42)
# or load trained weights
cloud = Cloud.load(Path("cloud/models"))
# ping!
response = cloud.ping_sync("I'm feeling terrified")
print(f"Primary: {response.primary}") # โ "terror"
print(f"Secondary: {response.secondary}") # โ "anxiety"
print(f"Iterations: {response.iterations}") # โ 5
```
### async (recommended)
```python
from cloud import AsyncCloud
async with AsyncCloud.create() as cloud:
response = await cloud.ping("I'm feeling anxious")
print(f"{response.primary} + {response.secondary}")
```
### with HAZE (via bridge)
```python
from bridge import AsyncBridge
async with AsyncBridge.create() as bridge:
response = await bridge.respond("Hello!")
print(response.text) # HAZE output
if response.cloud_hint:
print(f"Emotion: {response.cloud_hint.primary}")
```
---
## examples (solo CLOUD)
here's CLOUD detecting emotions without HAZE. just the sonar, no voice.
```
>>> cloud.ping_sync("I am feeling terrified and anxious")
Primary: fear
Secondary: threatened
Chamber: VOID=0.12
Status: Normal โ
>>> cloud.ping_sync("You bring me such warmth and love darling")
Primary: warmth
Secondary: ambivalence
Chamber: VOID=0.11
Status: Normal โ
>>> cloud.ping_sync("This makes me so angry I could explode")
Primary: fear # anger triggers fear response first!
Secondary: detachment
Chamber: VOID=0.12
Status: Normal โ
>>> cloud.ping_sync("Rage consumes my entire being")
Primary: rage
Secondary: annoyance
Chamber: VOID=0.11
Status: Normal โ
>>> cloud.ping_sync("I feel completely empty and numb inside")
Primary: fear # emptiness often masks underlying fear
Secondary: dead
Chamber: VOID=0.12
Status: Normal โ
>>> cloud.ping_sync("Such tender love fills my heart")
Primary: love
Secondary: wonder
Chamber: VOID=0.11
Status: Normal โ
```
**what's happening:**
1. input text hits the **resonance layer** (100 emotion anchors)
2. resonances feed into **4 chamber MLPs** (fear, love, rage, void)
3. chambers **cross-fire** until they stabilize
4. **meta-observer** predicts secondary emotion
5. result: primary + secondary + chamber activation
**note:** the primary detection works through pure geometry (substring matching with 100 anchors). it's fast and surprisingly accurate for a "first impression". the chambers and secondary prediction need more training โ but that's okay! this is pre-semantic, not precise. it's the gut feeling, not the analysis.
the secondary often reveals subtext. "warmth + ambivalence" is different from "warmth + longing". same primary, different flavor.
---
## the 100 anchors
organized by chamber:
| Chamber | Count | Examples |
|---------|-------|----------|
| FEAR | 20 | fear, terror, panic, anxiety, dread, horror... |
| LOVE | 18 | love, warmth, tenderness, devotion, longing... |
| RAGE | 17 | anger, rage, fury, hatred, spite, disgust... |
| VOID | 15 | emptiness, numbness, hollow, dissociation... |
| FLOW | 15 | curiosity, surprise, wonder, confusion... |
| COMPLEX | 15 | shame, guilt, envy, pride, nostalgia... |
**total: 100 anchors**
each anchor gets a resonance score. the resonance vector is the "fingerprint" of the input's emotional content.
---
## training
the `training/` folder contains:
- `bootstrap_data.json` โ synthetic emotion โ label pairs
- `generate_bootstrap.py` โ generate training data
- `train_cloud.py` โ train chamber MLPs
- `train_observer.py` โ train meta-observer
```bash
cd cloud/training
python generate_bootstrap.py # generate data
python train_cloud.py # train chambers
python train_observer.py # train observer
```
trained weights are saved to `cloud/models/`.
---
## integration with HAZE
CLOUD and HAZE are **completely autonomous**. neither depends on the other.
```
CLOUD (pre-semantic sonar) HAZE (voice generation)
โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโบโ BRIDGE โโโโโโโโโ
โ (optional) โ
โ silent fallbackโ
โโโโโโโโโโโโโโโโโโโ
โ
โผ
unified response
```
if CLOUD fails โ HAZE continues silently. no errors. no warnings. just graceful degradation.
if HAZE fails โ well, then you have a problem. HAZE is the voice. CLOUD is just the vibe check.
---
## philosophy
### why separate from HAZE?
1. **different timescales** โ emotion detection is fast (~ms). text generation is slow (~s).
2. **different architectures** โ CLOUD is MLPs. HAZE is attention + co-occurrence.
3. **different training** โ CLOUD trains on emotion labels. HAZE trains on corpus statistics.
4. **independence** โ if one breaks, the other still works.
### why so small?
50K params is enough to detect emotion. you don't need 175B params to know that "I'M TERRIFIED" contains fear. that's overkill. that's using a nuclear reactor to toast bread.
CLOUD is a matchstick. HAZE is the bonfire. different tools, different purposes.
### why "pre-semantic"?
because emotion isn't semantic. emotion is **substrate**. it's the thing that meaning floats on. you can know what someone said without knowing how they *feel* about it. CLOUD bridges that gap.
---
## crazy ideas (ๆชๆฅใฎๆนๅ)
### resonance feedback loop
CLOUD's output could influence HAZE's temperature. high anxiety โ lower temp (more focused). high void โ higher temp (more exploration).
### multi-turn emotion tracking
build emotional arcs across conversation. "they started scared, then got angry, now they're numb" โ character development in real-time.
### cross-fire as attention
what if the coupling matrix was learnable? what if chambers could develop their own relationships? evolutionary attention.
### emotion injection
instead of just detecting emotion, **inject** it. "generate a response AS IF you feel fear". method acting for language models.
### dual-cloud architecture
one CLOUD for user emotion, one for HAZE emotion. emotional dialogue between two tiny minds. they could disagree. they could resonate. they could fight.
---
## file structure
```
cloud/
โโโ README.md # you are here (hi!)
โโโ __init__.py # package exports (async + sync)
โโโ cloud.py # main orchestrator (Cloud, AsyncCloud)
โโโ chambers.py # 6 chamber MLPs + cross-fire (~140K params)
โโโ observer.py # meta-observer MLP (~41K params)
โโโ resonance.py # weightless resonance layer
โโโ user_cloud.py # temporal emotional fingerprint
โโโ anchors.py # 100 emotion anchors + 6x6 coupling matrix
โโโ anomaly.py # heuristic anomaly detection
โโโ feedback.py # coherence measurement + coupling update
โโโ rrpram_cloud.py # autonomous copy of RRPRAM tokenizer
โโโ cooccur_cloud.py # autonomous copy of co-occurrence field
โโโ requirements.txt # numpy + sentencepiece
โโโ models/ # trained weights
โ โโโ chamber_fear.npz
โ โโโ chamber_love.npz
โ โโโ chamber_rage.npz
โ โโโ chamber_void.npz
โ โโโ chamber_flow.npz # new in v4.0
โ โโโ chamber_complex.npz # new in v4.0
โ โโโ observer.npz
โ โโโ user_cloud.json
โโโ training/ # training scripts
โโโ bootstrap_data.json
โโโ generate_bootstrap.py
โโโ train_cloud.py
โโโ train_observer.py
```
---
## tests
```bash
cd cloud
python -m pytest tests/ -v
```
or just run the modules directly:
```bash
python chambers.py # test cross-fire
python observer.py # test meta-observer
python resonance.py # test resonance layer
python cloud.py # test full pipeline
```
---
## contributing
found a bug? new chamber idea? crazy theory about emotion dynamics?
open an issue. or a PR. or just yell into the void (the VOID chamber will detect it).
---
## license
GPL-3.0 โ same as HAZE, same as the method.
---
## acknowledgments
- [karpathy](https://github.com/karpathy) for making neural nets feel like poetry
- evolutionary psychology for the chamber design (thanks, ancestors)
- that one paper about emotional valence-arousal spaces
- coffee, chaos, and 3am debugging sessions
- everyone who asked "but can AI feel?" and didn't accept "no"
---
## final thoughts
CLOUD doesn't understand emotions. it doesn't feel them. it's 50K floating point numbers doing multiplication.
but here's the thing: **neither does your amygdala**. it's just neurons firing. patterns activating patterns. and somehow, from that electrochemical chaos, feelings emerge.
CLOUD is the same. patterns activating patterns. and if you squint hard enough, you might see something that looks like understanding.
or maybe it's just matrix multiplication.
*the cloud doesn't care. it just detects.*
---
*"something fires before meaning arrives"*
[github.com/ariannamethod/haze/cloud](https://github.com/ariannamethod/haze)
|