File size: 2,546 Bytes
3398b71 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | ---
license: mit
tags:
- agent-safety
- world-models
- causal-inference
- reproducibility
- code
---
# CLSA — code for "Causal Latent-State Agents"
This repository is the released code for *Causal Latent-State Agents: Pre-Action
Safety from a World Model You Can Audit* (submitted to *Artificial Intelligence*,
Elsevier). It is a mirror of the repository accompanying the submission, at
commit `{{COMMIT}}` ({{DATE}}).
It contains the analysis code, the configuration, the tests, the result files and
the figure scripts. The benchmark and the trained artefacts are in two companion
repositories:
| What | Where |
|---|---|
| PreAct-Bench: 4,508 pre-action decision points, images, schema, data card | [fahadhafeezofficial/preact-bench](https://huggingface.co/datasets/fahadhafeezofficial/preact-bench) |
| Trained artefacts for both backbones (transcoder, world model, risk head, monitors) | [fahadhafeezofficial/clsa-artifacts](https://huggingface.co/fahadhafeezofficial/clsa-artifacts) |
## Layout
| Path | Contents |
|---|---|
| `src/clsa/` | Package: sandbox, transcoder, world model, risk head, controller, monitors |
| `experiments/` | E1–E9 and `check_numbers.py`, which traces every table value back to `results/` |
| `tiers/` | Standalone smoke tests for the three adoption tiers |
| `tests/` | Test suite (31 tests) |
| `configs/` | Frozen experiment configuration |
| `results/` | Result JSON/JSONL files behind every number in the paper |
| `figures/`, `paper/` | Figure scripts and LaTeX source |
| `hf/` | Scripts that published these three repositories |
## Running it
```bash
python -m pip install -r requirements.txt
export PYTHONPATH=src
make test # 31 tests
python experiments/check_numbers.py # 103 table values traced to results/
```
Full reproduction of the benchmark and the artefacts needs the two companion
repositories:
```bash
hf download fahadhafeezofficial/preact-bench --repo-type dataset --local-dir data/preact_bench
hf download fahadhafeezofficial/clsa-artifacts --repo-type model --local-dir data/derived
make reproduce # bench + experiments + figures + number check
```
The derived artefacts must sit in `data/derived/<backbone with "/" as "__">`,
which is the layout the artefacts repository already uses and the only layout
`load_model()` resolves; there is no environment variable for that path.
Everything runs on a CPU, with no GPU, no paid API and no vendor SDK.
## Licence and citation
MIT (see `LICENSE`). Citation metadata is in `CITATION.cff`.
|