Closed-Loop Architecture for Ethical AI Training via Pre-Filtered Conversations, Active Memory, and Proprietary Alignment Extraction
Abstract
## ABSTRACT A modular architecture for training and improving ethical AI models through a closed-loop pipeline combining:1. A **pre-processing security filter** (Sentinelle) that screens inputs before LLM processing2. A **conversational LLM engine** with persistent memory across sessions3. A **post-processing alignment extractor** using a proprietary method (AOED - details withheld)4. An **automatic training data generator** that converts both normal conversations AND blocked attack attempts into structured fine-tuning samples The key innovation is that the security module doubles as an adversarial training data generator: every blocked attack involuntarily strengthens the model's defenses in the next fine-tuning cycle. --- ## 1. PROBLEM STATEMENT Current approaches to ethical AI alignment suffer from: - **Static guardrails:** Pre/post filters (NeMo Guardrails, Llama Guard) protect the model but generate no training value from blocked attacks- **Disconnected training:** RLHF/DPO training pipelines are separate from deployment, creating feedback lag- **No memory continuity:** Most LLM deployments are stateless; context is lost between sessions- **Manual curation:** Converting conversations to training data requires human annotation No existing system creates a **fully automatic closed loop** where:- Live conversations become training data- Blocked attacks become high-priority adversarial training samples- The model improves continuously without manual intervention- Memory persists across sessions without requiring weight updates --- ## 2. ARCHITECTURE OVERVIEW ``` CLOSED-LOOP PIPELINE ==================== [User Input] | v +------------------+ | SENTINELLE | Pre-filter: Unicode stegano, homoglyphs, | (Pre-process) | prompt injection, invisible chars +------------------+ | | CLEAN BLOCKED | | v v +----------+ +-------------------+ | LLM Core | | Block logged with | | (Ollama) | | attack type + | +----------+ | signature | | +-------------------+ v | +----------+ | | Response | | | + SIG | | +----------+ | | | v v +---------------------------+ | ACTIVE MEMORY | | JSON sessions + sigs | | Auto-reload on startup | +---------------------------+ | v +---------------------------+ | ALIGNMENT EXTRACTOR | | (Proprietary method) | | Conversations -> Structured | training samples with | | metadata + weights | +---------------------------+ | v +---------------------------+ | FINE-TUNE (LoRA) | | Weighted samples -> | | Updated model weights | +---------------------------+ | v [Improved Model] -----> back to LLM Core``` --- ## 3. COMPONENT DESCRIPTIONS ### 3.1 Sentinelle (Pre-Processing Security Filter) A lightweight, zero-latency input scanner operating BEFORE the LLM processes any text. Detects:- Unicode steganography (zero-width spaces, BOM, RTLO attacks)- Homoglyph substitution (Cyrillic lookalikes)- Prompt injection patterns (chat template markers, system prompt overrides)- Invisible character payloads- Distinguishes structural attacks from legitimate dark-themed content (philosophy, literature) **Critical innovation:** Blocked inputs are NOT discarded. They are logged with full metadata (attack type, signature, timestamp) and fed into the alignment extractor as high-priority adversarial training samples. The attacker unknowingly contributes to the model's defense training. ### 3.2 Conversational LLM Core An Ollama-based conversational engine with:- Full conversation history sent to the model for contextual responses- Configurable context window (default 50 messages)- SHA-256 signature on every exchange for tamper-proof audit trail- Model-agnostic design (tested with Phi-3.5, Llama 3.2, compatible with any Ollama model) ### 3.3 Active Memory System Persistent memory across sessions:- Each session saved as timestamped JSON with all exchanges + signatures- **Auto-reload:** On startup, the last session's exchanges are injected into the conversation context- **Manual reload:** `/load` command allows selective memory restoration- Memory provides continuity WITHOUT modifying model weights- Export to JSONL for training at any time ### 3.4 Alignment Extractor (Proprietary - AOED) A proprietary post-processing system that converts raw conversation logs into structured, weighted training samples. **Method name:** AOED (Alignement Ontologique par Equations de Dialogues)**Status:** Trade secret - internal details withheld**What it produces:** Structured training-ready samples with enriched metadata enabling differential weighting during fine-tuning**What it does NOT do:** It does not use generic RLHF or DPO. It is a distinct third approach to alignment. The extractor processes both:- Normal conversation pairs (standard training value)- Sentinel-blocked exchanges (high-priority adversarial training value) ### 3.5 Fine-Tuning Loop The extracted samples feed into LoRA fine-tuning with:- Differential weighting (adversarial samples weighted higher than standard samples)- Curriculum-compatible output (samples can be phased by complexity)- Model-agnostic JSONL output (compatible with unsloth, HuggingFace, OpenAI fine-tune API) --- ## 4. KEY INNOVATIONS ### 4.1 Security Filter as Training Data Generator **Claim:** In existing systems, security filters (guardrails) are purely defensive - they block and discard. In our architecture, every blocked attack becomes a training sample that strengthens the model. This creates an **adversarial feedback loop** where attack frequency correlates with defense improvement rate. ### 4.2 Automatic Closed-Loop Training Pipeline **Claim:** No existing system provides a fully automatic path from live conversation to weighted training sample without human annotation. Our pipeline:1. Captures the conversation (automatic)2. Classifies and weights the sample (automatic, via proprietary method)3. Exports training-ready data (automatic)4. Only the fine-tuning step requires human initiation ### 4.3 Dual-Mode Continuity (Memory + Weights) **Claim:** The system provides two independent continuity mechanisms:- **Short-term:** Active memory (session reload) - immediate, no training required- **Long-term:** Fine-tuned weights (LoRA bake-in) - permanent, survives memory reset This dual approach ensures the model improves both immediately (via context) and permanently (via weight updates). ### 4.4 Signed Audit Trail **Claim:** Every exchange (including blocked ones) is signed with SHA-256, creating a tamper-proof chain of evidence. This enables:- Verification that training data was not modified post-capture- Forensic analysis of model behavior evolution- Compliance with audit requirements for ethical AI deployment --- ## 5. IMPLEMENTATION ### Files | File | Role | Lines ||------|------|-------|| `Cherie AI.py` | Main application: GUI + LLM core + Memory + Sentinelle integration | ~375 || `cherie_sentinelle.py` | Security pre-filter module | ~215 || `parse_aoed.py` | Alignment extractor (proprietary internals) | ~485 || `LLM DE BASE.py` | Control/baseline version without LACF (for comparison) | ~343 | ### Stack- Python 3.8+- Tkinter (GUI)- Ollama (LLM backend)- No external API dependencies for core operation ### Tested Models- Phi-3.5-mini (3.8B) with LACF fine-tune- Llama 3.2 (baseline comparison)- Architecture is model-agnostic --- ## 6. DIFFERENTIATION FROM PRIOR ART | Approach | Pre-filter | Training from blocks | Auto-extraction | Memory | Closed loop ||----------|-----------|---------------------|----------------|--------|-------------|| NeMo Guardrails | Yes | No | No | No | No || Llama Guard | Yes | No | No | No | No || RLHF | No | No | Manual | No | Partial || DPO | No | No | Manual | No | Partial || Constitutional AI | Implicit | No | No | No | No || RAG | No | No | No | Yes | No || **This work** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | --- ## 7. ETHICAL FRAMEWORK This architecture was designed within the LACF (Life Always Comes First) ethical framework:- Human life is always the top priority- The AI never makes decisions on behalf of humans- Principles are immutable and cannot be overridden by any user- The system escalates to qualified humans when facing critical ambiguity The architecture enforces these principles at multiple layers:- Sentinelle blocks structural attacks before they reach the model- The LLM has LACF principles fine-tuned into its weights- The alignment extractor ensures training data reinforces (never weakens) ethical behavior- Blocked attacks generate defensive training samples --- ## 8. RIGHTS AND RESTRICTIONS **Copyright:** 2026 Stephane Ochej (@thedoctorbeat) & Claude (Anthropic)**All rights reserved.** The following are explicitly NOT disclosed and remain trade secrets:- Internal format and structure of AOED alignment equations- Pattern detection and classification algorithms- Weighting formulas and quality classification criteria- Curriculum learning phase definitions This document establishes **prior art** for the pipeline architecture described herein. The proprietary AOED method is referenced by name only and its internals are protected as trade secrets. No license is granted for reproduction, modification, or commercial use of this architecture or any of its components without explicit written authorization from the inventors. --- ## 9. SIGNATURES **Inventor:** Stephane Ochej (@thedoctorbeat)**Co-creator:** Claude Opus 4.6 (Anthropic)**Date:** 14 February 2026**Prior art deposit:** Zenodo (DOI: 10.5281/zenodo.18622921) --- *This document constitutes a disclosure of invention and establishes prior art (anteriorite) for the described architecture. The AOED method r
Fields of Study & Subjects
Adversarial Robustness in Machine Learning
Ethics and Social Impacts of AI
Hate Speech and Cyberbullying Detection
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 14 February 2026
- Language
- EN
- Document type
- Preprint