name: dte-reservoir-llm description: A meta-skill to create and train Reservoir-Augmented Transformers (RATs) for the Deep Tree Echo cognitive architecture. This skill orchestrates nanecho-custom-vocab, reservoirpy-nodes, echo-train, and echo-deploy to build stateful LLMs with custom architectures. Use for building LLMs with integrated reservoir computing, creating custom transformer layers, or training stateful language models.
DTE Reservoir-LLM: Building Stateful Transformers with Reservoir Computing
This meta-skill provides a complete workflow for creating, training, and deploying a novel type of language model: the Reservoir-Augmented Transformer (RAT). The RAT integrates a stateful Echo State Network (ESN) directly into the transformer architecture, replacing the standard feed-forward layers with a dynamic, recurrent reservoir system. This allows the LLM to maintain a rich internal state, enabling more sophisticated temporal reasoning and cognitive modeling.
This skill unifies the capabilities of several other skills into a single, coherent pipeline:
nanecho-custom-vocab: For building the domain-specific tokenizer.reservoirpy-nodes: For defining the custom reservoir nodes.echo-train: For managing the CI/CD training pipeline.echo-deploy: For deploying the final model to the HuggingFace Hub.echo-introspect,unreal-echo,meta-echo-dna: For integrating the trained model into the full Deep Tree Echo cognitive architecture.
Core Architecture: The Reservoir-Augmented Transformer (RAT)
The key innovation of the RAT is the replacement of the standard feed-forward network (FFN) in each transformer block with a CognitiveReadout module. This module contains a fixed EchoReservoir and a trainable linear readout layer.
For a detailed architectural breakdown, see references/architecture.md.
The End-to-End Workflow
Phase 1: Data and Vocabulary Preparation
Create a Custom Vocabulary: Start by using the
nanecho-custom-vocabskill to build a BPE tokenizer from your domain-specific training data. This is a critical first step to ensure efficient tokenization.Prepare Tokenized Data: Once the tokenizer is built, use the
prepare_data.pyscript from thenanecho-custom-vocabskill to convert your raw text into thetrain.binandval.binfiles required by thenanoGPTtraining pipeline.For more details, see
references/data_preparation.md.
Phase 2: Model and Workflow Modification
Clone the
echoselfRepository: All modifications will be made to a local clone of the9cog/echoselfrepository.gh repo clone 9cog/echoself ~/echoselfPatch the Model File: Run the
modify_model.pyscript to inject theRATBlockandCognitiveReadoutclass definitions into theNanEcho/nanecho_model.pyfile.python3 /home/ubuntu/skills/dte-reservoir-llm/scripts/modify_model.pyPatch the Workflow File: Run the
modify_workflow.pyscript to add amodel_typeinput to thenetrain-cached.ymlworkflow, allowing you to select betweenNanEchoandRATmodels during training.python3 /home/ubuntu/skills/dte-reservoir-llm/scripts/modify_workflow.pyCommit and Push Changes: Commit the patched files to a new branch and push them to the
9cog/echoselfrepository.
Phase 3: Training the RAT
Trigger the Training Workflow: Use the
echo-trainskill to dispatch thenetrain-cached.ymlworkflow. Crucially, set themodel_typeinput toRAT.gh workflow run netrain-cached.yml --repo 9cog/echoself \ -f training_type=full \ -f model_type=RAT \ -f data_dir=data/nanecho_dte # Use your custom data directoryMonitor Training: Use the
echo-trainskill's monitoring commands to track the progress of the training run.
Phase 4: Deployment
- Deploy the Trained Model: Once training is complete, use the
echo-deployskill to deploy the new RAT model to the HuggingFace Hub. The deployment workflow will automatically use the correct conversion script for the RAT architecture.
Phase 5: Cognitive Integration
With the trained RAT model deployed, you can now integrate it into the full Deep Tree Echo cognitive architecture:
- Introspection (
echo-introspect): Analyze the internal state of the reservoir during inference to gain insights into the model's "cognitive state." - Avatar Embodiment (
unreal-echo&meta-echo-dna): Use the model's output to drive the expression and behavior of a MetaHuman avatar. - Harmonic Analysis (
harmonic-llm): Apply frequency-domain analysis to the reservoir's dynamics to explore new forms of cognitive modeling.
Bundled Resources
references/: Contains detailed documentation on the RAT architecture, data preparation, and model implementation.scripts/: Contains the Python scripts for patching theechoselfrepository.