An LLM that sleeps, gets tired, and is born β a biologically inspired architecture for continual learning.
SomnolentLLM is an experimental system that treats an LLM as a living organism with its own rhythms:
- π€ Sleep β NREM/REM/Deep Sleep cycles for knowledge consolidation
- π΄ Fatigue β homeostatic monitoring for automatic learning regulation
- 𧬠Embryogenesis β "birthing" a model from the knowledge of parent models
- π Online Feeding β an embryo that grows on your data via HTTP API
Hypothesis: biologically inspired mechanisms make continual LLM learning more stable and efficient.
π Detailed Concept β
pip install -e ".[dev]"somnolent-train --model_path <model> --data_path <data>somnolent-birth --config config.qwen35.yaml# Prenatal phase (feeding)
python3 server.py --mode embryonic --port 8080
# Feeding text
curl -X POST http://localhost:8080/embryo/feed \
-d '{"text": "Hello world", "source": "ambient"}'
# After saturation β birth β inference
python3 server.py --mode inference --port 8000| Document | Description |
|---|---|
| CONCEPT | π Project Idea β what and why |
| ARCHITECTURE | Detailed component architecture |
| EMBRYOGENESIS | Model birth process |
| LORA | LoRA initialization methods |
| MATH | Mathematics behind the algorithms |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SomnolentLLM β
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
β β Sleep Engine β β Fatigue β β Manifold β β
β β NREM/REM/DS β β Monitor β β Accumulator β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
β β Episodic β β DMN β β LoRA Adapter β β
β β Buffer β β Generator β β (trainable) β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Role |
|---|---|
| SleepEngine | FSM of sleep cycles (NREM β REM β Deep Sleep) |
| FatigueMonitor | Homeostatic sleep pressure |
| ManifoldAccumulator | Geometrically correct gradients |
| EpisodicBuffer | Activation storage with LRU eviction |
| DMNGenerator | "Dream" generation in REM phase |
| LoRA Adapter | Low-rank adaptation (target layers only) |
Results:
- Perplexity: 9.62 (baseline: 9.69) β quality preserved
- Generation: coherent text
- OOM errors: 0
- Genetic phase β SVD initialization of LoRA from parent models
- Synthesis phase β generation of synthetic memories
- Awakening β first sleep cycle, wake up
# Check embryo
python3 debug/quick_sanity_check.py --adapter ./output/born_adapter_v5.pt
python3 debug/evaluate_embryo.py --adapter ./output/born_adapter_v5.ptWe use Qwen3.5-2B with a hybrid architecture:
- linear_attention (18 layers) β frozen, fast
- full_attention (6 layers) β trained via LoRA
A balance between speed and quality during training.
Data β Model β Fatigue β Sleep β Improved Model
Parent Model A + Parent Model B β Embryogenesis β Birth β Fine-tuning
HTTP API β Embryo β Saturation β Birth β Inference
somnolent_llm/
βββ core/ # Core: sleep, fatigue, birth
βββ adapters/ # LoRA adapters for Qwen3.5
βββ memory/ # Episodic memory and dream generators
βββ utils/ # Configuration, utilities
βββ examples/ # Usage examples
βββ docs/ # Documentation
βββ scripts/ # Embryo feeding scripts
βββ client/ # HTTP API clients
- Python 3.9+
- PyTorch 2.0+
- Transformers 4.35+
- CUDA 11.8+ (for GPU training)
β
Embryogenesis completed β model was born successfully
βΈοΈ Project on pause β code works, but development is suspended
This project was started on March 15, 2026. Over the following weeks it was actively developed with sleep mechanics, fatigue monitoring, and embryogenesis features. The codebase represents a snapshot of the system at the point when development was paused.
GitHub Issues for questions and discussions