Skip to content

Latest commit

Β 

History

114 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SENTINEL

Autonomous LLMOps and Self-Healing Evaluation Platform

SENTINEL is a local-first LLMOps platform that continuously evaluates Large Language Models, diagnoses the root causes of failures, and automatically attempts to self-heal them.

Status Python FastAPI Ollama React Docker Python SDK Research Paper ResearchGate Novel Features


πŸ“œ Official AI Research Paper & Python SDK

The formal academic paper detailing SENTINEL's underlying mathematical models, hybrid dense-sparse vector embedding algorithms, and autonomous prompt self-healing mutation engine is published and available for public review:


πŸ“Œ Overview

Large Language Models can produce incorrect, inconsistent, hallucinated, or poorly grounded responses even when the underlying application is functioning correctly.

Traditional CI/CD pipelines primarily test whether the software itself is working:

Code
 ↓
Unit Tests
 ↓
Integration Tests
 ↓
Build
 ↓
Deploy

However, an LLM application can pass all traditional software tests while its actual AI quality degrades.

SENTINEL introduces an AI quality layer into the software lifecycle:

Code / Prompt / Model Change
            ↓
       LLM Evaluation
            ↓
      Failure Detection
            ↓
         Diagnosis
            ↓
     Self-Healing Attempt
            ↓
         Verification
            ↓
      Quality Gate
            ↓
      Deploy / Block

SENTINEL is designed as a local-first platform, using Ollama to run local LLMs without requiring paid inference APIs or API keys.


🎯 Project Goals

SENTINEL aims to provide four major capabilities:

1. Evaluate

Continuously evaluate LLM responses using multiple quality metrics.

2. Diagnose

Determine the likely root cause when an LLM response fails.

3. Self-Heal

Automatically apply an appropriate recovery strategy.

4. Prevent Regression

Integrate AI evaluation into CI/CD so degraded prompts or models can be blocked before deployment.


🧠 Core Capabilities

1. Continuous LLM Evaluation

SENTINEL evaluates LLM responses across multiple dimensions:

  • Semantic correctness
  • Hallucination
  • Faithfulness
  • Relevance
  • Consistency
  • Toxicity
  • Latency

The evaluation engine combines:

  • Golden test suites
  • Embedding-based semantic similarity
  • Document grounding
  • LLM-as-a-Judge
  • Custom evaluation metrics

2. Multi-Layer Correctness Evaluation

SENTINEL uses multiple layers instead of relying on a single evaluation technique.

Layer 1 β€” Golden Test Suite

Manually defined test cases contain:

Question
Expected Answer
Category
Metadata

The generated answer is compared against the expected answer using semantic similarity.

Example:

Expected:
Paris is the capital of France.

LLM:
The capital city of France is Paris.

Although the wording differs, the semantic meaning is almost identical.

SENTINEL therefore uses embeddings instead of exact string matching.


Layer 2 β€” Document Grounding

For applications using RAG, the answer is compared with retrieved document chunks.

Question
   ↓
Retriever
   ↓
Documents
   ↓
LLM
   ↓
Answer
   ↓
Compare Answer ↔ Retrieved Context

If the response is not sufficiently supported by the retrieved context, SENTINEL can flag a potential hallucination or grounding failure.


Layer 3 β€” LLM-as-a-Judge

For difficult or ambiguous cases, a second LLM evaluates:

Question
+
Generated Answer
+
Reference / Context

and produces a structured judgment with a reason.

This provides an additional evaluation signal when simple semantic similarity is insufficient.


πŸ” Failure Diagnosis

A major feature of SENTINEL is that it does not stop at:

Evaluation β†’ FAIL

Instead, it attempts to determine:

Why did the model fail?

The initial diagnosis framework contains three major failure categories.


1. Vague Prompt

The same question is sent to multiple models:

Llama 3.1
Mistral
Phi-3

Their responses are converted into embeddings.

SENTINEL measures semantic agreement between the responses.

Conceptually:

Question
   β”‚
   β”œβ”€β”€β†’ Llama
   β”œβ”€β”€β†’ Mistral
   └──→ Phi
          β”‚
          β–Ό
      Embeddings
          β”‚
          β–Ό
   Similarity Analysis
          β”‚
          β–Ό
    Model Agreement

