MDPFuzz Replication
Project description
Replicate of MDPFuzz
This repository contains a re-implementation the policy testing framework MDPFuzz, whose original code can be found here. This tool has been used in the paper Replicability Study: Policy Testing with MDPFuzz.
Installation
You can install the package with pip:
pip install mdpfuzz
One can also want to install the package locally:
git clone https://github.com/QuentinMaz/MDPFuzz_Replication mdpfuzz
cd mdpfuzz
pip install -e .
In the latter case, don't forget to append the folder mdpfuzz/ to your path.
Usage
The Fuzzer class (mdpfuzz/mdpfuzz.py) provides functions for fuzzing with and without GMM guidance, as well as a simple random testing procedure.
It inputs an Executor object, which is responsible for generating and mutating inputs (also called seeds), loading the policy under test and executing test cases (i.e., running the policy with a given input).
As such, using the package involves 3 simple steps:
- Implementing a Executor class for your use case.
- Creating an executor, loading the model under test and instantiate a fuzzer.
- Running the fuzzer (fuzzing - with or without GMM guidance - or Random Testing) with the testing budget you want!
Example
In the file dqn_mountain_car.py, we test a DQN agent (learnt using the library Stable Baselines3) for the Mountain Car environment.
Setup
Setup a virtual environment with, for instance, conda:
conda create -n demo python=3.10.12
conda activate demo
pip install mdpfuzz
# install gymnasium and stable-baselines3 dependencies
pip install gymnasium==0.29.1
pip install stable-baselines3==2.2.1
Make sure to activate the virtual environment (conda activate demo) before executing the script!
Additionally, we provide the script as a Jupyter notebook in which with we detail each step of the demonstration.
If you use the notebook, install the following dependency in the virtual environment: pip install ipykernel.
The demonstration consists of:
- Learning and saving the DQN agent (
dqn_mountain_car.zip). - Testing the agent with a budget of 2500 test cases, with both Random Testing and MDPFuzz. The results of Random Testing are recorded in the current directory prefixed by
random_testing, while the results of MDPFuzz are prefixed bymdpfuzz. - Plotting the evolution of the number of failures found over the test cases by the two methods in the file
failure_results_comparison_demo.png.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdpfuzz-0.0.1.tar.gz.
File metadata
- Download URL: mdpfuzz-0.0.1.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10960ccf9a7070cd59baa63055a7ec30fbcc9759d1089d7eeb73352237116ab0
|
|
| MD5 |
ecc0a06bbaed57fe4f7b693645adc413
|
|
| BLAKE2b-256 |
8bb0bb737e45bdfd4d7b0b60cbbb752a5a02d74f875ca0df225d3cd8a117c578
|
Provenance
The following attestation bundles were made for mdpfuzz-0.0.1.tar.gz:
Publisher:
release.yml on QuentinMaz/MDPFuzz_Replication
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdpfuzz-0.0.1.tar.gz -
Subject digest:
10960ccf9a7070cd59baa63055a7ec30fbcc9759d1089d7eeb73352237116ab0 - Sigstore transparency entry: 184697241
- Sigstore integration time:
-
Permalink:
QuentinMaz/MDPFuzz_Replication@6ac1624540e0ed18c76207a4899f0d27ac9717e7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/QuentinMaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ac1624540e0ed18c76207a4899f0d27ac9717e7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mdpfuzz-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mdpfuzz-0.0.1-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbcd7ae6800b1d536631723faa7e070af91db7e8f081f14551ce6a0207918df9
|
|
| MD5 |
4618758ed8be8bd1f4b0e8a02627be71
|
|
| BLAKE2b-256 |
617d88ef3398d8af98d68c93c3d6c2f43efe540ee0d6966d59ef9dafdbce95ad
|
Provenance
The following attestation bundles were made for mdpfuzz-0.0.1-py3-none-any.whl:
Publisher:
release.yml on QuentinMaz/MDPFuzz_Replication
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdpfuzz-0.0.1-py3-none-any.whl -
Subject digest:
fbcd7ae6800b1d536631723faa7e070af91db7e8f081f14551ce6a0207918df9 - Sigstore transparency entry: 184697242
- Sigstore integration time:
-
Permalink:
QuentinMaz/MDPFuzz_Replication@6ac1624540e0ed18c76207a4899f0d27ac9717e7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/QuentinMaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ac1624540e0ed18c76207a4899f0d27ac9717e7 -
Trigger Event:
workflow_dispatch
-
Statement type: