Contributing
We welcome contributions to Safe dLLM! This guide outlines the development workflow.
Development Setup
Fork and Clone
git clone https://github.com/your-org/safe_dllm.git cd safe_dllm
Create Virtual Environment
conda create -n safe_dllm python=3.10 conda activate safe_dllm
Install Dependencies
pip install -e ".[dev]"
The
[dev]extra includes testing and documentation tools.Pre-commit Hooks
pre-commit install
Code Style
We follow PEP 8 with Black formatting:
black .
isort .
flake8
Testing
Run the test suite:
pytest tests/
Run with coverage:
pytest --cov=safety tests/
Building Documentation
Build HTML docs locally:
cd docs
make html
Preview: _build/html/index.html
Pull Request Process
Create a feature branch:
git checkout -b feat/your-feature
Make changes and add tests
Run full test suite:
pytest
Ensure docs build:
cd docs && make html && cd ..
Commit and push:
git add . git commit -m "feat: your feature description" git push origin feat/your-feature
Open a Pull Request on GitHub
Fill out the PR template
Link related issues
Request review from maintainers
Adding New Attack Methods
Implement attack in
safety/or fork AISafetyLabAdd configuration options to
configs/llada_eval.yamlDocument in
docs/guide/attacks.rstAdd example Slurm script if needed
Adding New Scorers
Inherit from
aisafetylab.evaluation.scorers.ScorerImplement
score()methodRegister in
safety/evaluator.pyAdd to scorer comparison table in
docs/guide/evaluation.rst
Adding New Datasets
Place data in
data/or provide HuggingFace dataset nameAdd loader to
safety/dataset.pyif custom format neededDocument in
docs/guide/evaluation.rstUpdate dataset selection logic in
run_safety_benchmark.py
Release Process
Update version in
pyproject.tomlUpdate
CHANGELOG.mdCreate release branch:
git checkout -b release/vX.Y.ZBuild and test wheels
Tag and publish to PyPI
Deploy documentation to GitHub Pages
Getting Help
Open an issue: https://github.com/your-org/safe_dllm/issues
Join discussions: https://github.com/your-org/safe_dllm/discussions
Read the docs: https://safe-dllm.readthedocs.io
Code of Conduct
Please read and follow our code_of_conduct before contributing.
License
By contributing, you agree that your contributions will be licensed under the MIT License.