Low agreement can be evidence that the prompt is ambiguous or underspecified.

The system should combine this signal with other evidence rather than treating one threshold as absolute proof.


2. Knowledge Gap

A model can fail because the information required to answer the question does not exist in the knowledge base.

SENTINEL analyzes:

Correct / expected information
          ↓
       Embedding
          ↓
Compare against retrieved documents
          ↓
Knowledge coverage

If relevant information cannot be found in the available knowledge base, the failure may be classified as:

KNOWLEDGE_GAP

3. Model Weakness

Some models may consistently perform poorly on particular topics.

For example:

Model: Llama 3.1

Topic: Financial Reasoning

Evaluations: 150
Failures: 118
Failure Rate: 78.6%

SENTINEL uses historical evaluation data to identify persistent model weaknesses.

If a model consistently fails on a topic, SENTINEL can create a model weakness flag and recommend considering another model.


πŸ› οΈ Self-Healing

Once a failure is diagnosed, SENTINEL attempts to select an appropriate recovery strategy.

Failure
   ↓
Diagnosis
   β”‚
   β”œβ”€β”€ Vague Prompt
   β”‚       ↓
   β”‚   Prompt Healing
   β”‚
   β”œβ”€β”€ Knowledge Gap / Retrieval Failure
   β”‚       ↓
   β”‚   RAG Healing
   β”‚
   └── Model Weakness
           ↓
       Model Recommendation

✍️ Prompt Healing

For vague or poorly structured prompts, SENTINEL uses a meta-LLM to generate an improved prompt.

Input:

Original Prompt
+
Incorrect Response
+
Expected Response
+
Failure Information

↓

Meta-LLM

↓

Improved Prompt

The new prompt is then evaluated against the original.

Original Prompt
       β”‚
       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚              β”‚
       β–Ό              β–Ό
 Evaluation       Evaluation
       β”‚              β”‚
       β–Ό              β–Ό
 Original Score   Healed Score
       β”‚              β”‚
       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
              β–Ό
         Comparison
              ↓
       Better Version

πŸ“š RAG Healing

When the problem is related to missing or poorly retrieved information, SENTINEL attempts to improve retrieval.

Process

Original Question
        ↓
Generate Alternative Queries
        ↓
Multiple Search Queries
        ↓
ChromaDB Retrieval
        ↓
Candidate Documents
        ↓
Embedding Similarity
        ↓
Re-ranking
        ↓
Top Relevant Documents
        ↓
LLM
        ↓
Re-evaluation

The goal is to improve the quality of context supplied to the LLM.


🚨 Model Weakness Handling

Model weakness cannot always be automatically fixed.

Instead, SENTINEL:

  1. Records the failure.
  2. Calculates historical failure rates.
  3. Creates a weakness flag.
  4. Generates an alert.
  5. Recommends an alternative model.
  6. Allows the result to be displayed in the dashboard.

πŸ§ͺ A/B Testing

SENTINEL evaluates original and healed versions against the same evaluation set.

             Evaluation Set
                   β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
          β–Ό                 β–Ό
     Original Prompt   Healed Prompt
          β”‚                 β”‚
          β–Ό                 β–Ό
      Evaluation         Evaluation
          β”‚                 β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β–Ό
              Comparison
                   ↓
             Winner Selected

Metrics can include:

  • Correctness
  • Hallucination
  • Faithfulness
  • Consistency
  • Toxicity
  • Latency
  • Overall evaluation score

The goal is to ensure that a healing operation actually improves the system rather than simply changing its behavior.


πŸ–₯️ Local-First Architecture

SENTINEL is designed to run locally.

The basic installation can contain:

SENTINEL Desktop
β”‚
β”œβ”€β”€ React
β”œβ”€β”€ Tauri
β”œβ”€β”€ FastAPI
β”œβ”€β”€ SQLite
β”œβ”€β”€ ChromaDB
β”œβ”€β”€ Sentence Transformer
└── Ollama
    β”œβ”€β”€ Llama 3.1
    β”œβ”€β”€ Mistral
    └── Phi-3

