Audio XAI
XAI for audio models
- GitHub | PyPI | Documentation
- Created by Piotr Kitłowski | GitHub @cncPomper | PyPI @pkitlo
- MIT License
Features
- TODO
Documentation
Documentation is built with Zensical and deployed to GitHub Pages.
- Live site: https://cncPomper.github.io/Audio-XAI/
- Preview locally:
just docs-serve(serves at http://localhost:8000) - Build:
just docs-build
API documentation is auto-generated from docstrings using mkdocstrings.
Docs deploy automatically on push to master via GitHub Actions. To enable this, go to your repo's Settings > Pages and set the source to GitHub Actions.
Setup
If you don't have ffmpeg installed, run:
Windows 11
winget install -e --id Gyan.FFmpeg
if you use conda, thats should enough
conda install -c conda-forge ffmpeg -y
Then verify the installation:
ffmpeg -version
ffprobe -version
Running tensorboard
tensorboard --logdir Audio-XAI/runs/ --port 6006 --bind_all
Examples
https://drive.google.com/drive/folders/1XD1rJwqSX-y-2OHzudYaatKE92MlYY8_?usp=sharing
Development
To set up for local development:
# Clone your fork
git clone git@github.com:your_username/Audio-XAI.git
cd Audio-XAI
# Install in editable mode with live updates
uv tool install --editable .
This installs the CLI globally but with live updates - any changes you make to the source code are immediately available when you run audio_xai.
Run tests:
uv run pytest
Run quality checks (format, lint, type check, test):
just qa
Author
Audio XAI was created in 2026 by Piotr Kitłowski.
Built with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.
1. General Information and Project Objective
The main objective of the project is to investigate the perceptual fragility of explanations (XAI methods) for deep learning models in the audio domain while keeping predictions unchanged.
2. Planned scope of experiments
- Datasets: Public datasets such as the Speech Commands Dataset (speech) and Sonics (synthetic/real music) will be used. The project will strictly ensure the immutability of the original data.
- Research models: Utilization and adaptation of audio recognition architectures: Audio Spectrogram Transformer, VGGish, Spectra, and ViT.
- XAI methods: Investigation of the vulnerability of gradient-based methods such as Grad-CAM and Integrated Gradients.
- Perceptual constraints: Instead of optimizing attacks against standard metrics, perceptual metrics will be considered (PESQ and STOI for speech, PEAQ for music).
- Computational resources and training: The project will require hardware acceleration (GPUs with a minimum of 16 GB VRAM). The estimated training and fine-tuning time for the base models is approximately 15 hours, while the main process of optimizing perceptual perturbations (XAI attack) for the entire test set is estimated to take an additional 25–30 hours of computation.
3. Planned Program Features
- Classification and Attribution Module: Reading models and generating explanation maps for them.
- Perturbation module: Generating subtle modifications to the audio signal with optimization that preserves high perceptual metrics (PESQ, PEAQ, STOI and ViSQOL).
- Deployment and Automation: Scripted building, testing, and deployment of applications using tools such as just and Python scripts built with typer or argparse.
- Final deliverables: The project will include clear documentation, user instructions, and tests relevant to the project’s scope.
4. Planned Technology Stack
The project will implement a robust base structure, automatically generated by tool cookiecutter.
- Environment management: Use of an isolated virtual environment managed by
uvorconda(SLURM-managed cluster will be used). - Code cleanliness: Enforced PEP8-compliant coding style with an increased line length limit. Syntax checking provided by an autoformatter and a linter using
ruff. - Version control: Rigorous use of a code repository with the
conventional commitsspecification implemented. - Frameworks and AI: Implementation of learning logic in dedicated frameworks such as
PyTorch Lightningin conjunction withHuggingfacelibraries. Code used for experiments will be continuously exported fromJupyter Labnotebooks into structured library code. - Experiments and configuration: Tracking progress, metrics, and logs using the
Tensorboardplatform. The configuration of model parameters and experiments will be completely separated from the execution code. - Documentation: Use of
mkdocsto fast and simple write documentation
5. Project schedule
| Deadline dates in 2026 | Planned scope of work and progress | Status |
|---|---|---|
| 30.03 - 05.04 | Repository configuration (Cookiecutter, Ruff, Uv). Defining the directory structure and ensuring that audio files remain immutable. | ✔ |
| 06.04 - 12.04 | Connecting W&B/TensorBoard. Training base classifiers using the PyTorch Lightning framework. (Estimated resource requirements: 15 hours of GPU computation) | ✔ |
| 13.04 - 19.04 | Implementation of explanation-generating (XAI) modules in clean code, after first exporting experiments from notebooks. Writing the first tests. | |
| 20.04 - 26.04 | Separating configuration from executable code. Preparing baseline attacks on attribution maps using standard distance metrics. | ✔ |
| 27.04 - 03.05 | Implementation of PESQ/STOI/PEAQ metric approximations directly into the attack optimization loop (generation of perceptual perturbations). | ✔ |
| 04.05 - 10.05 | Launch of the main research experiments on a dedicated cluster. (Estimated resource requirements: 25–30 hours of GPU computing for iterative processes). | ✔ |
| 11.05 - 17.05 | Scripting the execution of the entire experiment using the just tool and CLI libraries (e.g., typer). Aggregating tables containing the results. |
|
| 18.05 - 21.05 | Finalization of the work: creating documentation and clear instructions for using the finished system. Organizing the code in accordance with PEP8. | |
| 21.05 - 31.05 | Preparation of the paper(?) |
Metadata
Release files for Audio-XAI 0.0.2.post3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| audio_xai-0.0.2.post3.tar.gz | 390.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audio_xai-0.0.2.post3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 463.8 kB
Release files / audio_xai-0.0.2.post3.tar.gz
| Download URL | audio_xai-0.0.2.post3.tar.gz |
|---|---|
| Size | 390.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50e2bff0184ceeed4d26ef661b410fbd240aae0a03c03a89072103ee1575e26a
|
|
BLAKE2b-256 checksum How to use checksums |
cb5234f9a68a413ba00555c6de1c8c2409acd4829712bbd0124c6d4e0314663b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / audio_xai-0.0.2.post3-py3-none-any.whl
| Download URL | audio_xai-0.0.2.post3-py3-none-any.whl |
|---|---|
| Size | 73.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e4c8a3b5ff3900a080eceeae582f7162a4fa4fb87f8e6180307cb576972a169
|
|
BLAKE2b-256 checksum How to use checksums |
489776a7c423857cb1bbce964154fb22411bc7ca48a1f76cde5a789576aee8d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency log