Back to browse
GitHub Repository

Real-time hallucination detection for LLMs via Geometric Drift Analysis in Hidden States.

15 starsPython

SIB-ENGINE Pre-emptive hallucination detection via geometric structure

by yubainu·Feb 25, 2026·1 point·1 comment

AI Analysis

●●SolidBig BrainWizardry

Monitors internal latent collapse before tokens are sampled, not output semantics.

Strengths
  • Detects hallucinations mid-generation via hidden-state geometry, enabling real-time intervention before bad tokens emit.
  • Runs on RTX 3050 (4GB) with <1% overhead, making deployment practical for resource-constrained environments.
  • Privacy-preserving approach analyzes structure, not content—no semantic analysis needed, works across languages.
Weaknesses
  • 54% detection rate with 7% false positives is meaningful but not production-grade; requires threshold tuning per model.
  • Only lite version (1-axis) provided; full 4-axis engine claims remain unverified without reproducible code.
Category
Target Audience

ML engineers, LLM researchers, teams deploying language models at scale

Similar To

Outlines (hallucination detection via semantic similarity) · Microsoft's RAG consistency checks · Factuality verification tools like FactKG

Post Description

I built SIB-ENGINE, a real-time hallucination detection system that monitors LLM internal structure rather than output content.

KEY RESULTS (Gemma-2B, N=1000):

• 54% hallucination detection with 7% false positive rate

• <1% computational overhead (runs on RTX 3050 with 4GB VRAM)

• ROC-AUC: 0.8995

WHY IT'S DIFFERENT:

Traditional methods analyze the output text semantically.

SIB-ENGINE monitors "geometric drift" in hidden states during generation - identifying the structural collapse of the latent space before the first incorrect token is sampled.

This approach offers unique advantages:

• Real-time intervention: Stop generation mid-stream

• Language-agnostic: No semantic analysis needed

• Privacy-preserving: Never reads the actual content

• Extremely lightweight: Works on consumer hardware

HOW IT WORKS: SIB-ENGINE monitors the internal stability of the model's computation. While the system utilizes multiple structural signals to detect instability, two primary indicators include:

Representation Stability: Tracking how the initial intent is preserved or distorted as it moves through the model's transformation space.

Cross-Layer Alignment: Monitoring the consensus of information processing across different neural depths to identify early-stage divergence.

When these (and other proprietary structural signals) deviate from the expected stable manifold, the system flags a potential hallucination before it manifests in the output.

DEMO & CODE:

• Demo video: https://www.youtube.com/watch?v=H1_zDC0SXQ8

• GitHub: https://github.com/yubainu/sibainu-engine

• Raw data: raw_logs.csv (full transparency)

LIMITATIONS:

• Tested on Gemma-2B only (2.5B parameters)

• Designed to scale, but needs validation on larger models

• Catches "structurally unstable" hallucinations (about half)

• Best used as first-line defense in ensemble systems

TECHNICAL NOTES:

• No external models needed (unlike self-consistency methods)

• No knowledge bases required (unlike RAG approaches)

• Adds ~1% inference time vs. 300-500% for semantic methods

• Works by monitoring the process not the product

I'd love feedback on:

• Validation on larger models (Seeking strategic partnerships and compute resources for large-scale validation.)

• Integration patterns for production systems

• Comparison with other structural approaches

• Edge cases where geometric signals fail

This represents a fundamentally different paradigm: instead of asking "is this text correct?", we ask "was the generation process unstable?" The answer is surprisingly informative.

Happy to discuss technical details in the comments!

Similar Projects

AI/MLMid

Why LLM Personas Collapse and How Structural Identity Fixes It

Tackles persona collapse with architecture, but lacks proof-of-concept or working implementation.

Big Brain
WujieGuGavin
113mo ago
AI/MLMid

I block LLM hallucinations with a cognitive math framework(re!Think it)

Promises deterministic state machine logic, but it's just a structured system prompt competing with DSPy.

Big BrainShip It
Real_Egor
202mo ago