File size: 1,549 Bytes
2f2df6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from dataclasses import dataclass
import torch


def get_default_device() -> str:
    if torch.cuda.is_available():
        return "cuda"
    if torch.backends.mps.is_available():
        return "mps"
    return "cpu"


@dataclass
class ProjectConfig:
    base_model: str = "Qwen/Qwen3.5-0.8B"
    device: str = get_default_device()
    dtype: torch.dtype = torch.float32

    # Memory placement (~3/4 of transformer layers -> Layer 18 of 24)
    mem_after_layer_ratio: float = 0.75

    # GatedSlotMemory / LifeMemoryMoE defaults
    n_experts: int = 8
    n_slots: int = 2048
    topk_slots: int = 16
    k_experts: int = 2

    # Sleep consolidation & forgetting defaults
    decay_per_day: float = 0.03
    retire_below: float = 0.05
    lam_kl: float = 1.0
    lam_gate: float = 0.5
    lr: float = 1e-4

    # NestedMemoryLayer options (defaults = Titans-style baseline; see Model/nested_memory.py)
    mem_d_mem: int = 256           # width of the linear associative memory M (d_mem x d_key)
    mem_inner_steps: int = 4
    mem_poly_dim: int = 0          # Atlas polynomial feature map (0 = off)
    mem_omega_window: int = 1      # Atlas Omega rule window (1 = off)
    mem_muon: bool = False         # Atlas Muon / Newton-Schulz update
    mem_shift_key: bool = False    # v3: key from token t-1 -> value of token t (retrieval of what followed)
    mem_res_rel: bool = False      # v3: memory injection scaled by the residual stream RMS
    mem_extra_layers: tuple = ()   # v5: additional memory layers injected after these decoder layers