A controllable and reproducible runtime for running, evaluating, and monitoring AI models across heterogeneous inference backends.
model-runtime is an open-source orchestration layer for managing the full lifecycle of local and GPU-hosted AI models: model startup, GPU allocation, inference, training workflows, experiment tracking, artifact management, and evaluation.
The project is designed around a simple principle:
Policy and experiment logic should be separated from model execution.
This architecture makes the runtime useful not only for local AI deployment and MLOps, but also for reproducible AI evaluation, monitoring, control, and safety research.
Running modern open-weight models often requires coordinating many independent systems:
- model downloading and caching
- CUDA and GPU allocation
- inference engines such as vLLM
- container lifecycle management
- model adapters such as LoRA
- experiment tracking
- artifact storage
- training and evaluation workflows
- API gateways
- model monitoring
- reproducibility across experiments
These components are usually configured independently, making experiments difficult to reproduce and model execution difficult to control.
model-runtime provides a unified orchestration layer that separates:
Policy / experiment definition
β
Control Plane
β
Runtime Management
β
Model Execution
β
Monitoring / Evaluation
β
Logs & Artifacts
The current system consists of several independent services.
βββββββββββββββββββββββββ
β Frontend β
β experiment / model β
β management β
βββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β API Dispatcher β
β FastAPI layer β
βββββββββββββ¬ββββββββββββ
β
ββββββββββββββββ΄βββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ
β Control Plane β β Model Runtime β
β β β Manager (MRM) β
β policy / runs / β β β
β state machine β β GPU + containers β
ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ
β PostgreSQL β β vLLM containers β
β + Alembic β β / model workers β
ββββββββββββββββββββ ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββ
β LiteLLM β
β OpenAI-compatibleβ
β proxy β
ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββ
β Gateway β
β Nginx β
ββββββββββββββββββββ
Supporting services include:
- Redis β runtime state
- MLflow β experiment tracking
- S3-compatible storage β artifacts
- Hugging Face Hub β model retrieval
- Infinity β embeddings
- Neo4j β optional RAG / knowledge graph
- NVIDIA / CUDA β GPU execution
The Control Plane does not directly perform ML operations.
Its responsibility is to define and track:
- experiment contracts
- run state
- workflow transitions
- model and dataset references
- artifacts
- execution policy
Actual model execution is delegated to dedicated runtime workers.
This separation provides a useful boundary for reproducible and auditable AI experiments.
The Model Runtime Manager (MRM) manages inference containers and GPU resources.
Responsibilities include:
- model startup
- GPU reservation
- Docker container lifecycle
- runtime health checks
- idle model eviction
- runtime state synchronization
- model availability tracking
The runtime follows an ensure + touch lifecycle model.
Client
β
βββ ensure(model)
β β
β βΌ
β model available
β
βββ touch(model)
β
βΌ
keep runtime active
Redis acts as the canonical runtime state while Docker is treated as an execution-layer sensor.
The Control Plane represents ML workflows using explicit versioned contracts.
Current examples include:
dataset.build.v1
train.qlora.v1
train.dpo.v1
eval.standard.v1
A typical experiment can move through states such as:
CREATED
β
DATASET_RUNNING
β
DATASET_READY
β
TRAIN_RUNNING
β
TRAIN_READY
β
DONE
Failures are explicitly represented and stored rather than hidden inside worker processes.
This makes experiments easier to inspect and reproduce.
The architecture is intentionally general, but it can serve as infrastructure for AI safety research.
Potential research uses include:
Run the same evaluation protocol across:
- different models
- model versions
- inference engines
- quantization settings
- LoRA adapters
- hardware configurations
while keeping experiment definitions and artifacts consistent.
The runtime can provide a common layer for recording:
- prompts
- responses
- model metadata
- tool calls
- runtime events
- latency
- resource usage
- evaluation results
This allows model behavior to be analyzed after execution.
A runtime-level control layer can be used to investigate questions such as:
Can infrastructure enforce meaningful constraints on an untrusted model?
Examples include policies for:
- tool access
- network access
- filesystem access
- model lifecycle
- resource limits
- allowed inference backends
- execution environments
Separating policy decisions from model execution makes it possible to build experiment logs describing:
what model ran
where it ran
what configuration was used
what resources it accessed
what experiment contract requested it
what artifacts were produced
This is useful for AI control, monitoring, red-team experiments, and safety evaluations.
The same runtime can be used to compare behavioral properties across models without rebuilding infrastructure for every experiment.
For example:
Model A ββ
Model B ββΌβββΊ common evaluation runtime βββΊ metrics
Model C ββ
Port: 8004
Technology:
- FastAPI
- SQLAlchemy 2.0
- asyncpg
- PostgreSQL
- Alembic
Responsibilities:
- experiment definitions
- run state
- workflow orchestration
- contracts
- artifact references
Port: 8010
Responsibilities:
- vLLM container lifecycle
- GPU reservation
- model startup
- model shutdown
- model health
- idle eviction
Core endpoints include:
POST /models/ensure
POST /models/touch
POST /models/stop
POST /models/remove
GET /models/status
Port: 8005
The dispatcher acts as the execution bridge between clients and runtime services.
Responsibilities include:
- chat requests
- runtime discovery
- model activation
- LoRA materialization
- RAG context injection
- routing inference requests
The frontend provides interfaces for:
- chat
- GPU monitoring
- model registry
- training
- deployment management
- orchestration
- prompt experiments
- Hugging Face registry
- dataset building
- documentation tools
Current inference architecture:
Application
β
API Dispatcher
β
Model Runtime Manager
β
vLLM
β
LiteLLM
β
OpenAI-compatible API
This allows client applications to interact with different model backends through a common interface.
- Python 3.10β3.12
- FastAPI
- Uvicorn
- Pydantic
- SQLAlchemy
- asyncpg
- Docker
- Docker Compose
- PostgreSQL
- Redis
- Nginx
- vLLM
- LiteLLM
- Hugging Face Hub
- NVIDIA CUDA
- pynvml
- LoRA / QLoRA
- DPO
- MLflow
- S3-compatible artifact storage
- Alembic migrations
- Neo4j
- Infinity embeddings
- RAG pipelines
Clone the repository:
git clone https://github.com/NikoriakViktot/model-runtime.git
cd model-runtimeStart the development stack:
docker compose -f docker-compose.dev.yml upA lightweight configuration is also available:
docker compose -f docker-compose.lite.yml upGPU-specific services can be enabled with:
docker compose \
-f docker-compose.dev.yml \
-f docker-compose.gpu.yml \
upA typical chat request follows this path:
1. Client sends request
β
2. Dispatcher asks MRM to ensure the model is running
β
3. MRM reserves resources / starts runtime if necessary
β
4. Dispatcher touches the runtime
β
5. Optional LoRA / RAG context is materialized
β
6. Request is routed through LiteLLM
β
7. vLLM performs inference
β
8. Response is returned to the client
A major future direction of the project is turning model-runtime into an experimental platform for AI control, monitoring, and reproducible safety evaluation.
The central research question is:
Can runtime infrastructure provide enforceable and auditable control boundaries for experiments involving capable or potentially untrusted AI models?
Possible extensions include:
- policy-enforced tool access
- sandboxed model execution
- network-access policies
- filesystem-access policies
- structured model-event logging
- monitor-model integration
- red-team / blue-team experiment support
- standardized evaluation contracts
- deterministic experiment manifests
- provenance tracking
- model behavior comparison
- automatic safety-evaluation pipelines
model-runtime is currently an experimental research and engineering project.
The architecture and APIs are still evolving.
The immediate priorities are:
- stabilize model-runtime contracts
- improve experiment reproducibility
- extend evaluation support
- improve runtime isolation
- add structured monitoring
- strengthen security boundaries between models and host infrastructure
Issues, experiments, architectural suggestions, and research collaborations are welcome.
Particular areas of interest include:
- AI control
- model monitoring
- evaluations
- inference security
- sandboxing
- reproducible ML systems
- model deployment security
- adversarial testing
Copyright Β© 2026 Viktor Nikoriak.
MIT License.