Contributing¶
We welcome contributions — bug fixes, new methods, faithfulness corrections, and docs improvements.
Quick start¶
How to contribute¶
flowchart LR
START([Want to contribute?])
subgraph report [Open an issue]
BUG[Report a bug<br/>reproducer + error trace]
FAITH[Report faithfulness issue<br/>code vs. cited paper]
end
subgraph code [Write code]
ADD[Add a method<br/>implement · feature map · test]
FIX[Fix faithfulness issue<br/>read paper · fix code · update badge]
end
START --> BUG & FAITH & ADD & FIX
BUG & FAITH & ADD & FIX --> PR[Submit PR]
PR --> MERGE[Merged → changelog]
Report a bug¶
Open an issue with the bug report template. Include the method name, a minimal reproducer, and the error trace.
Report a faithfulness issue¶
If a method's code doesn't match its cited paper, open a faithfulness report. This is the most valuable contribution you can make — it directly improves the audit.
Add a method¶
- Implement the method faithfully against its paper under the appropriate
pillar:
src/safetune/interventions/{harden,recover,unlearn,steer}/orsrc/safetune/instrumentation/{interpret,evaluate}/. - Add it to the pillar's
__init__.py__all__list. - Add an entry to the Feature Map with the audit badge.
- Add a row to References with the paper link.
- Write a test under
tests/that verifies the method runs on a small model.
Fix a faithfulness issue¶
- Read the cited paper carefully.
- Fix the implementation to match.
- Update the badge in the Feature Map (Variant→Faithful if now faithful).
- Document the fix in the Changelog.
Development setup¶
- Python ≥ 3.12, PyTorch ≥ 2.7
pip install -e ".[dev]"installs test deps (pytest, black, ruff, mypy)- Install docs deps:
pip install -e ".[docs]" - Run tests:
pytest tests/ - Build docs:
mkdocs build --strict - Preview docs:
mkdocs serve -a 0.0.0.0:8000
Package structure¶
src/safetune/
├── interventions/ Tier 1 — harden, recover, unlearn, steer
├── instrumentation/ Tier 2 — interpret, evaluate
├── core/ shared internals
├── data/ data loaders
├── rewards/ reward functions
├── runner/ high-level Trainer API
├── utils/ logging, auth, device management
└── __init__.py top-level aliases
See System Design and API Contract for full documentation.
Pull request process¶
- Branch from
main. - Keep commits focused — one logical change per PR.
- Use the PR template.
- Ensure tests pass:
pytest tests/. - Ensure docs build:
pip install -e ".[docs]" && mkdocs build --strict. - Request review.
License¶
By contributing, you agree that your contributions are licensed under the Lexsi Labs Source Available License (LSAL) v1.1.