File size: 4,548 Bytes
d086025 | 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | # ProvableWorldModel — Usage Guide
ProvableWorldModel lets anyone verify, on a CPU with no floating point, that a
committed quantized [LeWorldModel](https://github.com/lucas-maes/le-wm)
(action-conditioned JEPA world model) was run exactly as specified: rolling out
candidate action plans, scoring them against a goal, and picking the best.
It Freivalds-checks the large matmuls and exactly re-executes everything else,
all bound by Merkle commitments and a Fiat-Shamir transcript.
The `pwm-tui` demo proves the pretrained checkpoint end to end on your machine.
## Quickstart
```bash
git clone https://github.com/AbdelStark/ProvableWorldModel
cd ProvableWorldModel
# the flagship demo: download, quantize, prove, verify, and tamper-check the
# pretrained checkpoint, live in your terminal (needs uv; cached after run one)
cargo run -p pwm-tui --release
```
Or the same pipeline through Docker, no local toolchain needed:
```bash
docker compose up --build
```
Default pipeline: `checkpoint -> quantize -> commit -> encode -> infer -> prove -> verify`.
Stages: LOAD -> INFER -> COMMIT -> VERIFY -> TAMPER (one forged matmul is
rejected with `FreivaldsCheckFailed`). Exit code 0 means the honest proof was
ACCEPTED and the forged one REJECTED.
## Running without Docker
```bash
cargo run -p pwm-tui --release # REAL checkpoint, full TUI demo
cargo run -p pwm-tui --release -- --offline # warm cache: no network at all
cargo run -p pwm-tui --release -- --headless --json # CI mode: plain log + JSON summary
cargo run -p pwm-tui --release -- cache ls # see what is cached (path|ls|clear)
cargo run -p pwm-testkit --bin pwm --release -- prove-predictor # real architecture, synthetic weights
cargo run -p pwm-testkit --bin pwm --release # the tiny compact story
cargo test --workspace # the accept and reject suites
```
## Docker profiles
| Command | What it runs |
|---|---|
| `docker compose up --build` | Real le-wm predictor architecture (192-dim, 16 heads, 6 blocks), synthetic weights, exact integer arithmetic. Fast, offline. |
| `docker compose --profile real up --build export predictor-real` (or `./demo/run-real.sh`) | The REAL `quentinll/lewm-pusht` checkpoint end to end: download, quantize the full V0, then prove + verify the real-weight predictor. Heavy: PyTorch image + ~70 MB checkpoint on first run. |
| `docker compose --profile compact up --build prover verifier` | Tiny two-party teaching handoff: a `prover` container writes a proof to a shared volume (`pwm prove /shared/artifact.bin`), a `verifier` container accepts it, forges a matmul, and rejects it (`pwm audit /shared/artifact.bin`). |
## Cache (pwm-tui)
Assets (checkpoint, dataset, bundle) land under a configurable cache. A warm
bundle cache skips Python entirely, so repeat runs are pure Rust and take about
a second. The only stage-1 dependency is [`uv`](https://docs.astral.sh/uv/)
(it provisions Python and the pinned torch environment from `uv.lock` on first
run).
Cache precedence: `--cache-dir <path>` > `PWM_CACHE_DIR` env var > the platform
default (e.g. `~/Library/Caches/ProvableWorldModel` on macOS).
## What gets proven
| Tier | Claim | Status |
|---|---|---|
| **P0** | One predictor step: `z_next = PredProj(ARPredictor(z_hist, ActEnc(actions)))`. | implemented and tested (full 192-dim 6-block 16-head predictor, real checkpoint weights) |
| **P1** | Autoregressive rollout with checked recurrence wiring. | implemented and tested |
| **P2** | Fixed-candidate planning (V0): roll out all `S` candidates, score by goal MSE, prove the selected is the argmin. | implemented and tested |
| P3 | Full CEM planner. | deferred |
| P4 | Pixel to plan, including the ViT encoder. | deferred |
Trust boundary: the export bundle is cryptographically bound into the proof
(weights Merkle root); checkpoint download, input encoding, and float-to-int8
quantization are trusted offline preprocessing. The verifier is `no_std` and
float-free: it never re-runs the model, Freivalds-checks every fixed matmul
(soundness error `<= 1/p`, `p = 2^61 - 1`), exactly recomputes attention,
softmax, GELU, SiLU, LayerNorm, and residuals, and range-checks accumulators
against a mod-`p` forgery.
## Further docs
- [demo.md](demo.md) — demo modes and the real-checkpoint walkthrough.
- [cli.md](cli.md) — the `pwm` CLI and `pwm-tui` flags.
- [export.md](export.md) — exporting a checkpoint bundle (input/output formats).
## License
Apache-2.0.
|