🧠 Brain-like Predictive Coding Code World Model

This model uses a hierarchical predictive coding network inspired by the brain's cortical hierarchy:

  • L1 (Sensory): Processes code token embeddings like primary visual cortex
  • L2 (Hidden): Learns associative patterns like inferotemporal cortex
  • L3 (Context): Maintains sequence context like prefrontal cortex

Brain-like features:

  • LIF (Leaky Integrate-and-Fire) neurons
  • PES (Prescribed Error Sensitivity) learning — error-driven weight updates
  • Top-down predictions from higher layers
  • Prediction errors drive learning (free-energy principle)
  • Numba JIT acceleration for fast CPU inference
1 10