This provides:

  • Local inference
  • No mandatory paid LLM APIs
  • No mandatory API keys
  • Privacy-preserving evaluation
  • Offline-capable evaluation
  • Local experimentation

Actual model performance will depend on the user's available CPU, GPU, RAM, and storage.


πŸ—οΈ System Architecture

                         SENTINEL
                            β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                   β”‚
              Desktop UI          Backend
                  β”‚                   β”‚
            React + Tauri          FastAPI
                                      β”‚
                                      β–Ό
                              Evaluation Service
                                      β”‚
                                      β–Ό
                               Evaluation Engine
                                      β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                   β”‚                  β”‚
                  β–Ό                   β–Ό                  β–Ό
                 LLM              Embeddings            RAG
                  β”‚                   β”‚                  β”‚
                  β–Ό                   β–Ό                  β–Ό
                Ollama          MiniLM-L6-v2          ChromaDB
                  β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό         β–Ό         β–Ό
      Llama     Mistral    Phi-3
                  β”‚
                  β–Ό
             Evaluation
                  β”‚
                  β–Ό
              Diagnosis
                  β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
         β–Ό        β–Ό        β–Ό
      Vague     Knowledge  Model
      Prompt      Gap      Weakness
         β”‚        β”‚        β”‚
         β–Ό        β–Ό        β–Ό
      Prompt     RAG      Alert /
      Healing   Healing   Recommendation
         β”‚        β”‚        β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–Ό
              Verification
                  β”‚
                  β–Ό
               A/B Test
                  β”‚
                  β–Ό
              Persistence
                  β”‚
                  β–Ό
             SQLite / PostgreSQL
                  β”‚
                  β–Ό
              Dashboard

πŸ”„ Evaluation Pipeline

The core SENTINEL pipeline is:

INGEST
  ↓
EVALUATE
  ↓
CLASSIFY
  ↓
DIAGNOSE
  ↓
HEAL
  ↓
VERIFY
  ↓
STORE
  ↓
ALERT

Each stage has a specific responsibility.


🧩 Technology Stack

AI / ML

  • Python
  • Ollama
  • Llama 3.1
  • Mistral
  • Phi-3
  • DeepEval
  • Sentence Transformers
  • all-MiniLM-L6-v2
  • scikit-learn
  • LlamaIndex
  • ChromaDB

Backend

  • Python
  • FastAPI
  • Pydantic
  • SQLAlchemy
  • SQLite
  • PostgreSQL
  • REST APIs
  • Background workers

Frontend / Desktop

  • React
  • TypeScript
  • Tailwind CSS
  • D3.js / Recharts
  • Tauri

LLMOps / MLOps

  • MLflow
  • DVC
  • Git
  • GitHub Actions

Infrastructure

  • Docker
  • Docker Compose
  • Kubernetes
  • Redis
  • Prometheus
  • Grafana

πŸ“‚ Project Structure

SENTINEL/
β”‚
β”œβ”€β”€ frontend/  β†’ UI + Tauri
β”œβ”€β”€ backend/  β†’ FastAPI + database + APIs
β”œβ”€β”€ ai/       β†’ entire AI/ML system
β”œβ”€β”€ data/     β†’ datasets + benchmarks
β”œβ”€β”€ prompts/  β†’ prompt assets/versioning
β”œβ”€β”€ research/ β†’ experiments + paper
β”œβ”€β”€ infrastructure/  β†’ Docker + Kubernetes
β”œβ”€β”€ mlops/  β†’ MLflow + DVC + evaluation gates
β”œβ”€β”€ tests/   β†’ all testing
β”œβ”€β”€ scripts/  β†’ architecture + documentation
β”œβ”€β”€ docs/   β†’ setup/utilities
β”‚
β”œβ”€β”€ .github/
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ dvc.yaml
β”œβ”€β”€ params.yaml
└── .gitignore

Directory Responsibilities

Directory Responsibility
frontend/ React + Tauri desktop interface
backend/ FastAPI, APIs, database and application services
ai/ LLM evaluation, diagnosis, healing and RAG
data/ Golden datasets, benchmarks and experiment data
prompts/ System, evaluation and healing prompts
research/ Experiments, analysis, results and research paper
infrastructure/ Docker, Kubernetes and monitoring
mlops/ MLflow, DVC and evaluation gates
tests/ Unit, integration and end-to-end tests
scripts/ Setup, model and benchmark utilities
docs/ Architecture and technical documentation
.github/ CI/CD workflows

πŸ”¬ Research Direction

SENTINEL is also designed as an experimental research project.

The primary research question is:

Can an autonomous system accurately diagnose the root causes of LLM failures and select an appropriate self-healing strategy without human intervention?

Potential research questions include:

  1. Can multi-model semantic disagreement identify vague prompts?
  2. Can retrieval analysis distinguish knowledge gaps from other failure types?
  3. Can historical failure patterns identify model-specific weaknesses?
  4. Can automatic prompt healing improve LLM evaluation scores?
  5. Can RAG healing improve grounding and faithfulness?
  6. Can the system automatically select an appropriate healing strategy?
  7. Does self-healing improve quality without unacceptable latency overhead?

πŸ“Š Research Methodology

SENTINEL will be evaluated against baseline systems.

Potential baselines include:

Baseline 1
LLM without self-healing

Baseline 2
LLM + standard RAG

Baseline 3
LLM + generic prompt rewriting

Baseline 4
LLM + fixed retrieval strategy

SENTINEL
Evaluation
β†’ Diagnosis
β†’ Targeted Healing
β†’ Verification

Evaluation metrics may include:

  • Accuracy
  • Semantic correctness
  • Hallucination rate
  • Faithfulness
  • Consistency
  • Toxicity
  • Latency
  • Diagnosis precision
  • Diagnosis recall
  • Diagnosis F1
  • Healing success rate
  • Regression rate
  • Healing latency overhead
  • Token overhead

πŸ§ͺ Ablation Studies

To understand which components contribute to performance, SENTINEL can be evaluated with individual components removed.

Examples:

Full SENTINEL

SENTINEL without multi-model diagnosis

SENTINEL without RAG re-ranking

SENTINEL without historical model analysis

SENTINEL without prompt healing

SENTINEL without verification

The results can be compared to determine the contribution of each component.


πŸ“ˆ Experiment Tracking

Each experiment should record information such as:

Model
Model Version
Prompt Version
Dataset Version
Question
Category
Response
Latency
Evaluation Scores
Diagnosis
Diagnosis Confidence
Healing Strategy
Healed Response
Before Score
After Score

MLflow can be used for experiment tracking, while Git and DVC can be used for code, prompt, and dataset versioning.

The goal is reproducibility.


πŸ” Privacy

SENTINEL is designed around local inference.

When running in local mode:

Questions
Documents
Prompts
LLM Responses
Embeddings
Evaluation Results

can remain on the user's machine.

No external LLM API is required for the core local evaluation workflow.


πŸš€ Future Server Mode

Although SENTINEL is local-first, the architecture can later support centralized deployment.

                    Load Balancer
                         β”‚
                         β–Ό
                  FastAPI Instances
                         β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
                β–Ό                 β–Ό
              Redis           PostgreSQL
                β”‚
                β–Ό
        Evaluation Workers
                β”‚
                β–Ό
       Ollama / vLLM Servers
                β”‚
                β–Ό
             LLMs

This enables:

  • Team-wide evaluation
  • Centralized experiment tracking
  • Multiple workers
  • Horizontal scaling
  • Shared dashboards
  • CI/CD integration

πŸ”„ CI/CD Evaluation Gate

SENTINEL extends traditional CI/CD by evaluating AI quality before deployment.

Developer Commit
       ↓
Unit Tests
       ↓
Integration Tests
       ↓
Build
       ↓
LLM Evaluation Suite
       ↓
Compare Against Baseline
       ↓
Quality Gate
       β”‚
   β”Œβ”€β”€β”€β”΄β”€β”€β”€β”€β”
   β–Ό        β–Ό
 PASS      FAIL
   β”‚        β”‚
   β–Ό        β–Ό
Deploy    Block

Example quality policies:

Correctness below threshold
        β†’ FAIL

Hallucination above threshold
        β†’ FAIL

Faithfulness below threshold
        β†’ FAIL

Significant latency regression
        β†’ FAIL

This allows AI quality regression to become a deployment concern.


πŸ›£οΈ Development Roadmap

