Defend LLMs Through Self-Consciousness

Boshi Huang, Fabio Nonato de Paula
8/4/2025
cs.AIcs.CLcs.CR

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

This paper introduces a novel self-consciousness defense mechanism for Large Language Models (LLMs) to combat prompt injection attacks. Unlike traditional approaches that rely on external classifiers, our method leverages the LLM's inherent reasoning capabilities to perform self-protection. We propose a framework that incorporates Meta-Cognitive and Arbitration Modules, enabling LLMs to evaluate and regulate their own outputs autonomously. Our approach is evaluated on seven state-of-the-art LLMs using two datasets: AdvBench and Prompt-Injection-Mixed-Techniques-2024. Experiment results demonstrate significant improvements in defense success rates across models and datasets, with some achieving perfect and near-perfect defense in Enhanced Mode. We also analyze the trade-off between defense success rate improvement and computational overhead. This self-consciousness method offers a lightweight, cost-effective solution for enhancing LLM ethics, particularly beneficial for GenAI use cases across various platforms.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{huang2025defend,
  title  = {Defend LLMs Through Self-Consciousness},
  author = {Boshi Huang and Fabio Nonato de Paula},
  year   = {2025},
  eprint = {2508.02961},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.02961v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.02961.svg)](https://codeofpaper.com/paper/2508.02961)

Discussion