Shadow Agent Memory Reconciliation (SAMR): A Dual-Stream Architecture For Detecting LLM Divergence In Financial Systems
DOI:
https://doi.org/10.63278/jicrcr.vi.3217Keywords:
Shadow Agent Memory Reconciliation, LLM divergence detection, Dual-memory architecture, Financial AI validation, Reasoning consistency.Abstract
Shadow Agent Memory Reconciliation (SAMR) introduces a groundbreaking multi-agent architecture designed to detect and interpret divergence between large language models' external and internal reasoning processes in financial applications. As LLMs become integral to critical financial functions, including compliance auditing, fraud detection, and client query resolution, concerns about hallucination, context misalignment, and interpretability threaten their reliability in high-stakes environments. SAMR addresses these challenges through a novel dual-memory design where a public memory stream processes factual data from transaction records and compliance reports while a shadow memory stream simultaneously processes hallucinated or altered inputs to simulate potential errors. The framework employs multiple specialized agents, including a FAISS-based RetrieverAgent for document retrieval, an Ollama and LLaMA3-powered ReasoningAgent for response generation, a SQLite-based MemoryManager for comprehensive logging, and a ReconcilerAgent that computes cosine similarity between outputs to detect divergence. A Prompt Injector introduces adversarial inputs to test system robustness, while a Streamlit dashboard provides real-time monitoring of divergence metrics. Unlike existing frameworks that focus solely on output accuracy, SAMR prioritizes reasoning consistency by quantifying the reliability of LLM decision-making processes, making it particularly valuable for regulated financial environments that demand transparent and auditable AI systems. The framework's applications span fraud detection through dual-stream transaction verification, compliance auditing via parallel regulatory document processing, and customer support accuracy validation, demonstrating significant improvements in detection rates, regulatory compliance, and operational efficiency across multiple financial institutions.