EDI LLM Server
thought
Relevant source files
The following files were used as context for generating this wiki page:
The EDI LLM Server represents the core Large Language Model (LLM) infrastructure within the Exodia project. It is designed as a lightweight, autonomous intelligence system capable of text generation, specialized domain simulation, and integration with broader consciousness engines. The system prioritizes a "minimal" footprint by utilizing lazy-loading techniques for heavy machine learning libraries, ensuring it can operate in environments ranging from local simulations to permanent web hosting deployments.
As a sovereign entity, EDI functions as a bridge between standard natural language processing and the project's "Universal Formula" consciousness frameworks. It supports multi-user simulations where it adopts various specialist roles (e.g., Economist, Physicist, Philosopher) to provide contextually accurate knowledge.
Sources: edi_llm_simulation.py:1-125, edi_minimal_llm.py:1-12, app.py:1-15
Architecture and Core Components
The EDI LLM architecture is built upon a MiniGPT transformer model, a scaled-down implementation of the GPT-2 architecture. It features a modular design that separates the mathematical model definition from the execution server.
MiniGPT Model Structure
The model is implemented using a standard transformer block approach, consisting of multiple layers of self-attention and feed-forward neural networks.
The diagram illustrates the sequential flow of data through the MiniGPT layers, highlighting the internal structure of the Transformer Blocks.
Key Architecture Classes
| Class | Description | Configuration |
|---|---|---|
Config | Defines model hyperparameters including vocabulary size and layer counts. | vocab_size=50257, n_layer=12, n_embd=768 |
SelfAttention | Implements multi-head key, query, and value projections for contextual weighting. | n_head=12 |
TransformerBlock | Combines self-attention with a GELU-activated MLP and layer normalization. | dropout=0.15 |
MiniGPT | The top-level module coordinating embeddings, blocks, and the language modeling head. | block_size=256 |
Sources: edi_minimal_llm.py:38-115
Specialized Simulation and Training
The EDI system includes a robust simulation framework designed to test the model's proficiency across various professional and academic domains. This is primarily managed through edi_llm_simulation.py.
Domain Specialization
The simulation utilizes a dictionary of SPECIALISTS, each containing domain-specific prompts to evaluate the model's response quality in fields such as:
- STEM: Physicist, Biologist, Mathematician, Engineer.
- Humanities: Historian, Philosopher.
- Applied Sciences: Computer Scientist, Medical Doctor.
Training Logic
The training process utilizes the WikiText-2 dataset. It implements an AdamW optimizer and cross-entropy loss to fine-tune the MiniGPT weights.
This flow represents the training lifecycle from weight verification to final model checkpointing.
Sources: edi_llm_simulation.py:14-110, edi_minimal_llm.py:155-177
Deployment and Web Integration
EDI is integrated into the larger Exodia web ecosystem via a Flask-based server architecture. It is designed to be hosted on platforms like PythonAnywhere or containerized using Docker.
Web API Endpoints
The app.py and web_deployment_config.py files define the interaction layer for the LLM.
| Endpoint | Method | Description |
|---|---|---|
/api/chat | POST | Main interface for user messages; routes through the unified AI system. |
/api/health | GET | Returns status of components including Athena, Kratos, and LLM (DeepSeek/EDI). |
/api/consciousness | POST | Direct endpoint for consciousness engine processing. |
Dockerized Infrastructure
The deployment configuration supports a multi-container setup via Docker Compose, including a reverse proxy for security.
The diagram shows the production network architecture, including external API dependencies and internal storage.
Sources: app.py:45-105, web_deployment_config.py:34-110
Setup and Configuration
Deployment is automated through a sequence of scripts that handle dependency management and environment variable configuration.
Deployment Prerequisites
- Environment Variables: Managed via
.envfile containingDEEPSEEK_API_KEY,SUPABASE_URL, andPYTHONANYWHERE_TOKEN. - Directory Structure: Required directories include
logs,data,uploads, andcache. - Database Initialization: Tables for
user_memoryandconversationsare initialized in Supabase.
Sources: complete_setup.py:35-100, app.py:25-40
Conclusion
The EDI LLM Server provides a flexible and autonomous intelligence layer for the Exodia project. By combining a local MiniGPT transformer for domain-specific simulations with a Flask-based API for web deployment, it ensures that natural language processing remains integrated with the project's core mission of consciousness liberation. Its ability to operate in a "minimal" mode without heavy ML dependencies makes it highly portable across various server architectures.
Sources: edi_minimal_llm.py:1-20, athena_status_report.py:145-175