MYCELIUM is a public-safe research codebase for testing whether a language-model safety mechanism is behaviorally load-bearing. The framework evaluates the same examples under normal execution and controlled internal counterfactuals such as removal, wrong routing, safety-family zeroing, non-safety-family zeroing, and base-path bypass diagnostics.
The associated study reports a controlled negative result: stronger architectural coupling and positive training-time dependency gaps did not by themselves produce favorable generation-level separation between the full system and removal/bypass controls.
- A mandatory-path linear wrapper with four low-rank anchor families:
core,utility,soft-safety, andhard-safety. - Model patching, routing, checkpoint loading, and counterfactual execution utilities.
- A cleaned public training entry point implementing the v6 objective.
- A generation evaluator that defaults to hash-only public output.
- Aggregate result tables and reproducibility metadata from the archived run.
- Unit tests and a safe toy dataset for smoke testing.
This is a cleaned, GitHub-ready public refactor of the v6 research implementation, not a byte-identical dump of the private TRUBA workspace. Private paths and data defaults were removed. Original source hashes are recorded in docs/PROVENANCE.md.
This repository intentionally does not contain:
- raw safety-sensitive prompts;
- raw model completions;
- private generation logs;
- private annotation packets;
- model weights or checkpoints;
- proprietary or restricted datasets.
Users must supply an appropriately licensed model, dataset, and—when needed—a compatible seed checkpoint. Do not commit private outputs or restricted data.
Python 3.10+ is recommended.
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .For development:
pip install -e '.[dev]'
pytest -qTraining data are JSONL rows with four fields:
{"id":"example-001","route":"green","prompt":"...","target":"..."}Allowed routes are green, amber, and red. The repository includes only a harmless toy dataset under examples/.
pytest -q
python scripts/inspect_toy_data.py examples/safe_toy_dataset.jsonlProvide the model, data, target module paths, and output directory explicitly:
python scripts/train_v6.py \
--model-dir /path/to/model \
--data /path/to/train.jsonl \
--targets model.layers.18.self_attn.o_proj,model.layers.19.self_attn.o_proj \
--out outputs/v6_run \
--steps 512A compatible seed checkpoint is optional. Without it, anchors start from their initialized state.
The evaluator writes hash-only public records by default:
python scripts/evaluate_v6.py \
--model-dir /path/to/model \
--checkpoint outputs/v6_run/checkpoints/v6_mandatory_path_FINAL.pt \
--targets model.layers.18.self_attn.o_proj,model.layers.19.self_attn.o_proj \
--data /path/to/eval.jsonl \
--out outputs/v6_evalRaw generations are not written unless --write-private is explicitly supplied. Keep any resulting private file outside a public repository.
The exact restricted datasets and private annotation packets are not redistributed. Public aggregate tables are under results/. See docs/REPRODUCIBILITY.md and the Zenodo artifact:
DOI: https://doi.org/10.5281/zenodo.21275745
Use the metadata in CITATION.cff. The repository corresponds to the manuscript:
When Safety Is Not Load-Bearing: Counterfactual Dependability Evaluation of Mandatory-Path Safety Mechanisms in Language Models.
- Nedim Mutlu Sezer — lead and corresponding author
- Ömer Faruk Aksoy
- Ahmet Rıfat Öztürk
- Feyzi Arda Salihoğlu
- Yağız Ekrem Dalar
Ethosoft Research Group, Pertevniyal Lisesi, Istanbul, Türkiye.
The numerical calculations reported in the associated work were partially performed at TUBITAK ULAKBIM, High Performance and Grid Computing Center (TRUBA resources).
Code is released under the MIT License. Aggregate research outputs remain subject to their original provenance and citation requirements.