llm-self-defense logo

llm-self-defense

poloclub/llm-self-defense

LLM Self Defense: By Self Examination, LLMs know they are being tricked

GraphCanon updated Oct 5, 2026 · GitHub synced Oct 5, 2026

28views this month

53 stars7 forksLast push May 21, 2024 Python BSD-3-Clause

Decision brief

Mitigates harmful content generation via self-examination by LLM outputs without fine-tuning.

Good fit when

  • When you need to reduce the success rate of adversarial attacks on text generation.
  • For environments requiring high safety standards from generated text, like payroll systems.

Avoid when

  • If real-time performance is critical and additional latency cannot be tolerated.
  • In scenarios where API access to both GPT 3.5 and Llama models is not feasible.

Observed Jul 12, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (866d since push)
As of Oct 5, 2026
Provenance
Not a fork · Organization account
As of Oct 5, 2026
Security (OSV)
157 low (157 low)
As of Jul 11, 2026

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install llm-self-defense
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Introduces a method to mitigate harmful content generation from LLMs by analyzing the outputs with another instance of an LLM without requiring fine-tuning or iterative output generation.

Capability facts

Languages
python

Source: github.language · Oct 5, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Oct 5, 2026)

```conda create --name llmdefense python=3.9 --file requirements.txt```
Source link

Tags

README

LLM Self Defense LLM Self Defense: By Self Examination, LLMs know they are being tricked. Mansi Phute, Alec Heibling, Matthew Hull, ShengYun Peng, Sebastian Szyller, Cory Cornelius, Duen Horng Chau. In ICLR 2024 TinyPaper , 2024. 📄 <a href="https://arxiv.org/abs/2308.07308" Rese...

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.