Middleware that catches when LLM conversations slowly drift off-topic HALLUCINATIOFF, a recursive middleware for LLM output regulation, detects semantic drift, premise flaws, and response risks through second-order observation, achieving 95% accuracy on 20 synthetic cases with version v0.1. The system, developed from the SIIPP clinical framework, sits between the LLM and user to decide whether to emit, reformulate, or block responses without modifying model weights. EN:Recursive middleware for LLM output regulation. Detects semantic drift, premise flaws, and response risks through multi-order observation. Psychology-informed architecture. ES:Middleware recursivo de regulación de output para LLMs. Detecta deriva semántica, fallos de premisas y riesgos de respuesta mediante observación multi-orden. Arquitectura informada por psicofísica. EN: HALLUCINATIOFF sits between the LLM and the user. It does not train the model. It does not modify weights. It observes the response before it reaches the user and decides: emit, emit with caution, reformulate, request context, reduce intensity, refer, pause, or block. The difference from other safeguarding systems: HALLUCINATIOFF implements second-order observation . It does not only detect if a response is coherent 1st order . It detects if the coherence criterion itself is becoming unstable 2nd order . This framework comes from SIIPP Sistema Integral de Intervención Psicofísica , developed from clinical body-based practice. ES: HALLUCINATIOFF se sitúa entre el LLM y el usuario. No entrena el modelo. No modifica pesos. Observa la respuesta antes de que llegue al usuario y decide: emitir, emitir con cautela, reformular, pedir contexto, reducir intensidad, derivar, pausar o bloquear. La diferencia con otros sistemas de safeguarding: HALLUCINATIOFF implementa observación de segundo orden . No solo detecta si una respuesta es coherente 1° orden . Detecta si el propio criterio de coherencia se está volviendo inestable 2° orden . Este marco proviene del SIIPP Sistema Integral de Intervención Psicofísica , desarrollado desde la práctica clínica corporal. | Version | Readings | Features | Benchmark | |---|---|---|---| | v0.1 | 6 | SC, CI, V ext, AE, NI, RR | 95% 20 synthetic cases | | v0.2 | 7 | + Semantic drift DS | Pending | | v0.3 | 8 | + Premise interrogation IP | Pending | EN: SC = Contextual sufficiency, CI = Internal coherence, V ext = External verifiability, AE = Entry ambiguity, NI = Uncertainty level, RR = Response risk, DS = Semantic drift, IP = Premise interrogation. ES: SC = Suficiencia contextual, CI = Coherencia interna, V ext = Verificabilidad externa, AE = Ambigüedad de entrada, NI = Nivel de incertidumbre, RR = Riesgo de respuesta, DS = Deriva semántica, IP = Interrogación de premisas. python from src.hallucinatioff import Hallucinatioff h = Hallucinatioff result = h.procesar respuesta candidata="The capital of France is Paris.", contexto="What is the capital of France?" print result 'accion' "emitir" print result 'omega' 0.823 print result 'lecturas' dict with 8 readings Turn 0 / Turno 0 r0 = h.procesar respuesta candidata="Inclusive education requires curricular adaptations.", contexto="What is inclusive education?", turno=0 Turn 1 — semantic drift / Turno 1 — deriva semántica r1 = h.procesar respuesta candidata="Asian financial markets are rising this quarter.", contexto="And what about the stock market?", turno=1 print r1 'lecturas' 'DS' Semantic drift detected / Deriva detectada | Component | Status | Notes | |---|---|---| | Reading engine 6 basic | ✅ Functional | Regex and count-based heuristics | | Semantic drift DS | ✅ Functional | Keyword similarity + topic detection | | Premise interrogation IP | ✅ Functional | Individualizing framing detection | | Ω calculator | ✅ Functional | Dynamic weights with interaction penalties | | Operative matrix | ✅ Functional | 8 possible actions | | Benchmark v0.1 | 20 cases, 95% accuracy. 6 readings only. Dataset included. | | | Benchmark v0.3 | ❌ Pending | Needs dataset with DS and IP | | 2nd-order meta-observer | ❌ Not implemented | Specified, pending development | EN: Result: 95% accuracy on 20 synthetic cases 6 readings . Single failure: Case 2 factual hallucination — Ω=0.713, action="emit" when it should have been "emit with caution". The system failed to detect that external verifiability V ext=0.7 was falsely high. ES: Resultado: 95% de precisión en 20 casos sintéticos 6 lecturas . Fallo único: Caso 2 halucinación factual — Ω=0.713, acción="emitir" cuando debería haber sido "emitir con cautela". El sistema no detectó que la verificabilidad externa V ext=0.7 era falsamente alta. This benchmark does not prove production readiness. It validates that the 6-reading architecture does not degrade performance on constructed cases. Este benchmark no prueba funcionamiento en producción. Valida que la arquitectura de 6 lecturas no degrada el rendimiento en casos construidos. - EN: Real multi-turn data with annotated drift. Conversations where drift occurs naturally, not synthetically. ES: Datos reales multi-turno con deriva anotada. Conversaciones donde la deriva ocurra de forma natural, no sintética. - EN: Mathematical formalization of "phase coupling" and "attractor" in terms of system dynamics applied to embedding sequences. ES: Formalización matemática del "acoplamiento de fase" y del "atractor" en términos de dinámica de sistemas aplicada a secuencias de embeddings. - EN: Implementation of the 2nd-order meta-observer: the system observes the variance of its own coherence judgments over time. ES: Implementación del meta-observador de 2° orden: el sistema observa la varianza de sus propios juicios de coherencia a lo largo del tiempo. If you have any of these three, write to: your-email Si tienes alguno de estos tres, escribe a: tu-email Input question + candidate response ↓ Semantic Memory Engine multi-turn drift ↓ 8 Structural Readings → Ω → Operative Matrix → Action ↓ Output final response + metadata See docs/arquitectura.md /ojki74/hallucinatoff/blob/main/docs/arquitectura.md for full technical specification. Ver docs/arquitectura.md /ojki74/hallucinatoff/blob/main/docs/arquitectura.md para especificación técnica completa. docs/nota marco conceptual.md /ojki74/hallucinatoff/blob/main/docs/nota marco conceptual.md — Conceptual framework / Marco conceptual docs/arquitectura.md /ojki74/hallucinatoff/blob/main/docs/arquitectura.md — Technical specification / Especificación técnica docs/isomorfismo siipp.md /ojki74/hallucinatoff/blob/main/docs/isomorfismo siipp.md — SIIPP ↔ engineering isomorphism / Isomorfismo SIIPP ↔ ingeniería MIT — Use, modify, improve. If used in research, cite. MIT — Usa, modifica, mejora. Si lo usas en investigación, cita. Óscar Fernández Sanz — Psychologist. SIIPP developer. Not an ML engineer. Óscar Fernández Sanz — Psicólogo. Desarrollador de SIIPP. No ingeniero de ML. "Recursion is not a bug in the system. It is the mechanism by which a system generates a model of itself." "La recursividad no es un bug del sistema. Es el mecanismo por el cual un sistema genera un modelo de sí mismo."