llm-guard
LLM-Guard is a comprehensive tool designed to fortify the security of Large Language Models (LLMs). By offering sanitization, detection of harmful language, prevention of data leakage, and resistance against prompt injection attacks, LLM-Guard ensures that your interactions with LLMs remain safe and secure.
What it is and what it does
LLM Guard is a security toolkit that scans both user inputs (prompts) and model outputs to detect and mitigate threats in Large Language Model interactions. It offers multiple scanning strategies including prompt injection detection, PII anonymization, secret detection, toxicity analysis, and output validation for harmful content, code injection, and factual consistency. The package integrates with popular LLM APIs and is designed for production deployment.
The package depends on 12 runtime libraries spanning NLP (nltk, transformers, tiktoken), data anonymization (presidio-analyzer, presidio-anonymizer, faker), and ML inference (torch). However, the project is now abandoned—its repository is archived and the last commit was 2026-07-08, meaning no new features, bug fixes, or security patches will be released. For teams considering adoption, this means relying on a static codebase for an inherently security-sensitive tool.
Use it for:
- Scan user prompts before sending to a production LLM API to block prompt injection and data exfiltration attempts
- Anonymize personally identifiable information in user inputs and deanonymize model outputs to comply with privacy requirements
- Detect and filter toxic, biased, or harmful language in both prompts and LLM responses
- Validate LLM outputs for code injection, malicious URLs, and factual consistency before returning to users
- Enforce organizational policies by banning specific topics, competitors, or substrings in LLM interactions
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LLM Guard provides input and output scanning for Large Language Models to detect and prevent prompt injection, data leakage, harmful language, and other security threats.
No—not for new projects. While the package is feature-rich and has low install friction, its abandoned status (archived repo, no commits since 2026-07-08) is disqualifying for security-sensitive work. An unmaintained firewall cannot be trusted to defend against evolving threats. Consider it only if you have a specific, time-bounded use case and can fork and maintain it yourself.
Install
llm-guard on PyPI
pip
pip install llm-guarduv
uv add llm-guardpoetry
poetry add llm-guardInstalling llm-guard
Before you install
Low install friction with a pure-Python wheel, but the package is abandoned as of the latest commit on 2026-07-08. The 12 runtime dependencies include heavy libraries (torch, transformers, tiktoken) that will pull in substantial downloads; base functionality requires fewer, with advanced features auto-installing as needed.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it legally straightforward to adopt—though the abandoned status means no upstream security patches or maintenance.
Quickstart
pip install llm-guard
from llm_guard import scan_prompt
result = scan_prompt("user input here")
Requires Python 3.10 or higher (capped below 3.13). Heavy dependencies like torch and transformers may require significant disk space and download time.
Verify before relying
- Whether the abandoned status affects real-world security scanning reliability or if the final release remains effective for current threat models
- Performance characteristics and latency of scanning operations under production load
- Compatibility of the 12 runtime dependencies with recent versions of torch, transformers, and other ML libraries
Package facts
| License | The MIT License (MIT) Copyright (c) Protect AI. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) (unclear) |
| Python support | capped below the current Python release (<3.13,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — bc-detect-secrets, faker, fuzzysearch, json-repair, nltk, presidio-analyzer, presidio-anonymizer, regex, tiktoken, torch, transformers, structlog |
| Maintenance | abandoned — 452 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 211,788/month — #9,474 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: llm_guard-0.3.16-py3-none-any.whl
Keywords: llm, language model, security, adversarial attacks, prompt injection, prompt leakage, PII detection, self-hardening, firewall
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
datarobot-moderationsEnforces content moderation on LLM prompts and…
unclear · top 15,000 on PyPI
garakGarak is a command-line tool that probes large…
unclear · top 15,000 on PyPI
deepteamDeepTeam is an open-source red teaming…
permissive · top 15,000 on PyPI
guardrails-aiGuardrails is a Python framework that validates…
permissive · top 15,000 on PyPI
plugin-scannerLints, verifies, and gates plugins, skills, MCP…
permissive · top 15,000 on PyPI
hol-guardHOL Guard is a local-first antivirus and…
permissive · top 15,000 on PyPI
pydantic-ai-shieldsPydantic AI Shields provides guardrail…
permissive · top 15,000 on PyPI
codeshieldCodeShield filters code generated by LLMs to…
permissive · top 15,000 on PyPI
toolguardGenerates deterministic Python code that…
permissive · top 15,000 on PyPI
zizmorzizmor is a static analysis tool that scans…
permissive · top 5,000 on PyPI