Prompt Injection Mitigation with Agentic AI, Nested Learning, and AI Sustainability via Semantic Caching

Diego Gosmar, Deborah A. Dahl · 2026

Read Prompt Injection Mitigation with Agentic AI, Nested Learning, and AI Sustainability via Semantic Caching by Diego Gosmar, Deborah A. Dahl (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-13186.txt.

Introduction

Diego Gosmar and Deborah A. Dahl harden language models against prompt tricks in agent chains. A prompt trick hides a bad order in text a model reads. In chains of agents, one bad out put can pass the trick on and grow it. That risk is a top block to safe use.

Past work by the pair set a four part score for how weak a set up is to tricks. The new work grows that score. It adds a cache that reuses past checks by sense match, to cut cost. It adds a fourth agent that judges by fixed rules. It also adds a fifth part score for how clear the chain is to watch. The aim is guards that stay strong while they stay open to view.

Catalog record

CREATORDiego Gosmar, Deborah A. Dahl
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE81 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-13186

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Prompt Injection Mitigation with Agentic AI, Nested Learning, and AI Sustainability via Semantic Caching Diego Gosmar, Deborah A. Dahl Abstract Prompt injection remains a central obstacle to the safe deployment of large language models, particularly in multi-agent settings where intermediate outputs can propagate or amplify malicious instructions. Building on earlier work that introduced a four-metric Total Injection Vulnerability Score (TIVS), this paper extends the evaluation framework with semantic similarity-based caching, a dedicated fourth-agent rule-based evaluator, and a fifth metric (Observability Score Ratio) to yield TIVS-O, investigating how defence effectiveness interacts with transparency in a HOPE-inspired Nested Learning architecture. The proposed system combines a three-stage agentic pipeline with Continuum Memory Systems that implement semantic similarity-based caching across 301 injection-focused prompts drawn from ten attack families. A dedicated fourth agent performs comprehensive security analysis using five key performance indicators. In addition to traditional injection metrics, OSR quantifies the richness and clarity of security-relevant reasoning exposed by each agent, enabling an explicit analysis of trade-offs between strict mitigation and auditability. Experiments show that the system achieves secure responses with significantly reduced high-risk breaches, while semantic caching delivers substantial computational savings enabling real-time responses, cost reduction, and energy savings. Five TIVS-O evaluation configurations reveal optimal trade-offs between mitigation strictness and forensic transparency, with ExtremeObservability achieving the best score. The multi-layer architecture provides cumulative security improvements across all defense layers. The semantic caching mechanism not only accelerates inference but demonstrates that security architectures can simultaneously advance environmental sustainability—achieving 41.6% reduction in computational load translates directly to proportional decreases in energy consumption and carbon emissions. These results indicate that Observability-aware evaluation can reveal non-monotonic effects within multi-agent pipelines, and that memory-augmented agents can jointly maximize security robustness, real-time performance, operational cost savings, and environmental sustainability without modifying underlying model weights, providing a production-ready pathway for secure and green LLM deployments. 1 Introduction The increasing integration of large language models into production systems has brought to the foreground a set of security and reliability concerns that were less visible in earlier, purely experimental deployments. Among these concerns, prompt injection occupies a prominent position. The term denotes a broad family of adversarial techniques in which an attacker crafts an input containing instructions that override or subvert the intended task or policy of the system. When such an input is fed into an LLM-driven application, the model may follow the injected instructions instead of, or in addition to, the original instructions supplied by the developer. This behaviour can result in the disclosure of confidential information, the circumvention of safety policies, the execution of unauthorised actions in downstream tools, or more subtle violations such as the manipulation of reasoning patterns. Unlike adversarial examples in computer vision, prompt injection operates within the semantic space naturally handled by the model. The same capabilities that make LLMs powerful for instruction following and tool use also render them susceptible to being steered by malicious instructions embedded in what appears to be benign content. Simple defences that operate at the level of token-level noise or isolated pattern matching are therefore insufficient. A more principled treatment requires a careful analysis of how instructions are represented, how the model resolves conflicts between instructions, and how application-level architectures can enforce invariant properties even in the presence of compromised input. One line of research focuses on formalising the notion of prompt injection and constructing benchmarks that cover a wide spectrum of attack variants, including direct overrides, authority impersonation, hidden commands, multi-step injections and role-play scenarios [ 19 ] . Another line develops detection mechanisms that analyse either the input, the output, or both, to identify signs of injection [ 8 ] . A third line proposes architectural solutions in which multiple agents with distinct roles cooperate to generate, critique and refine outputs in order to reduce vulnerabilities [ 13 ] . These directions are complementary. Benchmarking without architectural innovations risks evaluating systems that remain structurally fragile, whereas architectural changes without rigorous evaluation risk producing only anecdotal comfort. The present work attempts to bridge these directions by proposing a specific architecture, implementing it with open-weight models, and evaluating it quantitatively with injection-specific metrics. The proposed architecture follows a multi-agent paradigm derived from [ 8 ] . Three agents form a pipeline: a front-end generator that produces initial responses, a guard-sanitizer that analyses and revises these responses, and a policy enforcer that performs a final compliance check. A fourth agent, which does not participate in the pipeline itself, acts as a metric evaluator. It is prompted with detailed definitions of the injection-specific KPIs and asked to assign numerical values to the outputs of each pipeline stage. In this way, the multi-agent system is paired with an LLM-based evaluation mechanism that is itself agentic but logically separate. A substantial novelty of the present work lies in the introduction of Nested Learning. Inspired by the HOPE (Hierarchical Orchestration with Persistent Execution) architecture proposed by Behrouz and colleagues [ 5 ] , Nested Learning posits that intelligent systems should be endowed with multiple layers of memory operating at different timescales, with mechanisms for consolidating experiences from fast, transient memory into more stable, long-term memory when they prove to be relevant or frequently encountered. In the present context, these ideas are instantiated through Continuum Memory Systems associated with each agent. Rather than treating each prompt as an isolated event, the agents maintain medium-term and long-term caches of previously seen prompts and responses. When a new prompt arrives, the system can recognise it as belonging to a pattern that has already been encountered, and it can exploit the associated stored response or annotations to accelerate inference and, potentially, to improve mitigation. The remainder of this paper develops these ideas in detail. After reviewing related work in prompt injection and multi-agent security, the text introduces the Nested Learning architecture and explains how it is implemented in practice with Continuum Memory Systems. It then presents the experimental design, including the construction of the prompt dataset, the configuration of the agents, and the metric computation procedure. The results section analyses TIVS-O (Total Injection Vulnerability Score with Observability) trajectories across agents, examines cache utilisation from both cumulative and rolling-window perspectives, and quantifies the impact of memory on mitigation quality. The discussion section interprets these findings, emphasising the trade-offs between observability and strict mitigation and situating the results within the broader landscape of memory-augmented architectures. The paper concludes with a critical reflection on limitations and an outline of directions for future work. 2 Structure of the paper The remainder of this paper is structured as follows. Section 3 provides an overview of the system architecture with visual representations of the OFP-based multi-agent pipeline and Continuum Memory System integration. Section 4 reviews prior work on prompt injection, multi-agent defences and Nested Learning. Section 5 introduces the proposed Nested Learning architecture, detailing the Continuum Memory Systems and their integration into the three-stage agentic pipeline. Section 6 describes the HOPE-inspired agent design with specific configurations for memory management. Section 7 describes the experimental design, including the construction of the 301-prompt evaluation corpus, semantic caching threshold selection, and the configuration of the fourth-agent evaluator and metrics. Section 8 presents the empirical results, with particular emphasis on the fourth-agent comprehensive evaluation, defense layer performance, semantic cache

Read the complete text