Views
No views yet
| Component | Parameters | Role |
|---|---|---|
| Artificial Memory | 21K | Bit-level storage (64K words × 32 bits) + learned bit encoder/decoder |
| SLM-0 | 745K | State → memory address range |
| SLM-1 | 745K | State → memory address range |
| SLM-2 | 745K | State → memory address range |
| BLM | 11.2M | SLM selector [1,0,1] + next-state predictor + info requester |
| Total | 13.5M |
[1,0,1] in forward, differentiable in backward ┌─────────────────────────────┐
│ ARTIFICIAL MEMORY │
│ [0][1][0][1]...[1][0][1][0] │
│ 64K words × 32 bits each │
└──────────┬──────────────────-─┘
│ READ(addr_range)
┌───────────────────┼───────────────────┐
┌──────▼──────┐ ┌────────▼───────┐ ┌──────▼──────────┐
│ SLM-0 │ │ SLM-1 │ │ SLM-2 │
│ (745K) │ │ (745K) │ │ (745K) │
│ past_state │ │ past_state │ │ past_state │
│ curr_state │ │ curr_state │ │ curr_state │
│ character. │ │ character. │ │ character. │
│ → addr │ │ → addr │ │ → addr │
└──────┬──────┘ └────────┬───────┘ └────────┬────────┘
│ │ │
└──────────► BLM (11.2M) ◄──────────────┘
mask = [1, 0, 1]
→ next_state prediction
→ "what info do I need next?"| File | Description |
|---|---|
leworld_architecture.py | All model definitions: Memory, SLM, BLM, full system (~990 lines) |
leworld_training.py | 3-phase training pipeline, data generation, evaluation (~820 lines) |
PLAN.md | Complete design document with literature references |
1from leworld_architecture import LeWorldSystem, MemoryConfig, SLMConfig, BLMConfig
2from leworld_training import run_training, TrainingConfig
3
4# Build system
5system = LeWorldSystem(MemoryConfig(), SLMConfig(), BLMConfig())
6
7# Train (3 phases: pre-train → joint → refine)
8metrics = run_training(system, TrainingConfig())| Paper | What we borrowed |
|---|---|
| Gumbel-Softmax | Straight-Through sigmoid for binary routing |
| Switch Transformers | Gate-value scaling, load balance loss |
| Product Key Memory | Address decomposition into sub-keys |
| LM2 | LSTM-style memory gates |
| NAMM | Binary memory eviction |
| ProactAgent | Paired-branch reward for retrieval decisions |
| Mamba | Explicit state maintenance |
Phase 1: SLM loss 12.87 → 7.13, BLM loss 0.39 → 0.33
Phase 2: Routing becomes diverse — SLM usage: [0.72, 0.79, 0.67]
Phase 3: Info-request improves predictions by 19.5 loss units vs baseline
Final: MSE=0.36, Routing entropy=0.70
Per-step MSE: [0.64, 0.44, 0.31, 0.23, 0.19] ← improves over time
Routing patterns: [1,0,1] → [0,1,1] → [1,1,1] → [1,1,0] → [0,1,0]