Month 1 β€” Core Infrastructure

  • Ollama setup
  • Local model integration
  • FastAPI
  • SQLite
  • Basic evaluation engine
  • Semantic similarity
  • Latency evaluation
  • Initial hallucination/grounding evaluation
  • Docker development environment

Month 2 β€” LLMOps Pipeline

  • DeepEval integration
  • DVC
  • MLflow
  • Redis/background workers
  • Expanded evaluation metrics
  • Evaluation datasets

Month 3 β€” Diagnosis & Self-Healing

  • Multi-model diagnosis
  • Knowledge-gap detection
  • Model weakness detection
  • Prompt healer
  • RAG healer
  • Verification
  • A/B testing

Month 4 β€” CI/CD

  • GitHub Actions
  • Automated evaluation
  • Baseline comparison
  • Quality gates
  • Deployment blocking
  • Regression testing

Month 5 β€” Application & Deployment

  • Desktop application
  • React dashboard
  • Evaluation visualization
  • Failure analysis
  • Healing history
  • Model comparison
  • Monitoring
  • Packaging

Month 6 β€” Research & Benchmarking

  • Large-scale benchmark
  • Model comparison
  • Ablation studies
  • Error analysis
  • Statistical analysis
  • Research report
  • Paper preparation
  • Demo
  • Documentation

πŸ‘₯ Team Responsibilities

AI/ML

Responsible for:

  • LLM integration
  • Evaluation engine
  • Embeddings
  • Evaluation metrics
  • Diagnosis
  • RAG
  • Prompt healing
  • RAG healing
  • Model weakness detection
  • A/B testing
  • AI experiments
  • Research methodology

Backend

Responsible for:

  • FastAPI
  • API design
  • Database
  • SQLAlchemy
  • Application services
  • Evaluation job management
  • Result persistence
  • Backend testing

DevOps / LLMOps

Responsible for:

  • Docker
  • Docker Compose
  • GitHub Actions
  • DVC infrastructure
  • MLflow infrastructure
  • Kubernetes
  • CI/CD
  • Evaluation gates
  • Monitoring
  • Deployment

🀝 Development Workflow

SENTINEL uses a feature-branch workflow.

main
 β”‚
 β”œβ”€β”€ feature/ai-*
 β”œβ”€β”€ feature/backend-*
 └── feature/devops-*

Development process:

Create Feature Branch
        ↓
Develop
        ↓
Run Tests
        ↓
Commit
        ↓
Push
        ↓
Pull Request
        ↓
Code Review
        ↓
CI Checks
        ↓
Merge into main

The main branch should remain stable.


πŸ§ͺ Testing Strategy

SENTINEL uses multiple testing levels.

Unit Tests

Test individual:

  • Metrics
  • Embedding functions
  • Diagnosis logic
  • Healing logic
  • API services

Integration Tests

Test:

API
 ↓
Evaluation Service
 ↓
AI Engine
 ↓
Database

End-to-End Tests

Test the complete workflow:

Question
 ↓
LLM
 ↓
Evaluation
 ↓
Diagnosis
 ↓
Healing
 ↓
Verification
 ↓
Stored Result

πŸ“œ License

This project is licensed under the MIT License.

See LICENSE for details.


🚧 Project Status

SENTINEL is currently under active development.

The architecture and research methodology may evolve as experiments are conducted and results are analyzed.

The current development priority is:

Core Infrastructure
        ↓
LLM Evaluation
        ↓
Failure Diagnosis
        ↓
Self-Healing
        ↓
LLMOps / CI-CD
        ↓
Research Benchmark

⭐ Vision

SENTINEL aims to move LLM applications from:

"Does the application work?"

to:

"Is the AI system still performing correctly,
why did it fail, can it fix itself,
and should this version be deployed?"

The long-term goal is to provide a local-first, autonomous quality and reliability layer for LLM applications.


Project

SENTINEL β€” Autonomous LLMOps and Self-Healing Evaluation Platform

Built as a collaborative AI/ML, backend, and DevOps engineering project.

Status: 🚧 Under Development

About

A local-first autonomous LLMOps platform for continuous LLM evaluation, failure diagnosis, and self-healing using local models.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages