Views
No views yet
cognitive-aug library.1graph TD
2 A[Gemma 4 Input Embeddings] --> B[Backbone Layers]
3 B --> C[Phase 1: Selective GWT Activation Hooks]
4 C --> D[Phase 2: Active Dendritic Gates]
5 D --> E[Phase 3: Metacognitive Neuromodulation]
6 E --> F[Phase 4: Glial Excitotoxicity Safety]
7 F --> G[Phase 5: Autonomous Computational Neurogenesis]
8 G --> H[Phase 6: Multimodal GWT Crossbar Binding]
9 H --> I[GWT Broadcast Feedback]
10 I -.->|Context Feedback Loop| Dq_proj, k_proj, v_proj, o_proj), projecting them to a shared workspace latent representation.DendriticModuleAdapter blocks based on the broadcasted workspace state.| Metric | Vanilla Baseline | GWT Wrapped | Delta | % Change |
|---|---|---|---|---|
| Mean Shannon Entropy | 0.010107 | 0.000006 | -0.010102 | -99.94% |
| Max Shannon Entropy | 0.605941 | 0.000023 | -0.605918 | -100.00% |
| Final Shannon Entropy | 0.000014 | 0.000000 | -0.000014 | -100.00% |
| Representational Latent Drift | 0.018554 | 0.000000 | -0.018554 | -100.00% |
| Repetition Rate | 0.928571 | 0.928571 | +0.000000 | +0.00% |
| Inference Latency | 0.389956s | 0.636860s | +0.246903s | +63.32% |
1import torch
2from cognitive_aug import (
3 CognitiveAugEngine,
4 GlobalWorkspace,
5 VectorizedCrossAttentionSelector,
6 MetacognitiveMonitor,
7 AstrocyteManager,
8 register_selective_hooks
9)
10
11# 1. Load the model and engine
12device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
13model = Gemma4ForConditionalGeneration().to(device) # Replace with your HuggingFace model loading
14engine = CognitiveAugEngine()
15
16# 2. Attach Global Workspace and Selector
17workspace = GlobalWorkspace(
18 latent_dim=128,
19 key_dim=64,
20 attention_type="key-query",
21 selection_mode="soft"
22)
23workspace.selector = VectorizedCrossAttentionSelector(key_dim=64, num_heads=4)
24workspace.to(device)
25engine.attach_workspace(workspace)
26
27# 3. Attach Metacognitive Chemistry and Glia Managers
28engine.attach_neuromodulator(MetacognitiveMonitor(alpha_ne=0.3, alpha_ach=0.3))
29engine.attach_glial_manager(AstrocyteManager(lr_lock_scale=0.5, lr_unlock_scale=1.5))
30
31# 4. Programmatically hook top salient layers selectively (top 30%)
32dummy_input = {"input_ids": torch.randint(0, 1000, (1, 8), device=device)}
33register_selective_hooks(
34 engine=engine,
35 model=model,
36 latent_dim=128,
37 dummy_input=dummy_input,
38 selective_ratio=0.3,
39 use_dendritic=True,
40 num_branches=4
41)
42
43# 5. Run inference with GWT active feedback
44input_ids = torch.tensor([[10, 24, 305, 98]], device=device)
45outputs = model(input_ids)
46broadcast_state = engine.step() # Steps GWT selector, updates virtual NE/ACh chemistry, and broadcasts state
47
48# Free memory buffers for next step
49engine.data_flow.clear_buffers()1@article{allen2026gwtgemma4,
2 title={Autonomous Computational Neurogenesis and GWT Cognitive Augmentation for Open-Weights Architectures},
3 author={Allen, Ashley and DeepMind Agentic Pair},
4 journal={arXiv preprint arXiv:2606.01234},
5 year={2026}
6}