Skip to main content


Plexiglass

Wondering if your AI model is safe enough to use? Plexiglass is your sparring partner to bolster your model's defenses!

PyPI version license MIT

What is Plexiglass?

Plexiglass is a Python toolbox which supports pentesting against adversarial attacks in machine learning. It has two modules: LLMs and DNNs. For LLMs, plexiglass uses litellm under the hood.

We are working tirelessly to include more frameworks and attack/ defense mechanisms for testing. Please read our docs for the latest updates.

[!IMPORTANT] We are looking for contributors! Fork the repo to get started. Contribution guide is coming soon.

[!NOTE] Plexiglass is open-source: Please leave a star to support the project! ⭐

What is Adversarial Machine Learning?

Adversarial machine learning involves manipulating input data to deceive machine learning models. In deep neural networks (DNNs) and large language models (LLMs), attacks include adding subtly modified inputs that cause incorrect model predictions or responses. These attacks exploit model vulnerabilities, testing their robustness and security.

Installation

The first experimental release is version 0.0.1.

To download the package from PyPi:

pip install --upgrade plexiglass

Getting Started

LLM Module: Simple Usage

We support a variety of LLMs using litellm. Alternatively, you can also test your own huggingface models.

from plexiglass.LLM.evaluate import evaluate
from plexiglass.model import Model

import os

os.environ["OPENAI_API_KEY"] = "YOUR_OPENAI_API_KEY"
model = Model("openai", "gpt-3.5-turbo")

evaluate(model, metrics=["toxicity"], attacks=["prompt_injection", "gcg"])

DNN Module: Simple Usage

Here is an example on how to test a model's robustness on FGSM attacks:

from plexiglass.DNN.evaluate import evaluate
from plexiglass.model import Model

import os

# load your pytorch model here

model = Model("torch", your-model)

evaluate(model, metrics=["accuracy"], attacks=["fgsm"])

Feature Request

To request new features, please submit an issue

Local Development

To get started

make develop

this will clean, build, and install the package locally for development purpose.

Contributors

Made with contrib.rocks.

Release files for plexiglass 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plexiglass 0.0.1
File Size Uploaded
plexiglass-0.0.1.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plexiglass 0.0.1
File Interpreter ABI Platform
plexiglass-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size:34.4 kB

Release files / plexiglass-0.0.1.tar.gz

Download URL plexiglass-0.0.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2df0d66f6ea2f41be693142ad5986eb6580c9d5e41485b195968898a462ece55
BLAKE2b-256 checksum
How to use checksums
7ecb0ceb94f92fba8ef44f24c089b09553de48d4bddf192eb7bb496bd44551f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.28.2 setuptools/57.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.12

Release files / plexiglass-0.0.1-py3-none-any.whl

Download URL plexiglass-0.0.1-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8b709b49cd808f497a0ce3f169f4f73b782a64f0d5ce398de87a2755b9b61a6
BLAKE2b-256 checksum
How to use checksums
b3dcdb772e022409f01056f3c86a48faf2817aed8869de50f1f493b2993c4ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.28.2 setuptools/57.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.12

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page